@partbot/stockist-map 0.1.9 → 0.1.11

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,6 +1,6 @@
1
1
  var ue = Object.defineProperty;
2
2
  var de = (e, t, r) => t in e ? ue(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var H = (e, t, r) => de(e, typeof t != "symbol" ? t + "" : t, r);
3
+ var P = (e, t, r) => de(e, typeof t != "symbol" ? t + "" : t, r);
4
4
  import { jsxs as f, jsx as i } from "react/jsx-runtime";
5
5
  import { createRoot as J } from "react-dom/client";
6
6
  import * as s from "react";
@@ -26,7 +26,7 @@ const be = pe({
26
26
  size: A,
27
27
  weight: x = "regular",
28
28
  mirrored: T = !1,
29
- ...E
29
+ ...k
30
30
  } = s.useContext(be);
31
31
  return /* @__PURE__ */ s.createElement(
32
32
  "svg",
@@ -38,7 +38,7 @@ const be = pe({
38
38
  fill: n ?? L,
39
39
  viewBox: "0 0 256 256",
40
40
  transform: Z || T ? "scale(-1, 1)" : void 0,
41
- ...E,
41
+ ...k,
42
42
  ...v
43
43
  },
44
44
  !!r && /* @__PURE__ */ s.createElement("title", null, r),
@@ -114,7 +114,7 @@ const he = /* @__PURE__ */ new Map([
114
114
  ]
115
115
  ]), te = s.forwardRef((e, t) => /* @__PURE__ */ s.createElement(q, { ref: t, ...e, weights: he }));
116
116
  te.displayName = "XIcon";
117
- const me = "https://tile.openstreetmap.org/{z}/{x}/{y}.png", se = "https://basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}@2x.png", re = "OpenStreetMap contributors, CARTO", ne = "https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json", D = {
117
+ const me = "https://tile.openstreetmap.org/{z}/{x}/{y}.png", se = "https://basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}@2x.png", re = "OpenStreetMap contributors, CARTO", ne = "https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json", O = {
118
118
  primaryColor: "#111111",
119
119
  markerColor: "#111111",
120
120
  borderRadius: 8,
@@ -125,7 +125,8 @@ const me = "https://tile.openstreetmap.org/{z}/{x}/{y}.png", se = "https://basem
125
125
  styleUrl: ne,
126
126
  mapPalette: "monotone",
127
127
  tileUrl: se,
128
- tileAttribution: re
128
+ tileAttribution: re,
129
+ phoneDisplay: "call_now"
129
130
  };
130
131
  function B(e) {
131
132
  const t = e.trim().replace(/^#/, ""), r = t.length === 3 ? t.split("").map((n) => `${n}${n}`).join("") : t;
@@ -135,7 +136,7 @@ function B(e) {
135
136
  b: Number.parseInt(r.slice(4, 6), 16)
136
137
  } : null;
137
138
  }
138
- function P({ r: e, g: t, b: r }) {
139
+ function $({ r: e, g: t, b: r }) {
139
140
  const n = [e, t, r].map((l) => {
140
141
  const p = l / 255;
141
142
  return p <= 0.03928 ? p / 12.92 : ((p + 0.055) / 1.055) ** 2.4;
@@ -143,7 +144,7 @@ function P({ r: e, g: t, b: r }) {
143
144
  return 0.2126 * n[0] + 0.7152 * n[1] + 0.0722 * n[2];
144
145
  }
145
146
  function V(e, t) {
146
- const r = Math.max(P(e), P(t)), n = Math.min(P(e), P(t));
147
+ const r = Math.max($(e), $(t)), n = Math.min($(e), $(t));
147
148
  return (r + 0.05) / (n + 0.05);
148
149
  }
149
150
  function ge(e, t = "#111111", r = "#ffffff") {
@@ -152,17 +153,18 @@ function ge(e, t = "#111111", r = "#ffffff") {
152
153
  }
153
154
  function xe(e = {}) {
154
155
  return {
155
- ...D,
156
+ ...O,
156
157
  ...e,
157
158
  defaultCenter: {
158
- ...D.defaultCenter,
159
+ ...O.defaultCenter,
159
160
  ...e.defaultCenter || {}
160
161
  },
161
162
  styleUrl: e.styleUrl || ne,
162
163
  mapPalette: e.mapPalette || "monotone",
163
- borderRadius: Number.isFinite(Number(e.borderRadius)) ? Number(e.borderRadius) : D.borderRadius,
164
+ borderRadius: Number.isFinite(Number(e.borderRadius)) ? Number(e.borderRadius) : O.borderRadius,
164
165
  tileUrl: !e.tileUrl || e.tileUrl === me ? se : e.tileUrl,
165
166
  tileAttribution: e.tileAttribution || re,
167
+ phoneDisplay: e.phoneDisplay === "number" ? "number" : "call_now",
166
168
  radiusUnit: "km"
167
169
  };
168
170
  }
@@ -178,7 +180,7 @@ async function ve(e) {
178
180
  if (!t.ok) throw new Error(`Could not load stockist map config (${t.status})`);
179
181
  return t.json();
180
182
  }
181
- async function Ee(e, t = {}) {
183
+ async function ke(e, t = {}) {
182
184
  const r = await fetch(we(e, t), { headers: { Accept: "application/json" } });
183
185
  if (!r.ok) throw new Error(`Could not search stockists (${r.status})`);
184
186
  const n = await r.json();
@@ -189,13 +191,13 @@ async function Ee(e, t = {}) {
189
191
  resolvedQuery: n.resolvedQuery || null
190
192
  };
191
193
  }
192
- const ke = 6371;
193
- function $(e) {
194
+ const Ee = 6371;
195
+ function D(e) {
194
196
  return e * Math.PI / 180;
195
197
  }
196
198
  function Se(e, t) {
197
- const r = $(t.lat - e.lat), n = $(t.lng - e.lng), l = Math.sin(r / 2) ** 2 + Math.cos($(e.lat)) * Math.cos($(t.lat)) * Math.sin(n / 2) ** 2;
198
- return 2 * ke * Math.atan2(Math.sqrt(l), Math.sqrt(1 - l));
199
+ const r = D(t.lat - e.lat), n = D(t.lng - e.lng), l = Math.sin(r / 2) ** 2 + Math.cos(D(e.lat)) * Math.cos(D(t.lat)) * Math.sin(n / 2) ** 2;
200
+ return 2 * Ee * Math.atan2(Math.sqrt(l), Math.sqrt(1 - l));
199
201
  }
200
202
  function Le(e) {
201
203
  return `${e.toFixed(1)} km`;
@@ -218,36 +220,39 @@ function Me(e) {
218
220
  function Ce(e) {
219
221
  return `https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(`${e.lat},${e.lng}`)}`;
220
222
  }
221
- function Ne(e) {
222
- return e.stockist_id ?? e.id;
223
+ function Ne(e, t = "call_now") {
224
+ return t === "number" ? e : "Call now";
223
225
  }
224
226
  function Te(e) {
227
+ return e.stockist_id ?? e.id;
228
+ }
229
+ function Re(e) {
225
230
  const t = /* @__PURE__ */ new Set();
226
231
  return e.filter((r) => {
227
- const n = Ne(r);
232
+ const n = Te(r);
228
233
  return t.has(n) ? !1 : (t.add(n), !0);
229
234
  });
230
235
  }
231
- const Re = 3, Ie = 100, W = 50, _e = 350;
236
+ const _e = 3, Ie = 100, W = 50, Ue = 350;
232
237
  function G(e) {
233
238
  return e.display_address || e.address;
234
239
  }
235
- function Ue(e) {
240
+ function ze(e) {
236
241
  var t;
237
242
  return (t = e.categories) != null && t.length ? e.categories : e.category ? [e.category] : [];
238
243
  }
239
- function ze(e, t) {
244
+ function He(e, t) {
240
245
  const r = t == null ? void 0 : t[e];
241
246
  return r ? {
242
247
  "--pbss-category-color": r,
243
248
  "--pbss-category-contrast": ge(r)
244
249
  } : void 0;
245
250
  }
246
- function He(e, t) {
251
+ function Pe(e, t) {
247
252
  const r = t ? e.map((n) => ({ ...n, distanceKm: Se(t, n._geo) })).sort((n, l) => (n.distanceKm || 0) - (l.distanceKm || 0)) : e;
248
- return Te(r).slice(0, Re);
253
+ return Re(r).slice(0, _e);
249
254
  }
250
- function ae({
255
+ function oe({
251
256
  token: e,
252
257
  configUrl: t,
253
258
  config: r,
@@ -258,65 +263,65 @@ function ae({
258
263
  }) {
259
264
  const [c, N] = s.useState(r || null), [v, L] = s.useState(l), [A, x] = s.useState(
260
265
  l.trim() ? "typed" : null
261
- ), [T, E] = s.useState([]), [R, I] = s.useState(!1), [k, S] = s.useState(!1), [ie, d] = s.useState(!1), [K, y] = s.useState(!1), [_, h] = s.useState(null), M = s.useRef(null), m = s.useRef(0), w = s.useRef(0), C = s.useRef(null), j = s.useId(), F = s.useMemo(
266
+ ), [T, k] = s.useState([]), [R, _] = s.useState(!1), [E, S] = s.useState(!1), [ie, d] = s.useState(!1), [K, y] = s.useState(!1), [I, h] = s.useState(null), M = s.useRef(null), m = s.useRef(0), w = s.useRef(0), C = s.useRef(null), j = s.useId(), U = s.useMemo(
262
267
  () => xe({ ...(c == null ? void 0 : c.theme) || {}, ...n || {} }),
263
268
  [c == null ? void 0 : c.theme, n]
264
269
  ), b = s.useCallback(() => {
265
270
  C.current && (clearTimeout(C.current), C.current = null);
266
- }, []), U = s.useCallback(() => {
267
- m.current += 1, b(), E([]), I(!1), y(!1), h(null), d(!1);
268
- }, [b]), z = s.useCallback(
269
- async ({ activeQuery: a, center: o }) => {
271
+ }, []), z = s.useCallback(() => {
272
+ m.current += 1, b(), k([]), _(!1), y(!1), h(null), d(!1);
273
+ }, [b]), H = s.useCallback(
274
+ async ({ activeQuery: o, center: a }) => {
270
275
  if (!c) return;
271
276
  const u = m.current + 1;
272
- m.current = u, b(), I(!0), y(!0), h(null), d(!0);
277
+ m.current = u, b(), _(!0), y(!0), h(null), d(!0);
273
278
  try {
274
- const g = await Ee(c.search.url, {
275
- query: a,
276
- center: o,
279
+ const g = await ke(c.search.url, {
280
+ query: o,
281
+ center: a,
277
282
  radiusKm: W,
278
283
  limit: Ie,
279
- locationSearch: !o && !!a
284
+ locationSearch: !a && !!o
280
285
  });
281
286
  if (u !== m.current) return;
282
- E(He(g.hits, g.center || o));
287
+ k(Pe(g.hits, g.center || a));
283
288
  } catch (g) {
284
289
  if (u !== m.current) return;
285
- E([]), h(g instanceof Error ? g.message : "Could not search stockists");
290
+ k([]), h(g instanceof Error ? g.message : "Could not search stockists");
286
291
  } finally {
287
- u === m.current && I(!1);
292
+ u === m.current && _(!1);
288
293
  }
289
294
  },
290
295
  [b, c]
291
296
  );
292
297
  s.useEffect(() => {
293
- if (w.current += 1, m.current += 1, b(), N(r || null), L(l), x(l.trim() ? "typed" : null), E([]), I(!1), S(!1), y(!1), d(!1), h(null), r) return;
294
- const a = t || (e ? ye(e) : null);
295
- if (!a) return;
296
- let o = !1;
297
- return ve(a).then((u) => {
298
- o || N(u);
298
+ if (w.current += 1, m.current += 1, b(), N(r || null), L(l), x(l.trim() ? "typed" : null), k([]), _(!1), S(!1), y(!1), d(!1), h(null), r) return;
299
+ const o = t || (e ? ye(e) : null);
300
+ if (!o) return;
301
+ let a = !1;
302
+ return ve(o).then((u) => {
303
+ a || N(u);
299
304
  }).catch((u) => {
300
- o || (h(u instanceof Error ? u.message : "Could not load stockist search"), y(!0), d(!0));
305
+ a || (h(u instanceof Error ? u.message : "Could not load stockist search"), y(!0), d(!0));
301
306
  }), () => {
302
- o = !0;
307
+ a = !0;
303
308
  };
304
309
  }, [b, t, l, r, e]), s.useEffect(() => {
305
310
  if (!c || A !== "typed") return;
306
- const a = v.trim();
307
- if (!a) {
308
- U();
311
+ const o = v.trim();
312
+ if (!o) {
313
+ z();
309
314
  return;
310
315
  }
311
316
  return b(), C.current = setTimeout(() => {
312
- C.current = null, z({ activeQuery: a, center: null });
313
- }, _e), b;
314
- }, [b, c, v, U, z, A]), s.useEffect(() => {
315
- const a = (o) => {
316
- const u = typeof o.composedPath == "function" ? o.composedPath() : [], g = o.target instanceof Node ? o.target : null;
317
+ C.current = null, H({ activeQuery: o, center: null });
318
+ }, Ue), b;
319
+ }, [b, c, v, z, H, A]), s.useEffect(() => {
320
+ const o = (a) => {
321
+ const u = typeof a.composedPath == "function" ? a.composedPath() : [], g = a.target instanceof Node ? a.target : null;
317
322
  M.current && u.includes(M.current) || M.current && g && M.current.contains(g) || d(!1);
318
323
  };
319
- return document.addEventListener("pointerdown", a), () => document.removeEventListener("pointerdown", a);
324
+ return document.addEventListener("pointerdown", o), () => document.removeEventListener("pointerdown", o);
320
325
  }, []), s.useEffect(
321
326
  () => () => {
322
327
  w.current += 1, m.current += 1, b();
@@ -324,7 +329,7 @@ function ae({
324
329
  [b]
325
330
  );
326
331
  const le = () => {
327
- if (w.current += 1, U(), x(null), S(!1), typeof window < "u" && window.isSecureContext === !1) {
332
+ if (w.current += 1, z(), x(null), S(!1), typeof window < "u" && window.isSecureContext === !1) {
328
333
  h("Browser location is blocked on this site. Search by suburb or postcode instead."), y(!0), d(!0);
329
334
  return;
330
335
  }
@@ -335,41 +340,41 @@ function ae({
335
340
  return;
336
341
  }
337
342
  x("location"), S(!0), h(null), d(!0);
338
- const a = w.current;
343
+ const o = w.current;
339
344
  navigator.geolocation.getCurrentPosition(
340
- (o) => {
341
- if (a !== w.current) return;
342
- const u = { lat: o.coords.latitude, lng: o.coords.longitude };
343
- L(""), S(!1), z({ activeQuery: "", center: u });
345
+ (a) => {
346
+ if (o !== w.current) return;
347
+ const u = { lat: a.coords.latitude, lng: a.coords.longitude };
348
+ L(""), S(!1), H({ activeQuery: "", center: u });
344
349
  },
345
- (o) => {
346
- a === w.current && (S(!1), y(!0), h(Ae(o)), d(!0));
350
+ (a) => {
351
+ o === w.current && (S(!1), y(!0), h(Ae(a)), d(!0));
347
352
  },
348
353
  { enableHighAccuracy: !1, timeout: 8e3 }
349
354
  );
350
355
  }, ce = () => {
351
- const a = v.trim();
352
- a && (x("typed"), z({ activeQuery: a, center: null }));
353
- }, O = ie && (R || k || K || !!_);
356
+ const o = v.trim();
357
+ o && (x("typed"), H({ activeQuery: o, center: null }));
358
+ }, F = ie && (R || E || K || !!I);
354
359
  return /* @__PURE__ */ f(
355
360
  "div",
356
361
  {
357
362
  ref: M,
358
- className: `pbss-root ${F.darkMode ? "is-dark" : ""} ${Z}`.trim(),
363
+ className: `pbss-root ${U.darkMode ? "is-dark" : ""} ${Z}`.trim(),
359
364
  style: {
360
- "--pbss-primary": F.primaryColor,
361
- "--pbss-radius": `${Math.max(0, F.borderRadius)}px`
365
+ "--pbss-primary": U.primaryColor,
366
+ "--pbss-radius": `${Math.max(0, U.borderRadius)}px`
362
367
  },
363
- onKeyDown: (a) => {
364
- a.key === "Escape" && d(!1);
368
+ onKeyDown: (o) => {
369
+ o.key === "Escape" && d(!1);
365
370
  },
366
371
  children: [
367
372
  /* @__PURE__ */ f("div", { className: "pbss-search-control", children: [
368
373
  /* @__PURE__ */ i(
369
374
  "input",
370
375
  {
371
- "aria-controls": O ? j : void 0,
372
- "aria-expanded": O,
376
+ "aria-controls": F ? j : void 0,
377
+ "aria-expanded": F,
373
378
  "aria-label": "Search stockists",
374
379
  autoComplete: "postal-code",
375
380
  className: "pbss-input",
@@ -377,34 +382,34 @@ function ae({
377
382
  placeholder: "Search suburb or postcode",
378
383
  type: "search",
379
384
  value: v,
380
- onChange: (a) => {
381
- const o = a.target.value;
382
- w.current += 1, U(), S(!1), L(o), x(o.trim() ? "typed" : null);
385
+ onChange: (o) => {
386
+ const a = o.target.value;
387
+ w.current += 1, z(), S(!1), L(a), x(a.trim() ? "typed" : null);
383
388
  },
384
389
  onFocus: () => {
385
- (R || k || K || _) && d(!0);
390
+ (R || E || K || I) && d(!0);
386
391
  },
387
- onKeyDown: (a) => {
388
- a.key === "Enter" && (a.preventDefault(), ce());
392
+ onKeyDown: (o) => {
393
+ o.key === "Enter" && (o.preventDefault(), ce());
389
394
  }
390
395
  }
391
396
  ),
392
397
  /* @__PURE__ */ f(
393
398
  "button",
394
399
  {
395
- "aria-label": k ? "Finding your location" : "Use my location",
400
+ "aria-label": E ? "Finding your location" : "Use my location",
396
401
  className: "pbss-location-button",
397
- disabled: k || R || !c,
402
+ disabled: E || R || !c,
398
403
  type: "button",
399
404
  onClick: le,
400
405
  children: [
401
- k ? /* @__PURE__ */ i("span", { "aria-hidden": "true", className: "pbss-spinner" }) : /* @__PURE__ */ i(ee, { "aria-hidden": "true", "data-slot": "icon", weight: "bold" }),
406
+ E ? /* @__PURE__ */ i("span", { "aria-hidden": "true", className: "pbss-spinner" }) : /* @__PURE__ */ i(ee, { "aria-hidden": "true", "data-slot": "icon", weight: "bold" }),
402
407
  /* @__PURE__ */ i("span", { "aria-hidden": "true", className: "pbss-touch-target" })
403
408
  ]
404
409
  }
405
410
  )
406
411
  ] }),
407
- O && /* @__PURE__ */ f(
412
+ F && /* @__PURE__ */ f(
408
413
  "div",
409
414
  {
410
415
  "aria-label": "Nearest stockists",
@@ -428,38 +433,38 @@ function ae({
428
433
  }
429
434
  )
430
435
  ] }),
431
- /* @__PURE__ */ i("div", { "aria-live": "polite", className: "pbss-results-status", children: R || k ? /* @__PURE__ */ i("div", { className: "pbss-loading", children: "Finding nearby stockists." }) : _ ? /* @__PURE__ */ i("div", { className: "pbss-error", children: _ }) : T.length > 0 ? /* @__PURE__ */ i("ul", { className: "pbss-results", role: "list", children: T.map((a) => {
432
- const o = Me(a.website);
436
+ /* @__PURE__ */ i("div", { "aria-live": "polite", className: "pbss-results-status", children: R || E ? /* @__PURE__ */ i("div", { className: "pbss-loading", children: "Finding nearby stockists." }) : I ? /* @__PURE__ */ i("div", { className: "pbss-error", children: I }) : T.length > 0 ? /* @__PURE__ */ i("ul", { className: "pbss-results", role: "list", children: T.map((o) => {
437
+ const a = Me(o.website);
433
438
  return /* @__PURE__ */ f("li", { className: "pbss-result", children: [
434
439
  /* @__PURE__ */ f("div", { className: "pbss-result-heading", children: [
435
- /* @__PURE__ */ i("div", { className: "pbss-result-name", children: a.name }),
436
- /* @__PURE__ */ i("div", { className: "pbss-result-categories", children: Ue(a).map((u) => /* @__PURE__ */ i(
440
+ /* @__PURE__ */ i("div", { className: "pbss-result-name", children: o.name }),
441
+ /* @__PURE__ */ i("div", { className: "pbss-result-categories", children: ze(o).map((u) => /* @__PURE__ */ i(
437
442
  "span",
438
443
  {
439
444
  className: "pbss-result-category",
440
- style: ze(u, c == null ? void 0 : c.search.categoryColors),
445
+ style: He(u, c == null ? void 0 : c.search.categoryColors),
441
446
  children: u
442
447
  },
443
448
  u
444
449
  )) })
445
450
  ] }),
446
- G(a) && /* @__PURE__ */ i("div", { className: "pbss-result-address", children: G(a) }),
451
+ G(o) && /* @__PURE__ */ i("div", { className: "pbss-result-address", children: G(o) }),
447
452
  /* @__PURE__ */ f("div", { className: "pbss-result-actions", children: [
448
- a.phone && /* @__PURE__ */ i("a", { href: `tel:${a.phone}`, children: "Call now" }),
449
- o && /* @__PURE__ */ i("a", { href: o, rel: "noreferrer", target: "_blank", children: "Website" }),
450
- a.email && /* @__PURE__ */ i("a", { href: `mailto:${a.email}`, children: "Email" }),
451
- a.directions_available !== !1 && /* @__PURE__ */ i(
453
+ o.phone && /* @__PURE__ */ i("a", { href: `tel:${o.phone}`, children: Ne(o.phone, U.phoneDisplay) }),
454
+ a && /* @__PURE__ */ i("a", { href: a, rel: "noreferrer", target: "_blank", children: "Website" }),
455
+ o.email && /* @__PURE__ */ i("a", { href: `mailto:${o.email}`, children: "Email" }),
456
+ o.directions_available !== !1 && /* @__PURE__ */ i(
452
457
  "a",
453
458
  {
454
- href: Ce(a._geo),
459
+ href: Ce(o._geo),
455
460
  rel: "noreferrer",
456
461
  target: "_blank",
457
462
  children: "Get directions"
458
463
  }
459
464
  ),
460
- typeof a.distanceKm == "number" && /* @__PURE__ */ i("span", { className: "pbss-result-distance", children: Le(a.distanceKm) })
465
+ typeof o.distanceKm == "number" && /* @__PURE__ */ i("span", { className: "pbss-result-distance", children: Le(o.distanceKm) })
461
466
  ] })
462
- ] }, a.id);
467
+ ] }, o.id);
463
468
  }) }) : /* @__PURE__ */ f("div", { className: "pbss-empty", children: [
464
469
  "No stockists found within ",
465
470
  W,
@@ -473,10 +478,10 @@ function ae({
473
478
  }
474
479
  );
475
480
  }
476
- const Pe = ":host{display:block;position:relative;z-index:11}partbot-stockist-search{display:block}.pbss-root{--pbss-primary: #111111;--pbss-action-color: var(--pbss-primary);--pbss-radius: 8px;--pbss-surface: #ffffff;--pbss-control-surface: #ffffff;--pbss-border: rgb(28 25 23 / .14);--pbss-divider: rgb(28 25 23 / .09);--pbss-text: #1c1917;--pbss-muted-text: #78716c;--pbss-placeholder-text: #57534e;--pbss-danger-surface: #fff1f2;--pbss-danger-text: #9f1239;color:var(--pbss-text);container-type:inline-size;font-family:inherit;isolation:isolate;position:relative;width:100%;-webkit-font-smoothing:antialiased}.pbss-search-control{align-items:center;display:flex;min-width:0;position:relative}.pbss-input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--pbss-control-surface);border:0;border-radius:var(--pbss-radius);box-shadow:inset 0 0 0 1px var(--pbss-border);color:var(--pbss-text);font:inherit;font-size:16px;line-height:1.5;min-height:48px;min-width:0;padding:10px 56px 10px 14px;width:100%}.pbss-input::-webkit-search-cancel-button{margin-right:4px}.pbss-input::placeholder{color:var(--pbss-placeholder-text);opacity:1}.pbss-input:focus{box-shadow:inset 0 0 0 2px color-mix(in srgb,var(--pbss-action-color) 70%,transparent),0 0 0 3px color-mix(in srgb,var(--pbss-action-color) 14%,transparent);outline:none}.pbss-location-button{align-items:center;background:transparent;border:0;border-radius:max(4px,calc(var(--pbss-radius) - 4px));color:var(--pbss-action-color);cursor:pointer;display:inline-flex;height:40px;justify-content:center;padding:0;position:absolute;right:4px;width:40px}.pbss-location-button [data-slot=icon]{flex:0 0 auto;height:16px;width:16px}.pbss-location-button:hover{background:color-mix(in srgb,var(--pbss-action-color) 8%,transparent)}.pbss-location-button:focus-visible{outline:2px solid var(--pbss-action-color);outline-offset:-2px}.pbss-location-button:disabled{cursor:not-allowed;opacity:.5}.pbss-touch-target{height:max(100%,48px);left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:max(100%,48px)}.pbss-spinner{animation:pbss-spin .7s linear infinite;border:2px solid color-mix(in srgb,var(--pbss-action-color) 22%,transparent);border-radius:999px;border-top-color:var(--pbss-action-color);height:16px;width:16px}.pbss-results-panel{background:var(--pbss-surface);border-radius:var(--pbss-radius);box-shadow:0 16px 36px #1c191729,0 2px 8px #1c191714,0 0 0 1px #1c19170f;display:grid;left:0;margin-top:6px;overflow:hidden;position:absolute;right:0;z-index:20}.pbss-results-status{min-width:0}.pbss-mobile-results-header{display:none}.pbss-results{list-style:none;margin:0;padding:0}.pbss-result{display:grid;gap:8px;padding:14px}.pbss-result+.pbss-result{border-top:1px solid var(--pbss-divider)}.pbss-result-heading{align-items:center;display:flex;gap:8px;justify-content:space-between;min-width:0}.pbss-result-name{font-size:16px;font-weight:600;line-height:1.35;min-width:0}.pbss-result-categories{display:flex;flex:0 1 auto;flex-wrap:wrap;gap:5px;justify-content:flex-end}.pbss-result-category{background:var( --pbss-category-color, color-mix(in srgb, var(--pbss-action-color) 10%, var(--pbss-control-surface)) );border-radius:999px;color:var(--pbss-category-contrast, var(--pbss-action-color));font-size:11px;font-weight:700;line-height:1.2;padding:3px 7px;width:fit-content}.pbss-loading,.pbss-empty,.pbss-error{font-size:16px;line-height:1.45}.pbss-result-address{color:var(--pbss-muted-text);font-size:14px;line-height:1.4}.pbss-result-actions{align-items:center;display:flex;flex-wrap:wrap;gap:8px 14px}.pbss-result-actions a{color:var(--pbss-action-color);font-size:14px;font-weight:600;line-height:1.35;text-decoration:none}.pbss-result-actions a:hover{text-decoration:underline;text-underline-offset:3px}.pbss-result-actions a:focus-visible{outline:2px solid var(--pbss-action-color);outline-offset:2px}.pbss-result-distance{background:color-mix(in srgb,var(--pbss-text) 14%,transparent);border-radius:999px;color:var(--pbss-text);flex:0 0 auto;font-size:12px;font-variant-numeric:tabular-nums;font-weight:600;line-height:1.2;padding:4px 8px}.pbss-loading,.pbss-empty,.pbss-error{padding:16px 14px}.pbss-loading,.pbss-empty{color:var(--pbss-muted-text)}.pbss-error{background:var(--pbss-danger-surface);color:var(--pbss-danger-text)}.pbss-view-all{border-top:1px solid var(--pbss-divider);color:var(--pbss-action-color);font-size:16px;font-weight:600;line-height:1.4;padding:13px 14px;text-align:center;text-decoration:none}.pbss-view-all:hover{background:color-mix(in srgb,var(--pbss-action-color) 6%,var(--pbss-surface));text-decoration:underline;text-underline-offset:3px}.pbss-view-all:focus-visible{outline:2px solid var(--pbss-action-color);outline-offset:-3px}@container (min-width: 480px){.pbss-result-name,.pbss-loading,.pbss-empty,.pbss-error,.pbss-view-all{font-size:14px}.pbss-result-address,.pbss-result-actions a{font-size:12px}}@container (max-width: 479px){.pbss-mobile-results-header{align-items:center;border-bottom:1px solid var(--pbss-divider);display:flex;font-size:14px;font-weight:600;justify-content:space-between;line-height:1.35;min-height:48px;padding:4px 4px 4px 14px}.pbss-results-close{align-items:center;background:transparent;border:0;border-radius:max(4px,calc(var(--pbss-radius) - 4px));color:var(--pbss-action-color);cursor:pointer;display:inline-flex;font:inherit;gap:6px;min-height:40px;padding:8px 10px}.pbss-results-close [data-slot=icon]{height:16px;width:16px}.pbss-results-close:hover{background:color-mix(in srgb,var(--pbss-action-color) 8%,transparent)}.pbss-results-close:focus-visible{outline:2px solid var(--pbss-action-color);outline-offset:-2px}}.pbss-root.is-dark{--pbss-action-color: #f5f3f0;--pbss-surface: #1c1917;--pbss-control-surface: #292524;--pbss-border: rgb(255 255 255 / .16);--pbss-divider: rgb(255 255 255 / .1);--pbss-text: #f5f3f0;--pbss-muted-text: #d6d3d1;--pbss-placeholder-text: #d6d3d1;--pbss-danger-surface: #4c0519;--pbss-danger-text: #fecdd3}.pbss-root.is-dark .pbss-results-panel{box-shadow:0 18px 38px #0000006b,0 0 0 1px #ffffff1a}@media(prefers-reduced-motion:reduce){.pbss-spinner{animation-duration:1.4s}}@keyframes pbss-spin{to{transform:rotate(360deg)}}";
477
- function $e(e, t) {
481
+ const $e = ":host{display:block;position:relative;z-index:11}partbot-stockist-search{display:block}.pbss-root{--pbss-primary: #111111;--pbss-action-color: var(--pbss-primary);--pbss-radius: 8px;--pbss-surface: #ffffff;--pbss-control-surface: #ffffff;--pbss-border: rgb(28 25 23 / .14);--pbss-divider: rgb(28 25 23 / .09);--pbss-text: #1c1917;--pbss-muted-text: #78716c;--pbss-placeholder-text: #57534e;--pbss-danger-surface: #fff1f2;--pbss-danger-text: #9f1239;color:var(--pbss-text);container-type:inline-size;font-family:inherit;isolation:isolate;position:relative;width:100%;-webkit-font-smoothing:antialiased}.pbss-search-control{align-items:center;display:flex;min-width:0;position:relative}.pbss-input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--pbss-control-surface);border:0;border-radius:var(--pbss-radius);box-shadow:inset 0 0 0 1px var(--pbss-border);color:var(--pbss-text);font:inherit;font-size:16px;line-height:1.5;min-height:48px;min-width:0;padding:10px 56px 10px 14px;width:100%}.pbss-input::-webkit-search-cancel-button{margin-right:4px}.pbss-input::placeholder{color:var(--pbss-placeholder-text);opacity:1}.pbss-input:focus{box-shadow:inset 0 0 0 2px color-mix(in srgb,var(--pbss-action-color) 70%,transparent),0 0 0 3px color-mix(in srgb,var(--pbss-action-color) 14%,transparent);outline:none}.pbss-location-button{align-items:center;background:transparent;border:0;border-radius:max(4px,calc(var(--pbss-radius) - 4px));color:var(--pbss-action-color);cursor:pointer;display:inline-flex;height:40px;justify-content:center;padding:0;position:absolute;right:4px;width:40px}.pbss-location-button [data-slot=icon]{flex:0 0 auto;height:16px;width:16px}.pbss-location-button:hover{background:color-mix(in srgb,var(--pbss-action-color) 8%,transparent)}.pbss-location-button:focus-visible{outline:2px solid var(--pbss-action-color);outline-offset:-2px}.pbss-location-button:disabled{cursor:not-allowed;opacity:.5}.pbss-touch-target{height:max(100%,48px);left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:max(100%,48px)}.pbss-spinner{animation:pbss-spin .7s linear infinite;border:2px solid color-mix(in srgb,var(--pbss-action-color) 22%,transparent);border-radius:999px;border-top-color:var(--pbss-action-color);height:16px;width:16px}.pbss-results-panel{background:var(--pbss-surface);border-radius:var(--pbss-radius);box-shadow:0 16px 36px #1c191729,0 2px 8px #1c191714,0 0 0 1px #1c19170f;display:grid;left:0;margin-top:6px;overflow:hidden;position:absolute;right:0;z-index:20}.pbss-results-status{min-width:0}.pbss-mobile-results-header{display:none}.pbss-results{list-style:none;margin:0;padding:0}.pbss-result{display:grid;gap:8px;padding:14px}.pbss-result+.pbss-result{border-top:1px solid var(--pbss-divider)}.pbss-result-heading{align-items:center;display:flex;gap:8px;justify-content:space-between;min-width:0}.pbss-result-name{font-size:16px;font-weight:600;line-height:1.35;min-width:0}.pbss-result-categories{display:flex;flex:0 1 auto;flex-wrap:wrap;gap:5px;justify-content:flex-end}.pbss-result-category{background:var( --pbss-category-color, color-mix(in srgb, var(--pbss-action-color) 10%, var(--pbss-control-surface)) );border-radius:999px;color:var(--pbss-category-contrast, var(--pbss-action-color));font-size:11px;font-weight:700;line-height:1.2;padding:3px 7px;width:fit-content}.pbss-loading,.pbss-empty,.pbss-error{font-size:16px;line-height:1.45}.pbss-result-address{color:var(--pbss-muted-text);font-size:14px;line-height:1.4}.pbss-result-actions{align-items:center;display:flex;flex-wrap:wrap;gap:8px 14px}.pbss-result-actions a{color:var(--pbss-action-color);font-size:14px;font-weight:600;line-height:1.35;text-decoration:none}.pbss-result-actions a:hover{text-decoration:underline;text-underline-offset:3px}.pbss-result-actions a:focus-visible{outline:2px solid var(--pbss-action-color);outline-offset:2px}.pbss-result-distance{background:color-mix(in srgb,var(--pbss-text) 14%,transparent);border-radius:999px;color:var(--pbss-text);flex:0 0 auto;font-size:12px;font-variant-numeric:tabular-nums;font-weight:600;line-height:1.2;padding:4px 8px}.pbss-loading,.pbss-empty,.pbss-error{padding:16px 14px}.pbss-loading,.pbss-empty{color:var(--pbss-muted-text)}.pbss-error{background:var(--pbss-danger-surface);color:var(--pbss-danger-text)}.pbss-view-all{border-top:1px solid var(--pbss-divider);color:var(--pbss-action-color);font-size:16px;font-weight:600;line-height:1.4;padding:13px 14px;text-align:center;text-decoration:none}.pbss-view-all:hover{background:color-mix(in srgb,var(--pbss-action-color) 6%,var(--pbss-surface));text-decoration:underline;text-underline-offset:3px}.pbss-view-all:focus-visible{outline:2px solid var(--pbss-action-color);outline-offset:-3px}@container (min-width: 480px){.pbss-result-name,.pbss-loading,.pbss-empty,.pbss-error,.pbss-view-all{font-size:14px}.pbss-result-address,.pbss-result-actions a{font-size:12px}}@container (max-width: 479px){.pbss-mobile-results-header{align-items:center;border-bottom:1px solid var(--pbss-divider);display:flex;font-size:14px;font-weight:600;justify-content:space-between;line-height:1.35;min-height:48px;padding:4px 4px 4px 14px}.pbss-results-close{align-items:center;background:transparent;border:0;border-radius:max(4px,calc(var(--pbss-radius) - 4px));color:var(--pbss-action-color);cursor:pointer;display:inline-flex;font:inherit;gap:6px;min-height:40px;padding:8px 10px}.pbss-results-close [data-slot=icon]{height:16px;width:16px}.pbss-results-close:hover{background:color-mix(in srgb,var(--pbss-action-color) 8%,transparent)}.pbss-results-close:focus-visible{outline:2px solid var(--pbss-action-color);outline-offset:-2px}}.pbss-root.is-dark{--pbss-action-color: #f5f3f0;--pbss-surface: #1c1917;--pbss-control-surface: #292524;--pbss-border: rgb(255 255 255 / .16);--pbss-divider: rgb(255 255 255 / .1);--pbss-text: #f5f3f0;--pbss-muted-text: #d6d3d1;--pbss-placeholder-text: #d6d3d1;--pbss-danger-surface: #4c0519;--pbss-danger-text: #fecdd3}.pbss-root.is-dark .pbss-results-panel{box-shadow:0 18px 38px #0000006b,0 0 0 1px #ffffff1a}@media(prefers-reduced-motion:reduce){.pbss-spinner{animation-duration:1.4s}}@keyframes pbss-spin{to{transform:rotate(360deg)}}";
482
+ function De(e, t) {
478
483
  const r = J(e);
479
- return r.render(/* @__PURE__ */ i(ae, { ...t })), r;
484
+ return r.render(/* @__PURE__ */ i(oe, { ...t })), r;
480
485
  }
481
486
  const Y = "data-partbot-stockist-search-styles", Q = "data-partbot-stockist-search-root";
482
487
  function Ze(e) {
@@ -485,7 +490,7 @@ function Ze(e) {
485
490
  function Fe(e) {
486
491
  if (e.querySelector(`style[${Y}]`)) return;
487
492
  const t = document.createElement("style");
488
- t.setAttribute(Y, ""), t.textContent = Pe, e.prepend(t);
493
+ t.setAttribute(Y, ""), t.textContent = $e, e.prepend(t);
489
494
  }
490
495
  function Oe(e) {
491
496
  const t = e.querySelector(
@@ -495,13 +500,13 @@ function Oe(e) {
495
500
  const r = document.createElement("div");
496
501
  return r.setAttribute(Q, ""), e.appendChild(r), r;
497
502
  }
498
- const De = typeof HTMLElement > "u" ? class {
503
+ const Be = typeof HTMLElement > "u" ? class {
499
504
  } : HTMLElement;
500
- class oe extends De {
505
+ class ae extends Be {
501
506
  constructor() {
502
507
  super(...arguments);
503
- H(this, "root");
504
- H(this, "mountElement");
508
+ P(this, "root");
509
+ P(this, "mountElement");
505
510
  }
506
511
  connectedCallback() {
507
512
  this.renderStockistSearch();
@@ -515,7 +520,7 @@ class oe extends De {
515
520
  }
516
521
  renderStockistSearch() {
517
522
  const r = Ze(this);
518
- Fe(r), this.mountElement || (this.mountElement = Oe(r)), this.root || (this.root = J(this.mountElement)), this.root.render(/* @__PURE__ */ i(ae, { ...this.stockistSearchProps() }));
523
+ Fe(r), this.mountElement || (this.mountElement = Oe(r)), this.root || (this.root = J(this.mountElement)), this.root.render(/* @__PURE__ */ i(oe, { ...this.stockistSearchProps() }));
519
524
  }
520
525
  stockistSearchProps() {
521
526
  return {
@@ -526,17 +531,17 @@ class oe extends De {
526
531
  };
527
532
  }
528
533
  }
529
- H(oe, "observedAttributes", ["token", "config-url", "initial-query", "view-all-url"]);
534
+ P(ae, "observedAttributes", ["token", "config-url", "initial-query", "view-all-url"]);
530
535
  function X() {
531
- typeof window > "u" || !window.customElements || window.customElements.get("partbot-stockist-search") || window.customElements.define("partbot-stockist-search", oe);
536
+ typeof window > "u" || !window.customElements || window.customElements.get("partbot-stockist-search") || window.customElements.define("partbot-stockist-search", ae);
532
537
  }
533
538
  typeof window < "u" && (X(), window.PartbotStockistSearch = {
534
539
  defineCustomElement: X,
535
- mount: $e
540
+ mount: De
536
541
  });
537
542
  export {
538
- oe as PartbotStockistSearchElement,
539
- ae as StockistSearch,
543
+ ae as PartbotStockistSearchElement,
544
+ oe as StockistSearch,
540
545
  X as defineStockistSearchElement,
541
- $e as mountStockistSearch
546
+ De as mountStockistSearch
542
547
  };