@partbot/stockist-map 0.1.6 → 0.1.8

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,87 +1,87 @@
1
- var ae = Object.defineProperty;
2
- var ie = (e, t, r) => t in e ? ae(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var O = (e, t, r) => ie(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { jsxs as y, jsx as c } from "react/jsx-runtime";
5
- import { createRoot as Y } from "react-dom/client";
6
- import * as s from "react";
7
- import { createContext as le } from "react";
8
- const ce = le({
1
+ var ce = Object.defineProperty;
2
+ var ue = (e, t, s) => t in e ? ce(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
+ var P = (e, t, s) => ue(e, typeof t != "symbol" ? t + "" : t, s);
4
+ import { jsxs as g, jsx as l } from "react/jsx-runtime";
5
+ import { createRoot as J } from "react-dom/client";
6
+ import * as n from "react";
7
+ import { createContext as de } from "react";
8
+ const pe = de({
9
9
  color: "currentColor",
10
10
  size: "1em",
11
11
  weight: "regular",
12
12
  mirrored: !1
13
- }), Q = s.forwardRef(
13
+ }), X = n.forwardRef(
14
14
  (e, t) => {
15
15
  const {
16
- alt: r,
17
- color: n,
16
+ alt: s,
17
+ color: r,
18
18
  size: i,
19
- weight: M,
20
- mirrored: z,
21
- children: l,
22
- weights: R,
23
- ...w
24
- } = e, {
25
- color: S = "currentColor",
26
- size: A,
27
- weight: m = "regular",
28
- mirrored: N = !1,
19
+ weight: d,
20
+ mirrored: O,
21
+ children: c,
22
+ weights: N,
29
23
  ...v
30
- } = s.useContext(ce);
31
- return /* @__PURE__ */ s.createElement(
24
+ } = e, {
25
+ color: A = "currentColor",
26
+ size: C,
27
+ weight: x = "regular",
28
+ mirrored: R = !1,
29
+ ...k
30
+ } = n.useContext(pe);
31
+ return /* @__PURE__ */ n.createElement(
32
32
  "svg",
33
33
  {
34
34
  ref: t,
35
35
  xmlns: "http://www.w3.org/2000/svg",
36
- width: i ?? A,
37
- height: i ?? A,
38
- fill: n ?? S,
36
+ width: i ?? C,
37
+ height: i ?? C,
38
+ fill: r ?? A,
39
39
  viewBox: "0 0 256 256",
40
- transform: z || N ? "scale(-1, 1)" : void 0,
41
- ...v,
42
- ...w
40
+ transform: O || R ? "scale(-1, 1)" : void 0,
41
+ ...k,
42
+ ...v
43
43
  },
44
- !!r && /* @__PURE__ */ s.createElement("title", null, r),
45
- l,
46
- R.get(M ?? m)
44
+ !!s && /* @__PURE__ */ n.createElement("title", null, s),
45
+ c,
46
+ N.get(d ?? x)
47
47
  );
48
48
  }
49
49
  );
50
- Q.displayName = "IconBase";
51
- const ue = /* @__PURE__ */ new Map([
50
+ X.displayName = "IconBase";
51
+ const be = /* @__PURE__ */ new Map([
52
52
  [
53
53
  "bold",
54
- /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("path", { d: "M238.7,102.46,62.81,37.21l-.25-.09A20,20,0,0,0,37.12,62.56l.09.25L102.46,238.7A20,20,0,0,0,121.3,252h.35a20,20,0,0,0,18.77-14.12l.09-.29,21.23-75.85,75.85-21.23.29-.09a20,20,0,0,0,.82-38Zm-89.93,38a12,12,0,0,0-8.32,8.32l-19.68,70.29L62.8,62.8l156.26,58Z" }))
54
+ /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement("path", { d: "M238.7,102.46,62.81,37.21l-.25-.09A20,20,0,0,0,37.12,62.56l.09.25L102.46,238.7A20,20,0,0,0,121.3,252h.35a20,20,0,0,0,18.77-14.12l.09-.29,21.23-75.85,75.85-21.23.29-.09a20,20,0,0,0,.82-38Zm-89.93,38a12,12,0,0,0-8.32,8.32l-19.68,70.29L62.8,62.8l156.26,58Z" }))
55
55
  ],
56
56
  [
57
57
  "duotone",
58
- /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement(
58
+ /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
59
59
  "path",
60
60
  {
61
61
  d: "M234.35,129,152,152,129,234.35a8,8,0,0,1-15.21.27l-65.28-176A8,8,0,0,1,58.63,48.46l176,65.28A8,8,0,0,1,234.35,129Z",
62
62
  opacity: "0.2"
63
63
  }
64
- ), /* @__PURE__ */ s.createElement("path", { d: "M237.33,106.21,61.41,41l-.16-.05A16,16,0,0,0,40.9,61.25a1,1,0,0,0,.05.16l65.26,175.92A15.77,15.77,0,0,0,121.28,248h.3a15.77,15.77,0,0,0,15-11.29l.06-.2,21.84-78,78-21.84.2-.06a16,16,0,0,0,.62-30.38ZM149.84,144.3a8,8,0,0,0-5.54,5.54L121.3,232l-.06-.17L56,56l175.82,65.22.16.06Z" }))
64
+ ), /* @__PURE__ */ n.createElement("path", { d: "M237.33,106.21,61.41,41l-.16-.05A16,16,0,0,0,40.9,61.25a1,1,0,0,0,.05.16l65.26,175.92A15.77,15.77,0,0,0,121.28,248h.3a15.77,15.77,0,0,0,15-11.29l.06-.2,21.84-78,78-21.84.2-.06a16,16,0,0,0,.62-30.38ZM149.84,144.3a8,8,0,0,0-5.54,5.54L121.3,232l-.06-.17L56,56l175.82,65.22.16.06Z" }))
65
65
  ],
66
66
  [
67
67
  "fill",
68
- /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("path", { d: "M248,121.58a15.76,15.76,0,0,1-11.29,15l-.2.06-78,21.84-21.84,78-.06.2a15.77,15.77,0,0,1-15,11.29h-.3a15.77,15.77,0,0,1-15.07-10.67L41,61.41a1,1,0,0,1-.05-.16A16,16,0,0,1,61.25,40.9l.16.05,175.92,65.26A15.78,15.78,0,0,1,248,121.58Z" }))
68
+ /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement("path", { d: "M248,121.58a15.76,15.76,0,0,1-11.29,15l-.2.06-78,21.84-21.84,78-.06.2a15.77,15.77,0,0,1-15,11.29h-.3a15.77,15.77,0,0,1-15.07-10.67L41,61.41a1,1,0,0,1-.05-.16A16,16,0,0,1,61.25,40.9l.16.05,175.92,65.26A15.78,15.78,0,0,1,248,121.58Z" }))
69
69
  ],
70
70
  [
71
71
  "light",
72
- /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("path", { d: "M236.65,108.1,60.72,42.83l-.13,0A14,14,0,0,0,42.78,60.59s0,.09,0,.13L108.1,236.65A13.77,13.77,0,0,0,121.28,246h.26a13.8,13.8,0,0,0,13.14-9.88l0-.15,22.14-79.1L236,134.73l.15,0a14,14,0,0,0,.53-26.58Zm-4,15.1-82.26,23a6,6,0,0,0-4.16,4.16l-23,82.26a1.85,1.85,0,0,1-1.86,1.36,1.82,1.82,0,0,1-1.92-1.35.61.61,0,0,0,0-.12L54.11,56.62a2,2,0,0,1,2.51-2.51l175.91,65.26.12,0a2,2,0,0,1,0,3.79Z" }))
72
+ /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement("path", { d: "M236.65,108.1,60.72,42.83l-.13,0A14,14,0,0,0,42.78,60.59s0,.09,0,.13L108.1,236.65A13.77,13.77,0,0,0,121.28,246h.26a13.8,13.8,0,0,0,13.14-9.88l0-.15,22.14-79.1L236,134.73l.15,0a14,14,0,0,0,.53-26.58Zm-4,15.1-82.26,23a6,6,0,0,0-4.16,4.16l-23,82.26a1.85,1.85,0,0,1-1.86,1.36,1.82,1.82,0,0,1-1.92-1.35.61.61,0,0,0,0-.12L54.11,56.62a2,2,0,0,1,2.51-2.51l175.91,65.26.12,0a2,2,0,0,1,0,3.79Z" }))
73
73
  ],
74
74
  [
75
75
  "regular",
76
- /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("path", { d: "M237.33,106.21,61.41,41l-.16-.05A16,16,0,0,0,40.9,61.25a1,1,0,0,0,.05.16l65.26,175.92A15.77,15.77,0,0,0,121.28,248h.3a15.77,15.77,0,0,0,15-11.29l.06-.2,21.84-78,78-21.84.2-.06a16,16,0,0,0,.62-30.38ZM149.84,144.3a8,8,0,0,0-5.54,5.54L121.3,232l-.06-.17L56,56l175.82,65.22.16.06Z" }))
76
+ /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement("path", { d: "M237.33,106.21,61.41,41l-.16-.05A16,16,0,0,0,40.9,61.25a1,1,0,0,0,.05.16l65.26,175.92A15.77,15.77,0,0,0,121.28,248h.3a15.77,15.77,0,0,0,15-11.29l.06-.2,21.84-78,78-21.84.2-.06a16,16,0,0,0,.62-30.38ZM149.84,144.3a8,8,0,0,0-5.54,5.54L121.3,232l-.06-.17L56,56l175.82,65.22.16.06Z" }))
77
77
  ],
78
78
  [
79
79
  "thin",
80
- /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("path", { d: "M236,110,59.93,44.67A12,12,0,0,0,44.69,60L110,235.93A11.83,11.83,0,0,0,121.28,244h.22a11.82,11.82,0,0,0,11.26-8.47l0-.1,22.45-80.19,80.19-22.44.1,0A12,12,0,0,0,236,110Zm-2.79,15.12-82.3,23a4,4,0,0,0-2.78,2.77l-23,82.3a3.88,3.88,0,0,1-3.74,2.78,4,4,0,0,1-3.88-2.77L52.22,57.32a3.93,3.93,0,0,1,1-4.14A4,4,0,0,1,56,52a3.86,3.86,0,0,1,1.25.21l176.08,65.32a4,4,0,0,1-.09,7.59Z" }))
80
+ /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement("path", { d: "M236,110,59.93,44.67A12,12,0,0,0,44.69,60L110,235.93A11.83,11.83,0,0,0,121.28,244h.22a11.82,11.82,0,0,0,11.26-8.47l0-.1,22.45-80.19,80.19-22.44.1,0A12,12,0,0,0,236,110Zm-2.79,15.12-82.3,23a4,4,0,0,0-2.78,2.77l-23,82.3a3.88,3.88,0,0,1-3.74,2.78,4,4,0,0,1-3.88-2.77L52.22,57.32a3.93,3.93,0,0,1,1-4.14A4,4,0,0,1,56,52a3.86,3.86,0,0,1,1.25.21l176.08,65.32a4,4,0,0,1-.09,7.59Z" }))
81
81
  ]
82
- ]), W = s.forwardRef((e, t) => /* @__PURE__ */ s.createElement(Q, { ref: t, ...e, weights: ue }));
83
- W.displayName = "NavigationArrowIcon";
84
- const de = "https://tile.openstreetmap.org/{z}/{x}/{y}.png", J = "https://basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}@2x.png", X = "OpenStreetMap contributors, CARTO", ee = "https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json", q = {
82
+ ]), ee = n.forwardRef((e, t) => /* @__PURE__ */ n.createElement(X, { ref: t, ...e, weights: be }));
83
+ ee.displayName = "NavigationArrowIcon";
84
+ const fe = "https://tile.openstreetmap.org/{z}/{x}/{y}.png", te = "https://basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}@2x.png", se = "OpenStreetMap contributors, CARTO", re = "https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json", q = {
85
85
  primaryColor: "#111111",
86
86
  markerColor: "#111111",
87
87
  borderRadius: 8,
@@ -89,12 +89,35 @@ const de = "https://tile.openstreetmap.org/{z}/{x}/{y}.png", J = "https://basema
89
89
  defaultZoom: 5,
90
90
  defaultCenter: { lat: -25.2744, lng: 133.7751 },
91
91
  darkMode: !1,
92
- styleUrl: ee,
92
+ styleUrl: re,
93
93
  mapPalette: "monotone",
94
- tileUrl: J,
95
- tileAttribution: X
94
+ tileUrl: te,
95
+ tileAttribution: se
96
96
  };
97
- function pe(e = {}) {
97
+ function F(e) {
98
+ const t = e.trim().replace(/^#/, ""), s = t.length === 3 ? t.split("").map((r) => `${r}${r}`).join("") : t;
99
+ return /^[0-9a-f]{6}$/i.test(s) ? {
100
+ r: Number.parseInt(s.slice(0, 2), 16),
101
+ g: Number.parseInt(s.slice(2, 4), 16),
102
+ b: Number.parseInt(s.slice(4, 6), 16)
103
+ } : null;
104
+ }
105
+ function $({ r: e, g: t, b: s }) {
106
+ const r = [e, t, s].map((i) => {
107
+ const d = i / 255;
108
+ return d <= 0.03928 ? d / 12.92 : ((d + 0.055) / 1.055) ** 2.4;
109
+ });
110
+ return 0.2126 * r[0] + 0.7152 * r[1] + 0.0722 * r[2];
111
+ }
112
+ function j(e, t) {
113
+ const s = Math.max($(e), $(t)), r = Math.min($(e), $(t));
114
+ return (s + 0.05) / (r + 0.05);
115
+ }
116
+ function he(e, t = "#111111", s = "#ffffff") {
117
+ const r = F(e), i = F(t), d = F(s);
118
+ return !r || !i || !d ? s : j(r, i) >= j(r, d) ? t : s;
119
+ }
120
+ function me(e = {}) {
98
121
  return {
99
122
  ...q,
100
123
  ...e,
@@ -102,192 +125,217 @@ function pe(e = {}) {
102
125
  ...q.defaultCenter,
103
126
  ...e.defaultCenter || {}
104
127
  },
105
- styleUrl: e.styleUrl || ee,
128
+ styleUrl: e.styleUrl || re,
106
129
  mapPalette: e.mapPalette || "monotone",
107
130
  borderRadius: Number.isFinite(Number(e.borderRadius)) ? Number(e.borderRadius) : q.borderRadius,
108
- tileUrl: !e.tileUrl || e.tileUrl === de ? J : e.tileUrl,
109
- tileAttribution: e.tileAttribution || X,
131
+ tileUrl: !e.tileUrl || e.tileUrl === fe ? te : e.tileUrl,
132
+ tileAttribution: e.tileAttribution || se,
110
133
  radiusUnit: "km"
111
134
  };
112
135
  }
113
- function be(e, t) {
136
+ function ge(e, t) {
114
137
  return `/v1/stockist_maps/${encodeURIComponent(e)}/config`;
115
138
  }
116
- function fe(e, t = {}) {
117
- const r = typeof window > "u" ? "http://localhost" : window.location.href, n = new URL(e, r);
118
- return t.query && n.searchParams.set("q", t.query), t.limit && n.searchParams.set("limit", String(t.limit)), t.center && (n.searchParams.set("lat", String(t.center.lat)), n.searchParams.set("lng", String(t.center.lng))), t.radiusKm && n.searchParams.set("radius_km", String(t.radiusKm)), t.category && n.searchParams.set("category", t.category), t.locationSearch && n.searchParams.set("location_search", "true"), n.toString();
139
+ function xe(e, t = {}) {
140
+ const s = typeof window > "u" ? "http://localhost" : window.location.href, r = new URL(e, s);
141
+ return t.query && r.searchParams.set("q", t.query), t.limit && r.searchParams.set("limit", String(t.limit)), t.center && (r.searchParams.set("lat", String(t.center.lat)), r.searchParams.set("lng", String(t.center.lng))), t.radiusKm && r.searchParams.set("radius_km", String(t.radiusKm)), t.category && r.searchParams.set("category", t.category), t.locationSearch && r.searchParams.set("location_search", "true"), r.toString();
119
142
  }
120
- async function he(e) {
143
+ async function ye(e) {
121
144
  const t = await fetch(e, { headers: { Accept: "application/json" } });
122
145
  if (!t.ok) throw new Error(`Could not load stockist map config (${t.status})`);
123
146
  return t.json();
124
147
  }
125
- async function me(e, t = {}) {
126
- const r = await fetch(fe(e, t), { headers: { Accept: "application/json" } });
127
- if (!r.ok) throw new Error(`Could not search stockists (${r.status})`);
128
- const n = await r.json();
148
+ async function we(e, t = {}) {
149
+ const s = await fetch(xe(e, t), { headers: { Accept: "application/json" } });
150
+ if (!s.ok) throw new Error(`Could not search stockists (${s.status})`);
151
+ const r = await s.json();
129
152
  return {
130
- hits: Array.isArray(n.hits) ? n.hits : [],
131
- estimatedTotalHits: Number(n.estimatedTotalHits || 0),
132
- center: n.center || null,
133
- resolvedQuery: n.resolvedQuery || null
153
+ hits: Array.isArray(r.hits) ? r.hits : [],
154
+ estimatedTotalHits: Number(r.estimatedTotalHits || 0),
155
+ center: r.center || null,
156
+ resolvedQuery: r.resolvedQuery || null
134
157
  };
135
158
  }
136
- const ge = 6371;
159
+ const ve = 6371;
137
160
  function H(e) {
138
161
  return e * Math.PI / 180;
139
162
  }
140
- function xe(e, t) {
141
- const r = H(t.lat - e.lat), n = H(t.lng - e.lng), i = Math.sin(r / 2) ** 2 + Math.cos(H(e.lat)) * Math.cos(H(t.lat)) * Math.sin(n / 2) ** 2;
142
- return 2 * ge * Math.atan2(Math.sqrt(i), Math.sqrt(1 - i));
163
+ function ke(e, t) {
164
+ const s = H(t.lat - e.lat), r = H(t.lng - e.lng), i = Math.sin(s / 2) ** 2 + Math.cos(H(e.lat)) * Math.cos(H(t.lat)) * Math.sin(r / 2) ** 2;
165
+ return 2 * ve * Math.atan2(Math.sqrt(i), Math.sqrt(1 - i));
143
166
  }
144
- function ye(e) {
167
+ function Ee(e) {
145
168
  return `${e.toFixed(1)} km`;
146
169
  }
147
- function we(e) {
170
+ function Se(e) {
148
171
  const t = ["localhost", "127.0.0.1", "::1"].includes(window.location.hostname);
149
172
  return window.location.protocol !== "https:" && !t ? "Browser location is blocked on this local Partbot domain. Chrome and Brave only allow location access on HTTPS, localhost, or origins manually trusted in browser flags." : e.code === e.PERMISSION_DENIED ? "Location permission is blocked for this site. Allow location access in your browser settings, then try again." : e.code === e.POSITION_UNAVAILABLE ? "Your browser could not determine your location. Try again, or search by suburb or postcode." : e.code === e.TIMEOUT ? "Finding your location timed out. Try again, or search by suburb or postcode." : `Browser location failed with error code ${e.code}. Try again, or search by suburb or postcode.`;
150
173
  }
151
- function ve(e) {
174
+ function Ae(e) {
175
+ const t = e == null ? void 0 : e.trim();
176
+ if (!t || t.startsWith("/") && !t.startsWith("//")) return null;
177
+ const s = t.startsWith("//") ? `https:${t}` : /^[a-z][a-z\d+.-]*:/i.test(t) ? t : `https://${t}`;
178
+ try {
179
+ const r = new URL(s);
180
+ return r.protocol === "http:" || r.protocol === "https:" ? r.toString() : null;
181
+ } catch {
182
+ return null;
183
+ }
184
+ }
185
+ function Ce(e) {
186
+ return `https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(`${e.lat},${e.lng}`)}`;
187
+ }
188
+ function Te(e) {
152
189
  return e.stockist_id ?? e.id;
153
190
  }
154
- function ke(e) {
191
+ function Me(e) {
155
192
  const t = /* @__PURE__ */ new Set();
156
- return e.filter((r) => {
157
- const n = ve(r);
158
- return t.has(n) ? !1 : (t.add(n), !0);
193
+ return e.filter((s) => {
194
+ const r = Te(s);
195
+ return t.has(r) ? !1 : (t.add(r), !0);
159
196
  });
160
197
  }
161
- const Ee = 3, Se = 100, Z = 50, Ae = 350;
162
- function $(e) {
198
+ const Ne = 3, Re = 100, W = 50, Ie = 350;
199
+ function G(e) {
163
200
  return e.display_address || e.address;
164
201
  }
165
- function Te(e, t) {
166
- const r = t ? e.map((n) => ({ ...n, distanceKm: xe(t, n._geo) })).sort((n, i) => (n.distanceKm || 0) - (i.distanceKm || 0)) : e;
167
- return ke(r).slice(0, Ee);
202
+ function Le(e) {
203
+ var t;
204
+ return (t = e.categories) != null && t.length ? e.categories : e.category ? [e.category] : [];
168
205
  }
169
- function te({
206
+ function _e(e, t) {
207
+ const s = t == null ? void 0 : t[e];
208
+ return s ? {
209
+ "--pbss-category-color": s,
210
+ "--pbss-category-contrast": he(s)
211
+ } : void 0;
212
+ }
213
+ function Ue(e, t) {
214
+ const s = t ? e.map((r) => ({ ...r, distanceKm: ke(t, r._geo) })).sort((r, i) => (r.distanceKm || 0) - (i.distanceKm || 0)) : e;
215
+ return Me(s).slice(0, Ne);
216
+ }
217
+ function ne({
170
218
  token: e,
171
219
  configUrl: t,
172
- config: r,
173
- theme: n,
220
+ config: s,
221
+ theme: r,
174
222
  initialQuery: i = "",
175
- viewAllUrl: M = "/pages/stockists",
176
- className: z = ""
223
+ viewAllUrl: d = "/pages/stockists",
224
+ className: O = ""
177
225
  }) {
178
- const [l, R] = s.useState(r || null), [w, S] = s.useState(i), [A, m] = s.useState(
226
+ const [c, N] = n.useState(s || null), [v, A] = n.useState(i), [C, x] = n.useState(
179
227
  i.trim() ? "typed" : null
180
- ), [N, v] = s.useState([]), [L, I] = s.useState(!1), [k, E] = s.useState(!1), [re, d] = s.useState(!1), [F, g] = s.useState(!1), [_, b] = s.useState(null), T = s.useRef(null), f = s.useRef(0), x = s.useRef(0), C = s.useRef(null), K = s.useId(), D = s.useMemo(
181
- () => pe({ ...(l == null ? void 0 : l.theme) || {}, ...n || {} }),
182
- [l == null ? void 0 : l.theme, n]
183
- ), p = s.useCallback(() => {
184
- C.current && (clearTimeout(C.current), C.current = null);
185
- }, []), U = s.useCallback(() => {
186
- f.current += 1, p(), v([]), I(!1), g(!1), b(null), d(!1);
187
- }, [p]), P = s.useCallback(
228
+ ), [R, k] = n.useState([]), [I, L] = n.useState(!1), [E, S] = n.useState(!1), [ae, p] = n.useState(!1), [K, y] = n.useState(!1), [_, f] = n.useState(null), T = n.useRef(null), h = n.useRef(0), w = n.useRef(0), M = n.useRef(null), Z = n.useId(), D = n.useMemo(
229
+ () => me({ ...(c == null ? void 0 : c.theme) || {}, ...r || {} }),
230
+ [c == null ? void 0 : c.theme, r]
231
+ ), b = n.useCallback(() => {
232
+ M.current && (clearTimeout(M.current), M.current = null);
233
+ }, []), U = n.useCallback(() => {
234
+ h.current += 1, b(), k([]), L(!1), y(!1), f(null), p(!1);
235
+ }, [b]), z = n.useCallback(
188
236
  async ({ activeQuery: o, center: a }) => {
189
- if (!l) return;
190
- const u = f.current + 1;
191
- f.current = u, p(), I(!0), g(!0), b(null), d(!0);
237
+ if (!c) return;
238
+ const u = h.current + 1;
239
+ h.current = u, b(), L(!0), y(!0), f(null), p(!0);
192
240
  try {
193
- const h = await me(l.search.url, {
241
+ const m = await we(c.search.url, {
194
242
  query: o,
195
243
  center: a,
196
- radiusKm: Z,
197
- limit: Se,
244
+ radiusKm: W,
245
+ limit: Re,
198
246
  locationSearch: !a && !!o
199
247
  });
200
- if (u !== f.current) return;
201
- v(Te(h.hits, h.center || a));
202
- } catch (h) {
203
- if (u !== f.current) return;
204
- v([]), b(h instanceof Error ? h.message : "Could not search stockists");
248
+ if (u !== h.current) return;
249
+ k(Ue(m.hits, m.center || a));
250
+ } catch (m) {
251
+ if (u !== h.current) return;
252
+ k([]), f(m instanceof Error ? m.message : "Could not search stockists");
205
253
  } finally {
206
- u === f.current && I(!1);
254
+ u === h.current && L(!1);
207
255
  }
208
256
  },
209
- [p, l]
257
+ [b, c]
210
258
  );
211
- s.useEffect(() => {
212
- if (x.current += 1, f.current += 1, p(), R(r || null), S(i), m(i.trim() ? "typed" : null), v([]), I(!1), E(!1), g(!1), d(!1), b(null), r) return;
213
- const o = t || (e ? be(e) : null);
259
+ n.useEffect(() => {
260
+ if (w.current += 1, h.current += 1, b(), N(s || null), A(i), x(i.trim() ? "typed" : null), k([]), L(!1), S(!1), y(!1), p(!1), f(null), s) return;
261
+ const o = t || (e ? ge(e) : null);
214
262
  if (!o) return;
215
263
  let a = !1;
216
- return he(o).then((u) => {
217
- a || R(u);
264
+ return ye(o).then((u) => {
265
+ a || N(u);
218
266
  }).catch((u) => {
219
- a || (b(u instanceof Error ? u.message : "Could not load stockist search"), g(!0), d(!0));
267
+ a || (f(u instanceof Error ? u.message : "Could not load stockist search"), y(!0), p(!0));
220
268
  }), () => {
221
269
  a = !0;
222
270
  };
223
- }, [p, t, i, r, e]), s.useEffect(() => {
224
- if (!l || A !== "typed") return;
225
- const o = w.trim();
271
+ }, [b, t, i, s, e]), n.useEffect(() => {
272
+ if (!c || C !== "typed") return;
273
+ const o = v.trim();
226
274
  if (!o) {
227
275
  U();
228
276
  return;
229
277
  }
230
- return p(), C.current = setTimeout(() => {
231
- C.current = null, P({ activeQuery: o, center: null });
232
- }, Ae), p;
233
- }, [p, l, w, U, P, A]), s.useEffect(() => {
278
+ return b(), M.current = setTimeout(() => {
279
+ M.current = null, z({ activeQuery: o, center: null });
280
+ }, Ie), b;
281
+ }, [b, c, v, U, z, C]), n.useEffect(() => {
234
282
  const o = (a) => {
235
- const u = typeof a.composedPath == "function" ? a.composedPath() : [], h = a.target instanceof Node ? a.target : null;
236
- T.current && u.includes(T.current) || T.current && h && T.current.contains(h) || d(!1);
283
+ const u = typeof a.composedPath == "function" ? a.composedPath() : [], m = a.target instanceof Node ? a.target : null;
284
+ T.current && u.includes(T.current) || T.current && m && T.current.contains(m) || p(!1);
237
285
  };
238
286
  return document.addEventListener("pointerdown", o), () => document.removeEventListener("pointerdown", o);
239
- }, []), s.useEffect(
287
+ }, []), n.useEffect(
240
288
  () => () => {
241
- x.current += 1, f.current += 1, p();
289
+ w.current += 1, h.current += 1, b();
242
290
  },
243
- [p]
291
+ [b]
244
292
  );
245
- const oe = () => {
246
- if (x.current += 1, U(), m(null), E(!1), typeof window < "u" && window.isSecureContext === !1) {
247
- b("Browser location is blocked on this site. Search by suburb or postcode instead."), g(!0), d(!0);
293
+ const ie = () => {
294
+ if (w.current += 1, U(), x(null), S(!1), typeof window < "u" && window.isSecureContext === !1) {
295
+ f("Browser location is blocked on this site. Search by suburb or postcode instead."), y(!0), p(!0);
248
296
  return;
249
297
  }
250
298
  if (!navigator.geolocation) {
251
- b(
299
+ f(
252
300
  "This browser does not support location search. Search by suburb or postcode instead."
253
- ), g(!0), d(!0);
301
+ ), y(!0), p(!0);
254
302
  return;
255
303
  }
256
- m("location"), E(!0), b(null), d(!0);
257
- const o = x.current;
304
+ x("location"), S(!0), f(null), p(!0);
305
+ const o = w.current;
258
306
  navigator.geolocation.getCurrentPosition(
259
307
  (a) => {
260
- if (o !== x.current) return;
308
+ if (o !== w.current) return;
261
309
  const u = { lat: a.coords.latitude, lng: a.coords.longitude };
262
- S(""), E(!1), P({ activeQuery: "", center: u });
310
+ A(""), S(!1), z({ activeQuery: "", center: u });
263
311
  },
264
312
  (a) => {
265
- o === x.current && (E(!1), g(!0), b(we(a)), d(!0));
313
+ o === w.current && (S(!1), y(!0), f(Se(a)), p(!0));
266
314
  },
267
315
  { enableHighAccuracy: !1, timeout: 8e3 }
268
316
  );
269
- }, ne = () => {
270
- const o = w.trim();
271
- o && (m("typed"), P({ activeQuery: o, center: null }));
272
- }, B = re && (L || k || F || !!_);
273
- return /* @__PURE__ */ y(
317
+ }, le = () => {
318
+ const o = v.trim();
319
+ o && (x("typed"), z({ activeQuery: o, center: null }));
320
+ }, B = ae && (I || E || K || !!_);
321
+ return /* @__PURE__ */ g(
274
322
  "div",
275
323
  {
276
324
  ref: T,
277
- className: `pbss-root ${D.darkMode ? "is-dark" : ""} ${z}`.trim(),
325
+ className: `pbss-root ${D.darkMode ? "is-dark" : ""} ${O}`.trim(),
278
326
  style: {
279
327
  "--pbss-primary": D.primaryColor,
280
328
  "--pbss-radius": `${Math.max(0, D.borderRadius)}px`
281
329
  },
282
330
  onKeyDown: (o) => {
283
- o.key === "Escape" && d(!1);
331
+ o.key === "Escape" && p(!1);
284
332
  },
285
333
  children: [
286
- /* @__PURE__ */ y("div", { className: "pbss-search-control", children: [
287
- /* @__PURE__ */ c(
334
+ /* @__PURE__ */ g("div", { className: "pbss-search-control", children: [
335
+ /* @__PURE__ */ l(
288
336
  "input",
289
337
  {
290
- "aria-controls": B ? K : void 0,
338
+ "aria-controls": B ? Z : void 0,
291
339
  "aria-expanded": B,
292
340
  "aria-label": "Search stockists",
293
341
  autoComplete: "postal-code",
@@ -295,54 +343,80 @@ function te({
295
343
  name: "stockist-search",
296
344
  placeholder: "Search suburb or postcode",
297
345
  type: "search",
298
- value: w,
346
+ value: v,
299
347
  onChange: (o) => {
300
348
  const a = o.target.value;
301
- x.current += 1, U(), E(!1), S(a), m(a.trim() ? "typed" : null);
349
+ w.current += 1, U(), S(!1), A(a), x(a.trim() ? "typed" : null);
302
350
  },
303
351
  onFocus: () => {
304
- (L || k || F || _) && d(!0);
352
+ (I || E || K || _) && p(!0);
305
353
  },
306
354
  onKeyDown: (o) => {
307
- o.key === "Enter" && (o.preventDefault(), ne());
355
+ o.key === "Enter" && (o.preventDefault(), le());
308
356
  }
309
357
  }
310
358
  ),
311
- /* @__PURE__ */ y(
359
+ /* @__PURE__ */ g(
312
360
  "button",
313
361
  {
314
- "aria-label": k ? "Finding your location" : "Use my location",
362
+ "aria-label": E ? "Finding your location" : "Use my location",
315
363
  className: "pbss-location-button",
316
- disabled: k || L || !l,
364
+ disabled: E || I || !c,
317
365
  type: "button",
318
- onClick: oe,
366
+ onClick: ie,
319
367
  children: [
320
- k ? /* @__PURE__ */ c("span", { "aria-hidden": "true", className: "pbss-spinner" }) : /* @__PURE__ */ c(W, { "aria-hidden": "true", "data-slot": "icon", weight: "bold" }),
321
- /* @__PURE__ */ c("span", { "aria-hidden": "true", className: "pbss-touch-target" })
368
+ E ? /* @__PURE__ */ l("span", { "aria-hidden": "true", className: "pbss-spinner" }) : /* @__PURE__ */ l(ee, { "aria-hidden": "true", "data-slot": "icon", weight: "bold" }),
369
+ /* @__PURE__ */ l("span", { "aria-hidden": "true", className: "pbss-touch-target" })
322
370
  ]
323
371
  }
324
372
  )
325
373
  ] }),
326
- B && /* @__PURE__ */ y(
374
+ B && /* @__PURE__ */ g(
327
375
  "div",
328
376
  {
329
377
  "aria-label": "Nearest stockists",
330
378
  className: "pbss-results-panel",
331
- id: K,
379
+ id: Z,
332
380
  role: "region",
333
381
  children: [
334
- /* @__PURE__ */ c("div", { "aria-live": "polite", className: "pbss-results-status", children: L || k ? /* @__PURE__ */ c("div", { className: "pbss-loading", children: "Finding nearby stockists." }) : _ ? /* @__PURE__ */ c("div", { className: "pbss-error", children: _ }) : N.length > 0 ? /* @__PURE__ */ c("ul", { className: "pbss-results", role: "list", children: N.map((o) => /* @__PURE__ */ y("li", { className: "pbss-result", children: [
335
- /* @__PURE__ */ y("div", { className: "pbss-result-heading", children: [
336
- /* @__PURE__ */ c("div", { className: "pbss-result-name", children: o.name }),
337
- typeof o.distanceKm == "number" && /* @__PURE__ */ c("div", { className: "pbss-result-distance", children: ye(o.distanceKm) })
338
- ] }),
339
- $(o) && /* @__PURE__ */ c("div", { className: "pbss-result-address", children: $(o) })
340
- ] }, o.id)) }) : /* @__PURE__ */ y("div", { className: "pbss-empty", children: [
382
+ /* @__PURE__ */ l("div", { "aria-live": "polite", className: "pbss-results-status", children: I || E ? /* @__PURE__ */ l("div", { className: "pbss-loading", children: "Finding nearby stockists." }) : _ ? /* @__PURE__ */ l("div", { className: "pbss-error", children: _ }) : R.length > 0 ? /* @__PURE__ */ l("ul", { className: "pbss-results", role: "list", children: R.map((o) => {
383
+ const a = Ae(o.website);
384
+ return /* @__PURE__ */ g("li", { className: "pbss-result", children: [
385
+ /* @__PURE__ */ g("div", { className: "pbss-result-heading", children: [
386
+ /* @__PURE__ */ l("div", { className: "pbss-result-name", children: o.name }),
387
+ /* @__PURE__ */ l("div", { className: "pbss-result-categories", children: Le(o).map((u) => /* @__PURE__ */ l(
388
+ "span",
389
+ {
390
+ className: "pbss-result-category",
391
+ style: _e(u, c == null ? void 0 : c.search.categoryColors),
392
+ children: u
393
+ },
394
+ u
395
+ )) })
396
+ ] }),
397
+ G(o) && /* @__PURE__ */ l("div", { className: "pbss-result-address", children: G(o) }),
398
+ /* @__PURE__ */ g("div", { className: "pbss-result-actions", children: [
399
+ o.phone && /* @__PURE__ */ l("a", { href: `tel:${o.phone}`, children: "Call now" }),
400
+ a && /* @__PURE__ */ l("a", { href: a, rel: "noreferrer", target: "_blank", children: "Website" }),
401
+ o.email && /* @__PURE__ */ l("a", { href: `mailto:${o.email}`, children: "Email" }),
402
+ o.directions_available !== !1 && /* @__PURE__ */ l(
403
+ "a",
404
+ {
405
+ href: Ce(o._geo),
406
+ rel: "noreferrer",
407
+ target: "_blank",
408
+ children: "Get directions"
409
+ }
410
+ ),
411
+ typeof o.distanceKm == "number" && /* @__PURE__ */ l("span", { className: "pbss-result-distance", children: Ee(o.distanceKm) })
412
+ ] })
413
+ ] }, o.id);
414
+ }) }) : /* @__PURE__ */ g("div", { className: "pbss-empty", children: [
341
415
  "No stockists found within ",
342
- Z,
416
+ W,
343
417
  " km. Try another location."
344
418
  ] }) }),
345
- /* @__PURE__ */ c("a", { className: "pbss-view-all", href: M || "/pages/stockists", children: "View All Stockists" })
419
+ /* @__PURE__ */ l("a", { className: "pbss-view-all", href: d || "/pages/stockists", children: "View All Stockists" })
346
420
  ]
347
421
  }
348
422
  )
@@ -350,49 +424,49 @@ function te({
350
424
  }
351
425
  );
352
426
  }
353
- const Ce = ":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-results{list-style:none;margin:0;padding:0}.pbss-result{display:grid;gap:4px;padding:14px}.pbss-result+.pbss-result{border-top:1px solid var(--pbss-divider)}.pbss-result-heading{align-items:baseline;display:flex;gap:12px;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-distance{color:var(--pbss-action-color);flex:0 0 auto;font-size:14px;font-variant-numeric:tabular-nums;font-weight:600;line-height:1.35}.pbss-result-address,.pbss-loading,.pbss-empty,.pbss-error{font-size:16px;line-height:1.45}.pbss-result-address{color:var(--pbss-muted-text)}.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-result-address,.pbss-loading,.pbss-empty,.pbss-error,.pbss-view-all{font-size:14px}.pbss-result-distance{font-size:12px}}.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)}}";
354
- function Me(e, t) {
355
- const r = Y(e);
356
- return r.render(/* @__PURE__ */ c(te, { ...t })), r;
427
+ const ze = ":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-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}}.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)}}";
428
+ function Pe(e, t) {
429
+ const s = J(e);
430
+ return s.render(/* @__PURE__ */ l(ne, { ...t })), s;
357
431
  }
358
- const j = "data-partbot-stockist-search-styles", G = "data-partbot-stockist-search-root";
359
- function Re(e) {
432
+ const V = "data-partbot-stockist-search-styles", Y = "data-partbot-stockist-search-root";
433
+ function $e(e) {
360
434
  return e.shadowRoot || e.attachShadow({ mode: "open" });
361
435
  }
362
- function Ne(e) {
363
- if (e.querySelector(`style[${j}]`)) return;
436
+ function He(e) {
437
+ if (e.querySelector(`style[${V}]`)) return;
364
438
  const t = document.createElement("style");
365
- t.setAttribute(j, ""), t.textContent = Ce, e.prepend(t);
439
+ t.setAttribute(V, ""), t.textContent = ze, e.prepend(t);
366
440
  }
367
- function Le(e) {
441
+ function Oe(e) {
368
442
  const t = e.querySelector(
369
- `div[${G}]`
443
+ `div[${Y}]`
370
444
  );
371
445
  if (t) return t;
372
- const r = document.createElement("div");
373
- return r.setAttribute(G, ""), e.appendChild(r), r;
446
+ const s = document.createElement("div");
447
+ return s.setAttribute(Y, ""), e.appendChild(s), s;
374
448
  }
375
- const Ie = typeof HTMLElement > "u" ? class {
449
+ const De = typeof HTMLElement > "u" ? class {
376
450
  } : HTMLElement;
377
- class se extends Ie {
451
+ class oe extends De {
378
452
  constructor() {
379
453
  super(...arguments);
380
- O(this, "root");
381
- O(this, "mountElement");
454
+ P(this, "root");
455
+ P(this, "mountElement");
382
456
  }
383
457
  connectedCallback() {
384
458
  this.renderStockistSearch();
385
459
  }
386
460
  disconnectedCallback() {
387
- var r;
388
- (r = this.root) == null || r.unmount(), this.root = void 0;
461
+ var s;
462
+ (s = this.root) == null || s.unmount(), this.root = void 0;
389
463
  }
390
464
  attributeChangedCallback() {
391
465
  this.isConnected && this.renderStockistSearch();
392
466
  }
393
467
  renderStockistSearch() {
394
- const r = Re(this);
395
- Ne(r), this.mountElement || (this.mountElement = Le(r)), this.root || (this.root = Y(this.mountElement)), this.root.render(/* @__PURE__ */ c(te, { ...this.stockistSearchProps() }));
468
+ const s = $e(this);
469
+ He(s), this.mountElement || (this.mountElement = Oe(s)), this.root || (this.root = J(this.mountElement)), this.root.render(/* @__PURE__ */ l(ne, { ...this.stockistSearchProps() }));
396
470
  }
397
471
  stockistSearchProps() {
398
472
  return {
@@ -403,17 +477,17 @@ class se extends Ie {
403
477
  };
404
478
  }
405
479
  }
406
- O(se, "observedAttributes", ["token", "config-url", "initial-query", "view-all-url"]);
407
- function V() {
408
- typeof window > "u" || !window.customElements || window.customElements.get("partbot-stockist-search") || window.customElements.define("partbot-stockist-search", se);
480
+ P(oe, "observedAttributes", ["token", "config-url", "initial-query", "view-all-url"]);
481
+ function Q() {
482
+ typeof window > "u" || !window.customElements || window.customElements.get("partbot-stockist-search") || window.customElements.define("partbot-stockist-search", oe);
409
483
  }
410
- typeof window < "u" && (V(), window.PartbotStockistSearch = {
411
- defineCustomElement: V,
412
- mount: Me
484
+ typeof window < "u" && (Q(), window.PartbotStockistSearch = {
485
+ defineCustomElement: Q,
486
+ mount: Pe
413
487
  });
414
488
  export {
415
- se as PartbotStockistSearchElement,
416
- te as StockistSearch,
417
- V as defineStockistSearchElement,
418
- Me as mountStockistSearch
489
+ oe as PartbotStockistSearchElement,
490
+ ne as StockistSearch,
491
+ Q as defineStockistSearchElement,
492
+ Pe as mountStockistSearch
419
493
  };