@brainfish-ai/widgets-initiator 1.10.1-alpha.0 → 1.11.0-alpha.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,47 +1,47 @@
1
- var Le = Object.defineProperty, We = Object.defineProperties;
2
- var Pe = Object.getOwnPropertyDescriptors;
3
- var he = Object.getOwnPropertySymbols;
4
- var Fe = Object.prototype.hasOwnProperty, He = Object.prototype.propertyIsEnumerable;
5
- var P = (a, t, n) => t in a ? Le(a, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[t] = n, F = (a, t) => {
1
+ var je = Object.defineProperty, Pe = Object.defineProperties;
2
+ var Fe = Object.getOwnPropertyDescriptors;
3
+ var me = Object.getOwnPropertySymbols;
4
+ var He = Object.prototype.hasOwnProperty, $e = Object.prototype.propertyIsEnumerable;
5
+ var F = (a, t, n) => t in a ? je(a, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[t] = n, H = (a, t) => {
6
6
  for (var n in t || (t = {}))
7
- Fe.call(t, n) && P(a, n, t[n]);
8
- if (he)
9
- for (var n of he(t))
10
- He.call(t, n) && P(a, n, t[n]);
7
+ He.call(t, n) && F(a, n, t[n]);
8
+ if (me)
9
+ for (var n of me(t))
10
+ $e.call(t, n) && F(a, n, t[n]);
11
11
  return a;
12
- }, H = (a, t) => We(a, Pe(t));
13
- var C = (a, t, n) => P(a, typeof t != "symbol" ? t + "" : t, n);
14
- var v = (a, t, n) => new Promise((d, i) => {
12
+ }, $ = (a, t) => Pe(a, Fe(t));
13
+ var C = (a, t, n) => F(a, typeof t != "symbol" ? t + "" : t, n);
14
+ var v = (a, t, n) => new Promise((o, i) => {
15
15
  var r = (l) => {
16
16
  try {
17
- s(n.next(l));
18
- } catch (o) {
19
- i(o);
17
+ d(n.next(l));
18
+ } catch (s) {
19
+ i(s);
20
20
  }
21
21
  }, e = (l) => {
22
22
  try {
23
- s(n.throw(l));
24
- } catch (o) {
25
- i(o);
23
+ d(n.throw(l));
24
+ } catch (s) {
25
+ i(s);
26
26
  }
27
- }, s = (l) => l.done ? d(l.value) : Promise.resolve(l.value).then(r, e);
28
- s((n = n.apply(a, t)).next());
27
+ }, d = (l) => l.done ? o(l.value) : Promise.resolve(l.value).then(r, e);
28
+ d((n = n.apply(a, t)).next());
29
29
  });
30
- var A, R;
30
+ var B, j;
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] = "95c64701-de4e-4b4c-96fb-259c64e13694", a._sentryDebugIdIdentifier = "sentry-dbid-95c64701-de4e-4b4c-96fb-259c64e13694");
34
+ t && (a._sentryDebugIds = a._sentryDebugIds || {}, a._sentryDebugIds[t] = "7d80a83e-298d-4896-9c6f-d8685f349b16", a._sentryDebugIdIdentifier = "sentry-dbid-7d80a83e-298d-4896-9c6f-d8685f349b16");
35
35
  } catch (n) {
36
36
  }
37
- })(), (typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}).SENTRY_RELEASE = { id: "6422b84d562b6b200ccddeb25d09fbb9359087f5" }, function(a) {
37
+ })(), (typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}).SENTRY_RELEASE = { id: "3c07c9e2575fc71ef38f169dadf8dc504b165c3d" }, function(a) {
38
38
  a.Sidebar = "sidebar", a.Searchbar = "searchbar";
39
- }(A || (A = {})), A.Sidebar, A.Searchbar;
40
- class de extends Error {
41
- constructor(n, d) {
42
- super(n, d);
39
+ }(B || (B = {})), B.Sidebar, B.Searchbar;
40
+ class le extends Error {
41
+ constructor(n, o) {
42
+ super(n, o);
43
43
  C(this, "cause");
44
- this.name = "BrainfishWidgetError", this.cause = d == null ? void 0 : d.cause, Error.captureStackTrace && Error.captureStackTrace(this, de), this.cause instanceof Error && this.cause.stack && (this.stack = this.stack + `
44
+ this.name = "BrainfishWidgetError", this.cause = o == null ? void 0 : o.cause, Error.captureStackTrace && Error.captureStackTrace(this, le), this.cause instanceof Error && this.cause.stack && (this.stack = this.stack + `
45
45
  Caused by: ` + this.cause.stack);
46
46
  }
47
47
  toJSON() {
@@ -50,8 +50,8 @@ Caused by: ` + this.cause.stack);
50
50
  }
51
51
  (function(a) {
52
52
  a.LINK = "link", a.CALLBACK = "callback", a.EMAIL = "email", a.PHONE = "phone";
53
- })(R || (R = {}));
54
- const _ = (a, t, n, d) => {
53
+ })(j || (j = {}));
54
+ const S = (a, t, n, o) => {
55
55
  let i = n, r = {};
56
56
  if (t instanceof Error) try {
57
57
  r = JSON.parse(t.message), i += ` - ${r.message || t.message}`;
@@ -59,122 +59,122 @@ const _ = (a, t, n, d) => {
59
59
  i += ` - ${t.message}`;
60
60
  }
61
61
  else i += ` - ${String(t)}`;
62
- ((e, s, l) => {
62
+ ((e, d, l) => {
63
63
  if (!navigator || navigator.userAgent.toLowerCase().includes("headless")) return;
64
- const o = s.toJSON();
65
- fetch(`${e || "https://app.brainfi.sh"}/api/trackError.widget.create`, { method: "POST", headers: { "Content-Type": "application/json", "api-key": l }, body: JSON.stringify({ error: `WebWidgetVersion: 1.10.1-alpha.0. ${s.message}`, stack: s.stack, cause: { message: o.message, stack: o.stack, cause: o.cause } }) });
66
- })(a, new de(i, { cause: r }), d);
67
- }, $e = (a) => v(void 0, null, function* () {
64
+ const s = d.toJSON();
65
+ fetch(`${e || "https://app.brainfi.sh"}/api/trackError.widget.create`, { method: "POST", headers: { "Content-Type": "application/json", "api-key": l }, body: JSON.stringify({ error: `WebWidgetVersion: 1.11.0-alpha.0. ${d.message}`, stack: d.stack, cause: { message: s.message, stack: s.stack, cause: s.cause } }) });
66
+ })(a, new le(i, { cause: r }), o);
67
+ }, Ke = (a) => v(void 0, null, function* () {
68
68
  let { widgetKey: t, apiHost: n } = a;
69
- return function(d, i, r) {
69
+ return function(o, i, r) {
70
70
  return v(this, null, function* () {
71
- let e, s = 0;
72
- for (; s < 3; ) try {
73
- const l = yield fetch(`${d}${i}`, { method: "POST", headers: { "Content-Type": "application/json", "api-key": r } });
71
+ let e, d = 0;
72
+ for (; d < 3; ) try {
73
+ const l = yield fetch(`${o}${i}`, { method: "POST", headers: { "Content-Type": "application/json", "api-key": r } });
74
74
  if (!l.ok) throw new Error(`API call failed with status: ${l.status}`);
75
- const o = yield l.json();
76
- if (!o) throw new Error("Error loading config: empty response");
77
- return o;
75
+ const s = yield l.json();
76
+ if (!s) throw new Error("Error loading config: empty response");
77
+ return s;
78
78
  } catch (l) {
79
- if (e = l, s++, s >= 3) throw _(d, l, "Error fetching config", r), e;
80
- yield new Promise((o) => setTimeout(o, 500));
79
+ if (e = l, d++, d >= 3) throw S(o, l, "Error fetching config", r), e;
80
+ yield new Promise((s) => setTimeout(s, 500));
81
81
  }
82
82
  });
83
83
  }(n, "/api/searchWidgets.getConfigByKey", t);
84
- }), Ke = (a) => {
85
- let { config: t, apiKey: n, apiHost: d } = a;
84
+ }), Re = (a) => {
85
+ let { config: t, apiKey: n, apiHost: o } = a;
86
86
  const i = t.settings || {};
87
87
  return ["bodyActionButtons", "footerActionButtons", "nextBestActions"].forEach((r) => {
88
- i[r] && (i[r] = i[r].map((e) => e.type === R.CALLBACK && e.value ? H(F({}, e), { value: new Function(`return ${e.value}`)() }) : e));
89
- }), H(F({}, t), { settings: i, apiHost: d, widgetMode: t.widgetType, apiKey: n });
90
- }, le = (a) => (a == null ? void 0 : a.apiHost) || "https://app.brainfi.sh", $ = (() => {
88
+ i[r] && (i[r] = i[r].map((e) => e.type === j.CALLBACK && e.value ? $(H({}, e), { value: new Function(`return ${e.value}`)() }) : e));
89
+ }), $(H({}, t), { settings: i, apiHost: o, widgetMode: t.widgetType, apiKey: n });
90
+ }, ue = (a) => (a == null ? void 0 : a.apiHost) || "https://app.brainfi.sh", K = (() => {
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
96
  })(), ze = (a) => v(void 0, null, function* () {
97
- let { apiHost: t, widgetKey: n, version: d } = a;
97
+ let { apiHost: t, widgetKey: n, version: o } = a;
98
98
  try {
99
- const i = `https://cdn.jsdelivr.net/npm/@brainfish-ai/search-widget@${d}/dist/web.js`, r = $ ? i.replace("web.js", "web.umd.js") : i;
100
- return { widget: yield ((s) => v(void 0, null, function* () {
101
- return document.getElementById("brainfish-widget") ? window.Brainfish : new Promise((l, o) => {
99
+ const i = `https://cdn.jsdelivr.net/npm/@brainfish-ai/search-widget@${o}/dist/web.js`, r = K ? i.replace("web.js", "web.umd.js") : i;
100
+ return { widget: yield ((d) => v(void 0, null, function* () {
101
+ return document.getElementById("brainfish-widget") ? window.Brainfish : new Promise((l, s) => {
102
102
  const u = document.createElement("script");
103
- u.id = "brainfish-widget", u.src = s, u.type = $ ? "text/javascript" : "module", u.async = !0, u.crossOrigin = "anonymous", u.onload = () => {
103
+ u.id = "brainfish-widget", u.src = d, u.type = K ? "text/javascript" : "module", u.async = !0, u.crossOrigin = "anonymous", u.onload = () => {
104
104
  setTimeout(() => {
105
105
  const c = window.Brainfish;
106
- c ? l(c) : o(new Error("Failed to load Brainfish module"));
106
+ c ? l(c) : s(new Error("Failed to load Brainfish module"));
107
107
  }, 200);
108
108
  }, u.onerror = (c) => {
109
- const f = c, g = { message: `Failed to load script: ${s}`, type: f.type, fileName: f.filename, lineNumber: f.lineno, columnNumber: f.colno, error: f.error ? f.error.toString() : "Unknown error" };
110
- o(new Error(JSON.stringify(g)));
111
- }, $ || document.head.appendChild(u);
109
+ const f = c, g = { message: `Failed to load script: ${d}`, type: f.type, fileName: f.filename, lineNumber: f.lineno, columnNumber: f.colno, error: f.error ? f.error.toString() : "Unknown error" };
110
+ s(new Error(JSON.stringify(g)));
111
+ }, K || document.head.appendChild(u);
112
112
  });
113
113
  }))(r) };
114
114
  } catch (i) {
115
- _(t, i, i.message, n);
115
+ S(t, i, i.message, n);
116
116
  }
117
- }), me = /* @__PURE__ */ new Set(), Re = (a, t) => v(void 0, null, function* () {
118
- const n = le(a.overrides);
117
+ }), be = /* @__PURE__ */ new Set(), Ne = (a, t) => v(void 0, null, function* () {
118
+ const n = ue(a.overrides);
119
119
  try {
120
- if (me.has(a.widgetKey)) return;
121
- const d = yield ze({ apiHost: n, widgetKey: a.widgetKey, version: t.version || "latest" });
122
- if (d) {
123
- const { widget: i } = d, r = Ke({ config: t, apiKey: a.widgetKey, apiHost: n });
120
+ if (be.has(a.widgetKey)) return;
121
+ const o = yield ze({ apiHost: n, widgetKey: a.widgetKey, version: t.version || "latest" });
122
+ if (o) {
123
+ const { widget: i } = o, r = Re({ config: t, apiKey: a.widgetKey, apiHost: n });
124
124
  return a.overrides && t.settings && Object.entries(a.overrides).forEach((e) => {
125
- let [s, l] = e;
126
- t.settings && s in t.settings && (t.settings[s] = function() {
127
- let o = arguments.length > 1 ? arguments[1] : void 0;
125
+ let [d, l] = e;
126
+ t.settings && d in t.settings && (t.settings[d] = function() {
127
+ let s = arguments.length > 1 ? arguments[1] : void 0;
128
128
  const u = new Map((arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []).map((c) => [c.label, c]));
129
- return o.forEach((c) => u.set(c.label, c)), Array.from(u.values());
130
- }(t.settings[s], l));
131
- }), function(e, s) {
132
- s.widgetType === A.Searchbar || s.widgetType === "Search" ? e.SearchWidget.initStandard(s) : e.HelpWidget.initPopup(s);
133
- }(i, r), me.add(a.widgetKey), i;
129
+ return s.forEach((c) => u.set(c.label, c)), Array.from(u.values());
130
+ }(t.settings[d], l));
131
+ }), function(e, d) {
132
+ d.widgetType === B.Searchbar || d.widgetType === "Search" ? e.SearchWidget.initStandard(d) : e.HelpWidget.initPopup(d);
133
+ }(i, r), be.add(a.widgetKey), i;
134
134
  }
135
- } catch (d) {
136
- _(n, d, d.message, a.widgetKey);
135
+ } catch (o) {
136
+ S(n, o, o.message, a.widgetKey);
137
137
  }
138
138
  });
139
- let be = !1;
140
- const qe = function(d, i, r) {
139
+ let ve = !1;
140
+ const qe = function(o, i, r) {
141
141
  return v(this, arguments, function* (a, t, n) {
142
- let e = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "", s = arguments.length > 4 && arguments[4] !== void 0 && arguments[4], l = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : [], o = arguments.length > 6 ? arguments[6] : void 0;
143
- if (t || _(n, new Error("Access key is required"), "Access key is required", a), !be) try {
142
+ let e = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "", d = arguments.length > 4 && arguments[4] !== void 0 && arguments[4], l = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : [], s = arguments.length > 6 ? arguments[6] : void 0;
143
+ if (t || S(n, new Error("Access key is required"), "Access key is required", a), !ve) try {
144
144
  const u = (() => {
145
145
  if (typeof window == "undefined" || typeof navigator == "undefined") return !1;
146
146
  const c = navigator, f = window, g = (c.doNotTrack || f.doNotTrack || c.msDoNotTrack || "0").toString().toLowerCase();
147
147
  return ["1", "yes", "true"].includes(g);
148
148
  })();
149
- window.BrainfishAnalytics("init", { apiUrl: e, accessKey: t, trackScreenViews: !0, trackAttributes: !u, trackOutgoingLinks: !u, enableRecording: !u && s, recordingBlocklist: l, _allowLocalhostRecording: o }), be = !0, yield ((c, f) => v(this, null, function* () {
149
+ window.BrainfishAnalytics("init", { apiUrl: e, accessKey: t, trackScreenViews: !0, trackAttributes: !u, trackOutgoingLinks: !u, enableRecording: !u && d, recordingBlocklist: l, _allowLocalhostRecording: s }), ve = !0, yield ((c, f) => v(this, null, function* () {
150
150
  if (document.getElementById("brainfish-analytics")) return window.BrainfishAnalytics;
151
151
  const g = document.createElement("script");
152
152
  g.id = "brainfish-analytics", g.src = "https://cdn.jsdelivr.net/npm/@brainfish-ai/web-tracker@latest/dist/tracker.js", g.type = "module", g.async = !0, g.crossOrigin = "anonymous", g.onerror = () => {
153
- _(c, new Error(`Failed to load script: ${g.src}`), `Failed to load script: ${g.src}`, f);
153
+ S(c, new Error(`Failed to load script: ${g.src}`), `Failed to load script: ${g.src}`, f);
154
154
  }, document.head.appendChild(g);
155
155
  }))(n, a);
156
156
  } catch (u) {
157
- _(n, u, "Failed to initialize BrainfishAnalytics", a);
157
+ S(n, u, "Failed to initialize BrainfishAnalytics", a);
158
158
  }
159
159
  });
160
160
  };
161
- function S(a, t) {
161
+ function k(a, t) {
162
162
  let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
163
- const d = document.createElement(a);
164
- return d.className = t, Object.entries(n).forEach((i) => {
163
+ const o = document.createElement(a);
164
+ return o.className = t, Object.entries(n).forEach((i) => {
165
165
  let [r, e] = i;
166
- d.setAttribute(r, e);
167
- }), d;
166
+ o.setAttribute(r, e);
167
+ }), o;
168
168
  }
169
- const L = "bf-iframe-container", W = "bf-trigger-button";
169
+ const L = "bf-iframe-container", P = "bf-trigger-button";
170
170
  class y {
171
171
  static get isWidgetOpen() {
172
172
  return this.isOpen;
173
173
  }
174
174
  static initialize(t) {
175
- var n, d;
175
+ var n, o;
176
176
  let { button: i, icon: r, isButtonHidden: e } = t;
177
- this.button = i || null, this.icon = r || null, this.isButtonHidden = e || !1, i && i.addEventListener("click", () => this.toggleIframeVisibility()), (n = window.Brainfish) !== null && n !== void 0 && n.HelpWidget && (window.Brainfish.HelpWidget.close = () => this.closeWidget(), window.Brainfish.HelpWidget.open = () => this.openWidget()), (d = window.Brainfish) !== null && d !== void 0 && d.Widgets && (window.Brainfish.Widgets.open = () => this.openWidget(), window.Brainfish.Widgets.close = () => this.closeWidget());
177
+ this.button = i || null, this.icon = r || null, this.isButtonHidden = e || !1, i && i.addEventListener("click", () => this.toggleIframeVisibility()), (n = window.Brainfish) !== null && n !== void 0 && n.HelpWidget && (window.Brainfish.HelpWidget.close = () => this.closeWidget(), window.Brainfish.HelpWidget.open = () => this.openWidget()), (o = window.Brainfish) !== null && o !== void 0 && o.Widgets && (window.Brainfish.Widgets.open = () => this.openWidget(), window.Brainfish.Widgets.close = () => this.closeWidget());
178
178
  }
179
179
  static toggleIframeVisibility() {
180
180
  this.isOpen = !this.isOpen, this.isOpen ? this.openWidget() : this.closeWidget();
@@ -182,8 +182,8 @@ class y {
182
182
  static openWidget() {
183
183
  var t;
184
184
  this.isOpen = !0;
185
- const n = document.querySelector(".bf-iframe-container"), d = n == null ? void 0 : n.querySelector("iframe");
186
- if (n == null || n.classList.add("open"), n == null || n.setAttribute("aria-hidden", "false"), d == null || (t = d.contentWindow) === null || t === void 0 || t.postMessage({ type: "FOCUS_SEARCH_FIELD" }, "*"), this.button && this.icon) {
185
+ const n = document.querySelector(".bf-iframe-container"), o = n == null ? void 0 : n.querySelector("iframe");
186
+ if (n == null || n.classList.add("open"), n == null || n.setAttribute("aria-hidden", "false"), o == null || (t = o.contentWindow) === null || t === void 0 || t.postMessage({ type: "FOCUS_SEARCH_FIELD" }, "*"), this.button && this.icon) {
187
187
  const i = this.icon.querySelector(".fish-icon"), r = this.icon.querySelector(".close-icon");
188
188
  this.button.setAttribute("aria-expanded", "true"), i.classList.remove("visible"), r.classList.add("visible"), document.body.clientWidth <= 576 && this.hideTriggerButton();
189
189
  }
@@ -194,8 +194,8 @@ class y {
194
194
  const t = document.querySelector(".bf-iframe-container");
195
195
  if (t == null || t.classList.remove("open"), t == null || t.setAttribute("aria-hidden", "true"), this.button && this.icon) {
196
196
  this.button.setAttribute("aria-expanded", "false");
197
- const n = this.icon.querySelector(".fish-icon"), d = this.icon.querySelector(".close-icon");
198
- n.classList.add("visible"), d.classList.remove("visible"), document.body.clientWidth <= 576 && this.showTriggerButton();
197
+ const n = this.icon.querySelector(".fish-icon"), o = this.icon.querySelector(".close-icon");
198
+ n.classList.add("visible"), o.classList.remove("visible"), document.body.clientWidth <= 576 && this.showTriggerButton();
199
199
  }
200
200
  window.dispatchEvent(new Event("onBrainfishWidgetClose")), window.BrainfishAnalytics("track", "Close Widget");
201
201
  }
@@ -209,65 +209,65 @@ class y {
209
209
  }
210
210
  }
211
211
  C(y, "isOpen", !1), C(y, "button", null), C(y, "icon", null), C(y, "isButtonHidden", !1);
212
- function Ne(a) {
213
- let { widgetHost: t, apiHost: n, widgetKey: d, signal: i } = a;
212
+ function De(a) {
213
+ let { widgetHost: t, apiHost: n, widgetKey: o, signal: i } = a;
214
214
  window.addEventListener("message", (r) => {
215
215
  if (r.origin !== t) return;
216
216
  const { type: e } = r.data;
217
217
  if (e === "TOGGLE_WIDGET_SIZE" && function() {
218
- const s = document.querySelector(`.${L}`);
219
- s.classList.contains("expanded") ? s.classList.remove("expanded") : s.classList.add("expanded");
218
+ const d = document.querySelector(`.${L}`);
219
+ d.classList.contains("expanded") ? d.classList.remove("expanded") : d.classList.add("expanded");
220
220
  }(), e === "TRACK_EVENT") {
221
221
  if (!window.BrainfishAnalytics) return;
222
- const { eventName: s, data: l } = r.data;
223
- window.BrainfishAnalytics("track", s, l);
222
+ const { eventName: d, data: l } = r.data;
223
+ window.BrainfishAnalytics("track", d, l);
224
224
  }
225
225
  if (e === "CLOSE_WIDGET" && (window.BrainfishAnalytics("track", "Close Widget"), y.toggleIframeVisibility()), e === "NEXT_BEST_ACTION_CLICKED") {
226
- const { action: s, searchQueryId: l, query: o, answer: u } = r.data, c = { action: s, searchQueryId: l };
227
- if (!["function", "callback"].includes(s.type)) return void console.error("Invalid action type", s);
228
- if (window.__bfCallbacks = window.__bfCallbacks || {}, window.__bfCallbacks[s.id]) return void window.__bfCallbacks[s.id](o, u, c);
229
- const f = `${n}/api/searchWidgets.callback.codeblocks?apiKey=${d}&codeblockId=${s.id}`, g = document.createElement("script");
226
+ const { action: d, searchQueryId: l, query: s, answer: u } = r.data, c = { action: d, searchQueryId: l };
227
+ if (!["function", "callback"].includes(d.type)) return void console.error("Invalid action type", d);
228
+ if (window.__bfCallbacks = window.__bfCallbacks || {}, window.__bfCallbacks[d.id]) return void window.__bfCallbacks[d.id](s, u, c);
229
+ const f = `${n}/api/searchWidgets.callback.codeblocks?apiKey=${o}&codeblockId=${d.id}`, g = document.createElement("script");
230
230
  g.src = f, document.head.appendChild(g), g.onload = () => {
231
- window.__bfCallbacks[s.id](o, u, c), setTimeout(() => {
231
+ window.__bfCallbacks[d.id](s, u, c), setTimeout(() => {
232
232
  document.head.removeChild(g);
233
233
  }, 300);
234
234
  };
235
235
  }
236
236
  }, { signal: i });
237
237
  }
238
- function ue(a) {
238
+ function fe(a) {
239
239
  return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
240
240
  }
241
- var q = { exports: {} }, N = { exports: {} }, D = { exports: {} };
241
+ var N = { exports: {} }, q = { exports: {} }, D = { exports: {} };
242
242
  (function(a, t) {
243
243
  function n(i) {
244
244
  return Math.round(255 * i);
245
245
  }
246
- function d(i, r, e) {
246
+ function o(i, r, e) {
247
247
  return n(i) + "," + n(r) + "," + n(e);
248
248
  }
249
- t.__esModule = !0, t.default = void 0, t.default = function(i, r, e, s) {
250
- if (s === void 0 && (s = d), r === 0) return s(e, e, e);
251
- var l = (i % 360 + 360) % 360 / 60, o = (1 - Math.abs(2 * e - 1)) * r, u = o * (1 - Math.abs(l % 2 - 1)), c = 0, f = 0, g = 0;
252
- l >= 0 && l < 1 ? (c = o, f = u) : l >= 1 && l < 2 ? (c = u, f = o) : l >= 2 && l < 3 ? (f = o, g = u) : l >= 3 && l < 4 ? (f = u, g = o) : l >= 4 && l < 5 ? (c = u, g = o) : l >= 5 && l < 6 && (c = o, g = u);
253
- var h = e - o / 2;
254
- return s(c + h, f + h, g + h);
249
+ t.__esModule = !0, t.default = void 0, t.default = function(i, r, e, d) {
250
+ if (d === void 0 && (d = o), r === 0) return d(e, e, e);
251
+ var l = (i % 360 + 360) % 360 / 60, s = (1 - Math.abs(2 * e - 1)) * r, u = s * (1 - Math.abs(l % 2 - 1)), c = 0, f = 0, g = 0;
252
+ l >= 0 && l < 1 ? (c = s, f = u) : l >= 1 && l < 2 ? (c = u, f = s) : l >= 2 && l < 3 ? (f = s, g = u) : l >= 3 && l < 4 ? (f = u, g = s) : l >= 4 && l < 5 ? (c = u, g = s) : l >= 5 && l < 6 && (c = s, g = u);
253
+ var h = e - s / 2;
254
+ return d(c + h, f + h, g + h);
255
255
  }, a.exports = t.default;
256
256
  })(D, D.exports);
257
- var fe = D.exports, J = { exports: {} };
257
+ var ce = D.exports, U = { exports: {} };
258
258
  (function(a, t) {
259
259
  t.__esModule = !0, t.default = void 0;
260
260
  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" };
261
- t.default = function(d) {
262
- if (typeof d != "string") return d;
263
- var i = d.toLowerCase();
264
- return n[i] ? "#" + n[i] : d;
261
+ t.default = function(o) {
262
+ if (typeof o != "string") return o;
263
+ var i = o.toLowerCase();
264
+ return n[i] ? "#" + n[i] : o;
265
265
  }, a.exports = t.default;
266
- })(J, J.exports);
267
- var De = J.exports, U = { exports: {} };
266
+ })(U, U.exports);
267
+ var Ue = U.exports, J = { exports: {} };
268
268
  (function(a, t) {
269
269
  function n(l) {
270
- var o = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
270
+ var s = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
271
271
  return n = function(u) {
272
272
  if (u === null || !function(f) {
273
273
  try {
@@ -277,13 +277,13 @@ var De = J.exports, U = { exports: {} };
277
277
  }
278
278
  }(u)) return u;
279
279
  if (typeof u != "function") throw new TypeError("Super expression must either be null or a function");
280
- if (o !== void 0) {
281
- if (o.has(u)) return o.get(u);
282
- o.set(u, c);
280
+ if (s !== void 0) {
281
+ if (s.has(u)) return s.get(u);
282
+ s.set(u, c);
283
283
  }
284
284
  function c() {
285
285
  return function(f, g, h) {
286
- if (d()) return Reflect.construct.apply(null, arguments);
286
+ if (o()) return Reflect.construct.apply(null, arguments);
287
287
  var p = [null];
288
288
  p.push.apply(p, g);
289
289
  var m = new (f.bind.apply(f, p))();
@@ -293,24 +293,24 @@ var De = J.exports, U = { exports: {} };
293
293
  return c.prototype = Object.create(u.prototype, { constructor: { value: c, enumerable: !1, writable: !0, configurable: !0 } }), i(c, u);
294
294
  }, n(l);
295
295
  }
296
- function d() {
296
+ function o() {
297
297
  try {
298
298
  var l = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
299
299
  }));
300
- } catch (o) {
300
+ } catch (s) {
301
301
  }
302
- return (d = function() {
302
+ return (o = function() {
303
303
  return !!l;
304
304
  })();
305
305
  }
306
- function i(l, o) {
306
+ function i(l, s) {
307
307
  return i = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(u, c) {
308
308
  return u.__proto__ = c, u;
309
- }, i(l, o);
309
+ }, i(l, s);
310
310
  }
311
311
  function r(l) {
312
- return r = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(o) {
313
- return o.__proto__ || Object.getPrototypeOf(o);
312
+ return r = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(s) {
313
+ return s.__proto__ || Object.getPrototypeOf(s);
314
314
  }, r(l);
315
315
  }
316
316
  t.__esModule = !0, t.default = void 0;
@@ -463,126 +463,126 @@ To pass a single animation please supply them in simple values, e.g. animation('
463
463
 
464
464
  `, 78: `base must be set in "px" or "%" but you set it in "%s".
465
465
  ` };
466
- function s() {
467
- for (var l = arguments.length, o = new Array(l), u = 0; u < l; u++) o[u] = arguments[u];
468
- var c, f = o[0], g = [];
469
- for (c = 1; c < o.length; c += 1) g.push(o[c]);
466
+ function d() {
467
+ for (var l = arguments.length, s = new Array(l), u = 0; u < l; u++) s[u] = arguments[u];
468
+ var c, f = s[0], g = [];
469
+ for (c = 1; c < s.length; c += 1) g.push(s[c]);
470
470
  return g.forEach(function(h) {
471
471
  f = f.replace(/%[a-z]/, h);
472
472
  }), f;
473
473
  }
474
474
  t.default = function(l) {
475
- var o, u;
475
+ var s, u;
476
476
  function c(f) {
477
477
  var g;
478
478
  if (process.env.NODE_ENV === "production") g = l.call(this, "An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#" + f + " for more information.") || this;
479
479
  else {
480
480
  for (var h = arguments.length, p = new Array(h > 1 ? h - 1 : 0), m = 1; m < h; m++) p[m - 1] = arguments[m];
481
- g = l.call(this, s.apply(void 0, [e[f]].concat(p))) || this;
481
+ g = l.call(this, d.apply(void 0, [e[f]].concat(p))) || this;
482
482
  }
483
483
  return function(b) {
484
484
  if (b === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
485
485
  return b;
486
486
  }(g);
487
487
  }
488
- return u = l, (o = c).prototype = Object.create(u.prototype), o.prototype.constructor = o, i(o, u), c;
488
+ return u = l, (s = c).prototype = Object.create(u.prototype), s.prototype.constructor = s, i(s, u), c;
489
489
  }(n(Error)), a.exports = t.default;
490
- })(U, U.exports);
491
- var E = U.exports;
490
+ })(J, J.exports);
491
+ var E = J.exports;
492
492
  (function(a, t) {
493
493
  t.__esModule = !0, t.default = function(h) {
494
494
  if (typeof h != "string") throw new i.default(3);
495
- var p = (0, d.default)(h);
495
+ var p = (0, o.default)(h);
496
496
  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) };
497
- if (p.match(s)) {
497
+ if (p.match(d)) {
498
498
  var m = parseFloat((parseInt("" + p[7] + p[8], 16) / 255).toFixed(2));
499
499
  return { red: parseInt("" + p[1] + p[2], 16), green: parseInt("" + p[3] + p[4], 16), blue: parseInt("" + p[5] + p[6], 16), alpha: m };
500
500
  }
501
501
  if (p.match(l)) return { red: parseInt("" + p[1] + p[1], 16), green: parseInt("" + p[2] + p[2], 16), blue: parseInt("" + p[3] + p[3], 16) };
502
- if (p.match(o)) {
502
+ if (p.match(s)) {
503
503
  var b = parseFloat((parseInt("" + p[4] + p[4], 16) / 255).toFixed(2));
504
504
  return { red: parseInt("" + p[1] + p[1], 16), green: parseInt("" + p[2] + p[2], 16), blue: parseInt("" + p[3] + p[3], 16), alpha: b };
505
505
  }
506
- var k = u.exec(p);
507
- if (k) return { red: parseInt("" + k[1], 10), green: parseInt("" + k[2], 10), blue: parseInt("" + k[3], 10) };
506
+ var _ = u.exec(p);
507
+ if (_) return { red: parseInt("" + _[1], 10), green: parseInt("" + _[2], 10), blue: parseInt("" + _[3], 10) };
508
508
  var w = c.exec(p.substring(0, 50));
509
509
  if (w) return { red: parseInt("" + w[1], 10), green: parseInt("" + w[2], 10), blue: parseInt("" + w[3], 10), alpha: parseFloat("" + w[4]) > 1 ? parseFloat("" + w[4]) / 100 : parseFloat("" + w[4]) };
510
- var I = f.exec(p);
511
- if (I) {
512
- var Ae = parseInt("" + I[1], 10), Ie = parseInt("" + I[2], 10) / 100, Oe = parseInt("" + I[3], 10) / 100, pe = "rgb(" + (0, n.default)(Ae, Ie, Oe) + ")", O = u.exec(pe);
513
- if (!O) throw new i.default(4, p, pe);
514
- return { red: parseInt("" + O[1], 10), green: parseInt("" + O[2], 10), blue: parseInt("" + O[3], 10) };
510
+ var O = f.exec(p);
511
+ if (O) {
512
+ var Oe = parseInt("" + O[1], 10), Ie = parseInt("" + O[2], 10) / 100, Te = parseInt("" + O[3], 10) / 100, ge = "rgb(" + (0, n.default)(Oe, Ie, Te) + ")", I = u.exec(ge);
513
+ if (!I) throw new i.default(4, p, ge);
514
+ return { red: parseInt("" + I[1], 10), green: parseInt("" + I[2], 10), blue: parseInt("" + I[3], 10) };
515
515
  }
516
516
  var x = g.exec(p.substring(0, 50));
517
517
  if (x) {
518
- var Me = parseInt("" + x[1], 10), je = parseInt("" + x[2], 10) / 100, Te = parseInt("" + x[3], 10) / 100, ge = "rgb(" + (0, n.default)(Me, je, Te) + ")", M = u.exec(ge);
519
- if (!M) throw new i.default(4, p, ge);
520
- return { red: parseInt("" + M[1], 10), green: parseInt("" + M[2], 10), blue: parseInt("" + M[3], 10), alpha: parseFloat("" + x[4]) > 1 ? parseFloat("" + x[4]) / 100 : parseFloat("" + x[4]) };
518
+ var Me = parseInt("" + x[1], 10), We = parseInt("" + x[2], 10) / 100, Le = parseInt("" + x[3], 10) / 100, he = "rgb(" + (0, n.default)(Me, We, Le) + ")", T = u.exec(he);
519
+ if (!T) throw new i.default(4, p, he);
520
+ return { red: parseInt("" + T[1], 10), green: parseInt("" + T[2], 10), blue: parseInt("" + T[3], 10), alpha: parseFloat("" + x[4]) > 1 ? parseFloat("" + x[4]) / 100 : parseFloat("" + x[4]) };
521
521
  }
522
522
  throw new i.default(5);
523
523
  };
524
- var n = r(fe), d = r(De), i = r(E);
524
+ var n = r(ce), o = r(Ue), i = r(E);
525
525
  function r(h) {
526
526
  return h && h.__esModule ? h : { default: h };
527
527
  }
528
- var e = /^#[a-fA-F0-9]{6}$/, s = /^#[a-fA-F0-9]{8}$/, l = /^#[a-fA-F0-9]{3}$/, o = /^#[a-fA-F0-9]{4}$/, u = /^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, g = /^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;
528
+ var e = /^#[a-fA-F0-9]{6}$/, d = /^#[a-fA-F0-9]{8}$/, l = /^#[a-fA-F0-9]{3}$/, s = /^#[a-fA-F0-9]{4}$/, u = /^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, g = /^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;
529
529
  a.exports = t.default;
530
- })(N, N.exports);
531
- var ce = N.exports;
530
+ })(q, q.exports);
531
+ var pe = q.exports;
532
532
  (function(a, t) {
533
533
  t.__esModule = !0, t.default = function(i) {
534
534
  if (i === "transparent") return 0;
535
- var r = (0, d.default)(i), e = Object.keys(r).map(function(u) {
535
+ var r = (0, o.default)(i), e = Object.keys(r).map(function(u) {
536
536
  var c = r[u] / 255;
537
537
  return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
538
- }), s = e[0], l = e[1], o = e[2];
539
- return parseFloat((0.2126 * s + 0.7152 * l + 0.0722 * o).toFixed(3));
538
+ }), d = e[0], l = e[1], s = e[2];
539
+ return parseFloat((0.2126 * d + 0.7152 * l + 0.0722 * s).toFixed(3));
540
540
  };
541
- var n, d = (n = ce) && n.__esModule ? n : { default: n };
541
+ var n, o = (n = pe) && n.__esModule ? n : { default: n };
542
542
  a.exports = t.default;
543
- })(q, q.exports);
544
- const Je = ue(q.exports);
543
+ })(N, N.exports);
544
+ const Je = fe(N.exports);
545
545
  var Y = { exports: {} }, G = { exports: {} };
546
546
  (function(a, t) {
547
- function n(d, i, r) {
547
+ function n(o, i, r) {
548
548
  return function() {
549
549
  var e = r.concat(Array.prototype.slice.call(arguments));
550
- return e.length >= i ? d.apply(this, e) : n(d, i, e);
550
+ return e.length >= i ? o.apply(this, e) : n(o, i, e);
551
551
  };
552
552
  }
553
- t.__esModule = !0, t.default = function(d) {
554
- return n(d, d.length, []);
553
+ t.__esModule = !0, t.default = function(o) {
554
+ return n(o, o.length, []);
555
555
  }, a.exports = t.default;
556
556
  })(G, G.exports);
557
- var ve, j, we = G.exports, V = { exports: {} };
558
- ve = V, (j = V.exports).__esModule = !0, j.default = void 0, j.default = function(a, t, n) {
557
+ var ye, M, xe = G.exports, V = { exports: {} };
558
+ ye = V, (M = V.exports).__esModule = !0, M.default = void 0, M.default = function(a, t, n) {
559
559
  return Math.max(a, Math.min(t, n));
560
- }, ve.exports = j.default;
561
- var xe = V.exports, Z = { exports: {} }, Q = { exports: {} };
560
+ }, ye.exports = M.default;
561
+ var ke = V.exports, Z = { exports: {} }, Q = { exports: {} };
562
562
  (function(a, t) {
563
563
  t.__esModule = !0, t.default = void 0, t.default = function(n) {
564
- var d, i = n.red / 255, r = n.green / 255, e = n.blue / 255, s = Math.max(i, r, e), l = Math.min(i, r, e), o = (s + l) / 2;
565
- if (s === l) return n.alpha !== void 0 ? { hue: 0, saturation: 0, lightness: o, alpha: n.alpha } : { hue: 0, saturation: 0, lightness: o };
566
- var u = s - l, c = o > 0.5 ? u / (2 - s - l) : u / (s + l);
567
- switch (s) {
564
+ var o, i = n.red / 255, r = n.green / 255, e = n.blue / 255, d = Math.max(i, r, e), l = Math.min(i, r, e), s = (d + l) / 2;
565
+ if (d === l) return n.alpha !== void 0 ? { hue: 0, saturation: 0, lightness: s, alpha: n.alpha } : { hue: 0, saturation: 0, lightness: s };
566
+ var u = d - l, c = s > 0.5 ? u / (2 - d - l) : u / (d + l);
567
+ switch (d) {
568
568
  case i:
569
- d = (r - e) / u + (r < e ? 6 : 0);
569
+ o = (r - e) / u + (r < e ? 6 : 0);
570
570
  break;
571
571
  case r:
572
- d = (e - i) / u + 2;
572
+ o = (e - i) / u + 2;
573
573
  break;
574
574
  default:
575
- d = (i - r) / u + 4;
575
+ o = (i - r) / u + 4;
576
576
  }
577
- return d *= 60, n.alpha !== void 0 ? { hue: d, saturation: c, lightness: o, alpha: n.alpha } : { hue: d, saturation: c, lightness: o };
577
+ return o *= 60, n.alpha !== void 0 ? { hue: o, saturation: c, lightness: s, alpha: n.alpha } : { hue: o, saturation: c, lightness: s };
578
578
  }, a.exports = t.default;
579
579
  })(Q, Q.exports);
580
- var Ue = Q.exports;
580
+ var Ye = Q.exports;
581
581
  (function(a, t) {
582
582
  t.__esModule = !0, t.default = function(r) {
583
- return (0, d.default)((0, n.default)(r));
583
+ return (0, o.default)((0, n.default)(r));
584
584
  };
585
- var n = i(ce), d = i(Ue);
585
+ var n = i(pe), o = i(Ye);
586
586
  function i(r) {
587
587
  return r && r.__esModule ? r : { default: r };
588
588
  }
@@ -597,100 +597,100 @@ var Se = Z.exports, X = { exports: {} }, ee = { exports: {} }, te = { exports: {
597
597
  var _e = ne.exports, re = { exports: {} };
598
598
  (function(a, t) {
599
599
  t.__esModule = !0, t.default = void 0, t.default = function(n) {
600
- var d = n.toString(16);
601
- return d.length === 1 ? "0" + d : d;
600
+ var o = n.toString(16);
601
+ return o.length === 1 ? "0" + o : o;
602
602
  }, a.exports = t.default;
603
603
  })(re, re.exports);
604
- var ke = re.exports;
604
+ var Ce = re.exports;
605
605
  (function(a, t) {
606
606
  t.__esModule = !0, t.default = void 0;
607
- var n = r(fe), d = r(_e), i = r(ke);
607
+ var n = r(ce), o = r(_e), i = r(Ce);
608
608
  function r(l) {
609
609
  return l && l.__esModule ? l : { default: l };
610
610
  }
611
611
  function e(l) {
612
612
  return (0, i.default)(Math.round(255 * l));
613
613
  }
614
- function s(l, o, u) {
615
- return (0, d.default)("#" + e(l) + e(o) + e(u));
614
+ function d(l, s, u) {
615
+ return (0, o.default)("#" + e(l) + e(s) + e(u));
616
616
  }
617
- t.default = function(l, o, u) {
618
- return (0, n.default)(l, o, u, s);
617
+ t.default = function(l, s, u) {
618
+ return (0, n.default)(l, s, u, d);
619
619
  }, a.exports = t.default;
620
620
  })(te, te.exports);
621
- var Ce = te.exports;
621
+ var Ee = te.exports;
622
622
  (function(a, t) {
623
- t.__esModule = !0, t.default = function(r, e, s) {
624
- if (typeof r == "number" && typeof e == "number" && typeof s == "number") return (0, n.default)(r, e, s);
625
- if (typeof r == "object" && e === void 0 && s === void 0) return (0, n.default)(r.hue, r.saturation, r.lightness);
626
- throw new d.default(1);
623
+ t.__esModule = !0, t.default = function(r, e, d) {
624
+ if (typeof r == "number" && typeof e == "number" && typeof d == "number") return (0, n.default)(r, e, d);
625
+ if (typeof r == "object" && e === void 0 && d === void 0) return (0, n.default)(r.hue, r.saturation, r.lightness);
626
+ throw new o.default(1);
627
627
  };
628
- var n = i(Ce), d = i(E);
628
+ var n = i(Ee), o = i(E);
629
629
  function i(r) {
630
630
  return r && r.__esModule ? r : { default: r };
631
631
  }
632
632
  a.exports = t.default;
633
633
  })(ee, ee.exports);
634
- var Ye = ee.exports, ae = { exports: {} };
634
+ var Ge = ee.exports, ae = { exports: {} };
635
635
  (function(a, t) {
636
- t.__esModule = !0, t.default = function(e, s, l, o) {
637
- if (typeof e == "number" && typeof s == "number" && typeof l == "number" && typeof o == "number") return o >= 1 ? (0, n.default)(e, s, l) : "rgba(" + (0, d.default)(e, s, l) + "," + o + ")";
638
- if (typeof e == "object" && s === void 0 && l === void 0 && o === void 0) return e.alpha >= 1 ? (0, n.default)(e.hue, e.saturation, e.lightness) : "rgba(" + (0, d.default)(e.hue, e.saturation, e.lightness) + "," + e.alpha + ")";
636
+ t.__esModule = !0, t.default = function(e, d, l, s) {
637
+ if (typeof e == "number" && typeof d == "number" && typeof l == "number" && typeof s == "number") return s >= 1 ? (0, n.default)(e, d, l) : "rgba(" + (0, o.default)(e, d, l) + "," + s + ")";
638
+ if (typeof e == "object" && d === void 0 && l === void 0 && s === void 0) return e.alpha >= 1 ? (0, n.default)(e.hue, e.saturation, e.lightness) : "rgba(" + (0, o.default)(e.hue, e.saturation, e.lightness) + "," + e.alpha + ")";
639
639
  throw new i.default(2);
640
640
  };
641
- var n = r(Ce), d = r(fe), i = r(E);
641
+ var n = r(Ee), o = r(ce), i = r(E);
642
642
  function r(e) {
643
643
  return e && e.__esModule ? e : { default: e };
644
644
  }
645
645
  a.exports = t.default;
646
646
  })(ae, ae.exports);
647
- var Ge = ae.exports, ie = { exports: {} };
647
+ var Ve = ae.exports, ie = { exports: {} };
648
648
  (function(a, t) {
649
- t.__esModule = !0, t.default = function(e, s, l) {
650
- if (typeof e == "number" && typeof s == "number" && typeof l == "number") return (0, n.default)("#" + (0, d.default)(e) + (0, d.default)(s) + (0, d.default)(l));
651
- if (typeof e == "object" && s === void 0 && l === void 0) return (0, n.default)("#" + (0, d.default)(e.red) + (0, d.default)(e.green) + (0, d.default)(e.blue));
649
+ t.__esModule = !0, t.default = function(e, d, l) {
650
+ if (typeof e == "number" && typeof d == "number" && typeof l == "number") return (0, n.default)("#" + (0, o.default)(e) + (0, o.default)(d) + (0, o.default)(l));
651
+ if (typeof e == "object" && d === void 0 && l === void 0) return (0, n.default)("#" + (0, o.default)(e.red) + (0, o.default)(e.green) + (0, o.default)(e.blue));
652
652
  throw new i.default(6);
653
653
  };
654
- var n = r(_e), d = r(ke), i = r(E);
654
+ var n = r(_e), o = r(Ce), i = r(E);
655
655
  function r(e) {
656
656
  return e && e.__esModule ? e : { default: e };
657
657
  }
658
658
  a.exports = t.default;
659
659
  })(ie, ie.exports);
660
- var Ee = ie.exports, oe = { exports: {} };
660
+ var Ae = ie.exports, oe = { exports: {} };
661
661
  (function(a, t) {
662
- t.__esModule = !0, t.default = function(e, s, l, o) {
663
- if (typeof e == "string" && typeof s == "number") {
662
+ t.__esModule = !0, t.default = function(e, d, l, s) {
663
+ if (typeof e == "string" && typeof d == "number") {
664
664
  var u = (0, n.default)(e);
665
- return "rgba(" + u.red + "," + u.green + "," + u.blue + "," + s + ")";
665
+ return "rgba(" + u.red + "," + u.green + "," + u.blue + "," + d + ")";
666
666
  }
667
- if (typeof e == "number" && typeof s == "number" && typeof l == "number" && typeof o == "number") return o >= 1 ? (0, d.default)(e, s, l) : "rgba(" + e + "," + s + "," + l + "," + o + ")";
668
- if (typeof e == "object" && s === void 0 && l === void 0 && o === void 0) return e.alpha >= 1 ? (0, d.default)(e.red, e.green, e.blue) : "rgba(" + e.red + "," + e.green + "," + e.blue + "," + e.alpha + ")";
667
+ if (typeof e == "number" && typeof d == "number" && typeof l == "number" && typeof s == "number") return s >= 1 ? (0, o.default)(e, d, l) : "rgba(" + e + "," + d + "," + l + "," + s + ")";
668
+ if (typeof e == "object" && d === void 0 && l === void 0 && s === void 0) return e.alpha >= 1 ? (0, o.default)(e.red, e.green, e.blue) : "rgba(" + e.red + "," + e.green + "," + e.blue + "," + e.alpha + ")";
669
669
  throw new i.default(7);
670
670
  };
671
- var n = r(ce), d = r(Ee), i = r(E);
671
+ var n = r(pe), o = r(Ae), i = r(E);
672
672
  function r(e) {
673
673
  return e && e.__esModule ? e : { default: e };
674
674
  }
675
675
  a.exports = t.default;
676
676
  })(oe, oe.exports);
677
- var Ve = oe.exports;
677
+ var Ze = oe.exports;
678
678
  (function(a, t) {
679
679
  t.__esModule = !0, t.default = function(f) {
680
680
  if (typeof f != "object") throw new e.default(8);
681
- if (o(f)) return (0, r.default)(f);
681
+ if (s(f)) return (0, r.default)(f);
682
682
  if (l(f)) return (0, i.default)(f);
683
- if (c(f)) return (0, d.default)(f);
683
+ if (c(f)) return (0, o.default)(f);
684
684
  if (u(f)) return (0, n.default)(f);
685
685
  throw new e.default(8);
686
686
  };
687
- var n = s(Ye), d = s(Ge), i = s(Ee), r = s(Ve), e = s(E);
688
- function s(f) {
687
+ var n = d(Ge), o = d(Ve), i = d(Ae), r = d(Ze), e = d(E);
688
+ function d(f) {
689
689
  return f && f.__esModule ? f : { default: f };
690
690
  }
691
691
  var l = function(f) {
692
692
  return typeof f.red == "number" && typeof f.green == "number" && typeof f.blue == "number" && (typeof f.alpha != "number" || f.alpha === void 0);
693
- }, o = function(f) {
693
+ }, s = function(f) {
694
694
  return typeof f.red == "number" && typeof f.green == "number" && typeof f.blue == "number" && typeof f.alpha == "number";
695
695
  }, u = function(f) {
696
696
  return typeof f.hue == "number" && typeof f.saturation == "number" && typeof f.lightness == "number" && (typeof f.alpha != "number" || f.alpha === void 0);
@@ -702,115 +702,115 @@ var Ve = oe.exports;
702
702
  var Be = X.exports;
703
703
  (function(a, t) {
704
704
  t.__esModule = !0, t.default = void 0;
705
- var n = e(we), d = e(xe), i = e(Se), r = e(Be);
706
- function e(o) {
707
- return o && o.__esModule ? o : { default: o };
705
+ var n = e(xe), o = e(ke), i = e(Se), r = e(Be);
706
+ function e(s) {
707
+ return s && s.__esModule ? s : { default: s };
708
708
  }
709
- function s() {
710
- return s = Object.assign ? Object.assign.bind() : function(o) {
709
+ function d() {
710
+ return d = Object.assign ? Object.assign.bind() : function(s) {
711
711
  for (var u = 1; u < arguments.length; u++) {
712
712
  var c = arguments[u];
713
- for (var f in c) Object.prototype.hasOwnProperty.call(c, f) && (o[f] = c[f]);
713
+ for (var f in c) Object.prototype.hasOwnProperty.call(c, f) && (s[f] = c[f]);
714
714
  }
715
- return o;
716
- }, s.apply(this, arguments);
715
+ return s;
716
+ }, d.apply(this, arguments);
717
717
  }
718
- var l = (0, n.default)(function(o, u) {
718
+ var l = (0, n.default)(function(s, u) {
719
719
  if (u === "transparent") return u;
720
720
  var c = (0, i.default)(u);
721
- return (0, r.default)(s({}, c, { lightness: (0, d.default)(0, 1, c.lightness - parseFloat(o)) }));
721
+ return (0, r.default)(d({}, c, { lightness: (0, o.default)(0, 1, c.lightness - parseFloat(s)) }));
722
722
  });
723
723
  t.default = l, a.exports = t.default;
724
724
  })(Y, Y.exports);
725
- const Ze = ue(Y.exports);
725
+ const Qe = fe(Y.exports);
726
726
  var se = { exports: {} };
727
727
  (function(a, t) {
728
728
  t.__esModule = !0, t.default = void 0;
729
- var n = e(we), d = e(xe), i = e(Se), r = e(Be);
730
- function e(o) {
731
- return o && o.__esModule ? o : { default: o };
729
+ var n = e(xe), o = e(ke), i = e(Se), r = e(Be);
730
+ function e(s) {
731
+ return s && s.__esModule ? s : { default: s };
732
732
  }
733
- function s() {
734
- return s = Object.assign ? Object.assign.bind() : function(o) {
733
+ function d() {
734
+ return d = Object.assign ? Object.assign.bind() : function(s) {
735
735
  for (var u = 1; u < arguments.length; u++) {
736
736
  var c = arguments[u];
737
- for (var f in c) Object.prototype.hasOwnProperty.call(c, f) && (o[f] = c[f]);
737
+ for (var f in c) Object.prototype.hasOwnProperty.call(c, f) && (s[f] = c[f]);
738
738
  }
739
- return o;
740
- }, s.apply(this, arguments);
739
+ return s;
740
+ }, d.apply(this, arguments);
741
741
  }
742
- var l = (0, n.default)(function(o, u) {
742
+ var l = (0, n.default)(function(s, u) {
743
743
  if (u === "transparent") return u;
744
744
  var c = (0, i.default)(u);
745
- return (0, r.default)(s({}, c, { lightness: (0, d.default)(0, 1, c.lightness + parseFloat(o)) }));
745
+ return (0, r.default)(d({}, c, { lightness: (0, o.default)(0, 1, c.lightness + parseFloat(s)) }));
746
746
  });
747
747
  t.default = l, a.exports = t.default;
748
748
  })(se, se.exports);
749
- const Qe = ue(se.exports);
750
- function Xe(a) {
749
+ const Xe = fe(se.exports);
750
+ function et(a) {
751
751
  if (!document.querySelector("style[data-widget-styles]")) {
752
752
  var t, n;
753
753
  (function() {
754
- let d = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "#000", i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "FFF";
754
+ let o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "#000", i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "FFF";
755
755
  const r = document.createElement("style");
756
756
  r.attributes.setNamedItem(document.createAttribute("data-widget-styles"));
757
- const e = Je(d) > 0.5;
757
+ const e = Je(o) > 0.5;
758
758
  r.textContent = `
759
759
  .bf-trigger-button{position:fixed;bottom:16px;right:16px;width:36px;height:36px;border-radius:50%;border:none;box-shadow:0 1px 6px #0000000f,0 2px 32px #00000029;transition:transform 167ms cubic-bezier(.33,0,0,1);box-sizing:content-box;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{display:flex;align-items:center;justify-content:center;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 .fish-icon{display:none}.trigger-button-icon .fish-icon.visible{display:block}.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{display:none;position:fixed;z-index:2147483000000;background-color:#fff;bottom:0;right:0;width:100vw;height:100vh;border:none;overflow:hidden;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{display:block;opacity:1;transform:translateY(0);pointer-events:auto;top:0;left:0}@media (min-width: 576px){.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))}}.iframe-loading-indicator{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);display:flex;align-items:center;justify-content:center;z-index:10}.spinner{width:24px;height:24px;border:2px solid rgba(0,0,0,.1);border-radius:50%;border-top-color:#3498db;animation:spin 1s ease-in-out infinite}@keyframes spin{to{transform:rotate(360deg)}}.loading-error{width:24px;height:24px;position:relative;display:flex;align-items:center;justify-content:center}.loading-error:before,.loading-error:after{content:"";position:absolute;width:16px;height:2px;background-color:#e74c3c;border-radius:2px}.loading-error:before{transform:rotate(45deg)}.loading-error:after{transform:rotate(-45deg)}
760
- .${W} { background: ${d}; }
761
- .${W}:hover {
762
- background: ${e ? Ze(0.05, d) : Qe(0.05, d)};
760
+ .${P} { background: ${o}; }
761
+ .${P}:hover {
762
+ background: ${e ? Qe(0.05, o) : Xe(0.05, o)};
763
763
  }
764
764
  .trigger-button-icon { color: ${i}; }
765
765
  `, document.head.appendChild(r);
766
766
  })((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");
767
767
  }
768
768
  }
769
- function et(a, t) {
769
+ function tt(a, t) {
770
770
  const n = () => {
771
- ((d) => {
771
+ ((o) => {
772
772
  var i;
773
- (i = a.contentWindow) === null || i === void 0 || i.postMessage({ type: "UPDATE_BODY_CLASS", isDarkMode: d }, "*");
773
+ (i = a.contentWindow) === null || i === void 0 || i.postMessage({ type: "UPDATE_BODY_CLASS", isDarkMode: o }, "*");
774
774
  })(document.body.classList.contains("dark"));
775
775
  };
776
776
  n(), (() => {
777
- const d = new MutationObserver(n);
778
- d.observe(document.body, { attributes: !0, attributeFilter: ["class"] }), t.addEventListener("abort", () => d.disconnect());
777
+ const o = new MutationObserver(n);
778
+ o.observe(document.body, { attributes: !0, attributeFilter: ["class"] }), t.addEventListener("abort", () => o.disconnect());
779
779
  })();
780
780
  }
781
- function tt(a, t) {
781
+ function nt(a, t) {
782
782
  let n;
783
- const d = () => {
783
+ const o = () => {
784
784
  ((r) => {
785
785
  var e;
786
- const s = { type: "UPDATE_BODY_CLASS", isMobile: r };
787
- (e = a.contentWindow) === null || e === void 0 || e.postMessage(s, "*"), r && (y.isWidgetOpen ? y.hideTriggerButton() : y.showTriggerButton());
786
+ const d = { type: "UPDATE_BODY_CLASS", isMobile: r };
787
+ (e = a.contentWindow) === null || e === void 0 || e.postMessage(d, "*"), r && (y.isWidgetOpen ? y.hideTriggerButton() : y.showTriggerButton());
788
788
  })(document.body.clientWidth <= 576);
789
789
  }, i = () => {
790
- n && clearTimeout(n), n = window.setTimeout(d, 300);
790
+ n && clearTimeout(n), n = window.setTimeout(o, 300);
791
791
  };
792
- d(), (() => {
792
+ o(), (() => {
793
793
  const r = new ResizeObserver(i);
794
794
  r.observe(document.body), t.addEventListener("abort", () => r.disconnect());
795
795
  })();
796
796
  }
797
- function K(a) {
797
+ function R(a) {
798
798
  const t = new TextEncoder().encode(a);
799
799
  if (typeof window != "undefined" && typeof window.btoa == "function") {
800
- const n = Array.from(t, (d) => String.fromCharCode(d)).join("");
800
+ const n = Array.from(t, (o) => String.fromCharCode(o)).join("");
801
801
  return btoa(n);
802
802
  }
803
803
  if (typeof Buffer != "undefined") return Buffer.from(t).toString("base64");
804
804
  throw new Error("[utils.base64Encode]: Unsupported environment");
805
805
  }
806
- const ye = /* @__PURE__ */ new Set();
807
- function nt(a, t, n) {
808
- let { isButtonHidden: d, triggerButtonIcon: i } = n;
806
+ const we = /* @__PURE__ */ new Set();
807
+ function rt(a, t, n) {
808
+ let { isButtonHidden: o, triggerButtonIcon: i } = n;
809
809
  const r = document.createDocumentFragment();
810
- if (d) y.initialize({ isButtonHidden: d });
810
+ if (o) y.initialize({ isButtonHidden: o });
811
811
  else {
812
- const { button: l, icon: o } = function(u, c) {
813
- const f = S("button", W, { id: `trigger-button-${u}`, "aria-controls": L, "aria-expanded": "false", "data-name": W }), g = S("div", "trigger-button-icon", { "aria-hidden": "true" });
812
+ const { button: l, icon: s } = function(u, c) {
813
+ const f = k("button", P, { id: `trigger-button-${u}`, "aria-controls": L, "aria-expanded": "false", "data-name": P }), g = k("div", "trigger-button-icon", { "aria-hidden": "true" });
814
814
  return g.innerHTML = c ? `
815
815
  <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256" class="close-icon">
816
816
  <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>
@@ -825,59 +825,72 @@ function nt(a, t, n) {
825
825
  </svg>
826
826
  `, f.setAttribute("aria-label", "Open Brainfish widget"), f.appendChild(g), { button: f, icon: g };
827
827
  }(a, i);
828
- r.appendChild(l), y.initialize({ button: l, icon: o });
828
+ r.appendChild(l), y.initialize({ button: l, icon: s });
829
829
  }
830
- const { iframeContainer: e, iframe: s } = function(l) {
831
- const o = S("div", L, { id: L, "aria-live": "polite", "aria-hidden": "true" }), u = S("div", "iframe-loading-indicator"), c = S("div", "spinner");
832
- u.setAttribute("aria-label", "Loading content"), u.setAttribute("role", "status"), u.appendChild(c), o.appendChild(u);
833
- const f = S("iframe", "trigger-iframe", { src: l, sandbox: "allow-scripts allow-same-origin allow-popups allow-forms", allow: "clipboard-write", role: "dialog" });
830
+ const { iframeContainer: e, iframe: d } = function(l) {
831
+ const s = k("div", L, { id: L, "aria-live": "polite", "aria-hidden": "true" }), u = k("div", "iframe-loading-indicator"), c = k("div", "spinner");
832
+ u.setAttribute("aria-label", "Loading content"), u.setAttribute("role", "status"), u.appendChild(c), s.appendChild(u);
833
+ const f = k("iframe", "trigger-iframe", { src: l, sandbox: "allow-scripts allow-same-origin allow-popups allow-forms", allow: "clipboard-write", role: "dialog" });
834
834
  return f.style.opacity = "0", f.addEventListener("load", () => {
835
835
  u.style.display = "none", f.style.opacity = "1";
836
836
  }), f.addEventListener("error", (g) => {
837
837
  console.error("Error loading iframe:", g), u.innerHTML = "";
838
- const h = S("div", "loading-error");
838
+ const h = k("div", "loading-error");
839
839
  u.appendChild(h), u.setAttribute("aria-label", "Failed to load content");
840
- }), o.appendChild(f), { iframeContainer: o, iframe: f };
840
+ }), s.appendChild(f), { iframeContainer: s, iframe: f };
841
841
  }(t);
842
- return r.appendChild(e), { fragment: r, iframe: s };
842
+ return r.appendChild(e), { fragment: r, iframe: d };
843
843
  }
844
- const rt = (a, t) => {
844
+ const at = (a, t) => {
845
845
  var n;
846
- const d = le(a.overrides), i = ((r = a.overrides) == null ? void 0 : r.widgetHost) || "https://agent.brainfi.sh";
846
+ const o = ue(a.overrides), i = ((r = a.overrides) == null ? void 0 : r.widgetHost) || "https://agent.brainfi.sh";
847
847
  var r;
848
- const { theme: e, settings: s } = t, l = K(JSON.stringify((n = a.overrides) === null || n === void 0 ? void 0 : n.redirectRules)), o = `${i}/?widgetKey=${a.widgetKey}#${new URLSearchParams({ theme: K(JSON.stringify(e)), settings: K(JSON.stringify(s)), redirectRules: l }).toString()}`, u = s == null ? void 0 : s.hideTriggerButton, c = s == null ? void 0 : s.triggerButtonIcon;
848
+ const { theme: e, settings: d } = t, l = R(JSON.stringify((n = a.overrides) === null || n === void 0 ? void 0 : n.redirectRules)), s = `${i}/?widgetKey=${a.widgetKey}#${new URLSearchParams({ theme: R(JSON.stringify(e)), settings: R(JSON.stringify(d)), redirectRules: l }).toString()}`, u = d == null ? void 0 : d.hideTriggerButton, c = d == null ? void 0 : d.triggerButtonIcon;
849
849
  try {
850
- if (f = a.widgetKey, ye.has(f) || function(k) {
851
- return !!document.getElementById(`trigger-button-${k}`);
850
+ if (f = a.widgetKey, we.has(f) || function(_) {
851
+ return !!document.getElementById(`trigger-button-${_}`);
852
852
  }(a.widgetKey)) return;
853
- Xe(t);
854
- const { fragment: g, iframe: h } = nt(a.widgetKey, o, { isButtonHidden: u || !1, triggerButtonIcon: c || "" }), p = new AbortController(), { signal: m } = p;
853
+ et(t);
854
+ const { fragment: g, iframe: h } = rt(a.widgetKey, s, { isButtonHidden: u || !1, triggerButtonIcon: c || "" }), p = new AbortController(), { signal: m } = p;
855
855
  h.onload = () => {
856
856
  setTimeout(() => {
857
- et(h, m), Ne({ widgetHost: i, apiHost: d, widgetKey: a.widgetKey, signal: m }), tt(h, m);
857
+ tt(h, m), De({ widgetHost: i, apiHost: o, widgetKey: a.widgetKey, signal: m }), nt(h, m);
858
858
  }, 0);
859
- }, document.body.appendChild(g), ye.add(a.widgetKey);
859
+ }, document.body.appendChild(g), we.add(a.widgetKey);
860
860
  const b = () => {
861
861
  p.abort(), window.removeEventListener("beforeunload", b);
862
862
  };
863
863
  return void window.addEventListener("beforeunload", b);
864
864
  } catch (g) {
865
865
  (function(h, p, m) {
866
- _(h, p, p.message, m);
867
- })(d, g, a.widgetKey);
866
+ S(h, p, p.message, m);
867
+ })(o, g, a.widgetKey);
868
868
  }
869
869
  var f;
870
870
  };
871
- let T = null;
872
- const B = typeof window != "undefined" && window.Brainfish ? window.Brainfish : (T || (T = /* @__PURE__ */ function() {
871
+ var de = ((a) => (a.FRESHCHAT = "freshchat", a.INTERCOM = "intercom", a.ZENDESK = "zendesk", a.HELPSCOUT = "helpscout", a))(de || {});
872
+ const it = (a) => v(void 0, null, function* () {
873
+ const t = ((n) => {
874
+ var o;
875
+ const { settings: i } = n;
876
+ return i == null || !i.nextBestActions || i.nextBestActions.length === 0 || i.nextBestActions.every((r) => r.type !== j.CALLBACK) ? null : !((o = i.nextBestActions) === null || o === void 0) && o.some((r) => r.value.toString().indexOf("fcWidget") !== -1) ? de.FRESHCHAT : null;
877
+ })(a);
878
+ t && t === de.FRESHCHAT && (yield v(void 0, null, function* () {
879
+ window.fcWidget || (yield new Promise((n) => setTimeout(n, 100))), window.fcWidget.hide(), window.fcWidget.on("widget:closed", () => {
880
+ window.fcWidget.hide();
881
+ });
882
+ }));
883
+ });
884
+ let W = null;
885
+ const A = typeof window != "undefined" && window.Brainfish ? window.Brainfish : (W || (W = /* @__PURE__ */ function() {
873
886
  let a = [], t = null;
874
887
  function n(i, r) {
875
888
  if (t) {
876
889
  const e = i.split(".");
877
- let s = t;
878
- for (let o = 0; o < e.length - 1; o++) s = s[e[o]];
879
- const l = s[e[e.length - 1]];
880
- if (typeof l == "function") return l.apply(s, r);
890
+ let d = t;
891
+ for (let s = 0; s < e.length - 1; s++) d = d[e[s]];
892
+ const l = d[e[e.length - 1]];
893
+ if (typeof l == "function") return l.apply(d, r);
881
894
  } else a.push([i, r]);
882
895
  }
883
896
  return { Widgets: { init: function() {
@@ -907,46 +920,46 @@ const B = typeof window != "undefined" && window.Brainfish ? window.Brainfish :
907
920
  n(r, e);
908
921
  }
909
922
  } };
910
- }(), typeof window != "undefined" && (window.Brainfish = T)), T);
923
+ }(), typeof window != "undefined" && (window.Brainfish = W)), W);
911
924
  let z = null;
912
- B.Widgets.isReady = !1, B.Widgets.identify = (a) => {
925
+ A.Widgets.isReady = !1, A.Widgets.identify = (a) => {
913
926
  window.BrainfishAnalytics("identify", a);
914
- }, B.Widgets.init = (a) => v(void 0, null, function* () {
927
+ }, A.Widgets.init = (a) => v(void 0, null, function* () {
915
928
  window && (window.BrainfishAnalytics = window.BrainfishAnalytics || function() {
916
- for (var r = arguments.length, e = new Array(r), s = 0; s < r; s++) e[s] = arguments[s];
929
+ for (var r = arguments.length, e = new Array(r), d = 0; d < r; d++) e[d] = arguments[d];
917
930
  (window.BrainfishAnalytics.q = window.BrainfishAnalytics.q || []).push(e);
918
931
  });
919
- const t = le(a.overrides), n = ((d = a.overrides) == null ? void 0 : d.analyticsApiHost) || "";
920
- var d;
932
+ const t = ue(a.overrides), n = ((o = a.overrides) == null ? void 0 : o.analyticsApiHost) || "";
933
+ var o;
921
934
  let i;
922
935
  if (a.config) i = JSON.parse(((r) => {
923
936
  if (typeof window != "undefined" && typeof window.atob == "function") {
924
- const e = atob(r), s = e.length, l = new Uint8Array(s);
925
- for (let o = 0; o < s; o++) l[o] = e.charCodeAt(o);
937
+ const e = atob(r), d = e.length, l = new Uint8Array(d);
938
+ for (let s = 0; s < d; s++) l[s] = e.charCodeAt(s);
926
939
  return new TextDecoder().decode(l);
927
940
  }
928
941
  if (typeof Buffer != "undefined") return Buffer.from(r, "base64").toString("utf-8");
929
942
  throw new Error("[utils.base64Decode]: Unsupported environment");
930
943
  })(a.config));
931
944
  else {
932
- const { config: r } = yield $e({ widgetKey: a.widgetKey, apiHost: t });
945
+ const { config: r } = yield Ke({ widgetKey: a.widgetKey, apiHost: t });
933
946
  i = r;
934
947
  }
935
- z || (z = function(r, e, s, l) {
948
+ z || (z = function(r, e, d, l) {
936
949
  return v(this, null, function* () {
937
- var o, u, c, f, g;
938
- const h = ((o = r.overrides) === null || o === void 0 ? void 0 : o.enableRecording) || (e == null || (u = e.settings) === null || u === void 0 ? void 0 : u.enableRecording) || !1, p = ((c = r.overrides) === null || c === void 0 ? void 0 : c.version) || (e == null ? void 0 : e.version), m = [];
939
- p != null && p.startsWith("2.") ? rt(r, e) : m.push(Re(r, e)), m.push(qe(r.widgetKey, e.trackingToken || "", s, l, h, (e == null || (f = e.settings) === null || f === void 0 ? void 0 : f.recordingBlocklist) || [], e == null || (g = e.settings) === null || g === void 0 ? void 0 : g._allowLocalhostRecording));
950
+ var s, u, c, f, g;
951
+ const h = ((s = r.overrides) === null || s === void 0 ? void 0 : s.enableRecording) || (e == null || (u = e.settings) === null || u === void 0 ? void 0 : u.enableRecording) || !1, p = ((c = r.overrides) === null || c === void 0 ? void 0 : c.version) || (e == null ? void 0 : e.version), m = [];
952
+ p != null && p.startsWith("2.") ? at(r, e) : m.push(Ne(r, e)), m.push(qe(r.widgetKey, e.trackingToken || "", d, l, h, (e == null || (f = e.settings) === null || f === void 0 ? void 0 : f.recordingBlocklist) || [], e == null || (g = e.settings) === null || g === void 0 ? void 0 : g._allowLocalhostRecording));
940
953
  const [b] = yield Promise.allSettled(m);
941
- b && b.status === "fulfilled" && b.value && B._setRealBrainfish(b.value);
954
+ b && b.status === "fulfilled" && b.value && A._setRealBrainfish(b.value);
942
955
  });
943
- }(a, i, t, n)), yield z, B.Widgets.isReady = !0, window.dispatchEvent(new Event("onBrainfishReady"));
956
+ }(a, i, t, n)), yield z, yield it(i), A.Widgets.isReady = !0, window.dispatchEvent(new Event("onBrainfishReady"));
944
957
  });
945
- const it = function() {
958
+ const st = function() {
946
959
  typeof window != "undefined" && window.BrainfishAnalytics && window.BrainfishAnalytics(...arguments);
947
960
  };
948
961
  export {
949
- it as BrainfishAnalytics,
950
- B as default
962
+ st as BrainfishAnalytics,
963
+ A as default
951
964
  };
952
965
  //# sourceMappingURL=web.js.map