@brainfish-ai/widgets-initiator 1.4.0-beta.2 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/web.js CHANGED
@@ -1,46 +1,46 @@
1
- var Be = Object.defineProperty, Fe = Object.defineProperties;
1
+ var Fe = Object.defineProperty, Te = Object.defineProperties;
2
2
  var Le = Object.getOwnPropertyDescriptors;
3
3
  var pe = Object.getOwnPropertySymbols;
4
- var Te = Object.prototype.hasOwnProperty, $e = Object.prototype.propertyIsEnumerable;
5
- var L = (a, t, n) => t in a ? Be(a, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[t] = n, T = (a, t) => {
4
+ var $e = Object.prototype.hasOwnProperty, We = Object.prototype.propertyIsEnumerable;
5
+ var T = (a, t, n) => t in a ? Fe(a, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[t] = n, L = (a, t) => {
6
6
  for (var n in t || (t = {}))
7
- Te.call(t, n) && L(a, n, t[n]);
7
+ $e.call(t, n) && T(a, n, t[n]);
8
8
  if (pe)
9
9
  for (var n of pe(t))
10
- $e.call(t, n) && L(a, n, t[n]);
10
+ We.call(t, n) && T(a, n, t[n]);
11
11
  return a;
12
- }, $ = (a, t) => Fe(a, Le(t));
13
- var S = (a, t, n) => L(a, typeof t != "symbol" ? t + "" : t, n);
12
+ }, $ = (a, t) => Te(a, Le(t));
13
+ var _ = (a, t, n) => T(a, typeof t != "symbol" ? t + "" : t, n);
14
14
  var m = (a, t, n) => new Promise((i, o) => {
15
15
  var r = (s) => {
16
16
  try {
17
- u(n.next(s));
18
- } catch (l) {
19
- o(l);
17
+ l(n.next(s));
18
+ } catch (u) {
19
+ o(u);
20
20
  }
21
21
  }, e = (s) => {
22
22
  try {
23
- u(n.throw(s));
24
- } catch (l) {
25
- o(l);
23
+ l(n.throw(s));
24
+ } catch (u) {
25
+ o(u);
26
26
  }
27
- }, u = (s) => s.done ? i(s.value) : Promise.resolve(s.value).then(r, e);
28
- u((n = n.apply(a, t)).next());
27
+ }, l = (s) => s.done ? i(s.value) : Promise.resolve(s.value).then(r, e);
28
+ l((n = n.apply(a, t)).next());
29
29
  });
30
30
  var k, z;
31
31
  (function() {
32
32
  try {
33
33
  var a = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}, t = new a.Error().stack;
34
- t && (a._sentryDebugIds = a._sentryDebugIds || {}, a._sentryDebugIds[t] = "f7a3a049-20c4-45a8-9114-237a268bcd0c", a._sentryDebugIdIdentifier = "sentry-dbid-f7a3a049-20c4-45a8-9114-237a268bcd0c");
34
+ t && (a._sentryDebugIds = a._sentryDebugIds || {}, a._sentryDebugIds[t] = "48661401-d994-4a2e-9ad9-3e45a8dfbe86", a._sentryDebugIdIdentifier = "sentry-dbid-48661401-d994-4a2e-9ad9-3e45a8dfbe86");
35
35
  } catch (n) {
36
36
  }
37
- })(), (typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}).SENTRY_RELEASE = { id: "cad8ff1b22d4ed0a8dab362cb6326de1f58f15a5" }, function(a) {
37
+ })(), (typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}).SENTRY_RELEASE = { id: "0e2aad76f06034ea555f41b21f916a2e33210751" }, function(a) {
38
38
  a.Sidebar = "sidebar", a.Searchbar = "searchbar";
39
39
  }(k || (k = {})), k.Sidebar, k.Searchbar;
40
40
  class ie extends Error {
41
41
  constructor(n, i) {
42
42
  super(n, i);
43
- S(this, "cause");
43
+ _(this, "cause");
44
44
  this.name = "BrainfishWidgetError", this.cause = i == null ? void 0 : i.cause, Error.captureStackTrace && Error.captureStackTrace(this, ie), this.cause instanceof Error && this.cause.stack && (this.stack = this.stack + `
45
45
  Caused by: ` + this.cause.stack);
46
46
  }
@@ -59,77 +59,77 @@ const x = (a, t, n, i) => {
59
59
  o += ` - ${t.message}`;
60
60
  }
61
61
  else o += ` - ${String(t)}`;
62
- ((e, u, s) => {
62
+ ((e, l, s) => {
63
63
  if (!navigator || navigator.userAgent.toLowerCase().includes("headless")) return;
64
- const l = u.toJSON();
65
- fetch(`${e || "https://app.brainfi.sh"}/api/trackError.widget.create`, { method: "POST", headers: { "Content-Type": "application/json", "api-key": s }, body: JSON.stringify({ error: `WebWidgetVersion: 1.4.0-beta.2. ${u.message}`, stack: u.stack, cause: { message: l.message, stack: l.stack, cause: l.cause } }) });
64
+ const u = l.toJSON();
65
+ fetch(`${e || "https://app.brainfi.sh"}/api/trackError.widget.create`, { method: "POST", headers: { "Content-Type": "application/json", "api-key": s }, body: JSON.stringify({ error: `WebWidgetVersion: 1.5.0. ${l.message}`, stack: l.stack, cause: { message: u.message, stack: u.stack, cause: u.cause } }) });
66
66
  })(a, new ie(o, { cause: r }), i);
67
- }, We = (a) => m(void 0, null, function* () {
67
+ }, Ke = (a) => m(void 0, null, function* () {
68
68
  let { widgetKey: t, apiHost: n } = a;
69
69
  return function(i, o, r) {
70
70
  return m(this, null, function* () {
71
- let e, u = 0;
72
- for (; u < 3; ) try {
71
+ let e, l = 0;
72
+ for (; l < 3; ) try {
73
73
  const s = yield fetch(`${i}${o}`, { method: "POST", headers: { "Content-Type": "application/json", "api-key": r } });
74
74
  if (!s.ok) throw new Error(`API call failed with status: ${s.status}`);
75
- const l = yield s.json();
76
- if (!l) throw new Error("Error loading config: empty response");
77
- return l;
75
+ const u = yield s.json();
76
+ if (!u) throw new Error("Error loading config: empty response");
77
+ return u;
78
78
  } catch (s) {
79
- if (e = s, u++, u >= 3) throw x(i, s, "Error fetching config", r), e;
80
- yield new Promise((l) => setTimeout(l, 500));
79
+ if (e = s, l++, l >= 3) throw x(i, s, "Error fetching config", r), e;
80
+ yield new Promise((u) => setTimeout(u, 500));
81
81
  }
82
82
  });
83
83
  }(n, "/api/searchWidgets.getConfigByKey", t);
84
- }), Ke = (a) => {
84
+ }), ze = (a) => {
85
85
  let { config: t, apiKey: n, apiHost: i } = a;
86
86
  const o = t.settings || {};
87
87
  return ["bodyActionButtons", "footerActionButtons", "nextBestActions"].forEach((r) => {
88
- o[r] && (o[r] = o[r].map((e) => e.type === z.CALLBACK && e.value ? $(T({}, e), { value: new Function(`return ${e.value}`)() }) : e));
89
- }), $(T({}, t), { settings: o, apiHost: i, widgetMode: t.widgetType, apiKey: n });
88
+ o[r] && (o[r] = o[r].map((e) => e.type === z.CALLBACK && e.value ? $(L({}, e), { value: new Function(`return ${e.value}`)() }) : e));
89
+ }), $(L({}, t), { settings: o, apiHost: i, widgetMode: t.widgetType, apiKey: n });
90
90
  }, se = (a) => (a == null ? void 0 : a.apiHost) || "https://app.brainfi.sh", W = (() => {
91
91
  if (typeof window == "undefined") return;
92
92
  const a = window.navigator.userAgent;
93
93
  if (!(a.match(/iPad/i) || a.match(/iPhone/i))) return !1;
94
94
  const t = a.match(/OS (\d+)_/i);
95
95
  return t && parseInt(t[1], 10) <= 14;
96
- })(), ze = (a) => m(void 0, null, function* () {
96
+ })(), He = (a) => m(void 0, null, function* () {
97
97
  let { apiHost: t, widgetKey: n, version: i } = a;
98
98
  try {
99
99
  const o = `https://cdn.jsdelivr.net/npm/@brainfish-ai/search-widget@${i}/dist/web.js`, r = W ? o.replace("web.js", "web.umd.js") : o;
100
- return { widget: yield ((u) => m(void 0, null, function* () {
101
- return document.getElementById("brainfish-widget") ? window.Brainfish : new Promise((s, l) => {
100
+ return { widget: yield ((l) => m(void 0, null, function* () {
101
+ return document.getElementById("brainfish-widget") ? window.Brainfish : new Promise((s, u) => {
102
102
  const d = document.createElement("script");
103
- d.id = "brainfish-widget", d.src = u, d.type = W ? "text/javascript" : "module", d.async = !0, d.crossOrigin = "anonymous", d.onload = () => {
103
+ d.id = "brainfish-widget", d.src = l, d.type = W ? "text/javascript" : "module", d.async = !0, d.crossOrigin = "anonymous", d.onload = () => {
104
104
  setTimeout(() => {
105
105
  const c = window.Brainfish;
106
- c ? s(c) : l(new Error("Failed to load Brainfish module"));
106
+ c ? s(c) : u(new Error("Failed to load Brainfish module"));
107
107
  }, 200);
108
108
  }, d.onerror = (c) => {
109
- const f = c, h = { message: `Failed to load script: ${u}`, type: f.type, fileName: f.filename, lineNumber: f.lineno, columnNumber: f.colno, error: f.error ? f.error.toString() : "Unknown error" };
110
- l(new Error(JSON.stringify(h)));
109
+ const f = c, h = { message: `Failed to load script: ${l}`, type: f.type, fileName: f.filename, lineNumber: f.lineno, columnNumber: f.colno, error: f.error ? f.error.toString() : "Unknown error" };
110
+ u(new Error(JSON.stringify(h)));
111
111
  }, W || document.head.appendChild(d);
112
112
  });
113
113
  }))(r) };
114
114
  } catch (o) {
115
115
  x(t, o, o.message, n);
116
116
  }
117
- }), ge = /* @__PURE__ */ new Set(), He = (a, t) => m(void 0, null, function* () {
117
+ }), ge = /* @__PURE__ */ new Set(), qe = (a, t) => m(void 0, null, function* () {
118
118
  const n = se(a.overrides);
119
119
  try {
120
120
  if (ge.has(a.widgetKey)) return;
121
- const i = yield ze({ apiHost: n, widgetKey: a.widgetKey, version: t.version || "latest" });
121
+ const i = yield He({ apiHost: n, widgetKey: a.widgetKey, version: t.version || "latest" });
122
122
  if (i) {
123
- const { widget: o } = i, r = Ke({ config: t, apiKey: a.widgetKey, apiHost: n });
123
+ const { widget: o } = i, r = ze({ config: t, apiKey: a.widgetKey, apiHost: n });
124
124
  return a.overrides && t.settings && Object.entries(a.overrides).forEach((e) => {
125
- let [u, s] = e;
126
- t.settings && u in t.settings && (t.settings[u] = function() {
127
- let l = arguments.length > 1 ? arguments[1] : void 0;
125
+ let [l, s] = e;
126
+ t.settings && l in t.settings && (t.settings[l] = function() {
127
+ let u = arguments.length > 1 ? arguments[1] : void 0;
128
128
  const d = new Map((arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []).map((c) => [c.label, c]));
129
- return l.forEach((c) => d.set(c.label, c)), Array.from(d.values());
130
- }(t.settings[u], s));
131
- }), function(e, u) {
132
- u.widgetType === k.Searchbar || u.widgetType === "Search" ? e.SearchWidget.initStandard(u) : e.HelpWidget.initPopup(u);
129
+ return u.forEach((c) => d.set(c.label, c)), Array.from(d.values());
130
+ }(t.settings[l], s));
131
+ }), function(e, l) {
132
+ l.widgetType === k.Searchbar || l.widgetType === "Search" ? e.SearchWidget.initStandard(l) : e.HelpWidget.initPopup(l);
133
133
  }(o, r), ge.add(a.widgetKey), o;
134
134
  }
135
135
  } catch (i) {
@@ -137,15 +137,15 @@ const x = (a, t, n, i) => {
137
137
  }
138
138
  });
139
139
  let he = !1;
140
- const qe = function(i, o, r) {
140
+ const De = function(i, o, r) {
141
141
  return m(this, arguments, function* (a, t, n) {
142
- let e = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "", u = arguments.length > 4 && arguments[4] !== void 0 && arguments[4];
142
+ let e = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "", l = arguments.length > 4 && arguments[4] !== void 0 && arguments[4];
143
143
  if (t || x(n, new Error("Access key is required"), "Access key is required", a), !he) try {
144
- window.BrainfishAnalytics("init", { apiUrl: e, accessKey: t, trackScreenViews: !0, trackAttributes: !0, trackOutgoingLinks: !0, enableRecording: u }), he = !0, yield ((s, l) => m(this, null, function* () {
144
+ window.BrainfishAnalytics("init", { apiUrl: e, accessKey: t, trackScreenViews: !0, trackAttributes: !0, trackOutgoingLinks: !0, enableRecording: l }), he = !0, yield ((s, u) => m(this, null, function* () {
145
145
  if (document.getElementById("brainfish-analytics")) return window.BrainfishAnalytics;
146
146
  const d = document.createElement("script");
147
147
  d.id = "brainfish-analytics", d.src = "https://cdn.jsdelivr.net/npm/@brainfish-ai/web-tracker@latest/dist/tracker.js", d.type = "module", d.async = !0, d.crossOrigin = "anonymous", d.onerror = () => {
148
- x(s, new Error(`Failed to load script: ${d.src}`), `Failed to load script: ${d.src}`, l);
148
+ x(s, new Error(`Failed to load script: ${d.src}`), `Failed to load script: ${d.src}`, u);
149
149
  }, document.head.appendChild(d);
150
150
  }))(n, a);
151
151
  } catch (s) {
@@ -153,7 +153,7 @@ const qe = function(i, o, r) {
153
153
  }
154
154
  });
155
155
  };
156
- function I(a, t) {
156
+ function M(a, t) {
157
157
  let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
158
158
  const i = document.createElement(a);
159
159
  return i.className = t, Object.entries(n).forEach((o) => {
@@ -161,7 +161,7 @@ function I(a, t) {
161
161
  i.setAttribute(r, e);
162
162
  }), i;
163
163
  }
164
- const B = "bf-iframe-container", F = "bf-trigger-button";
164
+ const j = "bf-iframe-container", F = "bf-trigger-button";
165
165
  class v {
166
166
  static get isWidgetOpen() {
167
167
  return this.isOpen;
@@ -185,13 +185,13 @@ class v {
185
185
  (t = this.button) === null || t === void 0 || t.classList.add("hidden");
186
186
  }
187
187
  }
188
- S(v, "isOpen", !1), S(v, "button", null), S(v, "icon", null);
188
+ _(v, "isOpen", !1), _(v, "button", null), _(v, "icon", null);
189
189
  function Re(a, t) {
190
190
  window.addEventListener("message", (n) => {
191
191
  if (n.origin !== a) return;
192
192
  const { type: i } = n.data;
193
193
  if (i === "TOGGLE_WIDGET_SIZE" && function() {
194
- const o = document.querySelector(`.${B}`);
194
+ const o = document.querySelector(`.${j}`);
195
195
  o.classList.contains("expanded") ? o.classList.remove("expanded") : o.classList.add("expanded");
196
196
  }(), i === "TRACK_EVENT") {
197
197
  if (!window.BrainfishAnalytics) return;
@@ -201,10 +201,10 @@ function Re(a, t) {
201
201
  i === "CLOSE_WIDGET" && (window.BrainfishAnalytics("track", "Close Widget"), v.toggleIframeVisibility());
202
202
  }, { signal: t });
203
203
  }
204
- function le(a) {
204
+ function ue(a) {
205
205
  return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
206
206
  }
207
- var H = { exports: {} }, q = { exports: {} }, R = { exports: {} };
207
+ var H = { exports: {} }, q = { exports: {} }, D = { exports: {} };
208
208
  (function(a, t) {
209
209
  function n(o) {
210
210
  return Math.round(255 * o);
@@ -212,15 +212,15 @@ var H = { exports: {} }, q = { exports: {} }, R = { exports: {} };
212
212
  function i(o, r, e) {
213
213
  return n(o) + "," + n(r) + "," + n(e);
214
214
  }
215
- t.__esModule = !0, t.default = void 0, t.default = function(o, r, e, u) {
216
- if (u === void 0 && (u = i), r === 0) return u(e, e, e);
217
- var s = (o % 360 + 360) % 360 / 60, l = (1 - Math.abs(2 * e - 1)) * r, d = l * (1 - Math.abs(s % 2 - 1)), c = 0, f = 0, h = 0;
218
- s >= 0 && s < 1 ? (c = l, f = d) : s >= 1 && s < 2 ? (c = d, f = l) : s >= 2 && s < 3 ? (f = l, h = d) : s >= 3 && s < 4 ? (f = d, h = l) : s >= 4 && s < 5 ? (c = d, h = l) : s >= 5 && s < 6 && (c = l, h = d);
219
- var g = e - l / 2;
220
- return u(c + g, f + g, h + g);
215
+ t.__esModule = !0, t.default = void 0, t.default = function(o, r, e, l) {
216
+ if (l === void 0 && (l = i), r === 0) return l(e, e, e);
217
+ var s = (o % 360 + 360) % 360 / 60, u = (1 - Math.abs(2 * e - 1)) * r, d = u * (1 - Math.abs(s % 2 - 1)), c = 0, f = 0, h = 0;
218
+ s >= 0 && s < 1 ? (c = u, f = d) : s >= 1 && s < 2 ? (c = d, f = u) : s >= 2 && s < 3 ? (f = u, h = d) : s >= 3 && s < 4 ? (f = d, h = u) : s >= 4 && s < 5 ? (c = d, h = u) : s >= 5 && s < 6 && (c = u, h = d);
219
+ var g = e - u / 2;
220
+ return l(c + g, f + g, h + g);
221
221
  }, a.exports = t.default;
222
- })(R, R.exports);
223
- var ue = R.exports, D = { exports: {} };
222
+ })(D, D.exports);
223
+ var le = D.exports, R = { exports: {} };
224
224
  (function(a, t) {
225
225
  t.__esModule = !0, t.default = void 0;
226
226
  var n = { aliceblue: "f0f8ff", antiquewhite: "faebd7", aqua: "00ffff", aquamarine: "7fffd4", azure: "f0ffff", beige: "f5f5dc", bisque: "ffe4c4", black: "000", blanchedalmond: "ffebcd", blue: "0000ff", blueviolet: "8a2be2", brown: "a52a2a", burlywood: "deb887", cadetblue: "5f9ea0", chartreuse: "7fff00", chocolate: "d2691e", coral: "ff7f50", cornflowerblue: "6495ed", cornsilk: "fff8dc", crimson: "dc143c", cyan: "00ffff", darkblue: "00008b", darkcyan: "008b8b", darkgoldenrod: "b8860b", darkgray: "a9a9a9", darkgreen: "006400", darkgrey: "a9a9a9", darkkhaki: "bdb76b", darkmagenta: "8b008b", darkolivegreen: "556b2f", darkorange: "ff8c00", darkorchid: "9932cc", darkred: "8b0000", darksalmon: "e9967a", darkseagreen: "8fbc8f", darkslateblue: "483d8b", darkslategray: "2f4f4f", darkslategrey: "2f4f4f", darkturquoise: "00ced1", darkviolet: "9400d3", deeppink: "ff1493", deepskyblue: "00bfff", dimgray: "696969", dimgrey: "696969", dodgerblue: "1e90ff", firebrick: "b22222", floralwhite: "fffaf0", forestgreen: "228b22", fuchsia: "ff00ff", gainsboro: "dcdcdc", ghostwhite: "f8f8ff", gold: "ffd700", goldenrod: "daa520", gray: "808080", green: "008000", greenyellow: "adff2f", grey: "808080", honeydew: "f0fff0", hotpink: "ff69b4", indianred: "cd5c5c", indigo: "4b0082", ivory: "fffff0", khaki: "f0e68c", lavender: "e6e6fa", lavenderblush: "fff0f5", lawngreen: "7cfc00", lemonchiffon: "fffacd", lightblue: "add8e6", lightcoral: "f08080", lightcyan: "e0ffff", lightgoldenrodyellow: "fafad2", lightgray: "d3d3d3", lightgreen: "90ee90", lightgrey: "d3d3d3", lightpink: "ffb6c1", lightsalmon: "ffa07a", lightseagreen: "20b2aa", lightskyblue: "87cefa", lightslategray: "789", lightslategrey: "789", lightsteelblue: "b0c4de", lightyellow: "ffffe0", lime: "0f0", limegreen: "32cd32", linen: "faf0e6", magenta: "f0f", maroon: "800000", mediumaquamarine: "66cdaa", mediumblue: "0000cd", mediumorchid: "ba55d3", mediumpurple: "9370db", mediumseagreen: "3cb371", mediumslateblue: "7b68ee", mediumspringgreen: "00fa9a", mediumturquoise: "48d1cc", mediumvioletred: "c71585", midnightblue: "191970", mintcream: "f5fffa", mistyrose: "ffe4e1", moccasin: "ffe4b5", navajowhite: "ffdead", navy: "000080", oldlace: "fdf5e6", olive: "808000", olivedrab: "6b8e23", orange: "ffa500", orangered: "ff4500", orchid: "da70d6", palegoldenrod: "eee8aa", palegreen: "98fb98", paleturquoise: "afeeee", palevioletred: "db7093", papayawhip: "ffefd5", peachpuff: "ffdab9", peru: "cd853f", pink: "ffc0cb", plum: "dda0dd", powderblue: "b0e0e6", purple: "800080", rebeccapurple: "639", red: "f00", rosybrown: "bc8f8f", royalblue: "4169e1", saddlebrown: "8b4513", salmon: "fa8072", sandybrown: "f4a460", seagreen: "2e8b57", seashell: "fff5ee", sienna: "a0522d", silver: "c0c0c0", skyblue: "87ceeb", slateblue: "6a5acd", slategray: "708090", slategrey: "708090", snow: "fffafa", springgreen: "00ff7f", steelblue: "4682b4", tan: "d2b48c", teal: "008080", thistle: "d8bfd8", tomato: "ff6347", turquoise: "40e0d0", violet: "ee82ee", wheat: "f5deb3", white: "fff", whitesmoke: "f5f5f5", yellow: "ff0", yellowgreen: "9acd32" };
@@ -229,11 +229,11 @@ var ue = R.exports, D = { exports: {} };
229
229
  var o = i.toLowerCase();
230
230
  return n[o] ? "#" + n[o] : i;
231
231
  }, a.exports = t.default;
232
- })(D, D.exports);
233
- var De = D.exports, N = { exports: {} };
232
+ })(R, R.exports);
233
+ var Ne = R.exports, N = { exports: {} };
234
234
  (function(a, t) {
235
235
  function n(s) {
236
- var l = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
236
+ var u = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
237
237
  return n = function(d) {
238
238
  if (d === null || !function(f) {
239
239
  try {
@@ -243,9 +243,9 @@ var De = D.exports, N = { exports: {} };
243
243
  }
244
244
  }(d)) return d;
245
245
  if (typeof d != "function") throw new TypeError("Super expression must either be null or a function");
246
- if (l !== void 0) {
247
- if (l.has(d)) return l.get(d);
248
- l.set(d, c);
246
+ if (u !== void 0) {
247
+ if (u.has(d)) return u.get(d);
248
+ u.set(d, c);
249
249
  }
250
250
  function c() {
251
251
  return function(f, h, g) {
@@ -263,20 +263,20 @@ var De = D.exports, N = { exports: {} };
263
263
  try {
264
264
  var s = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
265
265
  }));
266
- } catch (l) {
266
+ } catch (u) {
267
267
  }
268
268
  return (i = function() {
269
269
  return !!s;
270
270
  })();
271
271
  }
272
- function o(s, l) {
272
+ function o(s, u) {
273
273
  return o = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(d, c) {
274
274
  return d.__proto__ = c, d;
275
- }, o(s, l);
275
+ }, o(s, u);
276
276
  }
277
277
  function r(s) {
278
- return r = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(l) {
279
- return l.__proto__ || Object.getPrototypeOf(l);
278
+ return r = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(u) {
279
+ return u.__proto__ || Object.getPrototypeOf(u);
280
280
  }, r(s);
281
281
  }
282
282
  t.__esModule = !0, t.default = void 0;
@@ -429,43 +429,43 @@ To pass a single animation please supply them in simple values, e.g. animation('
429
429
 
430
430
  `, 78: `base must be set in "px" or "%" but you set it in "%s".
431
431
  ` };
432
- function u() {
433
- for (var s = arguments.length, l = new Array(s), d = 0; d < s; d++) l[d] = arguments[d];
434
- var c, f = l[0], h = [];
435
- for (c = 1; c < l.length; c += 1) h.push(l[c]);
432
+ function l() {
433
+ for (var s = arguments.length, u = new Array(s), d = 0; d < s; d++) u[d] = arguments[d];
434
+ var c, f = u[0], h = [];
435
+ for (c = 1; c < u.length; c += 1) h.push(u[c]);
436
436
  return h.forEach(function(g) {
437
437
  f = f.replace(/%[a-z]/, g);
438
438
  }), f;
439
439
  }
440
440
  t.default = function(s) {
441
- var l, d;
441
+ var u, d;
442
442
  function c(f) {
443
443
  var h;
444
444
  if (process.env.NODE_ENV === "production") h = s.call(this, "An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#" + f + " for more information.") || this;
445
445
  else {
446
446
  for (var g = arguments.length, p = new Array(g > 1 ? g - 1 : 0), b = 1; b < g; b++) p[b - 1] = arguments[b];
447
- h = s.call(this, u.apply(void 0, [e[f]].concat(p))) || this;
447
+ h = s.call(this, l.apply(void 0, [e[f]].concat(p))) || this;
448
448
  }
449
449
  return function(C) {
450
450
  if (C === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
451
451
  return C;
452
452
  }(h);
453
453
  }
454
- return d = s, (l = c).prototype = Object.create(d.prototype), l.prototype.constructor = l, o(l, d), c;
454
+ return d = s, (u = c).prototype = Object.create(d.prototype), u.prototype.constructor = u, o(u, d), c;
455
455
  }(n(Error)), a.exports = t.default;
456
456
  })(N, N.exports);
457
- var _ = N.exports;
457
+ var S = N.exports;
458
458
  (function(a, t) {
459
459
  t.__esModule = !0, t.default = function(g) {
460
460
  if (typeof g != "string") throw new o.default(3);
461
461
  var p = (0, i.default)(g);
462
462
  if (p.match(e)) return { red: parseInt("" + p[1] + p[2], 16), green: parseInt("" + p[3] + p[4], 16), blue: parseInt("" + p[5] + p[6], 16) };
463
- if (p.match(u)) {
463
+ if (p.match(l)) {
464
464
  var b = parseFloat((parseInt("" + p[7] + p[8], 16) / 255).toFixed(2));
465
465
  return { red: parseInt("" + p[1] + p[2], 16), green: parseInt("" + p[3] + p[4], 16), blue: parseInt("" + p[5] + p[6], 16), alpha: b };
466
466
  }
467
467
  if (p.match(s)) return { red: parseInt("" + p[1] + p[1], 16), green: parseInt("" + p[2] + p[2], 16), blue: parseInt("" + p[3] + p[3], 16) };
468
- if (p.match(l)) {
468
+ if (p.match(u)) {
469
469
  var C = parseFloat((parseInt("" + p[4] + p[4], 16) / 255).toFixed(2));
470
470
  return { red: parseInt("" + p[1] + p[1], 16), green: parseInt("" + p[2] + p[2], 16), blue: parseInt("" + p[3] + p[3], 16), alpha: C };
471
471
  }
@@ -475,23 +475,23 @@ var _ = N.exports;
475
475
  if (y) return { red: parseInt("" + y[1], 10), green: parseInt("" + y[2], 10), blue: parseInt("" + y[3], 10), alpha: parseFloat("" + y[4]) > 1 ? parseFloat("" + y[4]) / 100 : parseFloat("" + y[4]) };
476
476
  var A = f.exec(p);
477
477
  if (A) {
478
- var Ae = parseInt("" + A[1], 10), Oe = parseInt("" + A[2], 10) / 100, Me = parseInt("" + A[3], 10) / 100, fe = "rgb(" + (0, n.default)(Ae, Oe, Me) + ")", O = d.exec(fe);
479
- if (!O) throw new o.default(4, p, fe);
480
- return { red: parseInt("" + O[1], 10), green: parseInt("" + O[2], 10), blue: parseInt("" + O[3], 10) };
478
+ var Ie = parseInt("" + A[1], 10), Oe = parseInt("" + A[2], 10) / 100, Me = parseInt("" + A[3], 10) / 100, fe = "rgb(" + (0, n.default)(Ie, Oe, Me) + ")", I = d.exec(fe);
479
+ if (!I) throw new o.default(4, p, fe);
480
+ return { red: parseInt("" + I[1], 10), green: parseInt("" + I[2], 10), blue: parseInt("" + I[3], 10) };
481
481
  }
482
482
  var w = h.exec(p.substring(0, 50));
483
483
  if (w) {
484
- var Ie = parseInt("" + w[1], 10), Pe = parseInt("" + w[2], 10) / 100, je = parseInt("" + w[3], 10) / 100, ce = "rgb(" + (0, n.default)(Ie, Pe, je) + ")", M = d.exec(ce);
485
- if (!M) throw new o.default(4, p, ce);
486
- return { red: parseInt("" + M[1], 10), green: parseInt("" + M[2], 10), blue: parseInt("" + M[3], 10), alpha: parseFloat("" + w[4]) > 1 ? parseFloat("" + w[4]) / 100 : parseFloat("" + w[4]) };
484
+ var Be = parseInt("" + w[1], 10), Pe = parseInt("" + w[2], 10) / 100, je = parseInt("" + w[3], 10) / 100, ce = "rgb(" + (0, n.default)(Be, Pe, je) + ")", O = d.exec(ce);
485
+ if (!O) throw new o.default(4, p, ce);
486
+ return { red: parseInt("" + O[1], 10), green: parseInt("" + O[2], 10), blue: parseInt("" + O[3], 10), alpha: parseFloat("" + w[4]) > 1 ? parseFloat("" + w[4]) / 100 : parseFloat("" + w[4]) };
487
487
  }
488
488
  throw new o.default(5);
489
489
  };
490
- var n = r(ue), i = r(De), o = r(_);
490
+ var n = r(le), i = r(Ne), o = r(S);
491
491
  function r(g) {
492
492
  return g && g.__esModule ? g : { default: g };
493
493
  }
494
- var e = /^#[a-fA-F0-9]{6}$/, u = /^#[a-fA-F0-9]{8}$/, s = /^#[a-fA-F0-9]{3}$/, l = /^#[a-fA-F0-9]{4}$/, d = /^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i, c = /^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i, f = /^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i, h = /^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;
494
+ var e = /^#[a-fA-F0-9]{6}$/, l = /^#[a-fA-F0-9]{8}$/, s = /^#[a-fA-F0-9]{3}$/, u = /^#[a-fA-F0-9]{4}$/, d = /^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i, c = /^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i, f = /^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i, h = /^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;
495
495
  a.exports = t.default;
496
496
  })(q, q.exports);
497
497
  var de = q.exports;
@@ -501,14 +501,14 @@ var de = q.exports;
501
501
  var r = (0, i.default)(o), e = Object.keys(r).map(function(d) {
502
502
  var c = r[d] / 255;
503
503
  return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
504
- }), u = e[0], s = e[1], l = e[2];
505
- return parseFloat((0.2126 * u + 0.7152 * s + 0.0722 * l).toFixed(3));
504
+ }), l = e[0], s = e[1], u = e[2];
505
+ return parseFloat((0.2126 * l + 0.7152 * s + 0.0722 * u).toFixed(3));
506
506
  };
507
507
  var n, i = (n = de) && n.__esModule ? n : { default: n };
508
508
  a.exports = t.default;
509
509
  })(H, H.exports);
510
- const Ne = le(H.exports);
511
- var Y = { exports: {} }, G = { exports: {} };
510
+ const Ye = ue(H.exports);
511
+ var Y = { exports: {} }, J = { exports: {} };
512
512
  (function(a, t) {
513
513
  function n(i, o, r) {
514
514
  return function() {
@@ -519,18 +519,18 @@ var Y = { exports: {} }, G = { exports: {} };
519
519
  t.__esModule = !0, t.default = function(i) {
520
520
  return n(i, i.length, []);
521
521
  }, a.exports = t.default;
522
- })(G, G.exports);
523
- var me, P, ye = G.exports, V = { exports: {} };
524
- me = V, (P = V.exports).__esModule = !0, P.default = void 0, P.default = function(a, t, n) {
522
+ })(J, J.exports);
523
+ var me, B, we = J.exports, U = { exports: {} };
524
+ me = U, (B = U.exports).__esModule = !0, B.default = void 0, B.default = function(a, t, n) {
525
525
  return Math.max(a, Math.min(t, n));
526
- }, me.exports = P.default;
527
- var we = V.exports, J = { exports: {} }, U = { exports: {} };
526
+ }, me.exports = B.default;
527
+ var xe = U.exports, G = { exports: {} }, V = { exports: {} };
528
528
  (function(a, t) {
529
529
  t.__esModule = !0, t.default = void 0, t.default = function(n) {
530
- var i, o = n.red / 255, r = n.green / 255, e = n.blue / 255, u = Math.max(o, r, e), s = Math.min(o, r, e), l = (u + s) / 2;
531
- if (u === s) return n.alpha !== void 0 ? { hue: 0, saturation: 0, lightness: l, alpha: n.alpha } : { hue: 0, saturation: 0, lightness: l };
532
- var d = u - s, c = l > 0.5 ? d / (2 - u - s) : d / (u + s);
533
- switch (u) {
530
+ var i, o = n.red / 255, r = n.green / 255, e = n.blue / 255, l = Math.max(o, r, e), s = Math.min(o, r, e), u = (l + s) / 2;
531
+ if (l === s) return n.alpha !== void 0 ? { hue: 0, saturation: 0, lightness: u, alpha: n.alpha } : { hue: 0, saturation: 0, lightness: u };
532
+ var d = l - s, c = u > 0.5 ? d / (2 - l - s) : d / (l + s);
533
+ switch (l) {
534
534
  case o:
535
535
  i = (r - e) / d + (r < e ? 6 : 0);
536
536
  break;
@@ -540,21 +540,21 @@ var we = V.exports, J = { exports: {} }, U = { exports: {} };
540
540
  default:
541
541
  i = (o - r) / d + 4;
542
542
  }
543
- return i *= 60, n.alpha !== void 0 ? { hue: i, saturation: c, lightness: l, alpha: n.alpha } : { hue: i, saturation: c, lightness: l };
543
+ return i *= 60, n.alpha !== void 0 ? { hue: i, saturation: c, lightness: u, alpha: n.alpha } : { hue: i, saturation: c, lightness: u };
544
544
  }, a.exports = t.default;
545
- })(U, U.exports);
546
- var Ye = U.exports;
545
+ })(V, V.exports);
546
+ var Je = V.exports;
547
547
  (function(a, t) {
548
548
  t.__esModule = !0, t.default = function(r) {
549
549
  return (0, i.default)((0, n.default)(r));
550
550
  };
551
- var n = o(de), i = o(Ye);
551
+ var n = o(de), i = o(Je);
552
552
  function o(r) {
553
553
  return r && r.__esModule ? r : { default: r };
554
554
  }
555
555
  a.exports = t.default;
556
- })(J, J.exports);
557
- var xe = J.exports, Z = { exports: {} }, Q = { exports: {} }, X = { exports: {} }, ee = { exports: {} };
556
+ })(G, G.exports);
557
+ var Se = G.exports, Z = { exports: {} }, Q = { exports: {} }, X = { exports: {} }, ee = { exports: {} };
558
558
  (function(a, t) {
559
559
  t.__esModule = !0, t.default = void 0, t.default = function(n) {
560
560
  return n.length === 7 && n[1] === n[2] && n[3] === n[4] && n[5] === n[6] ? "#" + n[1] + n[3] + n[5] : n;
@@ -567,96 +567,96 @@ var _e = ee.exports, te = { exports: {} };
567
567
  return i.length === 1 ? "0" + i : i;
568
568
  }, a.exports = t.default;
569
569
  })(te, te.exports);
570
- var Se = te.exports;
570
+ var ke = te.exports;
571
571
  (function(a, t) {
572
572
  t.__esModule = !0, t.default = void 0;
573
- var n = r(ue), i = r(_e), o = r(Se);
573
+ var n = r(le), i = r(_e), o = r(ke);
574
574
  function r(s) {
575
575
  return s && s.__esModule ? s : { default: s };
576
576
  }
577
577
  function e(s) {
578
578
  return (0, o.default)(Math.round(255 * s));
579
579
  }
580
- function u(s, l, d) {
581
- return (0, i.default)("#" + e(s) + e(l) + e(d));
580
+ function l(s, u, d) {
581
+ return (0, i.default)("#" + e(s) + e(u) + e(d));
582
582
  }
583
- t.default = function(s, l, d) {
584
- return (0, n.default)(s, l, d, u);
583
+ t.default = function(s, u, d) {
584
+ return (0, n.default)(s, u, d, l);
585
585
  }, a.exports = t.default;
586
586
  })(X, X.exports);
587
- var ke = X.exports;
587
+ var Ce = X.exports;
588
588
  (function(a, t) {
589
- t.__esModule = !0, t.default = function(r, e, u) {
590
- if (typeof r == "number" && typeof e == "number" && typeof u == "number") return (0, n.default)(r, e, u);
591
- if (typeof r == "object" && e === void 0 && u === void 0) return (0, n.default)(r.hue, r.saturation, r.lightness);
589
+ t.__esModule = !0, t.default = function(r, e, l) {
590
+ if (typeof r == "number" && typeof e == "number" && typeof l == "number") return (0, n.default)(r, e, l);
591
+ if (typeof r == "object" && e === void 0 && l === void 0) return (0, n.default)(r.hue, r.saturation, r.lightness);
592
592
  throw new i.default(1);
593
593
  };
594
- var n = o(ke), i = o(_);
594
+ var n = o(Ce), i = o(S);
595
595
  function o(r) {
596
596
  return r && r.__esModule ? r : { default: r };
597
597
  }
598
598
  a.exports = t.default;
599
599
  })(Q, Q.exports);
600
- var Ge = Q.exports, ne = { exports: {} };
600
+ var Ue = Q.exports, ne = { exports: {} };
601
601
  (function(a, t) {
602
- t.__esModule = !0, t.default = function(e, u, s, l) {
603
- if (typeof e == "number" && typeof u == "number" && typeof s == "number" && typeof l == "number") return l >= 1 ? (0, n.default)(e, u, s) : "rgba(" + (0, i.default)(e, u, s) + "," + l + ")";
604
- if (typeof e == "object" && u === void 0 && s === void 0 && l === void 0) return e.alpha >= 1 ? (0, n.default)(e.hue, e.saturation, e.lightness) : "rgba(" + (0, i.default)(e.hue, e.saturation, e.lightness) + "," + e.alpha + ")";
602
+ t.__esModule = !0, t.default = function(e, l, s, u) {
603
+ if (typeof e == "number" && typeof l == "number" && typeof s == "number" && typeof u == "number") return u >= 1 ? (0, n.default)(e, l, s) : "rgba(" + (0, i.default)(e, l, s) + "," + u + ")";
604
+ if (typeof e == "object" && l === void 0 && s === void 0 && u === void 0) return e.alpha >= 1 ? (0, n.default)(e.hue, e.saturation, e.lightness) : "rgba(" + (0, i.default)(e.hue, e.saturation, e.lightness) + "," + e.alpha + ")";
605
605
  throw new o.default(2);
606
606
  };
607
- var n = r(ke), i = r(ue), o = r(_);
607
+ var n = r(Ce), i = r(le), o = r(S);
608
608
  function r(e) {
609
609
  return e && e.__esModule ? e : { default: e };
610
610
  }
611
611
  a.exports = t.default;
612
612
  })(ne, ne.exports);
613
- var Ve = ne.exports, re = { exports: {} };
613
+ var Ge = ne.exports, re = { exports: {} };
614
614
  (function(a, t) {
615
- t.__esModule = !0, t.default = function(e, u, s) {
616
- if (typeof e == "number" && typeof u == "number" && typeof s == "number") return (0, n.default)("#" + (0, i.default)(e) + (0, i.default)(u) + (0, i.default)(s));
617
- if (typeof e == "object" && u === void 0 && s === void 0) return (0, n.default)("#" + (0, i.default)(e.red) + (0, i.default)(e.green) + (0, i.default)(e.blue));
615
+ t.__esModule = !0, t.default = function(e, l, s) {
616
+ if (typeof e == "number" && typeof l == "number" && typeof s == "number") return (0, n.default)("#" + (0, i.default)(e) + (0, i.default)(l) + (0, i.default)(s));
617
+ if (typeof e == "object" && l === void 0 && s === void 0) return (0, n.default)("#" + (0, i.default)(e.red) + (0, i.default)(e.green) + (0, i.default)(e.blue));
618
618
  throw new o.default(6);
619
619
  };
620
- var n = r(_e), i = r(Se), o = r(_);
620
+ var n = r(_e), i = r(ke), o = r(S);
621
621
  function r(e) {
622
622
  return e && e.__esModule ? e : { default: e };
623
623
  }
624
624
  a.exports = t.default;
625
625
  })(re, re.exports);
626
- var Ce = re.exports, ae = { exports: {} };
626
+ var Ee = re.exports, ae = { exports: {} };
627
627
  (function(a, t) {
628
- t.__esModule = !0, t.default = function(e, u, s, l) {
629
- if (typeof e == "string" && typeof u == "number") {
628
+ t.__esModule = !0, t.default = function(e, l, s, u) {
629
+ if (typeof e == "string" && typeof l == "number") {
630
630
  var d = (0, n.default)(e);
631
- return "rgba(" + d.red + "," + d.green + "," + d.blue + "," + u + ")";
631
+ return "rgba(" + d.red + "," + d.green + "," + d.blue + "," + l + ")";
632
632
  }
633
- if (typeof e == "number" && typeof u == "number" && typeof s == "number" && typeof l == "number") return l >= 1 ? (0, i.default)(e, u, s) : "rgba(" + e + "," + u + "," + s + "," + l + ")";
634
- if (typeof e == "object" && u === void 0 && s === void 0 && l === void 0) return e.alpha >= 1 ? (0, i.default)(e.red, e.green, e.blue) : "rgba(" + e.red + "," + e.green + "," + e.blue + "," + e.alpha + ")";
633
+ if (typeof e == "number" && typeof l == "number" && typeof s == "number" && typeof u == "number") return u >= 1 ? (0, i.default)(e, l, s) : "rgba(" + e + "," + l + "," + s + "," + u + ")";
634
+ if (typeof e == "object" && l === void 0 && s === void 0 && u === void 0) return e.alpha >= 1 ? (0, i.default)(e.red, e.green, e.blue) : "rgba(" + e.red + "," + e.green + "," + e.blue + "," + e.alpha + ")";
635
635
  throw new o.default(7);
636
636
  };
637
- var n = r(de), i = r(Ce), o = r(_);
637
+ var n = r(de), i = r(Ee), o = r(S);
638
638
  function r(e) {
639
639
  return e && e.__esModule ? e : { default: e };
640
640
  }
641
641
  a.exports = t.default;
642
642
  })(ae, ae.exports);
643
- var Je = ae.exports;
643
+ var Ve = ae.exports;
644
644
  (function(a, t) {
645
645
  t.__esModule = !0, t.default = function(f) {
646
646
  if (typeof f != "object") throw new e.default(8);
647
- if (l(f)) return (0, r.default)(f);
647
+ if (u(f)) return (0, r.default)(f);
648
648
  if (s(f)) return (0, o.default)(f);
649
649
  if (c(f)) return (0, i.default)(f);
650
650
  if (d(f)) return (0, n.default)(f);
651
651
  throw new e.default(8);
652
652
  };
653
- var n = u(Ge), i = u(Ve), o = u(Ce), r = u(Je), e = u(_);
654
- function u(f) {
653
+ var n = l(Ue), i = l(Ge), o = l(Ee), r = l(Ve), e = l(S);
654
+ function l(f) {
655
655
  return f && f.__esModule ? f : { default: f };
656
656
  }
657
657
  var s = function(f) {
658
658
  return typeof f.red == "number" && typeof f.green == "number" && typeof f.blue == "number" && (typeof f.alpha != "number" || f.alpha === void 0);
659
- }, l = function(f) {
659
+ }, u = function(f) {
660
660
  return typeof f.red == "number" && typeof f.green == "number" && typeof f.blue == "number" && typeof f.alpha == "number";
661
661
  }, d = function(f) {
662
662
  return typeof f.hue == "number" && typeof f.saturation == "number" && typeof f.lightness == "number" && (typeof f.alpha != "number" || f.alpha === void 0);
@@ -665,74 +665,74 @@ var Je = ae.exports;
665
665
  };
666
666
  a.exports = t.default;
667
667
  })(Z, Z.exports);
668
- var Ee = Z.exports;
668
+ var Ae = Z.exports;
669
669
  (function(a, t) {
670
670
  t.__esModule = !0, t.default = void 0;
671
- var n = e(ye), i = e(we), o = e(xe), r = e(Ee);
672
- function e(l) {
673
- return l && l.__esModule ? l : { default: l };
671
+ var n = e(we), i = e(xe), o = e(Se), r = e(Ae);
672
+ function e(u) {
673
+ return u && u.__esModule ? u : { default: u };
674
674
  }
675
- function u() {
676
- return u = Object.assign ? Object.assign.bind() : function(l) {
675
+ function l() {
676
+ return l = Object.assign ? Object.assign.bind() : function(u) {
677
677
  for (var d = 1; d < arguments.length; d++) {
678
678
  var c = arguments[d];
679
- for (var f in c) Object.prototype.hasOwnProperty.call(c, f) && (l[f] = c[f]);
679
+ for (var f in c) Object.prototype.hasOwnProperty.call(c, f) && (u[f] = c[f]);
680
680
  }
681
- return l;
682
- }, u.apply(this, arguments);
681
+ return u;
682
+ }, l.apply(this, arguments);
683
683
  }
684
- var s = (0, n.default)(function(l, d) {
684
+ var s = (0, n.default)(function(u, d) {
685
685
  if (d === "transparent") return d;
686
686
  var c = (0, o.default)(d);
687
- return (0, r.default)(u({}, c, { lightness: (0, i.default)(0, 1, c.lightness - parseFloat(l)) }));
687
+ return (0, r.default)(l({}, c, { lightness: (0, i.default)(0, 1, c.lightness - parseFloat(u)) }));
688
688
  });
689
689
  t.default = s, a.exports = t.default;
690
690
  })(Y, Y.exports);
691
- const Ue = le(Y.exports);
691
+ const Ze = ue(Y.exports);
692
692
  var oe = { exports: {} };
693
693
  (function(a, t) {
694
694
  t.__esModule = !0, t.default = void 0;
695
- var n = e(ye), i = e(we), o = e(xe), r = e(Ee);
696
- function e(l) {
697
- return l && l.__esModule ? l : { default: l };
695
+ var n = e(we), i = e(xe), o = e(Se), r = e(Ae);
696
+ function e(u) {
697
+ return u && u.__esModule ? u : { default: u };
698
698
  }
699
- function u() {
700
- return u = Object.assign ? Object.assign.bind() : function(l) {
699
+ function l() {
700
+ return l = Object.assign ? Object.assign.bind() : function(u) {
701
701
  for (var d = 1; d < arguments.length; d++) {
702
702
  var c = arguments[d];
703
- for (var f in c) Object.prototype.hasOwnProperty.call(c, f) && (l[f] = c[f]);
703
+ for (var f in c) Object.prototype.hasOwnProperty.call(c, f) && (u[f] = c[f]);
704
704
  }
705
- return l;
706
- }, u.apply(this, arguments);
705
+ return u;
706
+ }, l.apply(this, arguments);
707
707
  }
708
- var s = (0, n.default)(function(l, d) {
708
+ var s = (0, n.default)(function(u, d) {
709
709
  if (d === "transparent") return d;
710
710
  var c = (0, o.default)(d);
711
- return (0, r.default)(u({}, c, { lightness: (0, i.default)(0, 1, c.lightness + parseFloat(l)) }));
711
+ return (0, r.default)(l({}, c, { lightness: (0, i.default)(0, 1, c.lightness + parseFloat(u)) }));
712
712
  });
713
713
  t.default = s, a.exports = t.default;
714
714
  })(oe, oe.exports);
715
- const Ze = le(oe.exports);
716
- function Qe(a) {
715
+ const Qe = ue(oe.exports);
716
+ function Xe(a) {
717
717
  if (!document.querySelector("style[data-widget-styles]")) {
718
718
  var t, n;
719
719
  (function() {
720
720
  let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "#000", o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "FFF";
721
721
  const r = document.createElement("style");
722
722
  r.attributes.setNamedItem(document.createAttribute("data-widget-styles"));
723
- const e = Ne(i) > 0.5;
723
+ const e = Ye(i) > 0.5;
724
724
  r.textContent = `
725
725
  .bf-trigger-button{position:fixed;bottom:16px;right:16px;width:56px;height:56px;border-radius:50%;border:none;box-shadow:0 20px 25px -5px #1212171a,0 10px 10px -5px #1212170a;display:flex;align-items:center;justify-content:center;cursor:pointer;z-index:1000;padding:12px;gap:10px;overflow:hidden}.bf-trigger-button.hidden{display:none}.trigger-button-icon{width:36px;height:36px;position:relative}.trigger-button-icon svg{width:100%;height:100%;position:absolute;inset:0}.trigger-button-icon>svg>path{transition:transform .3s ease,opacity .3s ease;transform:scale(.5);transform-origin:center;opacity:0}.trigger-button-icon svg.visible{display:block}.trigger-button-icon>svg.visible>path{opacity:1;transform:scale(1)}.trigger-iframe{position:relative;width:100%;height:100%;border:none;outline:none;transform:translateZ(0)}.bf-iframe-container{position:fixed;bottom:0;right:0;width:100vw;height:100vh;border:none;overflow:hidden;z-index:999;opacity:0;pointer-events:none;transform:translateY(20px);transition:opacity .3s ease,transform .3s ease,width .2s ease-in-out,height .2s ease-in-out}.bf-iframe-container.open{opacity:1;transform:translateY(0);pointer-events:auto;top:0;left:0}@media (min-width: 768px){.bf-iframe-container{bottom:80px;right:24px;width:448px;height:min(750px,calc(100vh - 80px));border-radius:8px;border:1px solid var(--Dark-300, #D4D4D4);box-shadow:0 20px 25px -5px #1212171a,0 10px 10px -5px #1212170a}.bf-iframe-container.open{top:unset;left:unset}.bf-iframe-container.expanded{width:min(calc(448px * 1.35),calc(100vw - 16px));height:min(calc(750px * 1.35),calc(100vh - 80px))}}
726
726
  .${F} { background: ${i}; }
727
727
  .${F}:hover {
728
- background: ${e ? Ue(0.05, i) : Ze(0.05, i)};
728
+ background: ${e ? Ze(0.05, i) : Qe(0.05, i)};
729
729
  }
730
730
  .trigger-button-icon { color: ${o}; }
731
731
  `, document.head.appendChild(r);
732
732
  })((a == null || (t = a.theme) === null || t === void 0 ? void 0 : t.inputButtonBgColor) || "#007bff", (a == null || (n = a.theme) === null || n === void 0 ? void 0 : n.textBaseColor) || "#ffffff");
733
733
  }
734
734
  }
735
- function Xe(a, t) {
735
+ function et(a, t) {
736
736
  const n = () => {
737
737
  ((i) => {
738
738
  var o;
@@ -744,14 +744,14 @@ function Xe(a, t) {
744
744
  i.observe(document.body, { attributes: !0, attributeFilter: ["class"] }), t.addEventListener("abort", () => i.disconnect());
745
745
  })();
746
746
  }
747
- function et(a, t) {
747
+ function tt(a, t) {
748
748
  let n;
749
749
  const i = () => {
750
750
  ((r) => {
751
751
  var e;
752
- const u = { type: "UPDATE_BODY_CLASS", isMobile: r };
753
- (e = a.contentWindow) === null || e === void 0 || e.postMessage(u, "*"), r && (v.isWidgetOpen ? v.hideTriggerButton() : v.showTriggerButton());
754
- })(document.body.clientWidth <= 768);
752
+ const l = { type: "UPDATE_BODY_CLASS", isMobile: r };
753
+ (e = a.contentWindow) === null || e === void 0 || e.postMessage(l, "*"), r && (v.isWidgetOpen ? v.hideTriggerButton() : v.showTriggerButton());
754
+ })(document.body.clientWidth <= 576);
755
755
  }, o = () => {
756
756
  n && clearTimeout(n), n = window.setTimeout(i, 300);
757
757
  };
@@ -760,10 +760,19 @@ function et(a, t) {
760
760
  r.observe(document.body), t.addEventListener("abort", () => r.disconnect());
761
761
  })();
762
762
  }
763
- const be = /* @__PURE__ */ new Set();
764
- function tt(a, t) {
763
+ function be(a) {
764
+ const t = new TextEncoder().encode(a);
765
+ if (typeof window != "undefined" && typeof window.btoa == "function") {
766
+ const n = Array.from(t, (i) => String.fromCharCode(i)).join("");
767
+ return btoa(n);
768
+ }
769
+ if (typeof Buffer != "undefined") return Buffer.from(t).toString("base64");
770
+ throw new Error("[utils.base64Encode]: Unsupported environment");
771
+ }
772
+ const ve = /* @__PURE__ */ new Set();
773
+ function nt(a, t) {
765
774
  const n = document.createDocumentFragment(), i = function(e) {
766
- const u = I("button", F, { id: `trigger-button-${e}`, "aria-controls": B, "aria-expanded": "false", "data-name": F }), s = I("div", "trigger-button-icon", { "aria-hidden": "true" });
775
+ const l = M("button", F, { id: `trigger-button-${e}`, "aria-controls": j, "aria-expanded": "false", "data-name": F }), s = M("div", "trigger-button-icon", { "aria-hidden": "true" });
767
776
  return s.innerHTML = `
768
777
  <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256" class="close-icon">
769
778
  <path d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"></path>
@@ -771,49 +780,49 @@ function tt(a, t) {
771
780
  <svg width="24" height="14" viewBox="0 0 24 14" fill="none" xmlns="http://www.w3.org/2000/svg" class="fish-icon visible">
772
781
  <path fill-rule="evenodd" clip-rule="evenodd" d="M1.71844 10.3882L4.60606 6.98384L1.71844 3.58375C1.4014 3.21362 1.44424 2.65841 1.81269 2.33993C1.97978 2.1979 2.65242 1.98701 3.04657 2.43461L5.78425 5.65824C6.14281 5.29523 6.51693 4.95924 6.90479 4.65114C8.88976 3.07437 11.2345 2.22803 13.6931 2.22803C16.9492 2.22803 20.0039 3.71718 22.2917 6.41142C22.5702 6.74282 22.5702 7.22916 22.2917 7.56056C20.0039 10.2591 16.9492 11.744 13.6931 11.744C11.2348 11.744 8.89035 10.8948 6.90554 9.31995C6.51741 9.01199 6.14304 8.67628 5.78425 8.31374L3.04657 11.5374C2.72953 11.9075 2.18114 11.9505 1.81269 11.632C1.44852 11.3179 1.40568 10.7584 1.71844 10.3882ZM5.93026 10.4683C8.17161 12.2599 10.8546 13.25 13.6931 13.25C17.4881 13.25 21.019 11.4034 23.4447 8.52942C24.1873 7.64571 24.1843 6.31801 23.4397 5.43663C20.8944 2.43919 17.4337 0.722025 13.6931 0.722025C10.8555 0.722025 8.17194 1.70845 5.92952 3.50276L4.17682 1.43933C3.57943 0.760929 2.79325 0.630009 2.25286 0.662947C1.98116 0.679506 1.73125 0.736852 1.51895 0.811846C1.26839 0.900352 1.03017 1.02718 0.827835 1.20058C-0.165283 2.05903 -0.283916 3.561 0.574656 4.56345L2.63075 6.98445L0.568104 9.41623C-0.272133 10.4106 -0.166523 11.9125 0.827835 12.7714C1.81372 13.6243 3.34308 13.5062 4.19036 12.5171L5.93026 10.4683Z" fill="currentColor"/>
773
782
  </svg>
774
- `, u.setAttribute("aria-label", "Open Brainfish widget"), u.appendChild(s), v.initialize(u, s), u;
783
+ `, l.setAttribute("aria-label", "Open Brainfish widget"), l.appendChild(s), v.initialize(l, s), l;
775
784
  }(a), { iframeContainer: o, iframe: r } = function(e) {
776
- const u = I("div", B, { id: B, "aria-live": "polite", "aria-hidden": "true" }), s = I("iframe", "trigger-iframe", { src: e, sandbox: "allow-scripts allow-same-origin allow-popups", allow: "clipboard-write", role: "dialog" });
777
- return u.appendChild(s), { iframeContainer: u, iframe: s };
785
+ const l = M("div", j, { id: j, "aria-live": "polite", "aria-hidden": "true" }), s = M("iframe", "trigger-iframe", { src: e, sandbox: "allow-scripts allow-same-origin allow-popups", allow: "clipboard-write", role: "dialog" });
786
+ return l.appendChild(s), { iframeContainer: l, iframe: s };
778
787
  }(t);
779
788
  return n.appendChild(i), n.appendChild(o), { fragment: n, iframe: r };
780
789
  }
781
- const nt = (a, t) => {
790
+ const rt = (a, t) => {
782
791
  const n = se(a.overrides), i = ((o = a.overrides) == null ? void 0 : o.widgetHost) || "https://agent.brainfi.sh";
783
792
  var o;
784
- const r = `${i}/?widgetKey=${a.widgetKey}`;
793
+ const { theme: r, settings: e } = t, l = `${i}/?widgetKey=${a.widgetKey}&themeParam=${be(JSON.stringify(r))}&settingsParam=${be(JSON.stringify(e))}`;
785
794
  try {
786
- if (e = a.widgetKey, be.has(e) || function(f) {
787
- return !!document.getElementById(`trigger-button-${f}`);
795
+ if (s = a.widgetKey, ve.has(s) || function(g) {
796
+ return !!document.getElementById(`trigger-button-${g}`);
788
797
  }(a.widgetKey)) return;
789
- Qe(t);
790
- const { fragment: u, iframe: s } = tt(a.widgetKey, r), l = new AbortController(), { signal: d } = l;
791
- s.onload = () => {
798
+ Xe(t);
799
+ const { fragment: u, iframe: d } = nt(a.widgetKey, l), c = new AbortController(), { signal: f } = c;
800
+ d.onload = () => {
792
801
  setTimeout(() => {
793
- Xe(s, d), Re(i, d), et(s, d);
802
+ et(d, f), Re(i, f), tt(d, f);
794
803
  }, 0);
795
- }, document.body.appendChild(u), be.add(a.widgetKey);
796
- const c = () => {
797
- l.abort(), window.removeEventListener("beforeunload", c);
804
+ }, document.body.appendChild(u), ve.add(a.widgetKey);
805
+ const h = () => {
806
+ c.abort(), window.removeEventListener("beforeunload", h);
798
807
  };
799
- return void window.addEventListener("beforeunload", c);
808
+ return void window.addEventListener("beforeunload", h);
800
809
  } catch (u) {
801
- (function(s, l, d) {
802
- x(s, l, l.message, d);
810
+ (function(d, c, f) {
811
+ x(d, c, c.message, f);
803
812
  })(n, u, a.widgetKey);
804
813
  }
805
- var e;
814
+ var s;
806
815
  };
807
- let j = null;
808
- const ve = typeof window != "undefined" && window.Brainfish ? window.Brainfish : (j || (j = /* @__PURE__ */ function() {
816
+ let P = null;
817
+ const ye = typeof window != "undefined" && window.Brainfish ? window.Brainfish : (P || (P = /* @__PURE__ */ function() {
809
818
  let a = [], t = null;
810
819
  function n(o, r) {
811
820
  if (t) {
812
821
  const e = o.split(".");
813
- let u = t;
814
- for (let l = 0; l < e.length - 1; l++) u = u[e[l]];
815
- const s = u[e[e.length - 1]];
816
- if (typeof s == "function") return s.apply(u, r);
822
+ let l = t;
823
+ for (let u = 0; u < e.length - 1; u++) l = l[e[u]];
824
+ const s = l[e[e.length - 1]];
825
+ if (typeof s == "function") return s.apply(l, r);
817
826
  } else a.push([o, r]);
818
827
  }
819
828
  return { Widgets: { init: function() {
@@ -840,31 +849,44 @@ const ve = typeof window != "undefined" && window.Brainfish ? window.Brainfish :
840
849
  n(r, e);
841
850
  }
842
851
  } };
843
- }(), typeof window != "undefined" && (window.Brainfish = j)), j);
852
+ }(), typeof window != "undefined" && (window.Brainfish = P)), P);
844
853
  let K = null;
845
- ve.Widgets.init = (a) => m(void 0, null, function* () {
854
+ ye.Widgets.init = (a) => m(void 0, null, function* () {
846
855
  window && (window.BrainfishAnalytics = window.BrainfishAnalytics || function() {
847
- for (var r = arguments.length, e = new Array(r), u = 0; u < r; u++) e[u] = arguments[u];
856
+ for (var r = arguments.length, e = new Array(r), l = 0; l < r; l++) e[l] = arguments[l];
848
857
  (window.BrainfishAnalytics.q = window.BrainfishAnalytics.q || []).push(e);
849
858
  });
850
859
  const t = se(a.overrides), n = ((i = a.overrides) == null ? void 0 : i.analyticsApiHost) || "";
851
860
  var i;
852
- const { config: o } = yield We({ widgetKey: a.widgetKey, apiHost: t });
853
- K || (K = function(r, e, u, s) {
861
+ let o;
862
+ if (a.config) o = JSON.parse(((r) => {
863
+ if (typeof window != "undefined" && typeof window.atob == "function") {
864
+ const e = atob(r), l = e.length, s = new Uint8Array(l);
865
+ for (let u = 0; u < l; u++) s[u] = e.charCodeAt(u);
866
+ return new TextDecoder().decode(s);
867
+ }
868
+ if (typeof Buffer != "undefined") return Buffer.from(r, "base64").toString("utf-8");
869
+ throw new Error("[utils.base64Decode]: Unsupported environment");
870
+ })(a.config));
871
+ else {
872
+ const { config: r } = yield Ke({ widgetKey: a.widgetKey, apiHost: t });
873
+ o = r;
874
+ }
875
+ K || (K = function(r, e, l, s) {
854
876
  return m(this, null, function* () {
855
- var l, d, c;
856
- const f = ((l = r.overrides) === null || l === void 0 ? void 0 : l.enableRecording) || (e == null || (d = e.settings) === null || d === void 0 ? void 0 : d.enableRecording) || !1, h = ((c = r.overrides) === null || c === void 0 ? void 0 : c.version) || (e == null ? void 0 : e.version), g = [];
857
- h != null && h.startsWith("2.") ? nt(r, e) : g.push(He(r, e)), g.push(qe(r.widgetKey, e.trackingToken || "", u, s, f));
877
+ var u, d, c;
878
+ const f = ((u = r.overrides) === null || u === void 0 ? void 0 : u.enableRecording) || (e == null || (d = e.settings) === null || d === void 0 ? void 0 : d.enableRecording) || !1, h = ((c = r.overrides) === null || c === void 0 ? void 0 : c.version) || (e == null ? void 0 : e.version), g = [];
879
+ h != null && h.startsWith("2.") ? rt(r, e) : g.push(qe(r, e)), g.push(De(r.widgetKey, e.trackingToken || "", l, s, f));
858
880
  const [p] = yield Promise.allSettled(g);
859
- p && p.status === "fulfilled" && p.value && ve._setRealBrainfish(p.value);
881
+ p && p.status === "fulfilled" && p.value && ye._setRealBrainfish(p.value);
860
882
  });
861
883
  }(a, o, t, n)), yield K;
862
884
  });
863
- const at = function() {
885
+ const ot = function() {
864
886
  typeof window != "undefined" && window.BrainfishAnalytics && window.BrainfishAnalytics(...arguments);
865
887
  };
866
888
  export {
867
- at as BrainfishAnalytics,
868
- ve as default
889
+ ot as BrainfishAnalytics,
890
+ ye as default
869
891
  };
870
892
  //# sourceMappingURL=web.js.map