@cartbot/vehicle-search-beta 3.0.23 → 3.0.24

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,12 +1,12 @@
1
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 mt } from "react";
3
- import ft from "react-dom";
4
- import Ke from "js-cookie";
2
+ import { useState as A, useEffect as B, useRef as Z, useCallback as N, useMemo as ut } from "react";
3
+ import mt from "react-dom";
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";
6
6
  import kt from "fuzzysearch";
7
- import Qe from "pluralize";
7
+ import Ke from "pluralize";
8
8
  import ne from "clsx";
9
- import { MeiliSearch as We } from "meilisearch";
9
+ import { MeiliSearch as Qe } from "meilisearch";
10
10
  import Ct from "lodash/debounce.js";
11
11
  import _t from "tinycolor2";
12
12
  import Be from "posthog-js";
@@ -117,43 +117,43 @@ function X({
117
117
  label: b,
118
118
  items: v,
119
119
  selected: p,
120
- refine: F,
120
+ refine: U,
121
121
  showPopular: I,
122
122
  bgDark: R,
123
123
  sortOptions: P = !0,
124
- showLabel: T = !1,
124
+ showLabel: O = !1,
125
125
  isMobile: _ = !1,
126
126
  loading: V = !1,
127
- shouldBeActive: O = !1
127
+ shouldBeActive: T = !1
128
128
  // True when parent fields are selected and this field tried to load
129
129
  }) {
130
- const [ee, u] = A(""), [y, C] = A(p || null), q = (l) => {
131
- C(l), u(""), !(l && l.value === (p == null ? void 0 : p.value)) && F(l);
132
- }, te = (l) => {
133
- l.preventDefault(), l.stopPropagation(), u(""), C(null), F("");
130
+ const [re, u] = A(""), [y, C] = A(p || null), q = (s) => {
131
+ C(s), u(""), !(s && s.value === (p == null ? void 0 : p.value)) && U(s);
132
+ }, ee = (s) => {
133
+ s.preventDefault(), s.stopPropagation(), u(""), C(null), U("");
134
134
  };
135
135
  B(() => {
136
136
  u(""), C(p || null);
137
137
  }, [p, v]);
138
138
  let G = /* @__PURE__ */ new Set(), f = [];
139
- v && (v.forEach((l) => {
140
- String(l.value).split(/,(?![^(]*\))/).forEach((z) => {
141
- z = z.trim(), z && kt(ee, z.toLowerCase()) && !G.has(z.toLowerCase()) && (G.add(z.toLowerCase()), f.push({
142
- ...l,
139
+ v && (v.forEach((s) => {
140
+ String(s.value).split(/,(?![^(]*\))/).forEach((z) => {
141
+ z = z.trim(), z && kt(re, z.toLowerCase()) && !G.has(z.toLowerCase()) && (G.add(z.toLowerCase()), f.push({
142
+ ...s,
143
143
  value: z,
144
- refinement: l.value
144
+ refinement: s.value
145
145
  }));
146
146
  });
147
147
  }), f.length === 0 && (f = v));
148
- const D = f.filter((l) => l.popularity > 0).slice(0, 11);
148
+ const D = f.filter((s) => s.popularity > 0).slice(0, 11);
149
149
  P && (f = f.filter(
150
- (l) => !D.includes(l)
150
+ (s) => !D.includes(s)
151
151
  ), f.sort(
152
- (l, U) => l.value.localeCompare(U.value, "en", { numeric: !0 })
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
155
  return /* @__PURE__ */ E("div", { className: "vs:relative vs:flex vs:flex-col", children: [
156
- T && /* @__PURE__ */ a(
156
+ O && /* @__PURE__ */ a(
157
157
  "span",
158
158
  {
159
159
  className: `${R ? "vs:text-white" : "vs:text-black"} vs:mb-1 vs:block vs:text-(length:--partbot-font-size) vs:leading-[calc(var(--partbot-font-size)*1.5)] vs:font-medium vs:font-(family-name:--partbot-font-family)`,
@@ -164,11 +164,11 @@ function X({
164
164
  /* @__PURE__ */ E(
165
165
  "select",
166
166
  {
167
- onChange: (l) => {
168
- const U = f.find(
169
- (z) => z.value.toString() === l.target.value.toString()
167
+ onChange: (s) => {
168
+ const F = f.find(
169
+ (z) => z.value.toString() === s.target.value.toString()
170
170
  );
171
- U && q(U);
171
+ F && q(F);
172
172
  },
173
173
  className: "vehicle-search-select vs:relative vs:w-full vs:cursor-default vs:overflow-hidden vs:rounded-(--partbot-button-border-radius) partbot-input-border vs:bg-white vs:py-(--partbot-padding) vs:pl-[calc(var(--partbot-padding)*1.3)] vs:pr-10 vs:text-left vs:shadow-(--partbot-input-shadow) vs:focus:border-[rgb(var(--partbot-theme))] vs:focus:outline-none vs:focus:ring-1 vs:focus:ring-[rgb(var(--partbot-theme))] vs:disabled:opacity-100! vs:disabled:text-stone-400! vs:sm:text-(length:--partbot-font-size) vs:font-(family-name:--partbot-font-family) vs:text-(length:--partbot-font-size) vs:leading-[calc(var(--partbot-font-size)*1.5)]",
174
174
  tabIndex: -1,
@@ -177,13 +177,13 @@ function X({
177
177
  children: [
178
178
  /* @__PURE__ */ a("option", { value: "", disabled: !0, children: b }),
179
179
  D.length > 0 ? /* @__PURE__ */ E($e, { children: [
180
- /* @__PURE__ */ a("optgroup", { label: `Popular ${Qe(b)}`, children: D.map((l) => /* @__PURE__ */ a("option", { value: l.refinement, children: l.value }, l.value)) }),
181
- /* @__PURE__ */ a("optgroup", { label: `All ${Qe(b)}`, children: f.filter(
182
- (l) => !D.some(
183
- (U) => U.value === l.value
180
+ /* @__PURE__ */ a("optgroup", { label: `Popular ${Ke(b)}`, children: D.map((s) => /* @__PURE__ */ a("option", { value: s.refinement, children: s.value }, s.value)) }),
181
+ /* @__PURE__ */ a("optgroup", { label: `All ${Ke(b)}`, children: f.filter(
182
+ (s) => !D.some(
183
+ (F) => F.value === s.value
184
184
  )
185
- ).map((l) => /* @__PURE__ */ a("option", { value: l.refinement, children: l.value }, l.value)) })
186
- ] }) : f.map((l) => /* @__PURE__ */ a("option", { value: l.refinement, children: l.value }, l.value))
185
+ ).map((s) => /* @__PURE__ */ a("option", { value: s.refinement, children: s.value }, s.value)) })
186
+ ] }) : f.map((s) => /* @__PURE__ */ a("option", { value: s.refinement, children: s.value }, s.value))
187
187
  ]
188
188
  }
189
189
  ),
@@ -191,7 +191,7 @@ function X({
191
191
  !V && (y == null ? void 0 : y.value) && /* @__PURE__ */ a(
192
192
  "button",
193
193
  {
194
- onClick: te,
194
+ onClick: ee,
195
195
  tabIndex: -1,
196
196
  className: "vs:absolute vs:inset-y-0 vs:right-[calc(var(--partbot-font-size)*1.95)] vs:items-center vs:pr-(--partbot-padding) vs:text-red-300 vs:hover:text-red-500 vs:bg-transparent vs:border-none vs:outline-none vs:p-(--partbot-padding) vs:text-(length:--partbot-font-size) vs:leading-[calc(var(--partbot-font-size)*1.5)] vs:font-medium vs:transition vs:pointer-events-auto vs:flex vs:justify-center",
197
197
  children: /* @__PURE__ */ a(
@@ -224,10 +224,10 @@ function X({
224
224
  {
225
225
  autoComplete: "off",
226
226
  spellCheck: "false",
227
- placeholder: g && O && !V ? "N/A" : b,
227
+ placeholder: g && T && !V ? "N/A" : b,
228
228
  className: "vs:w-full vs:cursor-default vs:rounded-(--partbot-button-border-radius) partbot-input-border vs:bg-white vs:py-(--partbot-padding) vs:pl-[calc(var(--partbot-padding)*1.3)] vs:pr-10 vs:text-left vs:shadow-(--partbot-input-shadow) vs:focus:border-[rgb(var(--partbot-theme))] vs:focus:outline-none vs:focus:ring-1 vs:focus:ring-[rgb(var(--partbot-theme))] vs:text-(length:--partbot-font-size) vs:leading-[calc(var(--partbot-font-size)*1.5)] vs:font-(family-name:--partbot-font-family) vs:text-stone-900 vs:placeholder:text-stone-600 vs:disabled:placeholder:text-stone-400 vs:disabled:cursor-not-allowed",
229
- displayValue: (l) => (l == null ? void 0 : l.value) || "",
230
- onChange: (l) => u(l.target.value),
229
+ displayValue: (s) => (s == null ? void 0 : s.value) || "",
230
+ onChange: (s) => u(s.target.value),
231
231
  title: b
232
232
  }
233
233
  ),
@@ -235,7 +235,7 @@ function X({
235
235
  (y == null ? void 0 : y.value) && /* @__PURE__ */ a(
236
236
  "button",
237
237
  {
238
- onClick: te,
238
+ onClick: ee,
239
239
  tabIndex: -1,
240
240
  className: "vs:inset-y-0 vs:pr-2 vs:text-red-300 vs:hover:text-red-500 vs:bg-transparent vs:border-none vs:outline-none vs:p-2 vs:text-(length:--partbot-font-size) vs:leading-[calc(var(--partbot-font-size)*1.5)] vs:font-medium vs:transition vs:pointer-events-auto vs:flex vs:items-center vs:justify-center vs:cursor-pointer",
241
241
  children: /* @__PURE__ */ a(
@@ -272,31 +272,31 @@ function X({
272
272
  portal: !0,
273
273
  anchor: "bottom start",
274
274
  className: "vs:w-(--input-width) vs:z-99999! vs:max-h-60! vs:overflow-auto vs:rounded-[min(var(--partbot-button-border-radius),0.89rem)] vs:bg-white vs:py-1 vs:text-base vs:shadow-lg vs:ring-1 vs:ring-stone-200 vs:focus:outline-none vs:sm:text-(length:--partbot-font-size) empty:vs:invisible vs:mt-2",
275
- children: ({ option: l }) => {
276
- const U = l && D.some(
277
- (z) => z.value === l.value
275
+ children: ({ option: s }) => {
276
+ const F = s && D.some(
277
+ (z) => z.value === s.value
278
278
  );
279
279
  return /* @__PURE__ */ a(
280
280
  xt,
281
281
  {
282
- value: l,
282
+ value: s,
283
283
  className: ({ focus: z }) => ne(
284
284
  "vs:group vs:relative vs:w-full vs:cursor-default vs:py-(--partbot-padding) vs:px-[calc(var(--partbot-padding)*1.3)] vs:text-left vs:border-none",
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
- U && "vs:font-bold!"
286
+ F && "vs:font-bold!"
287
287
  ),
288
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
  {
292
292
  className: ne(
293
- l.value === (p == null ? void 0 : p.value) ? "vs:font-semibold" : "vs:font-normal",
293
+ s.value === (p == null ? void 0 : p.value) ? "vs:font-semibold" : "vs:font-normal",
294
294
  "vs:block vs:font-(family-name:--partbot-font-family) vs:whitespace-pre-wrap vs:text-left vs:text-(length:--partbot-font-size) vs:leading-none"
295
295
  ),
296
- children: l.value
296
+ children: s.value
297
297
  }
298
298
  ),
299
- l.value === (p == null ? void 0 : p.value) && /* @__PURE__ */ a(
299
+ s.value === (p == null ? void 0 : p.value) && /* @__PURE__ */ a(
300
300
  "span",
301
301
  {
302
302
  className: ne(
@@ -328,45 +328,45 @@ function X({
328
328
  )
329
329
  ] });
330
330
  }
331
- const $t = "3.0.23";
331
+ const $t = "3.0.24";
332
332
  console.info(
333
333
  `Vehicle Search v${$t} powered by Partbot https://mmyvs.partbot.io`
334
334
  );
335
335
  function Se(b = [], v = []) {
336
336
  const p = [];
337
- return b.forEach((F) => {
338
- const [I, ...R] = F.split(":"), P = R.join(":");
337
+ return b.forEach((U) => {
338
+ const [I, ...R] = U.split(":"), P = R.join(":");
339
339
  if (P.includes(" > ")) {
340
- const T = P.split(" > "), _ = T[T.length - 1].trim();
341
- if (I !== "make" && T.length >= 2) {
342
- const V = T[0].trim();
340
+ const O = P.split(" > "), _ = O[O.length - 1].trim();
341
+ if (I !== "make" && O.length >= 2) {
342
+ const V = O[0].trim();
343
343
  p.push(`make = "${V}"`);
344
344
  }
345
345
  p.push(`${I} = "${_}"`);
346
346
  } else
347
347
  p.push(`${I} = "${P}"`);
348
- }), v.forEach((F) => {
349
- p.push(F);
348
+ }), v.forEach((U) => {
349
+ p.push(U);
350
350
  }), p.length > 0 ? p.join(" AND ") : null;
351
351
  }
352
352
  function Mt({
353
353
  apiKey: b,
354
354
  makes: v = "",
355
355
  models: p = "",
356
- callbackUrl: F = "",
356
+ callbackUrl: U = "",
357
357
  layout: I = "row",
358
358
  fields: R,
359
359
  fieldPrefix: P = "",
360
- showBranding: T = !0,
360
+ showBranding: O = !0,
361
361
  showLabels: _ = !1,
362
362
  mobileFullWidthButton: V = !0,
363
- mobileDrawer: O = !0,
364
- modifyQueryString: ee = !0,
363
+ mobileDrawer: T = !0,
364
+ modifyQueryString: re = !0,
365
365
  onChange: u,
366
366
  buttonLabel: y = "Search",
367
367
  showButton: C = !0,
368
368
  onSubmit: q,
369
- store: te,
369
+ store: ee,
370
370
  useStoreVehicles: G = !0,
371
371
  fieldOrder: f = "MMY",
372
372
  // "MMY" (Make→Model→Year) or "YMM" (Year→Make→Model)
@@ -374,10 +374,10 @@ function Mt({
374
374
  // Use api.cartbot.io instead of api.partbot.io
375
375
  yearOptional: g = !1,
376
376
  // Make year selection optional, only requiring make + model
377
- mobileButtonLabel: l = "Select Vehicle"
377
+ mobileButtonLabel: s = "Select Vehicle"
378
378
  // Label for mobile drawer trigger button
379
379
  }) {
380
- const U = 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([]), [Ue, xe] = A([]), Xe = Z([]), [se, ke] = A([]), [e, Y] = A({
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,21 +386,21 @@ function Mt({
386
386
  variant: null,
387
387
  engine: null,
388
388
  engine_capacity: null
389
- }), [Ge, Me] = A(!1), Fe = Z([
389
+ }), [Xe, Me] = A(!1), Ue = Z([
390
390
  "body",
391
391
  "series",
392
392
  "variant",
393
393
  "engine",
394
394
  "engine_capacity"
395
395
  ]), Ce = Z(
396
- R && R.length && Fe.current ? R.split(",").filter((t) => {
396
+ R && R.length && Ue.current ? R.split(",").filter((t) => {
397
397
  var r;
398
- return (r = Fe.current) == null ? void 0 : r.includes(t);
398
+ return (r = Ue.current) == null ? void 0 : r.includes(t);
399
399
  }) : null
400
- ), [J, et] = A(!1);
400
+ ), [J, Ge] = A(!1);
401
401
  B(() => {
402
402
  const t = navigator.userAgent;
403
- et(
403
+ Ge(
404
404
  /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
405
405
  t
406
406
  )
@@ -412,7 +412,7 @@ function Mt({
412
412
  disable_session_recording: !1
413
413
  });
414
414
  }, []);
415
- const [oe, tt] = A({}), [Nt, rt] = A(""), Re = N(async () => {
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`;
@@ -427,7 +427,7 @@ function Mt({
427
427
  body: JSON.stringify(
428
428
  (() => {
429
429
  const m = { use_store_vehicles: G };
430
- return te && (m.store = te), m;
430
+ return ee && (m.store = ee), m;
431
431
  })()
432
432
  )
433
433
  });
@@ -435,13 +435,13 @@ function Mt({
435
435
  throw new Error(`Error: ${i.status} ${i.statusText}`);
436
436
  const {
437
437
  merchant: o,
438
- vehicle_makes: s,
438
+ vehicle_makes: l,
439
439
  vehicle_models: n,
440
440
  meilisearch_search_key: c,
441
441
  meilisearch_index_name: d,
442
442
  algolia_search_key: $,
443
443
  // Fallback for backward compatibility
444
- algolia_index_name: re,
444
+ algolia_index_name: te,
445
445
  // Fallback for backward compatibility
446
446
  store_index_name: pe,
447
447
  store_popular_makes: ae,
@@ -449,27 +449,27 @@ function Mt({
449
449
  store_popular_models: h
450
450
  // Object mapping makes to popular models: { "TOYOTA": ["HILUX", "LANDCRUISER"], ... }
451
451
  } = await i.json();
452
- z.current = o, ie.current = (s || []).map((m) => ({
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, j.current = h || null, tt({
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
  });
459
459
  } catch (i) {
460
- console.error("[VehicleSearch] Auth failed:", i), rt(i);
460
+ console.error("[VehicleSearch] Auth failed:", i), tt(i);
461
461
  }
462
- }, [b, te, G, D]);
462
+ }, [b, ee, G, D]);
463
463
  B(() => {
464
464
  Re();
465
465
  }, [Re]), B(() => {
466
466
  if (oe.searchKey) {
467
467
  try {
468
- Q.current = new We({
468
+ Q.current = new Qe({
469
469
  host: "https://search.partbot.io",
470
470
  apiKey: oe.searchKey
471
471
  }), w.current = Q.current.index(oe.indexName);
472
- const t = new We({
472
+ const t = new Qe({
473
473
  host: "https://partbot-meilisearch-cache.partbot.workers.dev",
474
474
  // Cloudflare Worker endpoint
475
475
  apiKey: oe.searchKey
@@ -483,7 +483,7 @@ function Mt({
483
483
  };
484
484
  }
485
485
  }, [oe.searchKey, b]);
486
- const [H, ot] = A(!1), Te = N(() => {
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;
@@ -497,9 +497,9 @@ function Mt({
497
497
  }
498
498
  const i = document.querySelector("vehicle-search");
499
499
  let o;
500
- i ? o = t(i) : o = t(U.current);
501
- const s = _t(o).isDark();
502
- ot(s);
500
+ i ? o = t(i) : o = t(F.current);
501
+ const l = _t(o).isDark();
502
+ rt(l);
503
503
  }, []);
504
504
  B(() => {
505
505
  async function t() {
@@ -516,13 +516,13 @@ function Mt({
516
516
  ), e.series && r.push(`series:${e.series.refinement}`), e.engine && r.push(`engine:${e.engine.refinement}`), e.engine_capacity && r.push(
517
517
  `engine_capacity:${e.engine_capacity.refinement}`
518
518
  );
519
- let s = (await w.current.search("", {
519
+ let l = (await w.current.search("", {
520
520
  filter: Se(r, i),
521
521
  attributesToRetrieve: ["otto_id"],
522
522
  limit: 500
523
523
  // Reduced from 1000 for faster queries
524
524
  })).hits.map((d) => d.otto_id);
525
- ke(s);
525
+ ke(l);
526
526
  let c = {
527
527
  ...Object.fromEntries(
528
528
  Object.entries(e || {}).map(([d, $]) => [d, $ && $.value || null]).filter(([d, $]) => $ !== null)
@@ -533,7 +533,7 @@ function Mt({
533
533
  }
534
534
  t();
535
535
  }, [e, w, g]);
536
- const Ae = (t) => P ? `${P}${t}` : t, at = (t) => P ? t.replace(new RegExp(`^${P}`), "") : t, nt = N(() => {
536
+ const Ae = (t) => P ? `${P}${t}` : t, ot = (t) => P ? t.replace(new RegExp(`^${P}`), "") : t, at = N(() => {
537
537
  const t = new URL(window.location.href).searchParams, r = [
538
538
  "make",
539
539
  "model",
@@ -543,19 +543,19 @@ function Mt({
543
543
  "engine",
544
544
  "engine_capacity"
545
545
  ].map(Ae), i = Object.fromEntries(
546
- [...t.entries()].filter(([o]) => r.includes(o)).map(([o, s]) => [at(o), { value: s, refinement: s }])
546
+ [...t.entries()].filter(([o]) => r.includes(o)).map(([o, l]) => [ot(o), { value: l, refinement: l }])
547
547
  );
548
548
  Y(i);
549
549
  }, []), L = N(({ query: t, value: r, remove: i }) => {
550
- if (ee && "URLSearchParams" in window) {
550
+ if (re && "URLSearchParams" in window) {
551
551
  let o = new URLSearchParams(window.location.search);
552
552
  t = Ae(t), t && r && o.set(t, r), t && !r && o.delete(t), i && i.forEach((n) => {
553
553
  n = Ae(n), o.delete(n);
554
554
  });
555
- const s = window.location.pathname + "?" + o.toString();
556
- window.history.pushState(null, "", s);
555
+ const l = window.location.pathname + "?" + o.toString();
556
+ window.history.pushState(null, "", l);
557
557
  }
558
- }, []), it = N(() => {
558
+ }, []), nt = N(() => {
559
559
  var i;
560
560
  const t = {
561
561
  vehicle_ids: se,
@@ -568,8 +568,8 @@ function Mt({
568
568
  window.dispatchEvent(r), document.dispatchEvent(r), setTimeout(() => {
569
569
  Me(!1);
570
570
  }, 900);
571
- }, [se, q]), Oe = N(() => {
572
- var i, o, s, n, c, d, $, re, pe;
571
+ }, [se, q]), Te = N(() => {
572
+ var i, o, l, n, c, d, $, te, pe;
573
573
  const t = {
574
574
  vehicle_ids: se,
575
575
  vehicle: (i = e == null ? void 0 : e.make) != null && i.value ? e : {},
@@ -583,23 +583,23 @@ function Mt({
583
583
  if (M.current === !0) {
584
584
  localStorage.removeItem("partbot_plate_details");
585
585
  const ae = JSON.stringify({
586
- description: `${((o = e.make) == null ? void 0 : o.value) || ""} ${((s = e.model) == null ? void 0 : s.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) || ""} ${((re = e.engine) == null ? void 0 : re.value) || ""} ${((pe = e.engine_capacity) == null ? void 0 : pe.value) || ""}`.trim(),
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(),
587
587
  vehicle_ids: se,
588
588
  vehicle: e ? Object.entries(e).reduce((h, [m, k]) => (h[m] = k != null && k.value ? k.value : {}, h), {}) : {}
589
589
  });
590
590
  localStorage.setItem(
591
591
  "partbot_selected_vehicle",
592
592
  ae
593
- ), Ke.set("partbot_selected_vehicle", ae, {
593
+ ), ft.set("partbot_selected_vehicle", ae, {
594
594
  secure: !0
595
595
  });
596
596
  }
597
- window.dispatchEvent(r), document.dispatchEvent(r), Xe.current = se, setTimeout(() => {
597
+ window.dispatchEvent(r), document.dispatchEvent(r), Je.current = se, setTimeout(() => {
598
598
  Me(!1);
599
599
  }, 900);
600
- }, [se, u]), _e = mt(
601
- () => Ct(Oe, 100),
602
- [Oe]
600
+ }, [se, u]), _e = ut(
601
+ () => Ct(Te, 100),
602
+ [Te]
603
603
  );
604
604
  B(() => {
605
605
  _e();
@@ -607,21 +607,7 @@ function Mt({
607
607
  _e.cancel();
608
608
  }, [_e]), B(() => {
609
609
  const t = () => {
610
- M.current = !1, localStorage.removeItem("partbot_selected_vehicle"), Ke.remove("partbot_selected_vehicle"), ee && setTimeout(() => {
611
- const r = new URL(window.location.href), i = [
612
- "make",
613
- "model",
614
- "year",
615
- "body",
616
- "series",
617
- "variant",
618
- "engine"
619
- ];
620
- let o = !1;
621
- i.forEach((s) => {
622
- r.searchParams.has(s) && (r.searchParams.delete(s), o = !0);
623
- }), o && window.history.replaceState(null, "", r.toString());
624
- }, 100), Y({
610
+ M.current = !1, Y({
625
611
  make: null,
626
612
  model: null,
627
613
  year: null,
@@ -639,14 +625,14 @@ function Mt({
639
625
  );
640
626
  };
641
627
  }, []), B(() => {
642
- oe.searchKey && (x || vt(), nt());
628
+ oe.searchKey && (x || pt(), at());
643
629
  }, [oe.searchKey, x]), B(() => {
644
630
  x && w.current && de.length === 0 && !e.year && w.current.search("", {
645
631
  attributesToRetrieve: ["year_from", "year_to"],
646
632
  limit: 1e4
647
633
  }).then(({ hits: t }) => {
648
- const r = t.map((c) => c.year_from).filter(Boolean), i = t.map((c) => c.year_to).filter(Boolean), o = Math.min(...r), s = Math.max(...i), n = Array.from(
649
- { length: s - o + 1 },
634
+ const r = t.map((c) => c.year_from).filter(Boolean), i = t.map((c) => c.year_to).filter(Boolean), o = Math.min(...r), l = Math.max(...i), n = Array.from(
635
+ { length: l - o + 1 },
650
636
  (c, d) => ({ value: o + d, refinement: o + d })
651
637
  ).reverse();
652
638
  he(n);
@@ -654,8 +640,8 @@ function Mt({
654
640
  console.error("[VehicleSearch] Error loading year range:", t);
655
641
  });
656
642
  }, [x, oe.searchKey, de.length, e.year]), B(() => {
657
- typeof document > "u" || Te();
658
- }, [Te]);
643
+ typeof document > "u" || Oe();
644
+ }, [Oe]);
659
645
  const Ze = N(
660
646
  (t) => {
661
647
  M.current = !0, ce([]), !x && !g && he([]), ge([]), be([]), we([]), xe([]), ye([]), Y((r) => ({
@@ -739,7 +725,7 @@ function Mt({
739
725
  }), !g && (!t || t === "") && ke([]);
740
726
  },
741
727
  [L, x, g]
742
- ), st = N(
728
+ ), it = N(
743
729
  (t) => {
744
730
  M.current = !0, Y((r) => ({
745
731
  ...r,
@@ -750,7 +736,7 @@ function Mt({
750
736
  });
751
737
  },
752
738
  [L]
753
- ), lt = N(
739
+ ), st = N(
754
740
  (t) => {
755
741
  M.current = !0, Y((r) => ({
756
742
  ...r,
@@ -761,7 +747,7 @@ function Mt({
761
747
  });
762
748
  },
763
749
  [L]
764
- ), ct = N(
750
+ ), lt = N(
765
751
  (t) => {
766
752
  M.current = !0, Y((r) => ({
767
753
  ...r,
@@ -772,7 +758,7 @@ function Mt({
772
758
  });
773
759
  },
774
760
  [L]
775
- ), dt = N(
761
+ ), ct = N(
776
762
  (t) => {
777
763
  M.current = !0, Y((r) => ({
778
764
  ...r,
@@ -783,7 +769,7 @@ function Mt({
783
769
  });
784
770
  },
785
771
  [L]
786
- ), pt = N(
772
+ ), dt = N(
787
773
  (t) => {
788
774
  M.current = !0, Y((r) => ({
789
775
  ...r,
@@ -811,9 +797,9 @@ function Mt({
811
797
  });
812
798
  });
813
799
  let o = Array.from(i.values());
814
- const s = new Set(K.current || []);
815
- s.size > 0 ? o.sort((n, c) => {
816
- const d = s.has(n.value), $ = s.has(c.value);
800
+ const l = new Set(K.current || []);
801
+ l.size > 0 ? o.sort((n, c) => {
802
+ const d = l.has(n.value), $ = l.has(c.value);
817
803
  return d && !$ ? -1 : !d && $ ? 1 : d && $ ? K.current.indexOf(n.value) - K.current.indexOf(c.value) : n.value.localeCompare(c.value);
818
804
  }) : o.sort(
819
805
  (n, c) => c.popularity === n.popularity ? n.value.localeCompare(c.value) : c.popularity - n.popularity
@@ -823,7 +809,7 @@ function Mt({
823
809
  }
824
810
  })();
825
811
  }, [x, e.year]);
826
- const vt = N(() => {
812
+ const pt = N(() => {
827
813
  (async () => {
828
814
  let r = [];
829
815
  if (ie.current && ie.current.length)
@@ -834,11 +820,11 @@ function Mt({
834
820
  attributesToRetrieve: ["make", "make_popularity"],
835
821
  limit: 1e3
836
822
  }), o = /* @__PURE__ */ new Map();
837
- i.hits.forEach((s) => {
838
- s.make && !o.has(s.make) && o.set(s.make, {
839
- value: s.make.toUpperCase(),
840
- refinement: s.make.toUpperCase(),
841
- popularity: s.make_popularity || 0
823
+ i.hits.forEach((l) => {
824
+ l.make && !o.has(l.make) && o.set(l.make, {
825
+ value: l.make.toUpperCase(),
826
+ refinement: l.make.toUpperCase(),
827
+ popularity: l.make_popularity || 0
842
828
  });
843
829
  }), r = Array.from(o.values());
844
830
  } catch (i) {
@@ -852,9 +838,9 @@ function Mt({
852
838
  }
853
839
  if (K.current && K.current.length > 0) {
854
840
  const i = new Set(K.current);
855
- r.sort((o, s) => {
856
- const n = i.has(o.value), c = i.has(s.value);
857
- return n && !c ? -1 : !n && c ? 1 : n && c ? K.current.indexOf(o.value) - K.current.indexOf(s.value) : o.value.localeCompare(s.value);
841
+ r.sort((o, l) => {
842
+ const n = i.has(o.value), c = i.has(l.value);
843
+ return n && !c ? -1 : !n && c ? 1 : n && c ? K.current.indexOf(o.value) - K.current.indexOf(l.value) : o.value.localeCompare(l.value);
858
844
  });
859
845
  } else
860
846
  r.sort((i, o) => i.popularity === o.popularity ? i.value.localeCompare(o.value) : o.popularity - i.popularity);
@@ -867,26 +853,26 @@ function Mt({
867
853
  const r = e.make.refinement;
868
854
  if (G && typeof S.current == "object" && !Array.isArray(S.current) && S.current[r]) {
869
855
  const i = S.current[r].map(
870
- (s) => ({
871
- value: s,
872
- refinement: s,
856
+ (l) => ({
857
+ value: l,
858
+ refinement: l,
873
859
  popularity: 0
874
860
  // Popularity will be used from PostHog for sorting
875
861
  })
876
862
  ), o = (t = j.current) == null ? void 0 : t[r];
877
863
  if (o && Array.isArray(o)) {
878
- const s = new Map(
864
+ const l = new Map(
879
865
  o.map((n, c) => [
880
866
  n.toUpperCase(),
881
867
  o.length - c
882
868
  ])
883
869
  );
884
870
  i.sort((n, c) => {
885
- const d = s.get(n.value.toUpperCase()) || 0, $ = s.get(c.value.toUpperCase()) || 0;
871
+ const d = l.get(n.value.toUpperCase()) || 0, $ = l.get(c.value.toUpperCase()) || 0;
886
872
  return d !== $ ? $ - d : n.value.localeCompare(c.value);
887
873
  });
888
874
  } else
889
- i.sort((s, n) => s.value.localeCompare(n.value));
875
+ i.sort((l, n) => l.value.localeCompare(n.value));
890
876
  ce(i);
891
877
  return;
892
878
  }
@@ -899,9 +885,9 @@ function Mt({
899
885
  }).then((i) => {
900
886
  var pe, ae;
901
887
  const { hits: o } = i;
902
- let s = [];
903
- o.length > 0 && o[0].models && (s = o[0].models);
904
- let n = s.map((h) => ({
888
+ let l = [];
889
+ o.length > 0 && o[0].models && (l = o[0].models);
890
+ let n = l.map((h) => ({
905
891
  model: `${e.make.refinement} > ${h.name}`,
906
892
  model_popularity: h.popularity || 0
907
893
  })), c = [];
@@ -938,18 +924,18 @@ function Mt({
938
924
  refinement: h.model.match(/[^>]*$/)[0].trim(),
939
925
  popularity: h.model_popularity
940
926
  }));
941
- const $ = (pe = e.make) == null ? void 0 : pe.refinement, re = (ae = j.current) == null ? void 0 : ae[$];
942
- if (re && Array.isArray(re) && re.length > 0) {
927
+ const $ = (pe = e.make) == null ? void 0 : pe.refinement, te = (ae = j.current) == null ? void 0 : ae[$];
928
+ if (te && Array.isArray(te) && te.length > 0) {
943
929
  const h = new Set(
944
- re.map((m) => String(m).trim().toUpperCase())
930
+ te.map((m) => String(m).trim().toUpperCase())
945
931
  );
946
932
  n.sort((m, k) => {
947
933
  const je = h.has(m.value), Ne = h.has(k.value);
948
934
  if (je && !Ne) return -1;
949
935
  if (!je && Ne) return 1;
950
936
  if (je && Ne) {
951
- const qe = re.map(
952
- (ut) => String(ut).trim().toUpperCase()
937
+ const qe = te.map(
938
+ (ht) => String(ht).trim().toUpperCase()
953
939
  );
954
940
  return qe.indexOf(m.value) - qe.indexOf(k.value);
955
941
  }
@@ -985,7 +971,7 @@ function Mt({
985
971
  limit: 200
986
972
  // Reduced from 1000 for faster queries
987
973
  }).then(({ hits: r }) => {
988
- const i = r.map((d) => d.year_from), o = Math.min(...i), s = r.map((d) => d.year_to), n = Math.max(...s);
974
+ const i = r.map((d) => d.year_from), o = Math.min(...i), l = r.map((d) => d.year_to), n = Math.max(...l);
989
975
  let c = Array.apply(null, {
990
976
  length: n + 1 - o
991
977
  }).map(function(d, $) {
@@ -1029,13 +1015,13 @@ function Mt({
1029
1015
  }, [e.year, e.make, e.model, g]);
1030
1016
  const ue = N(({ hits: t, attribute: r, stateCallback: i }) => {
1031
1017
  let o = [
1032
- ...new Map(t.map((s) => [s[r], s])).values()
1033
- ].map((s) => ({
1034
- value: s[r].match(/[^|]*$/)[0].trim(),
1035
- refinement: s[r].match(/[^|]*$/)[0].trim()
1036
- })).filter((s) => s.refinement);
1018
+ ...new Map(t.map((l) => [l[r], l])).values()
1019
+ ].map((l) => ({
1020
+ value: l[r].match(/[^|]*$/)[0].trim(),
1021
+ refinement: l[r].match(/[^|]*$/)[0].trim()
1022
+ })).filter((l) => l.refinement);
1037
1023
  i(o);
1038
- }, []), ht = N(() => {
1024
+ }, []), vt = N(() => {
1039
1025
  const t = Ce.current ? Ce.current.length + 3 : 3, r = C ? t + 1 : t;
1040
1026
  return `vs:lg:grid-cols-${r > 8 ? 8 : r}`;
1041
1027
  }, [C]);
@@ -1100,12 +1086,12 @@ function Mt({
1100
1086
  ]);
1101
1087
  const [ze, Ee] = A(!1);
1102
1088
  return B(() => {
1103
- if (O)
1089
+ if (T)
1104
1090
  return ze ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
1105
1091
  document.body.style.overflow = "";
1106
1092
  };
1107
- }, [ze, O]), /* @__PURE__ */ E($e, { children: [
1108
- O && /* @__PURE__ */ a(
1093
+ }, [ze, T]), /* @__PURE__ */ E($e, { children: [
1094
+ T && /* @__PURE__ */ a(
1109
1095
  "button",
1110
1096
  {
1111
1097
  onClick: () => Ee(!0),
@@ -1114,10 +1100,10 @@ function Mt({
1114
1100
  "vehicle-search-btn vs:md:hidden!",
1115
1101
  V ? "vs:w-full! vs:flex! vs:shrink-0!" : "vs:w-auto! vs:inline-flex! vs:shrink!"
1116
1102
  ),
1117
- children: /* @__PURE__ */ a("span", { children: l })
1103
+ children: /* @__PURE__ */ a("span", { children: s })
1118
1104
  }
1119
1105
  ),
1120
- O && /* @__PURE__ */ a(
1106
+ T && /* @__PURE__ */ a(
1121
1107
  "div",
1122
1108
  {
1123
1109
  onClick: () => Ee(!1),
@@ -1132,11 +1118,11 @@ function Mt({
1132
1118
  {
1133
1119
  className: ne(
1134
1120
  "partbot-mmyvs-container",
1135
- O && ze && "active",
1121
+ T && ze && "active",
1136
1122
  "w-full"
1137
1123
  ),
1138
1124
  children: [
1139
- O && /* @__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: [
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: [
1140
1126
  /* @__PURE__ */ a("span", { children: "Select Vehicle" }),
1141
1127
  /* @__PURE__ */ E(
1142
1128
  "button",
@@ -1163,10 +1149,10 @@ function Mt({
1163
1149
  /* @__PURE__ */ E(
1164
1150
  "div",
1165
1151
  {
1166
- ref: U,
1152
+ ref: F,
1167
1153
  className: ne(
1168
1154
  "vs:grid vs:gap-3",
1169
- I === "row" ? `${ht()} vs:grid-cols-1 vs:md:grid-cols-3` : "vs:grid-cols-1 vs:md:max-w-[400px] vs:md:gap-5",
1155
+ I === "row" ? `${vt()} vs:grid-cols-1 vs:md:grid-cols-3` : "vs:grid-cols-1 vs:md:max-w-[400px] vs:md:gap-5",
1170
1156
  "vs:w-full vs:transition vs:lg:mx-auto"
1171
1157
  ),
1172
1158
  children: [
@@ -1276,7 +1262,7 @@ function Mt({
1276
1262
  {
1277
1263
  label: "Body",
1278
1264
  items: Le,
1279
- refine: st,
1265
+ refine: it,
1280
1266
  selected: e.body,
1281
1267
  bgDark: H,
1282
1268
  showLabel: _,
@@ -1293,7 +1279,7 @@ function Mt({
1293
1279
  {
1294
1280
  label: "Series",
1295
1281
  items: Ie,
1296
- refine: lt,
1282
+ refine: st,
1297
1283
  selected: e.series,
1298
1284
  bgDark: H,
1299
1285
  showLabel: _,
@@ -1310,7 +1296,7 @@ function Mt({
1310
1296
  {
1311
1297
  label: "Variant",
1312
1298
  items: Ve,
1313
- refine: ct,
1299
+ refine: lt,
1314
1300
  selected: e.variant,
1315
1301
  bgDark: H,
1316
1302
  showLabel: _,
@@ -1326,13 +1312,13 @@ function Mt({
1326
1312
  X,
1327
1313
  {
1328
1314
  label: "Engine Capacity",
1329
- items: Ue,
1330
- refine: pt,
1315
+ items: Fe,
1316
+ refine: dt,
1331
1317
  selected: e.engine_capacity,
1332
1318
  bgDark: H,
1333
1319
  showLabel: _,
1334
1320
  isMobile: J,
1335
- loading: !!(e.make && e.model && e.year) && Ue.length === 0,
1321
+ loading: !!(e.make && e.model && e.year) && Fe.length === 0,
1336
1322
  shouldBeActive: !!(e.make && e.model && e.year)
1337
1323
  },
1338
1324
  "engine_capacity"
@@ -1344,7 +1330,7 @@ function Mt({
1344
1330
  {
1345
1331
  label: "Engine",
1346
1332
  items: De,
1347
- refine: dt,
1333
+ refine: ct,
1348
1334
  selected: e.engine,
1349
1335
  bgDark: H,
1350
1336
  showLabel: _,
@@ -1363,18 +1349,18 @@ function Mt({
1363
1349
  {
1364
1350
  className: "vehicle-search-btn",
1365
1351
  onClick: () => {
1366
- Me(!0), F && !q ? window.location.href = F + window.location.search : it();
1352
+ Me(!0), U && !q ? window.location.href = U + window.location.search : nt();
1367
1353
  },
1368
1354
  children: [
1369
1355
  /* @__PURE__ */ a("span", { children: y }),
1370
- Ge && /* @__PURE__ */ a(Pe, { className: "vs:w-[calc(var(--partbot-font-size)*0.9)]! vs:h-[calc(var(--partbot-font-size)*0.9)]! vs:animate-spin" })
1356
+ Xe && /* @__PURE__ */ a(Pe, { className: "vs:w-[calc(var(--partbot-font-size)*0.9)]! vs:h-[calc(var(--partbot-font-size)*0.9)]! vs:animate-spin" })
1371
1357
  ]
1372
1358
  }
1373
1359
  ) })
1374
1360
  ]
1375
1361
  }
1376
1362
  ),
1377
- T && /* @__PURE__ */ a(
1363
+ O && /* @__PURE__ */ a(
1378
1364
  "div",
1379
1365
  {
1380
1366
  className: ne(
@@ -1403,9 +1389,9 @@ function Mt({
1403
1389
  )
1404
1390
  ] });
1405
1391
  }
1406
- let Je = !1, me = !1;
1392
+ let We = !1, me = !1;
1407
1393
  function At(b) {
1408
- var O, ee;
1394
+ var T, re;
1409
1395
  const v = b.shadowRoot;
1410
1396
  if (!v) {
1411
1397
  console.error("[ShadowDOMPatch] No shadow root found");
@@ -1439,29 +1425,29 @@ function At(b) {
1439
1425
  }).observe(p, {
1440
1426
  childList: !0,
1441
1427
  subtree: !0
1442
- }), Je)
1428
+ }), We)
1443
1429
  return;
1444
- const R = (O = Object.getOwnPropertyDescriptor(
1430
+ const R = (T = Object.getOwnPropertyDescriptor(
1445
1431
  Document.prototype,
1446
1432
  "activeElement"
1447
- )) == null ? void 0 : O.get;
1433
+ )) == null ? void 0 : T.get;
1448
1434
  Object.defineProperty(Document.prototype, "activeElement", {
1449
1435
  get: function() {
1450
1436
  const u = R == null ? void 0 : R.call(this);
1451
1437
  return u === b ? v.activeElement : u;
1452
1438
  }
1453
1439
  });
1454
- const P = (ee = Object.getOwnPropertyDescriptor(
1440
+ const P = (re = Object.getOwnPropertyDescriptor(
1455
1441
  Event.prototype,
1456
1442
  "target"
1457
- )) == null ? void 0 : ee.get;
1443
+ )) == null ? void 0 : re.get;
1458
1444
  Object.defineProperty(Event.prototype, "target", {
1459
1445
  get: function() {
1460
1446
  const u = P == null ? void 0 : P.call(this);
1461
1447
  return u === b ? this.composedPath()[0] : u;
1462
1448
  }
1463
1449
  });
1464
- const T = (u) => {
1450
+ const O = (u) => {
1465
1451
  try {
1466
1452
  return document.body && u === document.body.style;
1467
1453
  } catch {
@@ -1469,7 +1455,7 @@ function At(b) {
1469
1455
  }
1470
1456
  }, _ = CSSStyleDeclaration.prototype.setProperty;
1471
1457
  CSSStyleDeclaration.prototype.setProperty = function(u, y, C) {
1472
- if (!(T(this) && u === "overflow" && y === "hidden" && me))
1458
+ if (!(O(this) && u === "overflow" && y === "hidden" && me))
1473
1459
  return _.call(this, u, y, C);
1474
1460
  };
1475
1461
  const V = Object.getOwnPropertyDescriptor(
@@ -1481,10 +1467,10 @@ function At(b) {
1481
1467
  return V.get.call(this);
1482
1468
  },
1483
1469
  set: function(u) {
1484
- if (!(T(this) && u === "hidden" && me))
1470
+ if (!(O(this) && u === "hidden" && me))
1485
1471
  return V.set.call(this, u);
1486
1472
  }
1487
- }), Je = !0;
1473
+ }), We = !0;
1488
1474
  }
1489
1475
  const Et = "/css/vehicle-search.css", Yt = Et;
1490
1476
  class jt extends HTMLElement {
@@ -1495,7 +1481,7 @@ class jt extends HTMLElement {
1495
1481
  }
1496
1482
  let v = document.createElement("style");
1497
1483
  v.textContent = zt;
1498
- const p = document.createElement("div"), F = this.attachShadow({ mode: "open" }), I = (j, Q, w) => {
1484
+ const p = document.createElement("div"), U = this.attachShadow({ mode: "open" }), I = (j, Q, w) => {
1499
1485
  let W;
1500
1486
  if (this.hasAttribute(Q)) {
1501
1487
  const M = this.getAttribute(Q);
@@ -1514,7 +1500,7 @@ class jt extends HTMLElement {
1514
1500
  "partbot-button-color",
1515
1501
  "data-button-color",
1516
1502
  "0 0 0"
1517
- ), T = I(
1503
+ ), O = I(
1518
1504
  "partbot-button-hover-color",
1519
1505
  "data-button-hover-color",
1520
1506
  "0 0 0"
@@ -1526,13 +1512,13 @@ class jt extends HTMLElement {
1526
1512
  "partbot-button-hover-label-color",
1527
1513
  "data-button-hover-label-color",
1528
1514
  "255 255 255"
1529
- ), O = I(
1515
+ ), T = I(
1530
1516
  "partbot-mobile-background-color",
1531
1517
  "data-mobile-background-color",
1532
1518
  "0 0 0"
1533
- ), ee = `:host { --partbot-button-border-radius: ${this.getAttribute("data-button-border-radius") || "0.375rem"}; } .partbot-mmyvs-container { --partbot-button-border-radius: ${this.getAttribute("data-button-border-radius") || "0.375rem"}; }`, u = `:host { --partbot-font-size: ${this.getAttribute("data-font-size") || "0.875rem"}; } .partbot-mmyvs-container { --partbot-font-size: ${this.getAttribute("data-font-size") || "0.875rem"}; }`, y = `:host { --partbot-font-family: ${(this.getAttribute("data-font-family") || this.getAttribute("data-font")) && (this.getAttribute("data-font-family") || this.getAttribute("data-font")).trim() !== "" ? this.getAttribute("data-font-family") || this.getAttribute("data-font") : '"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif'}; } .partbot-mmyvs-container { --partbot-font-family: ${(this.getAttribute("data-font-family") || this.getAttribute("data-font")) && (this.getAttribute("data-font-family") || this.getAttribute("data-font")).trim() !== "" ? this.getAttribute("data-font-family") || this.getAttribute("data-font") : '"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif'}; }`, C = `:host { --partbot-padding: ${this.getAttribute("data-padding") || "0.5rem"}; } .partbot-mmyvs-container { --partbot-padding: ${this.getAttribute("data-padding") || "0.5rem"}; }`;
1534
- const q = this.getAttribute("data-input-shadow"), te = q === "none" ? "none" : q || "0 1px 2px 0 rgb(0 0 0 / 0.05)";
1535
- let G = `:host { --partbot-input-shadow: ${te}; } .partbot-mmyvs-container { --partbot-input-shadow: ${te}; }`;
1519
+ ), re = `:host { --partbot-button-border-radius: ${this.getAttribute("data-button-border-radius") || "0.375rem"}; } .partbot-mmyvs-container { --partbot-button-border-radius: ${this.getAttribute("data-button-border-radius") || "0.375rem"}; }`, u = `:host { --partbot-font-size: ${this.getAttribute("data-font-size") || "0.875rem"}; } .partbot-mmyvs-container { --partbot-font-size: ${this.getAttribute("data-font-size") || "0.875rem"}; }`, y = `:host { --partbot-font-family: ${(this.getAttribute("data-font-family") || this.getAttribute("data-font")) && (this.getAttribute("data-font-family") || this.getAttribute("data-font")).trim() !== "" ? this.getAttribute("data-font-family") || this.getAttribute("data-font") : '"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif'}; } .partbot-mmyvs-container { --partbot-font-family: ${(this.getAttribute("data-font-family") || this.getAttribute("data-font")) && (this.getAttribute("data-font-family") || this.getAttribute("data-font")).trim() !== "" ? this.getAttribute("data-font-family") || this.getAttribute("data-font") : '"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif'}; }`, C = `:host { --partbot-padding: ${this.getAttribute("data-padding") || "0.5rem"}; } .partbot-mmyvs-container { --partbot-padding: ${this.getAttribute("data-padding") || "0.5rem"}; }`;
1520
+ const q = this.getAttribute("data-input-shadow"), ee = q === "none" ? "none" : q || "0 1px 2px 0 rgb(0 0 0 / 0.05)";
1521
+ let G = `:host { --partbot-input-shadow: ${ee}; } .partbot-mmyvs-container { --partbot-input-shadow: ${ee}; }`;
1536
1522
  const f = this.getAttribute("data-input-border-color");
1537
1523
  let D = "229 231 235";
1538
1524
  if (f)
@@ -1541,9 +1527,9 @@ class jt extends HTMLElement {
1541
1527
  D = `${j} ${Q} ${w}`;
1542
1528
  } else /^\d+\s+\d+\s+\d+$/.test(f) && (D = f);
1543
1529
  let g = `:host { --partbot-input-border-color: ${D}; } .partbot-mmyvs-container { --partbot-input-border-color: ${D}; }`;
1544
- const l = this.getAttribute("data-input-border-width") || "1px";
1545
- let U = `:host { --partbot-input-border-width: ${l}; } .partbot-mmyvs-container { --partbot-input-border-width: ${l}; }`;
1546
- v.textContent += R, v.textContent += P, v.textContent += T, v.textContent += _, v.textContent += V, v.textContent += O, v.textContent += ee, v.textContent += u, v.textContent += y, v.textContent += C, v.textContent += G, v.textContent += g, v.textContent += U, F.appendChild(v), F.appendChild(p);
1530
+ const s = this.getAttribute("data-input-border-width") || "1px";
1531
+ let F = `:host { --partbot-input-border-width: ${s}; } .partbot-mmyvs-container { --partbot-input-border-width: ${s}; }`;
1532
+ v.textContent += R, v.textContent += P, v.textContent += O, v.textContent += _, v.textContent += V, v.textContent += T, v.textContent += re, v.textContent += u, v.textContent += y, v.textContent += C, v.textContent += G, v.textContent += g, v.textContent += F, U.appendChild(v), U.appendChild(p);
1547
1533
  const z = this.getAttribute("data-api-key");
1548
1534
  if (!z) {
1549
1535
  console.warn("Missing attributes: " + (z ? "" : "data-api-key "));
@@ -1559,7 +1545,7 @@ class jt extends HTMLElement {
1559
1545
  }
1560
1546
  At(this);
1561
1547
  const K = /* @__PURE__ */ a(Mt, { ...S });
1562
- ft.render(K, p);
1548
+ mt.render(K, p);
1563
1549
  }
1564
1550
  }
1565
1551
  customElements.define("vehicle-search", jt);