@gymmymac/bob-widget 1.1.0 → 1.1.3
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/README.md +67 -27
- package/dist/index.d.ts +1 -0
- package/dist/index.js +13 -13
- package/dist/index.mjs +1313 -2005
- package/dist/version.d.ts +6 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
};
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
import * as we from "react";
|
|
7
|
-
import Tt, { createContext as Lr, useMemo as Ft, useContext as Mr, useState as Q, useRef as H, useEffect as se, useCallback as G } from "react";
|
|
8
|
-
import { createClient as Fr } from "@supabase/supabase-js";
|
|
9
|
-
var Wt = { exports: {} }, wt = {};
|
|
1
|
+
import He, { createContext as Tt, useMemo as rt, useContext as Et, useState as U, useRef as V, useEffect as X, useCallback as q } from "react";
|
|
2
|
+
import { createClient as jt } from "@supabase/supabase-js";
|
|
3
|
+
import { useQueryClient as Rt, useQuery as ht } from "@tanstack/react-query";
|
|
4
|
+
const gt = "1.1.3", Gt = () => gt;
|
|
5
|
+
var it = { exports: {} }, Ye = {};
|
|
10
6
|
/**
|
|
11
7
|
* @license React
|
|
12
8
|
* react-jsx-runtime.production.min.js
|
|
@@ -16,21 +12,21 @@ var Wt = { exports: {} }, wt = {};
|
|
|
16
12
|
* This source code is licensed under the MIT license found in the
|
|
17
13
|
* LICENSE file in the root directory of this source tree.
|
|
18
14
|
*/
|
|
19
|
-
var
|
|
20
|
-
function
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
var
|
|
24
|
-
function
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
for (
|
|
28
|
-
if (
|
|
29
|
-
return { $$typeof:
|
|
15
|
+
var ct;
|
|
16
|
+
function Ct() {
|
|
17
|
+
if (ct) return Ye;
|
|
18
|
+
ct = 1;
|
|
19
|
+
var n = He, l = Symbol.for("react.element"), i = Symbol.for("react.fragment"), f = Object.prototype.hasOwnProperty, d = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, _ = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
20
|
+
function b(E, g, x) {
|
|
21
|
+
var u, p = {}, h = null, j = null;
|
|
22
|
+
x !== void 0 && (h = "" + x), g.key !== void 0 && (h = "" + g.key), g.ref !== void 0 && (j = g.ref);
|
|
23
|
+
for (u in g) f.call(g, u) && !_.hasOwnProperty(u) && (p[u] = g[u]);
|
|
24
|
+
if (E && E.defaultProps) for (u in g = E.defaultProps, g) p[u] === void 0 && (p[u] = g[u]);
|
|
25
|
+
return { $$typeof: l, type: E, key: h, ref: j, props: p, _owner: d.current };
|
|
30
26
|
}
|
|
31
|
-
return
|
|
27
|
+
return Ye.Fragment = i, Ye.jsx = b, Ye.jsxs = b, Ye;
|
|
32
28
|
}
|
|
33
|
-
var
|
|
29
|
+
var Ge = {};
|
|
34
30
|
/**
|
|
35
31
|
* @license React
|
|
36
32
|
* react-jsx-runtime.development.js
|
|
@@ -40,91 +36,91 @@ var Et = {};
|
|
|
40
36
|
* This source code is licensed under the MIT license found in the
|
|
41
37
|
* LICENSE file in the root directory of this source tree.
|
|
42
38
|
*/
|
|
43
|
-
var
|
|
44
|
-
function
|
|
45
|
-
return
|
|
46
|
-
var
|
|
47
|
-
function
|
|
48
|
-
if (
|
|
39
|
+
var ut;
|
|
40
|
+
function kt() {
|
|
41
|
+
return ut || (ut = 1, process.env.NODE_ENV !== "production" && function() {
|
|
42
|
+
var n = He, l = Symbol.for("react.element"), i = Symbol.for("react.portal"), f = Symbol.for("react.fragment"), d = Symbol.for("react.strict_mode"), _ = Symbol.for("react.profiler"), b = Symbol.for("react.provider"), E = Symbol.for("react.context"), g = Symbol.for("react.forward_ref"), x = Symbol.for("react.suspense"), u = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), h = Symbol.for("react.lazy"), j = Symbol.for("react.offscreen"), C = Symbol.iterator, P = "@@iterator";
|
|
43
|
+
function R(e) {
|
|
44
|
+
if (e === null || typeof e != "object")
|
|
49
45
|
return null;
|
|
50
|
-
var
|
|
51
|
-
return typeof
|
|
46
|
+
var r = C && e[C] || e[P];
|
|
47
|
+
return typeof r == "function" ? r : null;
|
|
52
48
|
}
|
|
53
|
-
var I =
|
|
54
|
-
function
|
|
49
|
+
var I = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
50
|
+
function s(e) {
|
|
55
51
|
{
|
|
56
|
-
for (var
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
for (var r = arguments.length, c = new Array(r > 1 ? r - 1 : 0), T = 1; T < r; T++)
|
|
53
|
+
c[T - 1] = arguments[T];
|
|
54
|
+
m("error", e, c);
|
|
59
55
|
}
|
|
60
56
|
}
|
|
61
|
-
function
|
|
57
|
+
function m(e, r, c) {
|
|
62
58
|
{
|
|
63
|
-
var
|
|
64
|
-
|
|
65
|
-
var
|
|
66
|
-
return String(
|
|
59
|
+
var T = I.ReactDebugCurrentFrame, D = T.getStackAddendum();
|
|
60
|
+
D !== "" && (r += "%s", c = c.concat([D]));
|
|
61
|
+
var W = c.map(function(A) {
|
|
62
|
+
return String(A);
|
|
67
63
|
});
|
|
68
|
-
|
|
64
|
+
W.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, W);
|
|
69
65
|
}
|
|
70
66
|
}
|
|
71
|
-
var
|
|
72
|
-
|
|
73
|
-
function
|
|
74
|
-
return !!(typeof
|
|
67
|
+
var v = !1, a = !1, o = !1, w = !1, k = !1, N;
|
|
68
|
+
N = Symbol.for("react.module.reference");
|
|
69
|
+
function O(e) {
|
|
70
|
+
return !!(typeof e == "string" || typeof e == "function" || e === f || e === _ || k || e === d || e === x || e === u || w || e === j || v || a || o || typeof e == "object" && e !== null && (e.$$typeof === h || e.$$typeof === p || e.$$typeof === b || e.$$typeof === E || e.$$typeof === g || // This needs to include all possible module reference object
|
|
75
71
|
// types supported by any Flight configuration anywhere since
|
|
76
72
|
// we don't know which Flight build this will end up being used
|
|
77
73
|
// with.
|
|
78
|
-
|
|
74
|
+
e.$$typeof === N || e.getModuleId !== void 0));
|
|
79
75
|
}
|
|
80
|
-
function
|
|
81
|
-
var
|
|
82
|
-
if (
|
|
83
|
-
return
|
|
84
|
-
var
|
|
85
|
-
return
|
|
76
|
+
function y(e, r, c) {
|
|
77
|
+
var T = e.displayName;
|
|
78
|
+
if (T)
|
|
79
|
+
return T;
|
|
80
|
+
var D = r.displayName || r.name || "";
|
|
81
|
+
return D !== "" ? c + "(" + D + ")" : c;
|
|
86
82
|
}
|
|
87
|
-
function M(
|
|
88
|
-
return
|
|
83
|
+
function M(e) {
|
|
84
|
+
return e.displayName || "Context";
|
|
89
85
|
}
|
|
90
|
-
function
|
|
91
|
-
if (
|
|
86
|
+
function $(e) {
|
|
87
|
+
if (e == null)
|
|
92
88
|
return null;
|
|
93
|
-
if (typeof
|
|
94
|
-
return
|
|
95
|
-
if (typeof
|
|
96
|
-
return
|
|
97
|
-
switch (
|
|
98
|
-
case
|
|
89
|
+
if (typeof e.tag == "number" && s("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
90
|
+
return e.displayName || e.name || null;
|
|
91
|
+
if (typeof e == "string")
|
|
92
|
+
return e;
|
|
93
|
+
switch (e) {
|
|
94
|
+
case f:
|
|
99
95
|
return "Fragment";
|
|
100
|
-
case
|
|
96
|
+
case i:
|
|
101
97
|
return "Portal";
|
|
102
|
-
case
|
|
98
|
+
case _:
|
|
103
99
|
return "Profiler";
|
|
104
|
-
case
|
|
100
|
+
case d:
|
|
105
101
|
return "StrictMode";
|
|
106
|
-
case
|
|
102
|
+
case x:
|
|
107
103
|
return "Suspense";
|
|
108
|
-
case
|
|
104
|
+
case u:
|
|
109
105
|
return "SuspenseList";
|
|
110
106
|
}
|
|
111
|
-
if (typeof
|
|
112
|
-
switch (
|
|
107
|
+
if (typeof e == "object")
|
|
108
|
+
switch (e.$$typeof) {
|
|
109
|
+
case E:
|
|
110
|
+
var r = e;
|
|
111
|
+
return M(r) + ".Consumer";
|
|
112
|
+
case b:
|
|
113
|
+
var c = e;
|
|
114
|
+
return M(c._context) + ".Provider";
|
|
113
115
|
case g:
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return R(r, r.render, "ForwardRef");
|
|
121
|
-
case l:
|
|
122
|
-
var O = r.displayName || null;
|
|
123
|
-
return O !== null ? O : A(r.type) || "Memo";
|
|
124
|
-
case v: {
|
|
125
|
-
var W = r, q = W._payload, $ = W._init;
|
|
116
|
+
return y(e, e.render, "ForwardRef");
|
|
117
|
+
case p:
|
|
118
|
+
var T = e.displayName || null;
|
|
119
|
+
return T !== null ? T : $(e.type) || "Memo";
|
|
120
|
+
case h: {
|
|
121
|
+
var D = e, W = D._payload, A = D._init;
|
|
126
122
|
try {
|
|
127
|
-
return A(
|
|
123
|
+
return $(A(W));
|
|
128
124
|
} catch {
|
|
129
125
|
return null;
|
|
130
126
|
}
|
|
@@ -132,636 +128,647 @@ function Ar() {
|
|
|
132
128
|
}
|
|
133
129
|
return null;
|
|
134
130
|
}
|
|
135
|
-
var
|
|
136
|
-
function
|
|
131
|
+
var S = Object.assign, H = 0, ge, F, ee, re, be, K, Ee;
|
|
132
|
+
function Je() {
|
|
137
133
|
}
|
|
138
|
-
|
|
139
|
-
function
|
|
134
|
+
Je.__reactDisabledLog = !0;
|
|
135
|
+
function ie() {
|
|
140
136
|
{
|
|
141
|
-
if (
|
|
142
|
-
|
|
143
|
-
var
|
|
137
|
+
if (H === 0) {
|
|
138
|
+
ge = console.log, F = console.info, ee = console.warn, re = console.error, be = console.group, K = console.groupCollapsed, Ee = console.groupEnd;
|
|
139
|
+
var e = {
|
|
144
140
|
configurable: !0,
|
|
145
141
|
enumerable: !0,
|
|
146
|
-
value:
|
|
142
|
+
value: Je,
|
|
147
143
|
writable: !0
|
|
148
144
|
};
|
|
149
145
|
Object.defineProperties(console, {
|
|
150
|
-
info:
|
|
151
|
-
log:
|
|
152
|
-
warn:
|
|
153
|
-
error:
|
|
154
|
-
group:
|
|
155
|
-
groupCollapsed:
|
|
156
|
-
groupEnd:
|
|
146
|
+
info: e,
|
|
147
|
+
log: e,
|
|
148
|
+
warn: e,
|
|
149
|
+
error: e,
|
|
150
|
+
group: e,
|
|
151
|
+
groupCollapsed: e,
|
|
152
|
+
groupEnd: e
|
|
157
153
|
});
|
|
158
154
|
}
|
|
159
|
-
|
|
155
|
+
H++;
|
|
160
156
|
}
|
|
161
157
|
}
|
|
162
|
-
function
|
|
158
|
+
function nt() {
|
|
163
159
|
{
|
|
164
|
-
if (
|
|
165
|
-
var
|
|
160
|
+
if (H--, H === 0) {
|
|
161
|
+
var e = {
|
|
166
162
|
configurable: !0,
|
|
167
163
|
enumerable: !0,
|
|
168
164
|
writable: !0
|
|
169
165
|
};
|
|
170
166
|
Object.defineProperties(console, {
|
|
171
|
-
log:
|
|
172
|
-
value:
|
|
167
|
+
log: S({}, e, {
|
|
168
|
+
value: ge
|
|
173
169
|
}),
|
|
174
|
-
info:
|
|
175
|
-
value:
|
|
170
|
+
info: S({}, e, {
|
|
171
|
+
value: F
|
|
176
172
|
}),
|
|
177
|
-
warn:
|
|
178
|
-
value:
|
|
173
|
+
warn: S({}, e, {
|
|
174
|
+
value: ee
|
|
179
175
|
}),
|
|
180
|
-
error:
|
|
181
|
-
value:
|
|
176
|
+
error: S({}, e, {
|
|
177
|
+
value: re
|
|
182
178
|
}),
|
|
183
|
-
group:
|
|
184
|
-
value:
|
|
179
|
+
group: S({}, e, {
|
|
180
|
+
value: be
|
|
185
181
|
}),
|
|
186
|
-
groupCollapsed:
|
|
187
|
-
value:
|
|
182
|
+
groupCollapsed: S({}, e, {
|
|
183
|
+
value: K
|
|
188
184
|
}),
|
|
189
|
-
groupEnd:
|
|
190
|
-
value:
|
|
185
|
+
groupEnd: S({}, e, {
|
|
186
|
+
value: Ee
|
|
191
187
|
})
|
|
192
188
|
});
|
|
193
189
|
}
|
|
194
|
-
|
|
190
|
+
H < 0 && s("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
195
191
|
}
|
|
196
192
|
}
|
|
197
|
-
var
|
|
198
|
-
function
|
|
193
|
+
var Ae = I.ReactCurrentDispatcher, Xe;
|
|
194
|
+
function Fe(e, r, c) {
|
|
199
195
|
{
|
|
200
|
-
if (
|
|
196
|
+
if (Xe === void 0)
|
|
201
197
|
try {
|
|
202
198
|
throw Error();
|
|
203
|
-
} catch (
|
|
204
|
-
var
|
|
205
|
-
|
|
199
|
+
} catch (D) {
|
|
200
|
+
var T = D.stack.trim().match(/\n( *(at )?)/);
|
|
201
|
+
Xe = T && T[1] || "";
|
|
206
202
|
}
|
|
207
203
|
return `
|
|
208
|
-
` +
|
|
204
|
+
` + Xe + e;
|
|
209
205
|
}
|
|
210
206
|
}
|
|
211
|
-
var
|
|
207
|
+
var Qe = !1, We;
|
|
212
208
|
{
|
|
213
|
-
var
|
|
214
|
-
|
|
209
|
+
var lt = typeof WeakMap == "function" ? WeakMap : Map;
|
|
210
|
+
We = new lt();
|
|
215
211
|
}
|
|
216
|
-
function
|
|
217
|
-
if (!
|
|
212
|
+
function st(e, r) {
|
|
213
|
+
if (!e || Qe)
|
|
218
214
|
return "";
|
|
219
215
|
{
|
|
220
|
-
var
|
|
221
|
-
if (
|
|
222
|
-
return
|
|
216
|
+
var c = We.get(e);
|
|
217
|
+
if (c !== void 0)
|
|
218
|
+
return c;
|
|
223
219
|
}
|
|
224
|
-
var
|
|
225
|
-
|
|
226
|
-
var
|
|
220
|
+
var T;
|
|
221
|
+
Qe = !0;
|
|
222
|
+
var D = Error.prepareStackTrace;
|
|
227
223
|
Error.prepareStackTrace = void 0;
|
|
228
|
-
var
|
|
229
|
-
|
|
224
|
+
var W;
|
|
225
|
+
W = Ae.current, Ae.current = null, ie();
|
|
230
226
|
try {
|
|
231
|
-
if (
|
|
232
|
-
var
|
|
227
|
+
if (r) {
|
|
228
|
+
var A = function() {
|
|
233
229
|
throw Error();
|
|
234
230
|
};
|
|
235
|
-
if (Object.defineProperty(
|
|
231
|
+
if (Object.defineProperty(A.prototype, "props", {
|
|
236
232
|
set: function() {
|
|
237
233
|
throw Error();
|
|
238
234
|
}
|
|
239
235
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
240
236
|
try {
|
|
241
|
-
Reflect.construct(
|
|
242
|
-
} catch (
|
|
243
|
-
|
|
237
|
+
Reflect.construct(A, []);
|
|
238
|
+
} catch (te) {
|
|
239
|
+
T = te;
|
|
244
240
|
}
|
|
245
|
-
Reflect.construct(
|
|
241
|
+
Reflect.construct(e, [], A);
|
|
246
242
|
} else {
|
|
247
243
|
try {
|
|
248
|
-
|
|
249
|
-
} catch (
|
|
250
|
-
|
|
244
|
+
A.call();
|
|
245
|
+
} catch (te) {
|
|
246
|
+
T = te;
|
|
251
247
|
}
|
|
252
|
-
|
|
248
|
+
e.call(A.prototype);
|
|
253
249
|
}
|
|
254
250
|
} else {
|
|
255
251
|
try {
|
|
256
252
|
throw Error();
|
|
257
|
-
} catch (
|
|
258
|
-
|
|
253
|
+
} catch (te) {
|
|
254
|
+
T = te;
|
|
259
255
|
}
|
|
260
|
-
|
|
256
|
+
e();
|
|
261
257
|
}
|
|
262
|
-
} catch (
|
|
263
|
-
if (
|
|
264
|
-
for (var
|
|
265
|
-
`),
|
|
266
|
-
`),
|
|
267
|
-
|
|
268
|
-
for (;
|
|
269
|
-
if (
|
|
270
|
-
if (
|
|
258
|
+
} catch (te) {
|
|
259
|
+
if (te && T && typeof te.stack == "string") {
|
|
260
|
+
for (var L = te.stack.split(`
|
|
261
|
+
`), Z = T.stack.split(`
|
|
262
|
+
`), z = L.length - 1, Y = Z.length - 1; z >= 1 && Y >= 0 && L[z] !== Z[Y]; )
|
|
263
|
+
Y--;
|
|
264
|
+
for (; z >= 1 && Y >= 0; z--, Y--)
|
|
265
|
+
if (L[z] !== Z[Y]) {
|
|
266
|
+
if (z !== 1 || Y !== 1)
|
|
271
267
|
do
|
|
272
|
-
if (
|
|
273
|
-
var
|
|
274
|
-
` +
|
|
275
|
-
return
|
|
268
|
+
if (z--, Y--, Y < 0 || L[z] !== Z[Y]) {
|
|
269
|
+
var oe = `
|
|
270
|
+
` + L[z].replace(" at new ", " at ");
|
|
271
|
+
return e.displayName && oe.includes("<anonymous>") && (oe = oe.replace("<anonymous>", e.displayName)), typeof e == "function" && We.set(e, oe), oe;
|
|
276
272
|
}
|
|
277
|
-
while (
|
|
273
|
+
while (z >= 1 && Y >= 0);
|
|
278
274
|
break;
|
|
279
275
|
}
|
|
280
276
|
}
|
|
281
277
|
} finally {
|
|
282
|
-
|
|
278
|
+
Qe = !1, Ae.current = W, nt(), Error.prepareStackTrace = D;
|
|
283
279
|
}
|
|
284
|
-
var
|
|
285
|
-
return typeof
|
|
280
|
+
var De = e ? e.displayName || e.name : "", Pe = De ? Fe(De) : "";
|
|
281
|
+
return typeof e == "function" && We.set(e, Pe), Pe;
|
|
286
282
|
}
|
|
287
|
-
function
|
|
288
|
-
return
|
|
283
|
+
function Ze(e, r, c) {
|
|
284
|
+
return st(e, !1);
|
|
289
285
|
}
|
|
290
|
-
function
|
|
291
|
-
var
|
|
292
|
-
return !!(
|
|
286
|
+
function et(e) {
|
|
287
|
+
var r = e.prototype;
|
|
288
|
+
return !!(r && r.isReactComponent);
|
|
293
289
|
}
|
|
294
|
-
function
|
|
295
|
-
if (
|
|
290
|
+
function je(e, r, c) {
|
|
291
|
+
if (e == null)
|
|
296
292
|
return "";
|
|
297
|
-
if (typeof
|
|
298
|
-
return
|
|
299
|
-
if (typeof
|
|
300
|
-
return
|
|
301
|
-
switch (
|
|
302
|
-
case
|
|
303
|
-
return
|
|
304
|
-
case
|
|
305
|
-
return
|
|
293
|
+
if (typeof e == "function")
|
|
294
|
+
return st(e, et(e));
|
|
295
|
+
if (typeof e == "string")
|
|
296
|
+
return Fe(e);
|
|
297
|
+
switch (e) {
|
|
298
|
+
case x:
|
|
299
|
+
return Fe("Suspense");
|
|
300
|
+
case u:
|
|
301
|
+
return Fe("SuspenseList");
|
|
306
302
|
}
|
|
307
|
-
if (typeof
|
|
308
|
-
switch (
|
|
309
|
-
case
|
|
310
|
-
return
|
|
311
|
-
case
|
|
312
|
-
return
|
|
313
|
-
case
|
|
314
|
-
var
|
|
303
|
+
if (typeof e == "object")
|
|
304
|
+
switch (e.$$typeof) {
|
|
305
|
+
case g:
|
|
306
|
+
return Ze(e.render);
|
|
307
|
+
case p:
|
|
308
|
+
return je(e.type, r, c);
|
|
309
|
+
case h: {
|
|
310
|
+
var T = e, D = T._payload, W = T._init;
|
|
315
311
|
try {
|
|
316
|
-
return
|
|
312
|
+
return je(W(D), r, c);
|
|
317
313
|
} catch {
|
|
318
314
|
}
|
|
319
315
|
}
|
|
320
316
|
}
|
|
321
317
|
return "";
|
|
322
318
|
}
|
|
323
|
-
var
|
|
324
|
-
function
|
|
325
|
-
if (
|
|
326
|
-
var
|
|
327
|
-
|
|
319
|
+
var ve = Object.prototype.hasOwnProperty, B = {}, G = I.ReactDebugCurrentFrame;
|
|
320
|
+
function Q(e) {
|
|
321
|
+
if (e) {
|
|
322
|
+
var r = e._owner, c = je(e.type, e._source, r ? r.type : null);
|
|
323
|
+
G.setExtraStackFrame(c);
|
|
328
324
|
} else
|
|
329
|
-
|
|
325
|
+
G.setExtraStackFrame(null);
|
|
330
326
|
}
|
|
331
|
-
function
|
|
327
|
+
function ne(e, r, c, T, D) {
|
|
332
328
|
{
|
|
333
|
-
var
|
|
334
|
-
for (var
|
|
335
|
-
if (
|
|
336
|
-
var
|
|
329
|
+
var W = Function.call.bind(ve);
|
|
330
|
+
for (var A in e)
|
|
331
|
+
if (W(e, A)) {
|
|
332
|
+
var L = void 0;
|
|
337
333
|
try {
|
|
338
|
-
if (typeof
|
|
339
|
-
var
|
|
340
|
-
throw
|
|
334
|
+
if (typeof e[A] != "function") {
|
|
335
|
+
var Z = Error((T || "React class") + ": " + c + " type `" + A + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[A] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
336
|
+
throw Z.name = "Invariant Violation", Z;
|
|
341
337
|
}
|
|
342
|
-
|
|
343
|
-
} catch (
|
|
344
|
-
|
|
338
|
+
L = e[A](r, A, T, c, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
339
|
+
} catch (z) {
|
|
340
|
+
L = z;
|
|
345
341
|
}
|
|
346
|
-
|
|
342
|
+
L && !(L instanceof Error) && (Q(D), s("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", T || "React class", c, A, typeof L), Q(null)), L instanceof Error && !(L.message in B) && (B[L.message] = !0, Q(D), s("Failed %s type: %s", c, L.message), Q(null));
|
|
347
343
|
}
|
|
348
344
|
}
|
|
349
345
|
}
|
|
350
|
-
var
|
|
351
|
-
function
|
|
352
|
-
return
|
|
346
|
+
var xe = Array.isArray;
|
|
347
|
+
function Re(e) {
|
|
348
|
+
return xe(e);
|
|
353
349
|
}
|
|
354
|
-
function
|
|
350
|
+
function Ce(e) {
|
|
355
351
|
{
|
|
356
|
-
var
|
|
357
|
-
return
|
|
352
|
+
var r = typeof Symbol == "function" && Symbol.toStringTag, c = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
353
|
+
return c;
|
|
358
354
|
}
|
|
359
355
|
}
|
|
360
|
-
function
|
|
356
|
+
function ke(e) {
|
|
361
357
|
try {
|
|
362
|
-
return
|
|
358
|
+
return Se(e), !1;
|
|
363
359
|
} catch {
|
|
364
360
|
return !0;
|
|
365
361
|
}
|
|
366
362
|
}
|
|
367
|
-
function
|
|
368
|
-
return "" +
|
|
363
|
+
function Se(e) {
|
|
364
|
+
return "" + e;
|
|
369
365
|
}
|
|
370
|
-
function
|
|
371
|
-
if (
|
|
372
|
-
return
|
|
366
|
+
function ye(e) {
|
|
367
|
+
if (ke(e))
|
|
368
|
+
return s("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ce(e)), Se(e);
|
|
373
369
|
}
|
|
374
|
-
var
|
|
370
|
+
var we = I.ReactCurrentOwner, le = {
|
|
375
371
|
key: !0,
|
|
376
372
|
ref: !0,
|
|
377
373
|
__self: !0,
|
|
378
374
|
__source: !0
|
|
379
|
-
},
|
|
380
|
-
function
|
|
381
|
-
if (
|
|
382
|
-
var
|
|
383
|
-
if (
|
|
375
|
+
}, Ie, Ne;
|
|
376
|
+
function pe(e) {
|
|
377
|
+
if (ve.call(e, "ref")) {
|
|
378
|
+
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
379
|
+
if (r && r.isReactWarning)
|
|
384
380
|
return !1;
|
|
385
381
|
}
|
|
386
|
-
return
|
|
382
|
+
return e.ref !== void 0;
|
|
387
383
|
}
|
|
388
|
-
function
|
|
389
|
-
if (
|
|
390
|
-
var
|
|
391
|
-
if (
|
|
384
|
+
function ce(e) {
|
|
385
|
+
if (ve.call(e, "key")) {
|
|
386
|
+
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
387
|
+
if (r && r.isReactWarning)
|
|
392
388
|
return !1;
|
|
393
389
|
}
|
|
394
|
-
return
|
|
390
|
+
return e.key !== void 0;
|
|
395
391
|
}
|
|
396
|
-
function
|
|
397
|
-
typeof
|
|
392
|
+
function me(e, r) {
|
|
393
|
+
typeof e.ref == "string" && we.current;
|
|
398
394
|
}
|
|
399
|
-
function
|
|
395
|
+
function Oe(e, r) {
|
|
400
396
|
{
|
|
401
|
-
var
|
|
402
|
-
|
|
397
|
+
var c = function() {
|
|
398
|
+
Ie || (Ie = !0, s("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
403
399
|
};
|
|
404
|
-
|
|
405
|
-
get:
|
|
400
|
+
c.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
401
|
+
get: c,
|
|
406
402
|
configurable: !0
|
|
407
403
|
});
|
|
408
404
|
}
|
|
409
405
|
}
|
|
410
|
-
function
|
|
406
|
+
function ue(e, r) {
|
|
411
407
|
{
|
|
412
|
-
var
|
|
413
|
-
|
|
408
|
+
var c = function() {
|
|
409
|
+
Ne || (Ne = !0, s("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
414
410
|
};
|
|
415
|
-
|
|
416
|
-
get:
|
|
411
|
+
c.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
412
|
+
get: c,
|
|
417
413
|
configurable: !0
|
|
418
414
|
});
|
|
419
415
|
}
|
|
420
416
|
}
|
|
421
|
-
var
|
|
422
|
-
var
|
|
417
|
+
var se = function(e, r, c, T, D, W, A) {
|
|
418
|
+
var L = {
|
|
423
419
|
// This tag allows us to uniquely identify this as a React Element
|
|
424
|
-
$$typeof:
|
|
420
|
+
$$typeof: l,
|
|
425
421
|
// Built-in properties that belong on the element
|
|
426
|
-
type:
|
|
427
|
-
key:
|
|
428
|
-
ref:
|
|
429
|
-
props:
|
|
422
|
+
type: e,
|
|
423
|
+
key: r,
|
|
424
|
+
ref: c,
|
|
425
|
+
props: A,
|
|
430
426
|
// Record the component responsible for creating this element.
|
|
431
|
-
_owner:
|
|
427
|
+
_owner: W
|
|
432
428
|
};
|
|
433
|
-
return
|
|
429
|
+
return L._store = {}, Object.defineProperty(L._store, "validated", {
|
|
434
430
|
configurable: !1,
|
|
435
431
|
enumerable: !1,
|
|
436
432
|
writable: !0,
|
|
437
433
|
value: !1
|
|
438
|
-
}), Object.defineProperty(
|
|
434
|
+
}), Object.defineProperty(L, "_self", {
|
|
439
435
|
configurable: !1,
|
|
440
436
|
enumerable: !1,
|
|
441
437
|
writable: !1,
|
|
442
|
-
value:
|
|
443
|
-
}), Object.defineProperty(
|
|
438
|
+
value: T
|
|
439
|
+
}), Object.defineProperty(L, "_source", {
|
|
444
440
|
configurable: !1,
|
|
445
441
|
enumerable: !1,
|
|
446
442
|
writable: !1,
|
|
447
|
-
value:
|
|
448
|
-
}), Object.freeze && (Object.freeze(
|
|
443
|
+
value: D
|
|
444
|
+
}), Object.freeze && (Object.freeze(L.props), Object.freeze(L)), L;
|
|
449
445
|
};
|
|
450
|
-
function
|
|
446
|
+
function de(e, r, c, T, D) {
|
|
451
447
|
{
|
|
452
|
-
var
|
|
453
|
-
|
|
454
|
-
for (
|
|
455
|
-
|
|
456
|
-
if (
|
|
457
|
-
var
|
|
458
|
-
for (
|
|
459
|
-
|
|
448
|
+
var W, A = {}, L = null, Z = null;
|
|
449
|
+
c !== void 0 && (ye(c), L = "" + c), ce(r) && (ye(r.key), L = "" + r.key), pe(r) && (Z = r.ref, me(r, D));
|
|
450
|
+
for (W in r)
|
|
451
|
+
ve.call(r, W) && !le.hasOwnProperty(W) && (A[W] = r[W]);
|
|
452
|
+
if (e && e.defaultProps) {
|
|
453
|
+
var z = e.defaultProps;
|
|
454
|
+
for (W in z)
|
|
455
|
+
A[W] === void 0 && (A[W] = z[W]);
|
|
460
456
|
}
|
|
461
|
-
if (
|
|
462
|
-
var
|
|
463
|
-
|
|
457
|
+
if (L || Z) {
|
|
458
|
+
var Y = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
459
|
+
L && Oe(A, Y), Z && ue(A, Y);
|
|
464
460
|
}
|
|
465
|
-
return
|
|
461
|
+
return se(e, L, Z, D, T, we.current, A);
|
|
466
462
|
}
|
|
467
463
|
}
|
|
468
|
-
var
|
|
469
|
-
function
|
|
470
|
-
if (
|
|
471
|
-
var
|
|
472
|
-
|
|
464
|
+
var he = I.ReactCurrentOwner, Ue = I.ReactDebugCurrentFrame;
|
|
465
|
+
function _e(e) {
|
|
466
|
+
if (e) {
|
|
467
|
+
var r = e._owner, c = je(e.type, e._source, r ? r.type : null);
|
|
468
|
+
Ue.setExtraStackFrame(c);
|
|
473
469
|
} else
|
|
474
|
-
|
|
470
|
+
Ue.setExtraStackFrame(null);
|
|
475
471
|
}
|
|
476
|
-
var
|
|
477
|
-
|
|
478
|
-
function
|
|
479
|
-
return typeof
|
|
472
|
+
var Me;
|
|
473
|
+
Me = !1;
|
|
474
|
+
function ae(e) {
|
|
475
|
+
return typeof e == "object" && e !== null && e.$$typeof === l;
|
|
480
476
|
}
|
|
481
|
-
function
|
|
477
|
+
function Te() {
|
|
482
478
|
{
|
|
483
|
-
if (
|
|
484
|
-
var
|
|
485
|
-
if (
|
|
479
|
+
if (he.current) {
|
|
480
|
+
var e = $(he.current.type);
|
|
481
|
+
if (e)
|
|
486
482
|
return `
|
|
487
483
|
|
|
488
|
-
Check the render method of \`` +
|
|
484
|
+
Check the render method of \`` + e + "`.";
|
|
489
485
|
}
|
|
490
486
|
return "";
|
|
491
487
|
}
|
|
492
488
|
}
|
|
493
|
-
function
|
|
489
|
+
function Ve(e) {
|
|
494
490
|
return "";
|
|
495
491
|
}
|
|
496
|
-
var
|
|
497
|
-
function
|
|
492
|
+
var fe = {};
|
|
493
|
+
function tt(e) {
|
|
498
494
|
{
|
|
499
|
-
var
|
|
500
|
-
if (!
|
|
501
|
-
var
|
|
502
|
-
|
|
495
|
+
var r = Te();
|
|
496
|
+
if (!r) {
|
|
497
|
+
var c = typeof e == "string" ? e : e.displayName || e.name;
|
|
498
|
+
c && (r = `
|
|
503
499
|
|
|
504
|
-
Check the top-level render call using <` +
|
|
500
|
+
Check the top-level render call using <` + c + ">.");
|
|
505
501
|
}
|
|
506
|
-
return
|
|
502
|
+
return r;
|
|
507
503
|
}
|
|
508
504
|
}
|
|
509
|
-
function
|
|
505
|
+
function J(e, r) {
|
|
510
506
|
{
|
|
511
|
-
if (!
|
|
507
|
+
if (!e._store || e._store.validated || e.key != null)
|
|
512
508
|
return;
|
|
513
|
-
|
|
514
|
-
var
|
|
515
|
-
if (
|
|
509
|
+
e._store.validated = !0;
|
|
510
|
+
var c = tt(r);
|
|
511
|
+
if (fe[c])
|
|
516
512
|
return;
|
|
517
|
-
|
|
518
|
-
var
|
|
519
|
-
|
|
513
|
+
fe[c] = !0;
|
|
514
|
+
var T = "";
|
|
515
|
+
e && e._owner && e._owner !== he.current && (T = " It was passed a child from " + $(e._owner.type) + "."), _e(e), s('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', c, T), _e(null);
|
|
520
516
|
}
|
|
521
517
|
}
|
|
522
|
-
function
|
|
518
|
+
function Ke(e, r) {
|
|
523
519
|
{
|
|
524
|
-
if (typeof
|
|
520
|
+
if (typeof e != "object")
|
|
525
521
|
return;
|
|
526
|
-
if (
|
|
527
|
-
for (var
|
|
528
|
-
var
|
|
529
|
-
|
|
522
|
+
if (Re(e))
|
|
523
|
+
for (var c = 0; c < e.length; c++) {
|
|
524
|
+
var T = e[c];
|
|
525
|
+
ae(T) && J(T, r);
|
|
530
526
|
}
|
|
531
|
-
else if (
|
|
532
|
-
|
|
533
|
-
else if (
|
|
534
|
-
var
|
|
535
|
-
if (typeof
|
|
536
|
-
for (var
|
|
537
|
-
|
|
527
|
+
else if (ae(e))
|
|
528
|
+
e._store && (e._store.validated = !0);
|
|
529
|
+
else if (e) {
|
|
530
|
+
var D = R(e);
|
|
531
|
+
if (typeof D == "function" && D !== e.entries)
|
|
532
|
+
for (var W = D.call(e), A; !(A = W.next()).done; )
|
|
533
|
+
ae(A.value) && J(A.value, r);
|
|
538
534
|
}
|
|
539
535
|
}
|
|
540
536
|
}
|
|
541
|
-
function
|
|
537
|
+
function ze(e) {
|
|
542
538
|
{
|
|
543
|
-
var
|
|
544
|
-
if (
|
|
539
|
+
var r = e.type;
|
|
540
|
+
if (r == null || typeof r == "string")
|
|
545
541
|
return;
|
|
546
|
-
var
|
|
547
|
-
if (typeof
|
|
548
|
-
|
|
549
|
-
else if (typeof
|
|
542
|
+
var c;
|
|
543
|
+
if (typeof r == "function")
|
|
544
|
+
c = r.propTypes;
|
|
545
|
+
else if (typeof r == "object" && (r.$$typeof === g || // Note: Memo only checks outer props here.
|
|
550
546
|
// Inner props are checked in the reconciler.
|
|
551
|
-
|
|
552
|
-
|
|
547
|
+
r.$$typeof === p))
|
|
548
|
+
c = r.propTypes;
|
|
553
549
|
else
|
|
554
550
|
return;
|
|
555
|
-
if (
|
|
556
|
-
var
|
|
557
|
-
|
|
558
|
-
} else if (
|
|
559
|
-
|
|
560
|
-
var
|
|
561
|
-
|
|
551
|
+
if (c) {
|
|
552
|
+
var T = $(r);
|
|
553
|
+
ne(c, e.props, "prop", T, e);
|
|
554
|
+
} else if (r.PropTypes !== void 0 && !Me) {
|
|
555
|
+
Me = !0;
|
|
556
|
+
var D = $(r);
|
|
557
|
+
s("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", D || "Unknown");
|
|
562
558
|
}
|
|
563
|
-
typeof
|
|
559
|
+
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && s("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
564
560
|
}
|
|
565
561
|
}
|
|
566
|
-
function
|
|
562
|
+
function Le(e) {
|
|
567
563
|
{
|
|
568
|
-
for (var
|
|
569
|
-
var
|
|
570
|
-
if (
|
|
571
|
-
|
|
564
|
+
for (var r = Object.keys(e.props), c = 0; c < r.length; c++) {
|
|
565
|
+
var T = r[c];
|
|
566
|
+
if (T !== "children" && T !== "key") {
|
|
567
|
+
_e(e), s("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", T), _e(null);
|
|
572
568
|
break;
|
|
573
569
|
}
|
|
574
570
|
}
|
|
575
|
-
|
|
571
|
+
e.ref !== null && (_e(e), s("Invalid attribute `ref` supplied to `React.Fragment`."), _e(null));
|
|
576
572
|
}
|
|
577
573
|
}
|
|
578
|
-
var
|
|
579
|
-
function
|
|
574
|
+
var $e = {};
|
|
575
|
+
function qe(e, r, c, T, D, W) {
|
|
580
576
|
{
|
|
581
|
-
var
|
|
582
|
-
if (
|
|
583
|
-
var
|
|
584
|
-
(
|
|
585
|
-
var
|
|
586
|
-
|
|
587
|
-
var
|
|
588
|
-
|
|
577
|
+
var A = O(e);
|
|
578
|
+
if (!A) {
|
|
579
|
+
var L = "";
|
|
580
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (L += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
581
|
+
var Z = Ve();
|
|
582
|
+
Z ? L += Z : L += Te();
|
|
583
|
+
var z;
|
|
584
|
+
e === null ? z = "null" : Re(e) ? z = "array" : e !== void 0 && e.$$typeof === l ? (z = "<" + ($(e.type) || "Unknown") + " />", L = " Did you accidentally export a JSX literal instead of a component?") : z = typeof e, s("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", z, L);
|
|
589
585
|
}
|
|
590
|
-
var
|
|
591
|
-
if (
|
|
592
|
-
return
|
|
593
|
-
if (
|
|
594
|
-
var
|
|
595
|
-
if (
|
|
596
|
-
if (
|
|
597
|
-
if (
|
|
598
|
-
for (var
|
|
599
|
-
|
|
600
|
-
Object.freeze && Object.freeze(
|
|
586
|
+
var Y = de(e, r, c, D, W);
|
|
587
|
+
if (Y == null)
|
|
588
|
+
return Y;
|
|
589
|
+
if (A) {
|
|
590
|
+
var oe = r.children;
|
|
591
|
+
if (oe !== void 0)
|
|
592
|
+
if (T)
|
|
593
|
+
if (Re(oe)) {
|
|
594
|
+
for (var De = 0; De < oe.length; De++)
|
|
595
|
+
Ke(oe[De], e);
|
|
596
|
+
Object.freeze && Object.freeze(oe);
|
|
601
597
|
} else
|
|
602
|
-
|
|
598
|
+
s("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
603
599
|
else
|
|
604
|
-
|
|
600
|
+
Ke(oe, e);
|
|
605
601
|
}
|
|
606
|
-
if (
|
|
607
|
-
var
|
|
608
|
-
return
|
|
609
|
-
}),
|
|
610
|
-
if (
|
|
611
|
-
var
|
|
612
|
-
|
|
602
|
+
if (ve.call(r, "key")) {
|
|
603
|
+
var Pe = $(e), te = Object.keys(r).filter(function(_t) {
|
|
604
|
+
return _t !== "key";
|
|
605
|
+
}), ot = te.length > 0 ? "{key: someKey, " + te.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
606
|
+
if (!$e[Pe + ot]) {
|
|
607
|
+
var wt = te.length > 0 ? "{" + te.join(": ..., ") + ": ...}" : "{}";
|
|
608
|
+
s(`A props object containing a "key" prop is being spread into JSX:
|
|
613
609
|
let props = %s;
|
|
614
610
|
<%s {...props} />
|
|
615
611
|
React keys must be passed directly to JSX without using spread:
|
|
616
612
|
let props = %s;
|
|
617
|
-
<%s key={someKey} {...props} />`,
|
|
613
|
+
<%s key={someKey} {...props} />`, ot, Pe, wt, Pe), $e[Pe + ot] = !0;
|
|
618
614
|
}
|
|
619
615
|
}
|
|
620
|
-
return
|
|
616
|
+
return e === f ? Le(Y) : ze(Y), Y;
|
|
621
617
|
}
|
|
622
618
|
}
|
|
623
|
-
function
|
|
624
|
-
return
|
|
619
|
+
function at(e, r, c) {
|
|
620
|
+
return qe(e, r, c, !0);
|
|
625
621
|
}
|
|
626
|
-
function
|
|
627
|
-
return
|
|
622
|
+
function vt(e, r, c) {
|
|
623
|
+
return qe(e, r, c, !1);
|
|
628
624
|
}
|
|
629
|
-
var
|
|
630
|
-
|
|
631
|
-
}()),
|
|
625
|
+
var xt = vt, yt = at;
|
|
626
|
+
Ge.Fragment = f, Ge.jsx = xt, Ge.jsxs = yt;
|
|
627
|
+
}()), Ge;
|
|
632
628
|
}
|
|
633
|
-
process.env.NODE_ENV === "production" ?
|
|
634
|
-
var
|
|
635
|
-
const
|
|
636
|
-
function
|
|
637
|
-
children:
|
|
638
|
-
bobConfig:
|
|
639
|
-
hostApiConfig:
|
|
640
|
-
hostContext:
|
|
641
|
-
callbacks:
|
|
629
|
+
process.env.NODE_ENV === "production" ? it.exports = Ct() : it.exports = kt();
|
|
630
|
+
var t = it.exports;
|
|
631
|
+
const mt = Tt(null);
|
|
632
|
+
function Ht({
|
|
633
|
+
children: n,
|
|
634
|
+
bobConfig: l,
|
|
635
|
+
hostApiConfig: i,
|
|
636
|
+
hostContext: f = {},
|
|
637
|
+
callbacks: d = {}
|
|
642
638
|
}) {
|
|
643
|
-
const
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
}, [
|
|
647
|
-
const
|
|
648
|
-
|
|
649
|
-
...
|
|
650
|
-
...
|
|
639
|
+
const _ = rt(() => jt(l.supabaseUrl, l.supabaseKey), [l.supabaseUrl, l.supabaseKey]), [b, E] = He.useState(f);
|
|
640
|
+
He.useEffect(() => {
|
|
641
|
+
E(f);
|
|
642
|
+
}, [f]);
|
|
643
|
+
const g = He.useCallback((u) => {
|
|
644
|
+
E((p) => ({
|
|
645
|
+
...p,
|
|
646
|
+
...u
|
|
651
647
|
}));
|
|
652
|
-
}, []),
|
|
648
|
+
}, []), x = rt(
|
|
653
649
|
() => ({
|
|
654
|
-
bobSupabase:
|
|
655
|
-
bobConfig:
|
|
656
|
-
hostApiConfig:
|
|
657
|
-
hostContext:
|
|
658
|
-
callbacks:
|
|
659
|
-
updateHostContext:
|
|
650
|
+
bobSupabase: _,
|
|
651
|
+
bobConfig: l,
|
|
652
|
+
hostApiConfig: i,
|
|
653
|
+
hostContext: b,
|
|
654
|
+
callbacks: d,
|
|
655
|
+
updateHostContext: g
|
|
660
656
|
}),
|
|
661
|
-
[
|
|
657
|
+
[_, l, i, b, d, g]
|
|
662
658
|
);
|
|
663
|
-
return /* @__PURE__ */
|
|
659
|
+
return /* @__PURE__ */ t.jsx(mt.Provider, { value: x, children: n });
|
|
664
660
|
}
|
|
665
|
-
function
|
|
666
|
-
const
|
|
667
|
-
if (!
|
|
661
|
+
function Be() {
|
|
662
|
+
const n = Et(mt);
|
|
663
|
+
if (!n)
|
|
668
664
|
throw new Error("useBobContext must be used within a BobProvider");
|
|
669
|
-
return
|
|
665
|
+
return n;
|
|
670
666
|
}
|
|
671
|
-
function
|
|
672
|
-
const { bobSupabase:
|
|
673
|
-
return
|
|
667
|
+
function bt() {
|
|
668
|
+
const { bobSupabase: n } = Be();
|
|
669
|
+
return n;
|
|
674
670
|
}
|
|
675
|
-
function
|
|
676
|
-
const { hostContext:
|
|
677
|
-
return
|
|
671
|
+
function Jt() {
|
|
672
|
+
const { hostContext: n } = Be();
|
|
673
|
+
return n;
|
|
678
674
|
}
|
|
679
|
-
function
|
|
680
|
-
const { hostApiConfig:
|
|
681
|
-
return
|
|
675
|
+
function Xt() {
|
|
676
|
+
const { hostApiConfig: n } = Be();
|
|
677
|
+
return n;
|
|
682
678
|
}
|
|
683
|
-
function
|
|
684
|
-
const { callbacks:
|
|
685
|
-
return
|
|
679
|
+
function Qt() {
|
|
680
|
+
const { callbacks: n } = Be();
|
|
681
|
+
return n;
|
|
686
682
|
}
|
|
687
|
-
const
|
|
688
|
-
onStart:
|
|
689
|
-
onEnd:
|
|
690
|
-
onFailed:
|
|
683
|
+
const dt = 5e3, St = ({
|
|
684
|
+
onStart: n,
|
|
685
|
+
onEnd: l,
|
|
686
|
+
onFailed: i
|
|
691
687
|
} = {}) => {
|
|
692
|
-
const { bobConfig:
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
}, [
|
|
696
|
-
const
|
|
697
|
-
|
|
698
|
-
}, []),
|
|
699
|
-
var
|
|
700
|
-
|
|
701
|
-
}, []),
|
|
702
|
-
var
|
|
703
|
-
if (
|
|
704
|
-
|
|
705
|
-
var
|
|
706
|
-
console.warn("[BobWidget TTS] Timeout after 5s - triggering fallback callbacks"),
|
|
707
|
-
},
|
|
688
|
+
const { bobConfig: f } = Be(), [d, _] = U(!1), b = V(null), E = V(null), g = V(!1), x = V(n), u = V(l), p = V(i);
|
|
689
|
+
X(() => {
|
|
690
|
+
x.current = n, u.current = l, p.current = i;
|
|
691
|
+
}, [n, l, i]);
|
|
692
|
+
const h = q(() => {
|
|
693
|
+
E.current && (clearTimeout(E.current), E.current = null);
|
|
694
|
+
}, []), j = q(() => {
|
|
695
|
+
var s;
|
|
696
|
+
g.current || (g.current = !0, console.log("[BobWidget TTS] Fallback: triggering onStart without audio"), (s = x.current) == null || s.call(x));
|
|
697
|
+
}, []), C = q(async (s) => {
|
|
698
|
+
var m, v, a, o;
|
|
699
|
+
if (s.trim()) {
|
|
700
|
+
g.current = !1, h(), b.current && (b.current.pause(), b.current = null), E.current = setTimeout(() => {
|
|
701
|
+
var w, k;
|
|
702
|
+
console.warn("[BobWidget TTS] Timeout after 5s - triggering fallback callbacks"), j(), _(!1), (w = u.current) == null || w.call(u), (k = p.current) == null || k.call(p), b.current = null;
|
|
703
|
+
}, dt);
|
|
708
704
|
try {
|
|
709
|
-
const
|
|
710
|
-
`${
|
|
705
|
+
const w = new AbortController(), k = setTimeout(() => w.abort(), dt - 1e3), N = await fetch(
|
|
706
|
+
`${f.supabaseUrl}/functions/v1/bob-tts`,
|
|
711
707
|
{
|
|
712
708
|
method: "POST",
|
|
713
709
|
headers: {
|
|
714
710
|
"Content-Type": "application/json",
|
|
715
|
-
Authorization: `Bearer ${
|
|
711
|
+
Authorization: `Bearer ${f.supabaseKey}`
|
|
716
712
|
},
|
|
717
|
-
body: JSON.stringify({ text:
|
|
718
|
-
signal:
|
|
713
|
+
body: JSON.stringify({ text: s }),
|
|
714
|
+
signal: w.signal
|
|
719
715
|
}
|
|
720
716
|
);
|
|
721
|
-
if (clearTimeout(
|
|
722
|
-
const M = await
|
|
717
|
+
if (clearTimeout(k), !N.ok) {
|
|
718
|
+
const M = await N.json().catch(() => ({}));
|
|
723
719
|
throw console.error("[BobWidget TTS] Request failed:", M), new Error("TTS request failed");
|
|
724
720
|
}
|
|
725
|
-
const { audioContent:
|
|
726
|
-
|
|
721
|
+
const { audioContent: O } = await N.json(), y = new Audio(`data:audio/mp3;base64,${O}`);
|
|
722
|
+
b.current = y, y.onplay = () => {
|
|
727
723
|
var M;
|
|
728
|
-
|
|
729
|
-
},
|
|
724
|
+
h(), g.current || (g.current = !0, _(!0), console.log("[BobWidget TTS] Audio playing, triggering onStart"), (M = x.current) == null || M.call(x));
|
|
725
|
+
}, y.onended = () => {
|
|
730
726
|
var M;
|
|
731
|
-
|
|
732
|
-
},
|
|
733
|
-
var
|
|
734
|
-
|
|
727
|
+
h(), _(!1), (M = u.current) == null || M.call(u), b.current = null;
|
|
728
|
+
}, y.onerror = (M) => {
|
|
729
|
+
var $, S;
|
|
730
|
+
h(), console.warn("[BobWidget TTS] Audio playback error:", M), j(), _(!1), ($ = u.current) == null || $.call(u), (S = p.current) == null || S.call(p), b.current = null;
|
|
735
731
|
};
|
|
736
732
|
try {
|
|
737
|
-
await
|
|
733
|
+
await y.play();
|
|
738
734
|
} catch (M) {
|
|
739
|
-
console.warn("[BobWidget TTS] Audio play() failed (likely autoplay policy):", M),
|
|
735
|
+
console.warn("[BobWidget TTS] Audio play() failed (likely autoplay policy):", M), h(), j(), _(!1), (m = u.current) == null || m.call(u), (v = p.current) == null || v.call(p), b.current = null;
|
|
740
736
|
}
|
|
741
|
-
} catch (
|
|
742
|
-
|
|
737
|
+
} catch (w) {
|
|
738
|
+
h(), console.error("[BobWidget TTS] Speech synthesis error:", w), j(), _(!1), (a = u.current) == null || a.call(u), (o = p.current) == null || o.call(p);
|
|
743
739
|
}
|
|
744
740
|
}
|
|
745
|
-
}, [
|
|
746
|
-
|
|
747
|
-
}, [
|
|
748
|
-
var
|
|
749
|
-
(
|
|
750
|
-
}, []), I =
|
|
751
|
-
var
|
|
752
|
-
(
|
|
741
|
+
}, [f.supabaseUrl, f.supabaseKey, h, j]), P = q(() => {
|
|
742
|
+
h(), b.current && (b.current.pause(), b.current = null), _(!1);
|
|
743
|
+
}, [h]), R = q(() => {
|
|
744
|
+
var s;
|
|
745
|
+
(s = b.current) == null || s.pause();
|
|
746
|
+
}, []), I = q(() => {
|
|
747
|
+
var s;
|
|
748
|
+
(s = b.current) == null || s.play();
|
|
753
749
|
}, []);
|
|
754
|
-
return
|
|
755
|
-
|
|
756
|
-
}, [
|
|
757
|
-
speak:
|
|
758
|
-
stop:
|
|
759
|
-
pause:
|
|
750
|
+
return X(() => () => {
|
|
751
|
+
h(), b.current && (b.current.pause(), b.current = null);
|
|
752
|
+
}, [h]), {
|
|
753
|
+
speak: C,
|
|
754
|
+
stop: P,
|
|
755
|
+
pause: R,
|
|
760
756
|
resume: I,
|
|
761
|
-
isSpeaking:
|
|
757
|
+
isSpeaking: d,
|
|
762
758
|
isSupported: !0
|
|
763
759
|
};
|
|
764
|
-
},
|
|
760
|
+
}, It = [
|
|
761
|
+
"what version",
|
|
762
|
+
"which version",
|
|
763
|
+
"software version",
|
|
764
|
+
"bob version",
|
|
765
|
+
"your version",
|
|
766
|
+
"current version",
|
|
767
|
+
"running version",
|
|
768
|
+
"version number",
|
|
769
|
+
"what ver",
|
|
770
|
+
"which ver"
|
|
771
|
+
], ft = [
|
|
765
772
|
"recommend",
|
|
766
773
|
"suggest",
|
|
767
774
|
"need",
|
|
@@ -787,7 +794,7 @@ const ar = 5e3, Dr = ({
|
|
|
787
794
|
"add-on",
|
|
788
795
|
"tyre shine",
|
|
789
796
|
"windscreen wash"
|
|
790
|
-
],
|
|
797
|
+
], Nt = [
|
|
791
798
|
"WIPER BLADE FRONT",
|
|
792
799
|
"WIPER BLADE REAR",
|
|
793
800
|
"WIPER BLADE SET",
|
|
@@ -854,1044 +861,343 @@ const ar = 5e3, Dr = ({
|
|
|
854
861
|
"shock absorber",
|
|
855
862
|
"struts",
|
|
856
863
|
"suspension"
|
|
857
|
-
],
|
|
858
|
-
setAnimationState:
|
|
859
|
-
manualMode:
|
|
860
|
-
talkingState:
|
|
861
|
-
thinkingState:
|
|
862
|
-
completeState:
|
|
863
|
-
idleState:
|
|
864
|
-
listenState:
|
|
865
|
-
onStreamStart:
|
|
866
|
-
onStreamComplete:
|
|
867
|
-
onShowingProduct:
|
|
868
|
-
onResearchStart:
|
|
869
|
-
onReadyToSpeak:
|
|
870
|
-
onHighlightPart:
|
|
871
|
-
onHighlightProduct:
|
|
872
|
-
onNoPartsFound:
|
|
873
|
-
onAutoFetchComplete:
|
|
864
|
+
], Ot = ({
|
|
865
|
+
setAnimationState: n,
|
|
866
|
+
manualMode: l = !1,
|
|
867
|
+
talkingState: i = "talk",
|
|
868
|
+
thinkingState: f = "research",
|
|
869
|
+
completeState: d = "complete",
|
|
870
|
+
idleState: _ = "idle",
|
|
871
|
+
listenState: b = "talk_pause",
|
|
872
|
+
onStreamStart: E,
|
|
873
|
+
onStreamComplete: g,
|
|
874
|
+
onShowingProduct: x,
|
|
875
|
+
onResearchStart: u,
|
|
876
|
+
onReadyToSpeak: p,
|
|
877
|
+
onHighlightPart: h,
|
|
878
|
+
onHighlightProduct: j,
|
|
879
|
+
onNoPartsFound: C,
|
|
880
|
+
onAutoFetchComplete: P
|
|
874
881
|
}) => {
|
|
875
|
-
var
|
|
876
|
-
const { bobConfig:
|
|
877
|
-
|
|
878
|
-
}, { speak:
|
|
882
|
+
var Ze, et, je, ve;
|
|
883
|
+
const { bobConfig: R, hostApiConfig: I, hostContext: s, callbacks: m } = Be(), [v, a] = U([]), [o, w] = U(""), [k, N] = U(!1), [O, y] = U(!1), [M, $] = U(null), S = V(null), H = V(!1), ge = V(!1), F = V(""), ee = V(!1), re = V(null), be = () => {
|
|
884
|
+
re.current && (clearTimeout(re.current), re.current = null);
|
|
885
|
+
}, { speak: K, stop: Ee, isSpeaking: Je } = St({
|
|
879
886
|
onStart: () => {
|
|
880
|
-
|
|
887
|
+
be(), ee.current = !0, console.log("[BobWidget] Speech started - revealing products"), p == null || p(), l || ie(i);
|
|
881
888
|
},
|
|
882
889
|
onEnd: () => {
|
|
883
|
-
|
|
884
|
-
const
|
|
885
|
-
(
|
|
890
|
+
be();
|
|
891
|
+
const B = ft.some(
|
|
892
|
+
(G) => F.current.toLowerCase().includes(G.toLowerCase())
|
|
886
893
|
);
|
|
887
|
-
|
|
894
|
+
l || (B && x ? x() : g ? g() : (ie(d), setTimeout(() => ie(b), 3e3)));
|
|
888
895
|
},
|
|
889
896
|
onFailed: () => {
|
|
890
897
|
console.warn("[BobWidget] Speech synthesis failed - fallback triggered");
|
|
891
898
|
}
|
|
892
899
|
});
|
|
893
|
-
|
|
894
|
-
var
|
|
895
|
-
(
|
|
896
|
-
}, [
|
|
897
|
-
var
|
|
898
|
-
const
|
|
899
|
-
|
|
900
|
-
}, [(
|
|
901
|
-
var
|
|
902
|
-
if (
|
|
903
|
-
const
|
|
904
|
-
if (
|
|
905
|
-
|
|
906
|
-
const
|
|
907
|
-
|
|
900
|
+
X(() => {
|
|
901
|
+
var B;
|
|
902
|
+
(B = S.current) == null || B.scrollIntoView({ behavior: "smooth" });
|
|
903
|
+
}, [v]), X(() => {
|
|
904
|
+
var G, Q;
|
|
905
|
+
const B = (G = s.vehicle) == null ? void 0 : G.selectedVehicle;
|
|
906
|
+
B && !M && (console.log("[BobWidget] Setting vehicle from host context:", B), $(B), (Q = m.onVehicleIdentified) == null || Q.call(m, B));
|
|
907
|
+
}, [(Ze = s.vehicle) == null ? void 0 : Ze.selectedVehicle]), X(() => {
|
|
908
|
+
var B;
|
|
909
|
+
if (v.length === 0 && !ge.current) {
|
|
910
|
+
const G = (B = s.vehicle) == null ? void 0 : B.selectedVehicle;
|
|
911
|
+
if (G) {
|
|
912
|
+
ge.current = !0;
|
|
913
|
+
const Q = `${G.year} ${G.make} ${G.model}`;
|
|
914
|
+
a([{
|
|
908
915
|
role: "assistant",
|
|
909
|
-
content: `G'day! Saw you've got the ${
|
|
916
|
+
content: `G'day! Saw you've got the ${Q} - choice wagon! What can I help you find for it today?`
|
|
910
917
|
}]);
|
|
911
918
|
} else
|
|
912
|
-
|
|
919
|
+
a([{
|
|
913
920
|
role: "assistant",
|
|
914
921
|
content: "G'day! Bob from CARFIX here. How can I help ya today?"
|
|
915
922
|
}]);
|
|
916
923
|
}
|
|
917
|
-
}, [(
|
|
918
|
-
var
|
|
919
|
-
const
|
|
920
|
-
if (!
|
|
921
|
-
const
|
|
922
|
-
if (!Number.isFinite(
|
|
923
|
-
console.warn("[BobWidget] Vehicle has invalid vehicle_id, cannot auto-fetch:",
|
|
924
|
+
}, [(et = s.vehicle) == null ? void 0 : et.selectedVehicle, v.length]), X(() => {
|
|
925
|
+
var Ce, ke;
|
|
926
|
+
const B = (Ce = s.vehicle) == null ? void 0 : Ce.selectedVehicle;
|
|
927
|
+
if (!B || H.current) return;
|
|
928
|
+
const G = B.vehicle_id ?? B.id, Q = Number.parseInt(String(G), 10);
|
|
929
|
+
if (!Number.isFinite(Q)) {
|
|
930
|
+
console.warn("[BobWidget] Vehicle has invalid vehicle_id, cannot auto-fetch:", B);
|
|
924
931
|
return;
|
|
925
932
|
}
|
|
926
|
-
|
|
927
|
-
const
|
|
933
|
+
H.current = !0;
|
|
934
|
+
const ne = { ...B, vehicle_id: String(Q) }, xe = (ke = s.user) == null ? void 0 : ke.email;
|
|
928
935
|
(async () => {
|
|
929
|
-
var
|
|
930
|
-
const
|
|
936
|
+
var ye, we;
|
|
937
|
+
const Se = `${R.supabaseUrl}/functions/v1/bob-chat`;
|
|
931
938
|
try {
|
|
932
|
-
const
|
|
939
|
+
const le = await fetch(Se, {
|
|
933
940
|
method: "POST",
|
|
934
941
|
headers: {
|
|
935
942
|
"Content-Type": "application/json",
|
|
936
|
-
Authorization: `Bearer ${
|
|
943
|
+
Authorization: `Bearer ${R.supabaseKey}`
|
|
937
944
|
},
|
|
938
945
|
body: JSON.stringify({
|
|
939
946
|
messages: [],
|
|
940
|
-
vehicleContext:
|
|
941
|
-
customerEmail:
|
|
947
|
+
vehicleContext: ne,
|
|
948
|
+
customerEmail: xe,
|
|
942
949
|
autoFetchParts: !0,
|
|
943
950
|
hostConfig: I,
|
|
944
|
-
hostContext:
|
|
951
|
+
hostContext: s
|
|
945
952
|
})
|
|
946
953
|
});
|
|
947
|
-
if (!
|
|
948
|
-
console.error("[BobWidget] Auto-fetch failed:",
|
|
954
|
+
if (!le.ok || !le.body) {
|
|
955
|
+
console.error("[BobWidget] Auto-fetch failed:", le.status);
|
|
949
956
|
return;
|
|
950
957
|
}
|
|
951
|
-
const
|
|
952
|
-
let
|
|
958
|
+
const Ie = le.body.getReader(), Ne = new TextDecoder();
|
|
959
|
+
let pe = "";
|
|
953
960
|
for (; ; ) {
|
|
954
|
-
const { done:
|
|
955
|
-
if (
|
|
956
|
-
|
|
957
|
-
let
|
|
958
|
-
for (; (
|
|
961
|
+
const { done: ce, value: me } = await Ie.read();
|
|
962
|
+
if (ce) break;
|
|
963
|
+
pe += Ne.decode(me, { stream: !0 });
|
|
964
|
+
let Oe;
|
|
965
|
+
for (; (Oe = pe.indexOf(`
|
|
959
966
|
`)) !== -1; ) {
|
|
960
|
-
let
|
|
961
|
-
if (
|
|
962
|
-
const
|
|
963
|
-
if (
|
|
967
|
+
let ue = pe.slice(0, Oe);
|
|
968
|
+
if (pe = pe.slice(Oe + 1), ue.endsWith("\r") && (ue = ue.slice(0, -1)), ue.startsWith(":") || ue.trim() === "" || !ue.startsWith("data: ")) continue;
|
|
969
|
+
const se = ue.slice(6).trim();
|
|
970
|
+
if (se === "[DONE]") break;
|
|
964
971
|
try {
|
|
965
|
-
const
|
|
966
|
-
|
|
972
|
+
const de = JSON.parse(se);
|
|
973
|
+
de.type === "service_packages_found" && de.packages && ((ye = m.onServicePackagesFound) == null || ye.call(m, de.packages)), de.type === "parts_found" && de.parts && ((we = m.onPartsFound) == null || we.call(m, de.parts));
|
|
967
974
|
} catch {
|
|
968
975
|
}
|
|
969
976
|
}
|
|
970
977
|
}
|
|
971
|
-
|
|
972
|
-
} catch (
|
|
973
|
-
console.error("[BobWidget] Auto-fetch error:",
|
|
978
|
+
P == null || P();
|
|
979
|
+
} catch (le) {
|
|
980
|
+
console.error("[BobWidget] Auto-fetch error:", le);
|
|
974
981
|
}
|
|
975
982
|
})();
|
|
976
|
-
}, [(
|
|
977
|
-
const
|
|
983
|
+
}, [(je = s.vehicle) == null ? void 0 : je.selectedVehicle, (ve = s.user) == null ? void 0 : ve.email]);
|
|
984
|
+
const ie = (B) => {
|
|
978
985
|
try {
|
|
979
|
-
|
|
986
|
+
n(B);
|
|
980
987
|
} catch {
|
|
981
|
-
console.warn(`[BobWidget] State "${
|
|
988
|
+
console.warn(`[BobWidget] State "${B}" not available`);
|
|
982
989
|
}
|
|
983
|
-
},
|
|
984
|
-
var
|
|
985
|
-
const
|
|
990
|
+
}, nt = async (B) => {
|
|
991
|
+
var ne, xe, Re, Ce, ke, Se, ye, we, le, Ie, Ne, pe;
|
|
992
|
+
const G = `${R.supabaseUrl}/functions/v1/bob-chat`, Q = (ne = s.user) == null ? void 0 : ne.email;
|
|
986
993
|
try {
|
|
987
|
-
const
|
|
988
|
-
messages: [...
|
|
994
|
+
const ce = {
|
|
995
|
+
messages: [...v, B],
|
|
989
996
|
hostConfig: I,
|
|
990
|
-
hostContext:
|
|
997
|
+
hostContext: s
|
|
991
998
|
};
|
|
992
|
-
M && (
|
|
993
|
-
const
|
|
999
|
+
M && (ce.vehicleContext = M), Q && (ce.customerEmail = Q);
|
|
1000
|
+
const me = await fetch(G, {
|
|
994
1001
|
method: "POST",
|
|
995
1002
|
headers: {
|
|
996
1003
|
"Content-Type": "application/json",
|
|
997
|
-
Authorization: `Bearer ${
|
|
1004
|
+
Authorization: `Bearer ${R.supabaseKey}`
|
|
998
1005
|
},
|
|
999
|
-
body: JSON.stringify(
|
|
1006
|
+
body: JSON.stringify(ce)
|
|
1000
1007
|
});
|
|
1001
|
-
if (!
|
|
1002
|
-
if (
|
|
1003
|
-
(
|
|
1008
|
+
if (!me.ok) {
|
|
1009
|
+
if (me.status === 429) {
|
|
1010
|
+
(xe = m.onError) == null || xe.call(m, new Error("Rate limit exceeded"));
|
|
1004
1011
|
return;
|
|
1005
1012
|
}
|
|
1006
|
-
if (
|
|
1007
|
-
(
|
|
1013
|
+
if (me.status === 402) {
|
|
1014
|
+
(Re = m.onError) == null || Re.call(m, new Error("Payment required"));
|
|
1008
1015
|
return;
|
|
1009
1016
|
}
|
|
1010
1017
|
throw new Error("Failed to start stream");
|
|
1011
1018
|
}
|
|
1012
|
-
if (!
|
|
1013
|
-
const
|
|
1014
|
-
let
|
|
1015
|
-
for (; !
|
|
1016
|
-
const { done:
|
|
1017
|
-
if (
|
|
1018
|
-
|
|
1019
|
-
let
|
|
1020
|
-
for (; (
|
|
1019
|
+
if (!me.body) throw new Error("No response body");
|
|
1020
|
+
const Oe = me.body.getReader(), ue = new TextDecoder();
|
|
1021
|
+
let se = "", de = !1, he = "";
|
|
1022
|
+
for (; !de; ) {
|
|
1023
|
+
const { done: ae, value: Te } = await Oe.read();
|
|
1024
|
+
if (ae) break;
|
|
1025
|
+
se += ue.decode(Te, { stream: !0 });
|
|
1026
|
+
let Ve;
|
|
1027
|
+
for (; (Ve = se.indexOf(`
|
|
1021
1028
|
`)) !== -1; ) {
|
|
1022
|
-
let
|
|
1023
|
-
if (
|
|
1024
|
-
const
|
|
1025
|
-
if (
|
|
1026
|
-
|
|
1029
|
+
let fe = se.slice(0, Ve);
|
|
1030
|
+
if (se = se.slice(Ve + 1), fe.endsWith("\r") && (fe = fe.slice(0, -1)), fe.startsWith(":") || fe.trim() === "" || !fe.startsWith("data: ")) continue;
|
|
1031
|
+
const tt = fe.slice(6).trim();
|
|
1032
|
+
if (tt === "[DONE]") {
|
|
1033
|
+
de = !0;
|
|
1027
1034
|
break;
|
|
1028
1035
|
}
|
|
1029
1036
|
try {
|
|
1030
|
-
const
|
|
1031
|
-
if (
|
|
1032
|
-
|
|
1037
|
+
const J = JSON.parse(tt);
|
|
1038
|
+
if (J.type === "vehicle_identified" && J.vehicle) {
|
|
1039
|
+
$(J.vehicle), (Ce = m.onVehicleIdentified) == null || Ce.call(m, J.vehicle);
|
|
1033
1040
|
continue;
|
|
1034
1041
|
}
|
|
1035
|
-
if (
|
|
1036
|
-
(
|
|
1042
|
+
if (J.type === "service_packages_found" && J.packages) {
|
|
1043
|
+
(ke = m.onServicePackagesFound) == null || ke.call(m, J.packages);
|
|
1037
1044
|
continue;
|
|
1038
1045
|
}
|
|
1039
|
-
if (
|
|
1040
|
-
(
|
|
1046
|
+
if (J.type === "parts_found" && J.parts) {
|
|
1047
|
+
(Se = m.onPartsFound) == null || Se.call(m, J.parts);
|
|
1041
1048
|
continue;
|
|
1042
1049
|
}
|
|
1043
|
-
if (
|
|
1044
|
-
|
|
1050
|
+
if (J.type === "no_parts_found") {
|
|
1051
|
+
C == null || C();
|
|
1045
1052
|
continue;
|
|
1046
1053
|
}
|
|
1047
|
-
if (
|
|
1048
|
-
(
|
|
1054
|
+
if (J.type === "cart_updated" && J.items) {
|
|
1055
|
+
(ye = m.onCartUpdated) == null || ye.call(m, J.items);
|
|
1049
1056
|
continue;
|
|
1050
1057
|
}
|
|
1051
|
-
const
|
|
1052
|
-
if (
|
|
1053
|
-
|
|
1054
|
-
const
|
|
1055
|
-
|
|
1056
|
-
const
|
|
1057
|
-
return (
|
|
1058
|
-
(
|
|
1059
|
-
) : [...
|
|
1060
|
-
}), (
|
|
1058
|
+
const Ke = (Ie = (le = (we = J.choices) == null ? void 0 : we[0]) == null ? void 0 : le.delta) == null ? void 0 : Ie.content;
|
|
1059
|
+
if (Ke) {
|
|
1060
|
+
he += Ke;
|
|
1061
|
+
const ze = he.replace(/\[VEHICLE_CONFIRMED:\{[\s\S]*?\}\]/g, "");
|
|
1062
|
+
a((Le) => {
|
|
1063
|
+
const $e = Le[Le.length - 1];
|
|
1064
|
+
return ($e == null ? void 0 : $e.role) === "assistant" ? Le.map(
|
|
1065
|
+
(qe, at) => at === Le.length - 1 ? { ...qe, content: ze } : qe
|
|
1066
|
+
) : [...Le, { role: "assistant", content: ze }];
|
|
1067
|
+
}), (Ne = m.onBobMessage) == null || Ne.call(m, ze);
|
|
1061
1068
|
}
|
|
1062
1069
|
} catch {
|
|
1063
|
-
|
|
1064
|
-
` +
|
|
1070
|
+
se = fe + `
|
|
1071
|
+
` + se;
|
|
1065
1072
|
break;
|
|
1066
1073
|
}
|
|
1067
1074
|
}
|
|
1068
1075
|
}
|
|
1069
|
-
|
|
1070
|
-
const
|
|
1071
|
-
(
|
|
1072
|
-
),
|
|
1073
|
-
for (const
|
|
1074
|
-
if (
|
|
1075
|
-
const
|
|
1076
|
-
|
|
1076
|
+
F.current = he.replace(/\[VEHICLE_CONFIRMED:\{[\s\S]*?\}\]/g, "");
|
|
1077
|
+
const Ue = ft.some(
|
|
1078
|
+
(ae) => he.toLowerCase().includes(ae.toLowerCase())
|
|
1079
|
+
), _e = he.toLowerCase();
|
|
1080
|
+
for (const ae of Nt)
|
|
1081
|
+
if (_e.includes(ae.toLowerCase())) {
|
|
1082
|
+
const Te = ae.replace(/s\s*$/i, "").toUpperCase();
|
|
1083
|
+
h == null || h(Te);
|
|
1077
1084
|
break;
|
|
1078
1085
|
}
|
|
1079
|
-
const
|
|
1080
|
-
if (
|
|
1081
|
-
const [,
|
|
1082
|
-
|
|
1086
|
+
const Me = he.match(/(?:go with|recommend|suggest|grab|try)\s+(?:the\s+)?(\w+)\s+(?:at|for)\s+\$(\d+(?:\.\d{2})?)/i);
|
|
1087
|
+
if (Me) {
|
|
1088
|
+
const [, ae, Te] = Me;
|
|
1089
|
+
j == null || j({ brand: ae, price: parseFloat(Te) });
|
|
1083
1090
|
}
|
|
1084
|
-
!
|
|
1085
|
-
|
|
1086
|
-
}, 2e3)) : (
|
|
1087
|
-
} catch (
|
|
1088
|
-
console.error("[BobWidget] Chat error:",
|
|
1091
|
+
!O && F.current.trim() ? (ee.current = !1, be(), K(F.current), re.current = setTimeout(() => {
|
|
1092
|
+
ee.current || (console.warn("[BobWidget] Speech fallback after 2s"), p == null || p(), l || (Ue && x ? x() : g ? g() : (ie(d), setTimeout(() => ie(b), 3e3))));
|
|
1093
|
+
}, 2e3)) : (p == null || p(), l || (Ue && x ? x() : g ? g() : (ie(d), setTimeout(() => ie(b), 3e3))));
|
|
1094
|
+
} catch (ce) {
|
|
1095
|
+
console.error("[BobWidget] Chat error:", ce), (pe = m.onError) == null || pe.call(m, ce instanceof Error ? ce : new Error("Unknown error")), l || ie(_);
|
|
1089
1096
|
}
|
|
1090
|
-
},
|
|
1091
|
-
if (!
|
|
1092
|
-
|
|
1093
|
-
const
|
|
1094
|
-
|
|
1097
|
+
}, Ae = async () => {
|
|
1098
|
+
if (!o.trim() || k) return;
|
|
1099
|
+
Ee();
|
|
1100
|
+
const B = { role: "user", content: o };
|
|
1101
|
+
a((ne) => [...ne, B]), w("");
|
|
1102
|
+
const G = o.toLowerCase();
|
|
1103
|
+
if (It.some((ne) => G.includes(ne))) {
|
|
1104
|
+
const ne = `G'day mate! I'm running Bob v${gt} - she's running sweet as! Anything else I can help ya with?`;
|
|
1105
|
+
a((xe) => [...xe, { role: "assistant", content: ne }]), O || K(ne);
|
|
1106
|
+
return;
|
|
1107
|
+
}
|
|
1108
|
+
N(!0), u == null || u(), l || ie(f), await nt(B), N(!1);
|
|
1095
1109
|
};
|
|
1096
1110
|
return {
|
|
1097
|
-
messages:
|
|
1098
|
-
input:
|
|
1099
|
-
setInput:
|
|
1100
|
-
isLoading:
|
|
1101
|
-
handleSend:
|
|
1102
|
-
handleKeyPress: (
|
|
1103
|
-
|
|
1111
|
+
messages: v,
|
|
1112
|
+
input: o,
|
|
1113
|
+
setInput: w,
|
|
1114
|
+
isLoading: k,
|
|
1115
|
+
handleSend: Ae,
|
|
1116
|
+
handleKeyPress: (B) => {
|
|
1117
|
+
B.key === "Enter" && !B.shiftKey && (B.preventDefault(), Ae());
|
|
1104
1118
|
},
|
|
1105
1119
|
handleInputFocus: () => {
|
|
1106
1120
|
},
|
|
1107
1121
|
handleInputBlur: () => {
|
|
1108
1122
|
},
|
|
1109
|
-
chatEndRef:
|
|
1123
|
+
chatEndRef: S,
|
|
1110
1124
|
clearMessages: () => {
|
|
1111
|
-
|
|
1125
|
+
a([{
|
|
1112
1126
|
role: "assistant",
|
|
1113
1127
|
content: "G'day! Bob from CARFIX here. How can I help ya today?"
|
|
1114
1128
|
}]);
|
|
1115
1129
|
},
|
|
1116
|
-
isMuted:
|
|
1130
|
+
isMuted: O,
|
|
1117
1131
|
toggleMute: () => {
|
|
1118
|
-
|
|
1132
|
+
y((B) => !B), O || Ee();
|
|
1119
1133
|
},
|
|
1120
|
-
isSpeaking:
|
|
1134
|
+
isSpeaking: Je,
|
|
1121
1135
|
identifiedVehicle: M,
|
|
1122
1136
|
clearVehicle: () => {
|
|
1123
|
-
|
|
1137
|
+
$(null);
|
|
1124
1138
|
}
|
|
1125
1139
|
};
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
}
|
|
1131
|
-
subscribe(e) {
|
|
1132
|
-
return this.listeners.add(e), this.onSubscribe(), () => {
|
|
1133
|
-
this.listeners.delete(e), this.onUnsubscribe();
|
|
1134
|
-
};
|
|
1135
|
-
}
|
|
1136
|
-
hasListeners() {
|
|
1137
|
-
return this.listeners.size > 0;
|
|
1138
|
-
}
|
|
1139
|
-
onSubscribe() {
|
|
1140
|
-
}
|
|
1141
|
-
onUnsubscribe() {
|
|
1142
|
-
}
|
|
1143
|
-
}, Wr = {
|
|
1144
|
-
// We need the wrapper function syntax below instead of direct references to
|
|
1145
|
-
// global setTimeout etc.
|
|
1146
|
-
//
|
|
1147
|
-
// BAD: `setTimeout: setTimeout`
|
|
1148
|
-
// GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
|
|
1149
|
-
//
|
|
1150
|
-
// If we use direct references here, then anything that wants to spy on or
|
|
1151
|
-
// replace the global setTimeout (like tests) won't work since we'll already
|
|
1152
|
-
// have a hard reference to the original implementation at the time when this
|
|
1153
|
-
// file was imported.
|
|
1154
|
-
setTimeout: (e, t) => setTimeout(e, t),
|
|
1155
|
-
clearTimeout: (e) => clearTimeout(e),
|
|
1156
|
-
setInterval: (e, t) => setInterval(e, t),
|
|
1157
|
-
clearInterval: (e) => clearInterval(e)
|
|
1158
|
-
}, Te, Ye, vr, Vr = (vr = class {
|
|
1159
|
-
constructor() {
|
|
1160
|
-
// We cannot have TimeoutManager<T> as we must instantiate it with a concrete
|
|
1161
|
-
// type at app boot; and if we leave that type, then any new timer provider
|
|
1162
|
-
// would need to support ReturnType<typeof setTimeout>, which is infeasible.
|
|
1163
|
-
//
|
|
1164
|
-
// We settle for type safety for the TimeoutProvider type, and accept that
|
|
1165
|
-
// this class is unsafe internally to allow for extension.
|
|
1166
|
-
z(this, Te, Wr);
|
|
1167
|
-
z(this, Ye, !1);
|
|
1168
|
-
}
|
|
1169
|
-
setTimeoutProvider(e) {
|
|
1170
|
-
process.env.NODE_ENV !== "production" && o(this, Ye) && e !== o(this, Te) && console.error(
|
|
1171
|
-
"[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",
|
|
1172
|
-
{ previous: o(this, Te), provider: e }
|
|
1173
|
-
), F(this, Te, e), process.env.NODE_ENV !== "production" && F(this, Ye, !1);
|
|
1174
|
-
}
|
|
1175
|
-
setTimeout(e, t) {
|
|
1176
|
-
return process.env.NODE_ENV !== "production" && F(this, Ye, !0), o(this, Te).setTimeout(e, t);
|
|
1177
|
-
}
|
|
1178
|
-
clearTimeout(e) {
|
|
1179
|
-
o(this, Te).clearTimeout(e);
|
|
1180
|
-
}
|
|
1181
|
-
setInterval(e, t) {
|
|
1182
|
-
return process.env.NODE_ENV !== "production" && F(this, Ye, !0), o(this, Te).setInterval(e, t);
|
|
1183
|
-
}
|
|
1184
|
-
clearInterval(e) {
|
|
1185
|
-
o(this, Te).clearInterval(e);
|
|
1186
|
-
}
|
|
1187
|
-
}, Te = new WeakMap(), Ye = new WeakMap(), vr), Mt = new Vr();
|
|
1188
|
-
function Kr(e) {
|
|
1189
|
-
setTimeout(e, 0);
|
|
1190
|
-
}
|
|
1191
|
-
var St = typeof window > "u" || "Deno" in globalThis;
|
|
1192
|
-
function Vt() {
|
|
1193
|
-
}
|
|
1194
|
-
function cr(e) {
|
|
1195
|
-
return typeof e == "number" && e >= 0 && e !== 1 / 0;
|
|
1196
|
-
}
|
|
1197
|
-
function qr(e, t) {
|
|
1198
|
-
return Math.max(e + (t || 0) - Date.now(), 0);
|
|
1199
|
-
}
|
|
1200
|
-
function Rt(e, t) {
|
|
1201
|
-
return typeof e == "function" ? e(t) : e;
|
|
1202
|
-
}
|
|
1203
|
-
function xe(e, t) {
|
|
1204
|
-
return typeof e == "function" ? e(t) : e;
|
|
1205
|
-
}
|
|
1206
|
-
var zr = Object.prototype.hasOwnProperty;
|
|
1207
|
-
function Kt(e, t) {
|
|
1208
|
-
if (e === t)
|
|
1209
|
-
return e;
|
|
1210
|
-
const s = lr(e) && lr(t);
|
|
1211
|
-
if (!s && !(ur(e) && ur(t))) return t;
|
|
1212
|
-
const i = (s ? e : Object.keys(e)).length, f = s ? t : Object.keys(t), u = f.length, g = s ? new Array(u) : {};
|
|
1213
|
-
let d = 0;
|
|
1214
|
-
for (let y = 0; y < u; y++) {
|
|
1215
|
-
const h = s ? y : f[y], l = e[h], v = t[h];
|
|
1216
|
-
if (l === v) {
|
|
1217
|
-
g[h] = l, (s ? y < i : zr.call(e, h)) && d++;
|
|
1218
|
-
continue;
|
|
1219
|
-
}
|
|
1220
|
-
if (l === null || v === null || typeof l != "object" || typeof v != "object") {
|
|
1221
|
-
g[h] = v;
|
|
1222
|
-
continue;
|
|
1223
|
-
}
|
|
1224
|
-
const w = Kt(l, v);
|
|
1225
|
-
g[h] = w, w === l && d++;
|
|
1226
|
-
}
|
|
1227
|
-
return i === u && d === i ? e : g;
|
|
1228
|
-
}
|
|
1229
|
-
function qt(e, t) {
|
|
1230
|
-
if (!t || Object.keys(e).length !== Object.keys(t).length)
|
|
1231
|
-
return !1;
|
|
1232
|
-
for (const s in e)
|
|
1233
|
-
if (e[s] !== t[s])
|
|
1234
|
-
return !1;
|
|
1235
|
-
return !0;
|
|
1236
|
-
}
|
|
1237
|
-
function lr(e) {
|
|
1238
|
-
return Array.isArray(e) && e.length === Object.keys(e).length;
|
|
1239
|
-
}
|
|
1240
|
-
function ur(e) {
|
|
1241
|
-
if (!dr(e))
|
|
1242
|
-
return !1;
|
|
1243
|
-
const t = e.constructor;
|
|
1244
|
-
if (t === void 0)
|
|
1245
|
-
return !0;
|
|
1246
|
-
const s = t.prototype;
|
|
1247
|
-
return !(!dr(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
|
|
1248
|
-
}
|
|
1249
|
-
function dr(e) {
|
|
1250
|
-
return Object.prototype.toString.call(e) === "[object Object]";
|
|
1251
|
-
}
|
|
1252
|
-
function fr(e, t, s) {
|
|
1253
|
-
if (typeof s.structuralSharing == "function")
|
|
1254
|
-
return s.structuralSharing(e, t);
|
|
1255
|
-
if (s.structuralSharing !== !1) {
|
|
1256
|
-
if (process.env.NODE_ENV !== "production")
|
|
1257
|
-
try {
|
|
1258
|
-
return Kt(e, t);
|
|
1259
|
-
} catch (n) {
|
|
1260
|
-
throw console.error(
|
|
1261
|
-
`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${s.queryHash}]: ${n}`
|
|
1262
|
-
), n;
|
|
1263
|
-
}
|
|
1264
|
-
return Kt(e, t);
|
|
1265
|
-
}
|
|
1266
|
-
return t;
|
|
1267
|
-
}
|
|
1268
|
-
function Qr(e, t) {
|
|
1269
|
-
return typeof e == "function" ? e(...t) : !!e;
|
|
1270
|
-
}
|
|
1271
|
-
var Ge, Le, ot, yr, Hr = (yr = class extends er {
|
|
1272
|
-
constructor() {
|
|
1273
|
-
super();
|
|
1274
|
-
z(this, Ge);
|
|
1275
|
-
z(this, Le);
|
|
1276
|
-
z(this, ot);
|
|
1277
|
-
F(this, ot, (t) => {
|
|
1278
|
-
if (!St && window.addEventListener) {
|
|
1279
|
-
const s = () => t();
|
|
1280
|
-
return window.addEventListener("visibilitychange", s, !1), () => {
|
|
1281
|
-
window.removeEventListener("visibilitychange", s);
|
|
1282
|
-
};
|
|
1283
|
-
}
|
|
1284
|
-
});
|
|
1285
|
-
}
|
|
1286
|
-
onSubscribe() {
|
|
1287
|
-
o(this, Le) || this.setEventListener(o(this, ot));
|
|
1288
|
-
}
|
|
1289
|
-
onUnsubscribe() {
|
|
1290
|
-
var t;
|
|
1291
|
-
this.hasListeners() || ((t = o(this, Le)) == null || t.call(this), F(this, Le, void 0));
|
|
1292
|
-
}
|
|
1293
|
-
setEventListener(t) {
|
|
1294
|
-
var s;
|
|
1295
|
-
F(this, ot, t), (s = o(this, Le)) == null || s.call(this), F(this, Le, t((n) => {
|
|
1296
|
-
typeof n == "boolean" ? this.setFocused(n) : this.onFocus();
|
|
1297
|
-
}));
|
|
1298
|
-
}
|
|
1299
|
-
setFocused(t) {
|
|
1300
|
-
o(this, Ge) !== t && (F(this, Ge, t), this.onFocus());
|
|
1301
|
-
}
|
|
1302
|
-
onFocus() {
|
|
1303
|
-
const t = this.isFocused();
|
|
1304
|
-
this.listeners.forEach((s) => {
|
|
1305
|
-
s(t);
|
|
1306
|
-
});
|
|
1307
|
-
}
|
|
1308
|
-
isFocused() {
|
|
1309
|
-
var t;
|
|
1310
|
-
return typeof o(this, Ge) == "boolean" ? o(this, Ge) : ((t = globalThis.document) == null ? void 0 : t.visibilityState) !== "hidden";
|
|
1311
|
-
}
|
|
1312
|
-
}, Ge = new WeakMap(), Le = new WeakMap(), ot = new WeakMap(), yr), Yr = new Hr();
|
|
1313
|
-
function hr() {
|
|
1314
|
-
let e, t;
|
|
1315
|
-
const s = new Promise((i, f) => {
|
|
1316
|
-
e = i, t = f;
|
|
1317
|
-
});
|
|
1318
|
-
s.status = "pending", s.catch(() => {
|
|
1319
|
-
});
|
|
1320
|
-
function n(i) {
|
|
1321
|
-
Object.assign(s, i), delete s.resolve, delete s.reject;
|
|
1322
|
-
}
|
|
1323
|
-
return s.resolve = (i) => {
|
|
1324
|
-
n({
|
|
1325
|
-
status: "fulfilled",
|
|
1326
|
-
value: i
|
|
1327
|
-
}), e(i);
|
|
1328
|
-
}, s.reject = (i) => {
|
|
1329
|
-
n({
|
|
1330
|
-
status: "rejected",
|
|
1331
|
-
reason: i
|
|
1332
|
-
}), t(i);
|
|
1333
|
-
}, s;
|
|
1334
|
-
}
|
|
1335
|
-
var Gr = Kr;
|
|
1336
|
-
function Jr() {
|
|
1337
|
-
let e = [], t = 0, s = (g) => {
|
|
1338
|
-
g();
|
|
1339
|
-
}, n = (g) => {
|
|
1340
|
-
g();
|
|
1341
|
-
}, i = Gr;
|
|
1342
|
-
const f = (g) => {
|
|
1343
|
-
t ? e.push(g) : i(() => {
|
|
1344
|
-
s(g);
|
|
1345
|
-
});
|
|
1346
|
-
}, u = () => {
|
|
1347
|
-
const g = e;
|
|
1348
|
-
e = [], g.length && i(() => {
|
|
1349
|
-
n(() => {
|
|
1350
|
-
g.forEach((d) => {
|
|
1351
|
-
s(d);
|
|
1352
|
-
});
|
|
1353
|
-
});
|
|
1354
|
-
});
|
|
1355
|
-
};
|
|
1356
|
-
return {
|
|
1357
|
-
batch: (g) => {
|
|
1358
|
-
let d;
|
|
1359
|
-
t++;
|
|
1360
|
-
try {
|
|
1361
|
-
d = g();
|
|
1362
|
-
} finally {
|
|
1363
|
-
t--, t || u();
|
|
1364
|
-
}
|
|
1365
|
-
return d;
|
|
1366
|
-
},
|
|
1367
|
-
/**
|
|
1368
|
-
* All calls to the wrapped function will be batched.
|
|
1369
|
-
*/
|
|
1370
|
-
batchCalls: (g) => (...d) => {
|
|
1371
|
-
f(() => {
|
|
1372
|
-
g(...d);
|
|
1373
|
-
});
|
|
1374
|
-
},
|
|
1375
|
-
schedule: f,
|
|
1376
|
-
/**
|
|
1377
|
-
* Use this method to set a custom notify function.
|
|
1378
|
-
* This can be used to for example wrap notifications with `React.act` while running tests.
|
|
1379
|
-
*/
|
|
1380
|
-
setNotifyFunction: (g) => {
|
|
1381
|
-
s = g;
|
|
1382
|
-
},
|
|
1383
|
-
/**
|
|
1384
|
-
* Use this method to set a custom function to batch notifications together into a single tick.
|
|
1385
|
-
* By default React Query will use the batch function provided by ReactDOM or React Native.
|
|
1386
|
-
*/
|
|
1387
|
-
setBatchNotifyFunction: (g) => {
|
|
1388
|
-
n = g;
|
|
1389
|
-
},
|
|
1390
|
-
setScheduler: (g) => {
|
|
1391
|
-
i = g;
|
|
1392
|
-
}
|
|
1393
|
-
};
|
|
1394
|
-
}
|
|
1395
|
-
var Tr = Jr(), ct, Me, lt, xr, Xr = (xr = class extends er {
|
|
1396
|
-
constructor() {
|
|
1397
|
-
super();
|
|
1398
|
-
z(this, ct, !0);
|
|
1399
|
-
z(this, Me);
|
|
1400
|
-
z(this, lt);
|
|
1401
|
-
F(this, lt, (t) => {
|
|
1402
|
-
if (!St && window.addEventListener) {
|
|
1403
|
-
const s = () => t(!0), n = () => t(!1);
|
|
1404
|
-
return window.addEventListener("online", s, !1), window.addEventListener("offline", n, !1), () => {
|
|
1405
|
-
window.removeEventListener("online", s), window.removeEventListener("offline", n);
|
|
1406
|
-
};
|
|
1407
|
-
}
|
|
1408
|
-
});
|
|
1409
|
-
}
|
|
1410
|
-
onSubscribe() {
|
|
1411
|
-
o(this, Me) || this.setEventListener(o(this, lt));
|
|
1412
|
-
}
|
|
1413
|
-
onUnsubscribe() {
|
|
1414
|
-
var t;
|
|
1415
|
-
this.hasListeners() || ((t = o(this, Me)) == null || t.call(this), F(this, Me, void 0));
|
|
1416
|
-
}
|
|
1417
|
-
setEventListener(t) {
|
|
1418
|
-
var s;
|
|
1419
|
-
F(this, lt, t), (s = o(this, Me)) == null || s.call(this), F(this, Me, t(this.setOnline.bind(this)));
|
|
1420
|
-
}
|
|
1421
|
-
setOnline(t) {
|
|
1422
|
-
o(this, ct) !== t && (F(this, ct, t), this.listeners.forEach((n) => {
|
|
1423
|
-
n(t);
|
|
1424
|
-
}));
|
|
1425
|
-
}
|
|
1426
|
-
isOnline() {
|
|
1427
|
-
return o(this, ct);
|
|
1428
|
-
}
|
|
1429
|
-
}, ct = new WeakMap(), Me = new WeakMap(), lt = new WeakMap(), xr), Zr = new Xr();
|
|
1430
|
-
function es(e) {
|
|
1431
|
-
return (e ?? "online") === "online" ? Zr.isOnline() : !0;
|
|
1432
|
-
}
|
|
1433
|
-
function ts(e, t) {
|
|
1434
|
-
return {
|
|
1435
|
-
fetchFailureCount: 0,
|
|
1436
|
-
fetchFailureReason: null,
|
|
1437
|
-
fetchStatus: es(t.networkMode) ? "fetching" : "paused",
|
|
1438
|
-
...e === void 0 && {
|
|
1439
|
-
error: null,
|
|
1440
|
-
status: "pending"
|
|
1441
|
-
}
|
|
1442
|
-
};
|
|
1443
|
-
}
|
|
1444
|
-
var le, U, Ct, ae, Je, ut, Ce, Fe, jt, dt, ft, Xe, Ze, Be, ht, V, _t, zt, Qt, Ht, Yt, Gt, Jt, Xt, Rr, wr, rs = (wr = class extends er {
|
|
1445
|
-
constructor(t, s) {
|
|
1446
|
-
super();
|
|
1447
|
-
z(this, V);
|
|
1448
|
-
z(this, le);
|
|
1449
|
-
z(this, U);
|
|
1450
|
-
z(this, Ct);
|
|
1451
|
-
z(this, ae);
|
|
1452
|
-
z(this, Je);
|
|
1453
|
-
z(this, ut);
|
|
1454
|
-
z(this, Ce);
|
|
1455
|
-
z(this, Fe);
|
|
1456
|
-
z(this, jt);
|
|
1457
|
-
z(this, dt);
|
|
1458
|
-
// This property keeps track of the last query with defined data.
|
|
1459
|
-
// It will be used to pass the previous data and query to the placeholder function between renders.
|
|
1460
|
-
z(this, ft);
|
|
1461
|
-
z(this, Xe);
|
|
1462
|
-
z(this, Ze);
|
|
1463
|
-
z(this, Be);
|
|
1464
|
-
z(this, ht, /* @__PURE__ */ new Set());
|
|
1465
|
-
this.options = s, F(this, le, t), F(this, Fe, null), F(this, Ce, hr()), this.bindMethods(), this.setOptions(s);
|
|
1466
|
-
}
|
|
1467
|
-
bindMethods() {
|
|
1468
|
-
this.refetch = this.refetch.bind(this);
|
|
1469
|
-
}
|
|
1470
|
-
onSubscribe() {
|
|
1471
|
-
this.listeners.size === 1 && (o(this, U).addObserver(this), pr(o(this, U), this.options) ? Z(this, V, _t).call(this) : this.updateResult(), Z(this, V, Yt).call(this));
|
|
1472
|
-
}
|
|
1473
|
-
onUnsubscribe() {
|
|
1474
|
-
this.hasListeners() || this.destroy();
|
|
1475
|
-
}
|
|
1476
|
-
shouldFetchOnReconnect() {
|
|
1477
|
-
return Zt(
|
|
1478
|
-
o(this, U),
|
|
1479
|
-
this.options,
|
|
1480
|
-
this.options.refetchOnReconnect
|
|
1481
|
-
);
|
|
1482
|
-
}
|
|
1483
|
-
shouldFetchOnWindowFocus() {
|
|
1484
|
-
return Zt(
|
|
1485
|
-
o(this, U),
|
|
1486
|
-
this.options,
|
|
1487
|
-
this.options.refetchOnWindowFocus
|
|
1488
|
-
);
|
|
1489
|
-
}
|
|
1490
|
-
destroy() {
|
|
1491
|
-
this.listeners = /* @__PURE__ */ new Set(), Z(this, V, Gt).call(this), Z(this, V, Jt).call(this), o(this, U).removeObserver(this);
|
|
1492
|
-
}
|
|
1493
|
-
setOptions(t) {
|
|
1494
|
-
const s = this.options, n = o(this, U);
|
|
1495
|
-
if (this.options = o(this, le).defaultQueryOptions(t), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof xe(this.options.enabled, o(this, U)) != "boolean")
|
|
1496
|
-
throw new Error(
|
|
1497
|
-
"Expected enabled to be a boolean or a callback that returns a boolean"
|
|
1498
|
-
);
|
|
1499
|
-
Z(this, V, Xt).call(this), o(this, U).setOptions(this.options), s._defaulted && !qt(this.options, s) && o(this, le).getQueryCache().notify({
|
|
1500
|
-
type: "observerOptionsUpdated",
|
|
1501
|
-
query: o(this, U),
|
|
1502
|
-
observer: this
|
|
1503
|
-
});
|
|
1504
|
-
const i = this.hasListeners();
|
|
1505
|
-
i && gr(
|
|
1506
|
-
o(this, U),
|
|
1507
|
-
n,
|
|
1508
|
-
this.options,
|
|
1509
|
-
s
|
|
1510
|
-
) && Z(this, V, _t).call(this), this.updateResult(), i && (o(this, U) !== n || xe(this.options.enabled, o(this, U)) !== xe(s.enabled, o(this, U)) || Rt(this.options.staleTime, o(this, U)) !== Rt(s.staleTime, o(this, U))) && Z(this, V, zt).call(this);
|
|
1511
|
-
const f = Z(this, V, Qt).call(this);
|
|
1512
|
-
i && (o(this, U) !== n || xe(this.options.enabled, o(this, U)) !== xe(s.enabled, o(this, U)) || f !== o(this, Be)) && Z(this, V, Ht).call(this, f);
|
|
1513
|
-
}
|
|
1514
|
-
getOptimisticResult(t) {
|
|
1515
|
-
const s = o(this, le).getQueryCache().build(o(this, le), t), n = this.createResult(s, t);
|
|
1516
|
-
return ns(this, n) && (F(this, ae, n), F(this, ut, this.options), F(this, Je, o(this, U).state)), n;
|
|
1517
|
-
}
|
|
1518
|
-
getCurrentResult() {
|
|
1519
|
-
return o(this, ae);
|
|
1520
|
-
}
|
|
1521
|
-
trackResult(t, s) {
|
|
1522
|
-
return new Proxy(t, {
|
|
1523
|
-
get: (n, i) => (this.trackProp(i), s == null || s(i), i === "promise" && (this.trackProp("data"), !this.options.experimental_prefetchInRender && o(this, Ce).status === "pending" && o(this, Ce).reject(
|
|
1524
|
-
new Error(
|
|
1525
|
-
"experimental_prefetchInRender feature flag is not enabled"
|
|
1526
|
-
)
|
|
1527
|
-
)), Reflect.get(n, i))
|
|
1528
|
-
});
|
|
1529
|
-
}
|
|
1530
|
-
trackProp(t) {
|
|
1531
|
-
o(this, ht).add(t);
|
|
1532
|
-
}
|
|
1533
|
-
getCurrentQuery() {
|
|
1534
|
-
return o(this, U);
|
|
1535
|
-
}
|
|
1536
|
-
refetch({ ...t } = {}) {
|
|
1537
|
-
return this.fetch({
|
|
1538
|
-
...t
|
|
1539
|
-
});
|
|
1540
|
-
}
|
|
1541
|
-
fetchOptimistic(t) {
|
|
1542
|
-
const s = o(this, le).defaultQueryOptions(t), n = o(this, le).getQueryCache().build(o(this, le), s);
|
|
1543
|
-
return n.fetch().then(() => this.createResult(n, s));
|
|
1544
|
-
}
|
|
1545
|
-
fetch(t) {
|
|
1546
|
-
return Z(this, V, _t).call(this, {
|
|
1547
|
-
...t,
|
|
1548
|
-
cancelRefetch: t.cancelRefetch ?? !0
|
|
1549
|
-
}).then(() => (this.updateResult(), o(this, ae)));
|
|
1550
|
-
}
|
|
1551
|
-
createResult(t, s) {
|
|
1552
|
-
var P;
|
|
1553
|
-
const n = o(this, U), i = this.options, f = o(this, ae), u = o(this, Je), g = o(this, ut), y = t !== n ? t.state : o(this, Ct), { state: h } = t;
|
|
1554
|
-
let l = { ...h }, v = !1, w;
|
|
1555
|
-
if (s._optimisticResults) {
|
|
1556
|
-
const j = this.hasListeners(), R = !j && pr(t, s), M = j && gr(t, n, s, i);
|
|
1557
|
-
(R || M) && (l = {
|
|
1558
|
-
...l,
|
|
1559
|
-
...ts(h.data, t.options)
|
|
1560
|
-
}), s._optimisticResults === "isRestoring" && (l.fetchStatus = "idle");
|
|
1561
|
-
}
|
|
1562
|
-
let { error: k, errorUpdatedAt: N, status: _ } = l;
|
|
1563
|
-
w = l.data;
|
|
1564
|
-
let I = !1;
|
|
1565
|
-
if (s.placeholderData !== void 0 && w === void 0 && _ === "pending") {
|
|
1566
|
-
let j;
|
|
1567
|
-
f != null && f.isPlaceholderData && s.placeholderData === (g == null ? void 0 : g.placeholderData) ? (j = f.data, I = !0) : j = typeof s.placeholderData == "function" ? s.placeholderData(
|
|
1568
|
-
(P = o(this, ft)) == null ? void 0 : P.state.data,
|
|
1569
|
-
o(this, ft)
|
|
1570
|
-
) : s.placeholderData, j !== void 0 && (_ = "success", w = fr(
|
|
1571
|
-
f == null ? void 0 : f.data,
|
|
1572
|
-
j,
|
|
1573
|
-
s
|
|
1574
|
-
), v = !0);
|
|
1575
|
-
}
|
|
1576
|
-
if (s.select && w !== void 0 && !I)
|
|
1577
|
-
if (f && w === (u == null ? void 0 : u.data) && s.select === o(this, jt))
|
|
1578
|
-
w = o(this, dt);
|
|
1579
|
-
else
|
|
1580
|
-
try {
|
|
1581
|
-
F(this, jt, s.select), w = s.select(w), w = fr(f == null ? void 0 : f.data, w, s), F(this, dt, w), F(this, Fe, null);
|
|
1582
|
-
} catch (j) {
|
|
1583
|
-
F(this, Fe, j);
|
|
1584
|
-
}
|
|
1585
|
-
o(this, Fe) && (k = o(this, Fe), w = o(this, dt), N = Date.now(), _ = "error");
|
|
1586
|
-
const p = l.fetchStatus === "fetching", E = _ === "pending", T = _ === "error", b = E && p, m = w !== void 0, C = {
|
|
1587
|
-
status: _,
|
|
1588
|
-
fetchStatus: l.fetchStatus,
|
|
1589
|
-
isPending: E,
|
|
1590
|
-
isSuccess: _ === "success",
|
|
1591
|
-
isError: T,
|
|
1592
|
-
isInitialLoading: b,
|
|
1593
|
-
isLoading: b,
|
|
1594
|
-
data: w,
|
|
1595
|
-
dataUpdatedAt: l.dataUpdatedAt,
|
|
1596
|
-
error: k,
|
|
1597
|
-
errorUpdatedAt: N,
|
|
1598
|
-
failureCount: l.fetchFailureCount,
|
|
1599
|
-
failureReason: l.fetchFailureReason,
|
|
1600
|
-
errorUpdateCount: l.errorUpdateCount,
|
|
1601
|
-
isFetched: l.dataUpdateCount > 0 || l.errorUpdateCount > 0,
|
|
1602
|
-
isFetchedAfterMount: l.dataUpdateCount > y.dataUpdateCount || l.errorUpdateCount > y.errorUpdateCount,
|
|
1603
|
-
isFetching: p,
|
|
1604
|
-
isRefetching: p && !E,
|
|
1605
|
-
isLoadingError: T && !m,
|
|
1606
|
-
isPaused: l.fetchStatus === "paused",
|
|
1607
|
-
isPlaceholderData: v,
|
|
1608
|
-
isRefetchError: T && m,
|
|
1609
|
-
isStale: tr(t, s),
|
|
1610
|
-
refetch: this.refetch,
|
|
1611
|
-
promise: o(this, Ce),
|
|
1612
|
-
isEnabled: xe(s.enabled, t) !== !1
|
|
1613
|
-
};
|
|
1614
|
-
if (this.options.experimental_prefetchInRender) {
|
|
1615
|
-
const j = (A) => {
|
|
1616
|
-
C.status === "error" ? A.reject(C.error) : C.data !== void 0 && A.resolve(C.data);
|
|
1617
|
-
}, R = () => {
|
|
1618
|
-
const A = F(this, Ce, C.promise = hr());
|
|
1619
|
-
j(A);
|
|
1620
|
-
}, M = o(this, Ce);
|
|
1621
|
-
switch (M.status) {
|
|
1622
|
-
case "pending":
|
|
1623
|
-
t.queryHash === n.queryHash && j(M);
|
|
1624
|
-
break;
|
|
1625
|
-
case "fulfilled":
|
|
1626
|
-
(C.status === "error" || C.data !== M.value) && R();
|
|
1627
|
-
break;
|
|
1628
|
-
case "rejected":
|
|
1629
|
-
(C.status !== "error" || C.error !== M.reason) && R();
|
|
1630
|
-
break;
|
|
1631
|
-
}
|
|
1632
|
-
}
|
|
1633
|
-
return C;
|
|
1634
|
-
}
|
|
1635
|
-
updateResult() {
|
|
1636
|
-
const t = o(this, ae), s = this.createResult(o(this, U), this.options);
|
|
1637
|
-
if (F(this, Je, o(this, U).state), F(this, ut, this.options), o(this, Je).data !== void 0 && F(this, ft, o(this, U)), qt(s, t))
|
|
1638
|
-
return;
|
|
1639
|
-
F(this, ae, s);
|
|
1640
|
-
const n = () => {
|
|
1641
|
-
if (!t)
|
|
1642
|
-
return !0;
|
|
1643
|
-
const { notifyOnChangeProps: i } = this.options, f = typeof i == "function" ? i() : i;
|
|
1644
|
-
if (f === "all" || !f && !o(this, ht).size)
|
|
1645
|
-
return !0;
|
|
1646
|
-
const u = new Set(
|
|
1647
|
-
f ?? o(this, ht)
|
|
1648
|
-
);
|
|
1649
|
-
return this.options.throwOnError && u.add("error"), Object.keys(o(this, ae)).some((g) => {
|
|
1650
|
-
const d = g;
|
|
1651
|
-
return o(this, ae)[d] !== t[d] && u.has(d);
|
|
1652
|
-
});
|
|
1653
|
-
};
|
|
1654
|
-
Z(this, V, Rr).call(this, { listeners: n() });
|
|
1655
|
-
}
|
|
1656
|
-
onQueryUpdate() {
|
|
1657
|
-
this.updateResult(), this.hasListeners() && Z(this, V, Yt).call(this);
|
|
1658
|
-
}
|
|
1659
|
-
}, le = new WeakMap(), U = new WeakMap(), Ct = new WeakMap(), ae = new WeakMap(), Je = new WeakMap(), ut = new WeakMap(), Ce = new WeakMap(), Fe = new WeakMap(), jt = new WeakMap(), dt = new WeakMap(), ft = new WeakMap(), Xe = new WeakMap(), Ze = new WeakMap(), Be = new WeakMap(), ht = new WeakMap(), V = new WeakSet(), _t = function(t) {
|
|
1660
|
-
Z(this, V, Xt).call(this);
|
|
1661
|
-
let s = o(this, U).fetch(
|
|
1662
|
-
this.options,
|
|
1663
|
-
t
|
|
1664
|
-
);
|
|
1665
|
-
return t != null && t.throwOnError || (s = s.catch(Vt)), s;
|
|
1666
|
-
}, zt = function() {
|
|
1667
|
-
Z(this, V, Gt).call(this);
|
|
1668
|
-
const t = Rt(
|
|
1669
|
-
this.options.staleTime,
|
|
1670
|
-
o(this, U)
|
|
1671
|
-
);
|
|
1672
|
-
if (St || o(this, ae).isStale || !cr(t))
|
|
1673
|
-
return;
|
|
1674
|
-
const n = qr(o(this, ae).dataUpdatedAt, t) + 1;
|
|
1675
|
-
F(this, Xe, Mt.setTimeout(() => {
|
|
1676
|
-
o(this, ae).isStale || this.updateResult();
|
|
1677
|
-
}, n));
|
|
1678
|
-
}, Qt = function() {
|
|
1679
|
-
return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(o(this, U)) : this.options.refetchInterval) ?? !1;
|
|
1680
|
-
}, Ht = function(t) {
|
|
1681
|
-
Z(this, V, Jt).call(this), F(this, Be, t), !(St || xe(this.options.enabled, o(this, U)) === !1 || !cr(o(this, Be)) || o(this, Be) === 0) && F(this, Ze, Mt.setInterval(() => {
|
|
1682
|
-
(this.options.refetchIntervalInBackground || Yr.isFocused()) && Z(this, V, _t).call(this);
|
|
1683
|
-
}, o(this, Be)));
|
|
1684
|
-
}, Yt = function() {
|
|
1685
|
-
Z(this, V, zt).call(this), Z(this, V, Ht).call(this, Z(this, V, Qt).call(this));
|
|
1686
|
-
}, Gt = function() {
|
|
1687
|
-
o(this, Xe) && (Mt.clearTimeout(o(this, Xe)), F(this, Xe, void 0));
|
|
1688
|
-
}, Jt = function() {
|
|
1689
|
-
o(this, Ze) && (Mt.clearInterval(o(this, Ze)), F(this, Ze, void 0));
|
|
1690
|
-
}, Xt = function() {
|
|
1691
|
-
const t = o(this, le).getQueryCache().build(o(this, le), this.options);
|
|
1692
|
-
if (t === o(this, U))
|
|
1693
|
-
return;
|
|
1694
|
-
const s = o(this, U);
|
|
1695
|
-
F(this, U, t), F(this, Ct, t.state), this.hasListeners() && (s == null || s.removeObserver(this), t.addObserver(this));
|
|
1696
|
-
}, Rr = function(t) {
|
|
1697
|
-
Tr.batch(() => {
|
|
1698
|
-
t.listeners && this.listeners.forEach((s) => {
|
|
1699
|
-
s(o(this, ae));
|
|
1700
|
-
}), o(this, le).getQueryCache().notify({
|
|
1701
|
-
query: o(this, U),
|
|
1702
|
-
type: "observerResultsUpdated"
|
|
1703
|
-
});
|
|
1704
|
-
});
|
|
1705
|
-
}, wr);
|
|
1706
|
-
function ss(e, t) {
|
|
1707
|
-
return xe(t.enabled, e) !== !1 && e.state.data === void 0 && !(e.state.status === "error" && t.retryOnMount === !1);
|
|
1708
|
-
}
|
|
1709
|
-
function pr(e, t) {
|
|
1710
|
-
return ss(e, t) || e.state.data !== void 0 && Zt(e, t, t.refetchOnMount);
|
|
1711
|
-
}
|
|
1712
|
-
function Zt(e, t, s) {
|
|
1713
|
-
if (xe(t.enabled, e) !== !1 && Rt(t.staleTime, e) !== "static") {
|
|
1714
|
-
const n = typeof s == "function" ? s(e) : s;
|
|
1715
|
-
return n === "always" || n !== !1 && tr(e, t);
|
|
1716
|
-
}
|
|
1717
|
-
return !1;
|
|
1718
|
-
}
|
|
1719
|
-
function gr(e, t, s, n) {
|
|
1720
|
-
return (e !== t || xe(n.enabled, e) === !1) && (!s.suspense || e.state.status !== "error") && tr(e, s);
|
|
1721
|
-
}
|
|
1722
|
-
function tr(e, t) {
|
|
1723
|
-
return xe(t.enabled, e) !== !1 && e.isStaleByTime(Rt(t.staleTime, e));
|
|
1724
|
-
}
|
|
1725
|
-
function ns(e, t) {
|
|
1726
|
-
return !qt(e.getCurrentResult(), t);
|
|
1727
|
-
}
|
|
1728
|
-
var is = we.createContext(
|
|
1729
|
-
void 0
|
|
1730
|
-
), Sr = (e) => {
|
|
1731
|
-
const t = we.useContext(is);
|
|
1732
|
-
if (!t)
|
|
1733
|
-
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
1734
|
-
return t;
|
|
1735
|
-
}, Cr = we.createContext(!1), as = () => we.useContext(Cr);
|
|
1736
|
-
Cr.Provider;
|
|
1737
|
-
function os() {
|
|
1738
|
-
let e = !1;
|
|
1739
|
-
return {
|
|
1740
|
-
clearReset: () => {
|
|
1741
|
-
e = !1;
|
|
1742
|
-
},
|
|
1743
|
-
reset: () => {
|
|
1744
|
-
e = !0;
|
|
1745
|
-
},
|
|
1746
|
-
isReset: () => e
|
|
1747
|
-
};
|
|
1748
|
-
}
|
|
1749
|
-
var cs = we.createContext(os()), ls = () => we.useContext(cs), us = (e, t) => {
|
|
1750
|
-
(e.suspense || e.throwOnError || e.experimental_prefetchInRender) && (t.isReset() || (e.retryOnMount = !1));
|
|
1751
|
-
}, ds = (e) => {
|
|
1752
|
-
we.useEffect(() => {
|
|
1753
|
-
e.clearReset();
|
|
1754
|
-
}, [e]);
|
|
1755
|
-
}, fs = ({
|
|
1756
|
-
result: e,
|
|
1757
|
-
errorResetBoundary: t,
|
|
1758
|
-
throwOnError: s,
|
|
1759
|
-
query: n,
|
|
1760
|
-
suspense: i
|
|
1761
|
-
}) => e.isError && !t.isReset() && !e.isFetching && n && (i && e.data === void 0 || Qr(s, [e.error, n])), hs = (e) => {
|
|
1762
|
-
if (e.suspense) {
|
|
1763
|
-
const s = (i) => i === "static" ? i : Math.max(i ?? 1e3, 1e3), n = e.staleTime;
|
|
1764
|
-
e.staleTime = typeof n == "function" ? (...i) => s(n(...i)) : s(n), typeof e.gcTime == "number" && (e.gcTime = Math.max(
|
|
1765
|
-
e.gcTime,
|
|
1766
|
-
1e3
|
|
1767
|
-
));
|
|
1768
|
-
}
|
|
1769
|
-
}, ps = (e, t) => e.isLoading && e.isFetching && !t, gs = (e, t) => (e == null ? void 0 : e.suspense) && t.isPending, br = (e, t, s) => t.fetchOptimistic(e).catch(() => {
|
|
1770
|
-
s.clearReset();
|
|
1771
|
-
});
|
|
1772
|
-
function bs(e, t, s) {
|
|
1773
|
-
var l, v, w, k, N;
|
|
1774
|
-
if (process.env.NODE_ENV !== "production" && (typeof e != "object" || Array.isArray(e)))
|
|
1775
|
-
throw new Error(
|
|
1776
|
-
'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
|
|
1777
|
-
);
|
|
1778
|
-
const n = as(), i = ls(), f = Sr(), u = f.defaultQueryOptions(e);
|
|
1779
|
-
(v = (l = f.getDefaultOptions().queries) == null ? void 0 : l._experimental_beforeQuery) == null || v.call(
|
|
1780
|
-
l,
|
|
1781
|
-
u
|
|
1782
|
-
), process.env.NODE_ENV !== "production" && (u.queryFn || console.error(
|
|
1783
|
-
`[${u.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`
|
|
1784
|
-
)), u._optimisticResults = n ? "isRestoring" : "optimistic", hs(u), us(u, i), ds(i);
|
|
1785
|
-
const g = !f.getQueryCache().get(u.queryHash), [d] = we.useState(
|
|
1786
|
-
() => new t(
|
|
1787
|
-
f,
|
|
1788
|
-
u
|
|
1789
|
-
)
|
|
1790
|
-
), y = d.getOptimisticResult(u), h = !n && e.subscribed !== !1;
|
|
1791
|
-
if (we.useSyncExternalStore(
|
|
1792
|
-
we.useCallback(
|
|
1793
|
-
(_) => {
|
|
1794
|
-
const I = h ? d.subscribe(Tr.batchCalls(_)) : Vt;
|
|
1795
|
-
return d.updateResult(), I;
|
|
1796
|
-
},
|
|
1797
|
-
[d, h]
|
|
1798
|
-
),
|
|
1799
|
-
() => d.getCurrentResult(),
|
|
1800
|
-
() => d.getCurrentResult()
|
|
1801
|
-
), we.useEffect(() => {
|
|
1802
|
-
d.setOptions(u);
|
|
1803
|
-
}, [u, d]), gs(u, y))
|
|
1804
|
-
throw br(u, d, i);
|
|
1805
|
-
if (fs({
|
|
1806
|
-
result: y,
|
|
1807
|
-
errorResetBoundary: i,
|
|
1808
|
-
throwOnError: u.throwOnError,
|
|
1809
|
-
query: f.getQueryCache().get(u.queryHash),
|
|
1810
|
-
suspense: u.suspense
|
|
1811
|
-
}))
|
|
1812
|
-
throw y.error;
|
|
1813
|
-
if ((k = (w = f.getDefaultOptions().queries) == null ? void 0 : w._experimental_afterQuery) == null || k.call(
|
|
1814
|
-
w,
|
|
1815
|
-
u,
|
|
1816
|
-
y
|
|
1817
|
-
), u.experimental_prefetchInRender && !St && ps(y, n)) {
|
|
1818
|
-
const _ = g ? (
|
|
1819
|
-
// Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
|
|
1820
|
-
br(u, d, i)
|
|
1821
|
-
) : (
|
|
1822
|
-
// subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
|
|
1823
|
-
(N = f.getQueryCache().get(u.queryHash)) == null ? void 0 : N.promise
|
|
1824
|
-
);
|
|
1825
|
-
_ == null || _.catch(Vt).finally(() => {
|
|
1826
|
-
d.updateResult();
|
|
1827
|
-
});
|
|
1828
|
-
}
|
|
1829
|
-
return u.notifyOnChangeProps ? y : d.trackResult(y);
|
|
1830
|
-
}
|
|
1831
|
-
function jr(e, t) {
|
|
1832
|
-
return bs(e, rs);
|
|
1833
|
-
}
|
|
1834
|
-
const ms = (e) => {
|
|
1835
|
-
const t = Sr(), s = _r();
|
|
1836
|
-
return se(() => {
|
|
1837
|
-
const n = s.channel("animation-states-changes").on("postgres_changes", {
|
|
1140
|
+
}, Lt = (n) => {
|
|
1141
|
+
const l = Rt(), i = bt();
|
|
1142
|
+
return X(() => {
|
|
1143
|
+
const f = i.channel("animation-states-changes").on("postgres_changes", {
|
|
1838
1144
|
event: "*",
|
|
1839
1145
|
schema: "public",
|
|
1840
1146
|
table: "animation_states"
|
|
1841
1147
|
}, () => {
|
|
1842
|
-
|
|
1843
|
-
}).subscribe(),
|
|
1148
|
+
l.invalidateQueries({ queryKey: ["bob-animation-data"] });
|
|
1149
|
+
}).subscribe(), d = i.channel("bob-animations-changes").on("postgres_changes", {
|
|
1844
1150
|
event: "*",
|
|
1845
1151
|
schema: "public",
|
|
1846
1152
|
table: "bob_animations"
|
|
1847
1153
|
}, () => {
|
|
1848
|
-
|
|
1154
|
+
l.invalidateQueries({ queryKey: ["bob-animation-data"] });
|
|
1849
1155
|
}).subscribe();
|
|
1850
1156
|
return () => {
|
|
1851
|
-
|
|
1157
|
+
i.removeChannel(f), i.removeChannel(d);
|
|
1852
1158
|
};
|
|
1853
|
-
}, [
|
|
1854
|
-
queryKey: ["bob-animation-data",
|
|
1159
|
+
}, [l, i]), ht({
|
|
1160
|
+
queryKey: ["bob-animation-data", n],
|
|
1855
1161
|
queryFn: async () => {
|
|
1856
|
-
var
|
|
1857
|
-
const { data:
|
|
1858
|
-
if (
|
|
1859
|
-
const
|
|
1860
|
-
if (!
|
|
1162
|
+
var R;
|
|
1163
|
+
const { data: f, error: d } = await i.from("bob_looks").select("*").order("display_order");
|
|
1164
|
+
if (d) throw d;
|
|
1165
|
+
const _ = (f || []).find((I) => I.is_active), b = n || (_ == null ? void 0 : _.id) || f && ((R = f[0]) == null ? void 0 : R.id) || null;
|
|
1166
|
+
if (!b)
|
|
1861
1167
|
return {
|
|
1862
1168
|
states: [],
|
|
1863
1169
|
configs: [],
|
|
1864
1170
|
uploadedImages: [],
|
|
1865
|
-
looks:
|
|
1171
|
+
looks: f || [],
|
|
1866
1172
|
activeLookId: null
|
|
1867
1173
|
};
|
|
1868
|
-
const { data:
|
|
1869
|
-
if (
|
|
1870
|
-
const { data:
|
|
1871
|
-
if (
|
|
1872
|
-
const
|
|
1873
|
-
if (
|
|
1874
|
-
const
|
|
1875
|
-
const { data:
|
|
1876
|
-
return
|
|
1174
|
+
const { data: E, error: g } = await i.from("animation_states").select("*").eq("is_active", !0).eq("look_id", b).order("display_order");
|
|
1175
|
+
if (g) throw g;
|
|
1176
|
+
const { data: x, error: u } = await i.from("bob_animations").select("*").eq("is_active", !0).eq("look_id", b).order("animation_state").order("sequence_order");
|
|
1177
|
+
if (u) throw u;
|
|
1178
|
+
const p = new Set((E || []).map((I) => I.state_key)), h = (x || []).filter((I) => p.has(I.animation_state)), { data: j, error: C } = await i.storage.from("bob-images").list();
|
|
1179
|
+
if (C) throw C;
|
|
1180
|
+
const P = (j || []).map((I) => {
|
|
1181
|
+
const { data: s } = i.storage.from("bob-images").getPublicUrl(I.name);
|
|
1182
|
+
return s.publicUrl;
|
|
1877
1183
|
});
|
|
1878
|
-
return
|
|
1879
|
-
const
|
|
1880
|
-
|
|
1184
|
+
return h.forEach((I) => {
|
|
1185
|
+
const s = new Image();
|
|
1186
|
+
s.src = I.image_url;
|
|
1881
1187
|
}), {
|
|
1882
|
-
states:
|
|
1883
|
-
configs:
|
|
1884
|
-
uploadedImages:
|
|
1885
|
-
looks:
|
|
1886
|
-
activeLookId:
|
|
1188
|
+
states: E || [],
|
|
1189
|
+
configs: h,
|
|
1190
|
+
uploadedImages: P,
|
|
1191
|
+
looks: f || [],
|
|
1192
|
+
activeLookId: b
|
|
1887
1193
|
};
|
|
1888
1194
|
},
|
|
1889
1195
|
staleTime: 30 * 1e3,
|
|
1890
1196
|
gcTime: 5 * 60 * 1e3
|
|
1891
1197
|
});
|
|
1892
|
-
},
|
|
1893
|
-
const [
|
|
1894
|
-
if (!
|
|
1198
|
+
}, Pt = () => {
|
|
1199
|
+
const [n, l] = U(""), [i, f] = U(0), [d, _] = U(400), [b, E] = U(!1), g = V(), { data: x, isLoading: u } = Lt(), p = V({}), { imageUrlsMap: h, alternateImages: j, offsetsMap: C, scalesMap: P, availableStates: R } = rt(() => {
|
|
1200
|
+
if (!x)
|
|
1895
1201
|
return {
|
|
1896
1202
|
imageUrlsMap: {},
|
|
1897
1203
|
alternateImages: {},
|
|
@@ -1899,261 +1205,261 @@ const ms = (e) => {
|
|
|
1899
1205
|
scalesMap: {},
|
|
1900
1206
|
availableStates: []
|
|
1901
1207
|
};
|
|
1902
|
-
const
|
|
1903
|
-
return
|
|
1904
|
-
const
|
|
1905
|
-
if (
|
|
1906
|
-
const
|
|
1907
|
-
|
|
1908
|
-
url:
|
|
1909
|
-
animation_speed: (
|
|
1910
|
-
pause_duration: (
|
|
1911
|
-
loop_count: (
|
|
1912
|
-
},
|
|
1208
|
+
const v = {}, a = {}, o = {}, w = {}, k = x.states.map((N) => N.state_key);
|
|
1209
|
+
return k.forEach((N) => {
|
|
1210
|
+
const O = x.configs.filter((S) => S.animation_state === N), y = O.map((S) => S.image_url), M = O.map((S) => S.vertical_offset || 0), $ = O.map((S) => S.scale || 100);
|
|
1211
|
+
if (y.length > 0) {
|
|
1212
|
+
const S = x.states.find((H) => H.state_key === N);
|
|
1213
|
+
v[N] = {
|
|
1214
|
+
url: y[0],
|
|
1215
|
+
animation_speed: (S == null ? void 0 : S.animation_speed) || 400,
|
|
1216
|
+
pause_duration: (S == null ? void 0 : S.pause_duration) || 0,
|
|
1217
|
+
loop_count: (S == null ? void 0 : S.loop_count) || 0
|
|
1218
|
+
}, a[N] = y, o[N] = M, w[N] = $;
|
|
1913
1219
|
}
|
|
1914
1220
|
}), {
|
|
1915
|
-
imageUrlsMap:
|
|
1916
|
-
alternateImages:
|
|
1917
|
-
offsetsMap:
|
|
1918
|
-
scalesMap:
|
|
1919
|
-
availableStates:
|
|
1221
|
+
imageUrlsMap: v,
|
|
1222
|
+
alternateImages: a,
|
|
1223
|
+
offsetsMap: o,
|
|
1224
|
+
scalesMap: w,
|
|
1225
|
+
availableStates: k
|
|
1920
1226
|
};
|
|
1921
|
-
}, [
|
|
1922
|
-
return
|
|
1923
|
-
|
|
1924
|
-
}, [
|
|
1925
|
-
|
|
1926
|
-
}, [
|
|
1927
|
-
const
|
|
1928
|
-
if (
|
|
1929
|
-
|
|
1930
|
-
const
|
|
1931
|
-
let
|
|
1932
|
-
const
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
const
|
|
1936
|
-
return
|
|
1937
|
-
|
|
1938
|
-
},
|
|
1227
|
+
}, [x]);
|
|
1228
|
+
return X(() => {
|
|
1229
|
+
p.current = h;
|
|
1230
|
+
}, [h]), X(() => {
|
|
1231
|
+
R.length > 0 && !n && l(R[0]);
|
|
1232
|
+
}, [R, n]), X(() => {
|
|
1233
|
+
const v = j[n];
|
|
1234
|
+
if (g.current && clearInterval(g.current), v && v.length > 1) {
|
|
1235
|
+
f(0);
|
|
1236
|
+
const a = p.current[n], o = (a == null ? void 0 : a.animation_speed) || d || 400, w = (a == null ? void 0 : a.loop_count) || 0, k = (a == null ? void 0 : a.pause_duration) || 0;
|
|
1237
|
+
let N = 0, O = !1;
|
|
1238
|
+
const y = () => {
|
|
1239
|
+
g.current = setInterval(() => {
|
|
1240
|
+
O || f((M) => {
|
|
1241
|
+
const $ = (M + 1) % v.length;
|
|
1242
|
+
return $ === 0 && (N++, w > 0 && N >= w) ? (clearInterval(g.current), k > 0 && (O = !0, setTimeout(() => {
|
|
1243
|
+
N = 0, O = !1, y();
|
|
1244
|
+
}, k)), M) : $;
|
|
1939
1245
|
});
|
|
1940
|
-
},
|
|
1246
|
+
}, o);
|
|
1941
1247
|
};
|
|
1942
|
-
|
|
1248
|
+
y();
|
|
1943
1249
|
} else
|
|
1944
|
-
|
|
1250
|
+
f(0);
|
|
1945
1251
|
return () => {
|
|
1946
|
-
|
|
1252
|
+
g.current && clearInterval(g.current);
|
|
1947
1253
|
};
|
|
1948
|
-
}, [
|
|
1949
|
-
animationState:
|
|
1950
|
-
setAnimationState:
|
|
1254
|
+
}, [n, j]), {
|
|
1255
|
+
animationState: n,
|
|
1256
|
+
setAnimationState: l,
|
|
1951
1257
|
getCurrentImage: () => {
|
|
1952
|
-
const
|
|
1953
|
-
if (!
|
|
1954
|
-
const
|
|
1955
|
-
var
|
|
1956
|
-
return ((
|
|
1258
|
+
const v = j[n];
|
|
1259
|
+
if (!v || v.length === 0) {
|
|
1260
|
+
const a = R.find((o) => {
|
|
1261
|
+
var w;
|
|
1262
|
+
return ((w = j[o]) == null ? void 0 : w.length) > 0;
|
|
1957
1263
|
});
|
|
1958
|
-
return
|
|
1264
|
+
return a ? j[a][0] : "";
|
|
1959
1265
|
}
|
|
1960
|
-
return
|
|
1266
|
+
return v[i] || v[0];
|
|
1961
1267
|
},
|
|
1962
1268
|
getCurrentOffset: () => {
|
|
1963
|
-
const
|
|
1964
|
-
if (!
|
|
1965
|
-
const
|
|
1966
|
-
var
|
|
1967
|
-
return ((
|
|
1269
|
+
const v = C[n];
|
|
1270
|
+
if (!v || v.length === 0) {
|
|
1271
|
+
const a = R.find((o) => {
|
|
1272
|
+
var w;
|
|
1273
|
+
return ((w = C[o]) == null ? void 0 : w.length) > 0;
|
|
1968
1274
|
});
|
|
1969
|
-
return
|
|
1275
|
+
return a ? C[a][0] : 0;
|
|
1970
1276
|
}
|
|
1971
|
-
return
|
|
1277
|
+
return v[i] || v[0];
|
|
1972
1278
|
},
|
|
1973
1279
|
getCurrentScale: () => {
|
|
1974
|
-
const
|
|
1975
|
-
if (!
|
|
1976
|
-
const
|
|
1977
|
-
var
|
|
1978
|
-
return ((
|
|
1280
|
+
const v = P[n];
|
|
1281
|
+
if (!v || v.length === 0) {
|
|
1282
|
+
const a = R.find((o) => {
|
|
1283
|
+
var w;
|
|
1284
|
+
return ((w = P[o]) == null ? void 0 : w.length) > 0;
|
|
1979
1285
|
});
|
|
1980
|
-
return
|
|
1286
|
+
return a ? P[a][0] : 100;
|
|
1981
1287
|
}
|
|
1982
|
-
return
|
|
1288
|
+
return v[i] || v[0];
|
|
1983
1289
|
},
|
|
1984
|
-
imageUrls:
|
|
1985
|
-
availableStates:
|
|
1986
|
-
setTalkSpeed:
|
|
1987
|
-
manualMode:
|
|
1988
|
-
setManualMode:
|
|
1989
|
-
isLoading:
|
|
1290
|
+
imageUrls: h,
|
|
1291
|
+
availableStates: R,
|
|
1292
|
+
setTalkSpeed: _,
|
|
1293
|
+
manualMode: b,
|
|
1294
|
+
setManualMode: E,
|
|
1295
|
+
isLoading: u
|
|
1990
1296
|
};
|
|
1991
|
-
},
|
|
1992
|
-
const
|
|
1297
|
+
}, Bt = () => {
|
|
1298
|
+
const n = bt(), { data: l = [], isLoading: i } = ht({
|
|
1993
1299
|
queryKey: ["bob-backdrops"],
|
|
1994
1300
|
queryFn: async () => {
|
|
1995
|
-
const { data:
|
|
1996
|
-
if (
|
|
1997
|
-
return
|
|
1301
|
+
const { data: d, error: _ } = await n.from("bob_backdrops").select("*").order("display_order", { ascending: !0 });
|
|
1302
|
+
if (_) throw _;
|
|
1303
|
+
return d;
|
|
1998
1304
|
},
|
|
1999
1305
|
staleTime: 5 * 60 * 1e3,
|
|
2000
1306
|
gcTime: 10 * 60 * 1e3
|
|
2001
|
-
}),
|
|
1307
|
+
}), f = l.find((d) => d.is_active);
|
|
2002
1308
|
return {
|
|
2003
|
-
backdrops:
|
|
2004
|
-
activeBackdrop:
|
|
2005
|
-
isLoading:
|
|
1309
|
+
backdrops: l,
|
|
1310
|
+
activeBackdrop: f,
|
|
1311
|
+
isLoading: i
|
|
2006
1312
|
};
|
|
2007
|
-
},
|
|
2008
|
-
currentImage:
|
|
2009
|
-
animationState:
|
|
2010
|
-
backdropUrl:
|
|
2011
|
-
counterOverlayUrl:
|
|
2012
|
-
counterHeightPercent:
|
|
2013
|
-
className:
|
|
2014
|
-
verticalOffset:
|
|
2015
|
-
scale:
|
|
1313
|
+
}, At = ({
|
|
1314
|
+
currentImage: n,
|
|
1315
|
+
animationState: l,
|
|
1316
|
+
backdropUrl: i,
|
|
1317
|
+
counterOverlayUrl: f,
|
|
1318
|
+
counterHeightPercent: d = 12,
|
|
1319
|
+
className: _ = "",
|
|
1320
|
+
verticalOffset: b = 0,
|
|
1321
|
+
scale: E = 100
|
|
2016
1322
|
}) => {
|
|
2017
|
-
const
|
|
2018
|
-
return /* @__PURE__ */
|
|
2019
|
-
|
|
1323
|
+
const g = b + d, x = 55 * (E / 100);
|
|
1324
|
+
return /* @__PURE__ */ t.jsx("div", { className: `flex flex-col items-center justify-center gap-6 w-full ${_}`, children: /* @__PURE__ */ t.jsxs("div", { className: "relative w-full max-w-[600px] mx-auto aspect-[16/10] overflow-hidden", children: [
|
|
1325
|
+
i && /* @__PURE__ */ t.jsx(
|
|
2020
1326
|
"img",
|
|
2021
1327
|
{
|
|
2022
|
-
src:
|
|
1328
|
+
src: i,
|
|
2023
1329
|
alt: "Backdrop",
|
|
2024
1330
|
className: "absolute inset-0 z-0 w-full h-full object-cover object-bottom"
|
|
2025
1331
|
}
|
|
2026
1332
|
),
|
|
2027
|
-
/* @__PURE__ */
|
|
1333
|
+
/* @__PURE__ */ t.jsx(
|
|
2028
1334
|
"img",
|
|
2029
1335
|
{
|
|
2030
|
-
src:
|
|
2031
|
-
alt: `Bob ${
|
|
1336
|
+
src: n,
|
|
1337
|
+
alt: `Bob ${l}`,
|
|
2032
1338
|
className: "absolute z-10 h-auto object-contain left-1/2 -translate-x-1/2",
|
|
2033
1339
|
style: {
|
|
2034
|
-
bottom: `${
|
|
2035
|
-
width: `${
|
|
2036
|
-
maxWidth: `${220 * (
|
|
1340
|
+
bottom: `${g}%`,
|
|
1341
|
+
width: `${x}%`,
|
|
1342
|
+
maxWidth: `${220 * (E / 100)}px`,
|
|
2037
1343
|
transformOrigin: "center bottom"
|
|
2038
1344
|
}
|
|
2039
1345
|
}
|
|
2040
1346
|
),
|
|
2041
|
-
|
|
1347
|
+
f && /* @__PURE__ */ t.jsx(
|
|
2042
1348
|
"img",
|
|
2043
1349
|
{
|
|
2044
|
-
src:
|
|
1350
|
+
src: f,
|
|
2045
1351
|
alt: "Counter",
|
|
2046
1352
|
className: "absolute z-20 bottom-0 left-0 w-full object-cover object-bottom",
|
|
2047
|
-
style: { height: `${
|
|
1353
|
+
style: { height: `${d}%` }
|
|
2048
1354
|
}
|
|
2049
1355
|
)
|
|
2050
1356
|
] }) });
|
|
2051
|
-
},
|
|
2052
|
-
messages:
|
|
2053
|
-
input:
|
|
2054
|
-
setInput:
|
|
2055
|
-
isLoading:
|
|
2056
|
-
onSend:
|
|
2057
|
-
onKeyPress:
|
|
2058
|
-
onInputFocus:
|
|
2059
|
-
onInputBlur:
|
|
2060
|
-
chatEndRef:
|
|
2061
|
-
isMuted:
|
|
2062
|
-
onToggleMute:
|
|
2063
|
-
isSpeaking:
|
|
2064
|
-
className:
|
|
2065
|
-
}) => /* @__PURE__ */
|
|
2066
|
-
/* @__PURE__ */
|
|
2067
|
-
/* @__PURE__ */
|
|
1357
|
+
}, Mt = ({
|
|
1358
|
+
messages: n,
|
|
1359
|
+
input: l,
|
|
1360
|
+
setInput: i,
|
|
1361
|
+
isLoading: f,
|
|
1362
|
+
onSend: d,
|
|
1363
|
+
onKeyPress: _,
|
|
1364
|
+
onInputFocus: b,
|
|
1365
|
+
onInputBlur: E,
|
|
1366
|
+
chatEndRef: g,
|
|
1367
|
+
isMuted: x = !1,
|
|
1368
|
+
onToggleMute: u,
|
|
1369
|
+
isSpeaking: p = !1,
|
|
1370
|
+
className: h = ""
|
|
1371
|
+
}) => /* @__PURE__ */ t.jsx("div", { className: `w-full max-w-6xl mx-auto px-4 pb-8 ${h}`, children: /* @__PURE__ */ t.jsxs("div", { className: "bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg overflow-hidden", children: [
|
|
1372
|
+
/* @__PURE__ */ t.jsx("div", { className: "p-4 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800", children: /* @__PURE__ */ t.jsxs("div", { className: "flex gap-2", children: [
|
|
1373
|
+
/* @__PURE__ */ t.jsx(
|
|
2068
1374
|
"input",
|
|
2069
1375
|
{
|
|
2070
|
-
value:
|
|
2071
|
-
onChange: (
|
|
2072
|
-
onKeyPress:
|
|
2073
|
-
onFocus:
|
|
2074
|
-
onBlur:
|
|
1376
|
+
value: l,
|
|
1377
|
+
onChange: (j) => i(j.target.value),
|
|
1378
|
+
onKeyPress: _,
|
|
1379
|
+
onFocus: b,
|
|
1380
|
+
onBlur: E,
|
|
2075
1381
|
placeholder: "Ask Bob about car parts...",
|
|
2076
|
-
disabled:
|
|
1382
|
+
disabled: f,
|
|
2077
1383
|
className: "flex-1 px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
2078
1384
|
}
|
|
2079
1385
|
),
|
|
2080
|
-
|
|
1386
|
+
u && /* @__PURE__ */ t.jsx(
|
|
2081
1387
|
"button",
|
|
2082
1388
|
{
|
|
2083
|
-
onClick:
|
|
2084
|
-
className: `shrink-0 p-2 border border-gray-300 dark:border-gray-600 rounded-md ${
|
|
2085
|
-
title:
|
|
2086
|
-
children:
|
|
1389
|
+
onClick: u,
|
|
1390
|
+
className: `shrink-0 p-2 border border-gray-300 dark:border-gray-600 rounded-md ${p ? "animate-pulse" : ""}`,
|
|
1391
|
+
title: x ? "Unmute Bob's voice" : "Mute Bob's voice",
|
|
1392
|
+
children: x ? "🔇" : "🔊"
|
|
2087
1393
|
}
|
|
2088
1394
|
),
|
|
2089
|
-
/* @__PURE__ */
|
|
1395
|
+
/* @__PURE__ */ t.jsx(
|
|
2090
1396
|
"button",
|
|
2091
1397
|
{
|
|
2092
|
-
onClick:
|
|
2093
|
-
disabled:
|
|
1398
|
+
onClick: d,
|
|
1399
|
+
disabled: f || !l.trim(),
|
|
2094
1400
|
className: "shrink-0 px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
2095
1401
|
children: "Send"
|
|
2096
1402
|
}
|
|
2097
1403
|
)
|
|
2098
1404
|
] }) }),
|
|
2099
|
-
/* @__PURE__ */
|
|
2100
|
-
[...
|
|
1405
|
+
/* @__PURE__ */ t.jsxs("div", { className: "overflow-y-auto p-4 space-y-3 h-[300px] md:h-[400px]", children: [
|
|
1406
|
+
[...n].reverse().map((j, C) => /* @__PURE__ */ t.jsx(
|
|
2101
1407
|
"div",
|
|
2102
1408
|
{
|
|
2103
|
-
className: `flex ${
|
|
2104
|
-
children: /* @__PURE__ */
|
|
1409
|
+
className: `flex ${j.role === "user" ? "justify-end" : "justify-start"}`,
|
|
1410
|
+
children: /* @__PURE__ */ t.jsx(
|
|
2105
1411
|
"div",
|
|
2106
1412
|
{
|
|
2107
|
-
className: `max-w-[80%] rounded-lg px-4 py-2 text-sm md:text-base ${
|
|
2108
|
-
children:
|
|
1413
|
+
className: `max-w-[80%] rounded-lg px-4 py-2 text-sm md:text-base ${j.role === "user" ? "bg-blue-600 text-white" : "bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-gray-100"}`,
|
|
1414
|
+
children: j.content
|
|
2109
1415
|
}
|
|
2110
1416
|
)
|
|
2111
1417
|
},
|
|
2112
|
-
|
|
1418
|
+
C
|
|
2113
1419
|
)),
|
|
2114
|
-
/* @__PURE__ */
|
|
1420
|
+
/* @__PURE__ */ t.jsx("div", { ref: g })
|
|
2115
1421
|
] })
|
|
2116
|
-
] }) }),
|
|
2117
|
-
currentImage:
|
|
2118
|
-
animationState:
|
|
2119
|
-
counterOverlayUrl:
|
|
2120
|
-
counterHeightPercent:
|
|
2121
|
-
scale:
|
|
2122
|
-
position:
|
|
1422
|
+
] }) }), $t = ({
|
|
1423
|
+
currentImage: n,
|
|
1424
|
+
animationState: l,
|
|
1425
|
+
counterOverlayUrl: i,
|
|
1426
|
+
counterHeightPercent: f = 15,
|
|
1427
|
+
scale: d = 100,
|
|
1428
|
+
position: _ = "center"
|
|
2123
1429
|
}) => {
|
|
2124
|
-
const
|
|
2125
|
-
return /* @__PURE__ */
|
|
2126
|
-
/* @__PURE__ */
|
|
1430
|
+
const b = 85 * d / 100, E = 400 * d / 100, g = _ === "center" ? "-20%" : "-35%";
|
|
1431
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "absolute inset-0 pointer-events-none overflow-hidden", children: [
|
|
1432
|
+
/* @__PURE__ */ t.jsx(
|
|
2127
1433
|
"div",
|
|
2128
1434
|
{
|
|
2129
1435
|
className: "absolute left-0 z-40",
|
|
2130
1436
|
style: {
|
|
2131
|
-
bottom: `${
|
|
2132
|
-
transform: `translateX(${
|
|
2133
|
-
width: `${
|
|
2134
|
-
maxWidth: `${
|
|
1437
|
+
bottom: `${f - 2}%`,
|
|
1438
|
+
transform: `translateX(${g})`,
|
|
1439
|
+
width: `${b}%`,
|
|
1440
|
+
maxWidth: `${E}px`,
|
|
2135
1441
|
transition: "transform 0.4s ease-out"
|
|
2136
1442
|
},
|
|
2137
|
-
children: /* @__PURE__ */
|
|
1443
|
+
children: /* @__PURE__ */ t.jsx(
|
|
2138
1444
|
"img",
|
|
2139
1445
|
{
|
|
2140
|
-
src:
|
|
2141
|
-
alt: `Bob ${
|
|
1446
|
+
src: n,
|
|
1447
|
+
alt: `Bob ${l}`,
|
|
2142
1448
|
className: "w-full h-auto object-contain",
|
|
2143
1449
|
style: { display: "block" }
|
|
2144
1450
|
}
|
|
2145
1451
|
)
|
|
2146
1452
|
}
|
|
2147
1453
|
),
|
|
2148
|
-
|
|
1454
|
+
i && /* @__PURE__ */ t.jsx(
|
|
2149
1455
|
"div",
|
|
2150
1456
|
{
|
|
2151
1457
|
className: "absolute bottom-0 left-0 right-0 z-50",
|
|
2152
|
-
style: { height: `${
|
|
2153
|
-
children: /* @__PURE__ */
|
|
1458
|
+
style: { height: `${f}%` },
|
|
1459
|
+
children: /* @__PURE__ */ t.jsx(
|
|
2154
1460
|
"img",
|
|
2155
1461
|
{
|
|
2156
|
-
src:
|
|
1462
|
+
src: i,
|
|
2157
1463
|
alt: "Shop counter",
|
|
2158
1464
|
className: "w-full h-full object-cover object-top"
|
|
2159
1465
|
}
|
|
@@ -2161,308 +1467,308 @@ const ms = (e) => {
|
|
|
2161
1467
|
}
|
|
2162
1468
|
)
|
|
2163
1469
|
] });
|
|
2164
|
-
},
|
|
2165
|
-
if (!
|
|
2166
|
-
const
|
|
2167
|
-
return
|
|
2168
|
-
},
|
|
2169
|
-
var
|
|
2170
|
-
const
|
|
2171
|
-
return
|
|
2172
|
-
},
|
|
2173
|
-
products:
|
|
2174
|
-
servicePackages:
|
|
2175
|
-
highlightedPartType:
|
|
2176
|
-
highlightedProduct:
|
|
2177
|
-
onProductClick:
|
|
2178
|
-
onPackageSelect:
|
|
2179
|
-
isResearching:
|
|
2180
|
-
visible:
|
|
2181
|
-
counterHeightPercent:
|
|
2182
|
-
hasVehicle:
|
|
1470
|
+
}, pt = (n, l) => {
|
|
1471
|
+
if (!n || !l) return !1;
|
|
1472
|
+
const i = n.toLowerCase();
|
|
1473
|
+
return l.toLowerCase().replace(/s\b/g, "").split(/\s+/).filter(Boolean).every((d) => i.includes(d));
|
|
1474
|
+
}, Dt = (n, l) => {
|
|
1475
|
+
var d;
|
|
1476
|
+
const i = ((d = n.brand) == null ? void 0 : d.toLowerCase()) === l.brand.toLowerCase(), f = Math.abs(n.price - l.price) < 1;
|
|
1477
|
+
return i && f;
|
|
1478
|
+
}, Ft = ({
|
|
1479
|
+
products: n,
|
|
1480
|
+
servicePackages: l,
|
|
1481
|
+
highlightedPartType: i,
|
|
1482
|
+
highlightedProduct: f,
|
|
1483
|
+
onProductClick: d,
|
|
1484
|
+
onPackageSelect: _,
|
|
1485
|
+
isResearching: b,
|
|
1486
|
+
visible: E = !0,
|
|
1487
|
+
counterHeightPercent: g = 22,
|
|
1488
|
+
hasVehicle: x = !1
|
|
2183
1489
|
}) => {
|
|
2184
|
-
const
|
|
2185
|
-
const
|
|
2186
|
-
return
|
|
2187
|
-
const
|
|
2188
|
-
|
|
2189
|
-
}), Object.keys(
|
|
2190
|
-
}, [e]);
|
|
2191
|
-
se(() => {
|
|
2192
|
-
var p;
|
|
2193
|
-
if (s) {
|
|
2194
|
-
const E = w.find((T) => mr(T.name, s));
|
|
2195
|
-
E && l.current[E.name] && ((p = l.current[E.name]) == null || p.scrollIntoView({ behavior: "smooth", block: "start" }));
|
|
2196
|
-
}
|
|
2197
|
-
}, [s, w]), se(() => {
|
|
2198
|
-
n && v.current && v.current.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
1490
|
+
const u = V(null), p = V({}), h = V(null), j = rt(() => {
|
|
1491
|
+
const s = {};
|
|
1492
|
+
return n.forEach((v) => {
|
|
1493
|
+
const a = v.partslotDescription || "Other Parts";
|
|
1494
|
+
s[a] || (s[a] = []), s[a].push(v);
|
|
1495
|
+
}), Object.keys(s).sort((v, a) => v.localeCompare(a)).map((v) => ({ name: v, products: s[v] }));
|
|
2199
1496
|
}, [n]);
|
|
2200
|
-
|
|
2201
|
-
|
|
1497
|
+
X(() => {
|
|
1498
|
+
var s;
|
|
1499
|
+
if (i) {
|
|
1500
|
+
const m = j.find((v) => pt(v.name, i));
|
|
1501
|
+
m && p.current[m.name] && ((s = p.current[m.name]) == null || s.scrollIntoView({ behavior: "smooth", block: "start" }));
|
|
1502
|
+
}
|
|
1503
|
+
}, [i, j]), X(() => {
|
|
1504
|
+
f && h.current && h.current.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
1505
|
+
}, [f]);
|
|
1506
|
+
const C = n.length > 0 || l.length > 0, P = b, R = C && !b, I = x ? "56px" : "8px";
|
|
1507
|
+
return /* @__PURE__ */ t.jsxs(
|
|
2202
1508
|
"div",
|
|
2203
1509
|
{
|
|
2204
|
-
ref:
|
|
2205
|
-
className: `absolute right-2 w-[52%] max-w-[220px] overflow-y-auto overflow-x-hidden z-30 flex flex-col gap-2 pb-4 transition-all duration-300 ease-out ${
|
|
1510
|
+
ref: u,
|
|
1511
|
+
className: `absolute right-2 w-[52%] max-w-[220px] overflow-y-auto overflow-x-hidden z-30 flex flex-col gap-2 pb-4 transition-all duration-300 ease-out ${E ? "opacity-100 translate-x-0" : "opacity-0 translate-x-8 pointer-events-none"}`,
|
|
2206
1512
|
style: {
|
|
2207
1513
|
top: I,
|
|
2208
|
-
bottom: `calc(${
|
|
1514
|
+
bottom: `calc(${g}% + 16px)`,
|
|
2209
1515
|
paddingTop: "env(safe-area-inset-top, 4px)"
|
|
2210
1516
|
},
|
|
2211
1517
|
children: [
|
|
2212
|
-
|
|
2213
|
-
/* @__PURE__ */
|
|
2214
|
-
/* @__PURE__ */
|
|
1518
|
+
P && /* @__PURE__ */ t.jsx("div", { className: "rounded-lg p-3", children: /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2 text-sm text-gray-500", children: [
|
|
1519
|
+
/* @__PURE__ */ t.jsx("div", { className: "w-4 h-4 border-2 border-blue-600 border-t-transparent rounded-full animate-spin" }),
|
|
1520
|
+
/* @__PURE__ */ t.jsx("span", { children: "Finding parts..." })
|
|
2215
1521
|
] }) }),
|
|
2216
|
-
|
|
2217
|
-
/* @__PURE__ */
|
|
2218
|
-
/* @__PURE__ */
|
|
1522
|
+
R && l.length > 0 && /* @__PURE__ */ t.jsxs("div", { className: "space-y-2", children: [
|
|
1523
|
+
/* @__PURE__ */ t.jsxs("div", { className: "text-xs font-semibold text-blue-600 flex items-center gap-1 px-1", children: [
|
|
1524
|
+
/* @__PURE__ */ t.jsx("svg", { className: "h-3 w-3", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4" }) }),
|
|
2219
1525
|
"Service Packages"
|
|
2220
1526
|
] }),
|
|
2221
|
-
|
|
1527
|
+
l.map((s) => /* @__PURE__ */ t.jsxs(
|
|
2222
1528
|
"div",
|
|
2223
1529
|
{
|
|
2224
|
-
onClick: () =>
|
|
1530
|
+
onClick: () => _ == null ? void 0 : _(s),
|
|
2225
1531
|
className: "cursor-pointer hover:shadow-md transition-all bg-white/80 rounded-lg border border-gray-200 p-2",
|
|
2226
1532
|
children: [
|
|
2227
|
-
/* @__PURE__ */
|
|
2228
|
-
/* @__PURE__ */
|
|
1533
|
+
/* @__PURE__ */ t.jsx("p", { className: "text-xs font-medium line-clamp-1", children: s.title }),
|
|
1534
|
+
/* @__PURE__ */ t.jsxs("p", { className: "text-sm font-bold text-blue-600", children: [
|
|
2229
1535
|
"$",
|
|
2230
|
-
|
|
1536
|
+
s.from_price.toFixed(0)
|
|
2231
1537
|
] })
|
|
2232
1538
|
]
|
|
2233
1539
|
},
|
|
2234
|
-
|
|
1540
|
+
s.id
|
|
2235
1541
|
))
|
|
2236
1542
|
] }),
|
|
2237
|
-
|
|
2238
|
-
const
|
|
2239
|
-
return /* @__PURE__ */
|
|
1543
|
+
R && j.map(({ name: s, products: m }, v) => {
|
|
1544
|
+
const a = i && pt(s, i);
|
|
1545
|
+
return /* @__PURE__ */ t.jsxs(
|
|
2240
1546
|
"section",
|
|
2241
1547
|
{
|
|
2242
|
-
ref: (
|
|
2243
|
-
|
|
1548
|
+
ref: (o) => {
|
|
1549
|
+
p.current[s] = o;
|
|
2244
1550
|
},
|
|
2245
|
-
className: `rounded-lg transition-all border border-transparent ${
|
|
1551
|
+
className: `rounded-lg transition-all border border-transparent ${a ? "ring-2 ring-blue-600 p-2 bg-blue-50/50 shadow-lg" : ""}`,
|
|
2246
1552
|
children: [
|
|
2247
|
-
/* @__PURE__ */
|
|
2248
|
-
/* @__PURE__ */
|
|
2249
|
-
/* @__PURE__ */
|
|
2250
|
-
/* @__PURE__ */
|
|
1553
|
+
/* @__PURE__ */ t.jsxs("h3", { className: "text-xs font-semibold mb-2 flex items-center gap-1 px-1 text-gray-900", children: [
|
|
1554
|
+
/* @__PURE__ */ t.jsx("svg", { className: "h-3 w-3 text-gray-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4" }) }),
|
|
1555
|
+
/* @__PURE__ */ t.jsx("span", { className: "truncate", children: s }),
|
|
1556
|
+
/* @__PURE__ */ t.jsxs("span", { className: "text-[10px] text-gray-500", children: [
|
|
2251
1557
|
"(",
|
|
2252
|
-
|
|
1558
|
+
m.length,
|
|
2253
1559
|
")"
|
|
2254
1560
|
] })
|
|
2255
1561
|
] }),
|
|
2256
|
-
/* @__PURE__ */
|
|
2257
|
-
const
|
|
2258
|
-
return /* @__PURE__ */
|
|
1562
|
+
/* @__PURE__ */ t.jsx("div", { className: "space-y-2", children: m.map((o, w) => {
|
|
1563
|
+
const k = f && Dt(o, f);
|
|
1564
|
+
return /* @__PURE__ */ t.jsxs(
|
|
2259
1565
|
"div",
|
|
2260
1566
|
{
|
|
2261
|
-
ref:
|
|
2262
|
-
onClick: () =>
|
|
2263
|
-
className: `cursor-pointer transition-all bg-white/80 rounded-lg border border-gray-200 relative ${
|
|
1567
|
+
ref: k ? h : void 0,
|
|
1568
|
+
onClick: () => d == null ? void 0 : d(o),
|
|
1569
|
+
className: `cursor-pointer transition-all bg-white/80 rounded-lg border border-gray-200 relative ${k ? "ring-4 ring-blue-600 scale-105 z-10" : "hover:shadow-md"}`,
|
|
2264
1570
|
children: [
|
|
2265
|
-
|
|
2266
|
-
/* @__PURE__ */
|
|
1571
|
+
k && /* @__PURE__ */ t.jsxs("span", { className: "absolute -top-2 -right-2 bg-blue-600 text-white text-[8px] px-1 py-0.5 rounded z-20 flex items-center", children: [
|
|
1572
|
+
/* @__PURE__ */ t.jsx("svg", { className: "h-2 w-2 mr-0.5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ t.jsx("path", { d: "M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" }) }),
|
|
2267
1573
|
"Pick"
|
|
2268
1574
|
] }),
|
|
2269
|
-
/* @__PURE__ */
|
|
2270
|
-
/* @__PURE__ */
|
|
2271
|
-
/* @__PURE__ */
|
|
2272
|
-
|
|
1575
|
+
/* @__PURE__ */ t.jsxs("div", { className: "p-2", children: [
|
|
1576
|
+
/* @__PURE__ */ t.jsx("div", { className: "aspect-square bg-gray-100 rounded-md mb-1 flex items-center justify-center overflow-hidden", children: o.image_url ? /* @__PURE__ */ t.jsx("img", { src: o.image_url, alt: o.name, className: "w-full h-full object-contain" }) : /* @__PURE__ */ t.jsx("svg", { className: "h-8 w-8 text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4" }) }) }),
|
|
1577
|
+
/* @__PURE__ */ t.jsx("p", { className: "text-xs font-medium line-clamp-2", children: o.name }),
|
|
1578
|
+
o.brand && /* @__PURE__ */ t.jsx("p", { className: "text-[10px] text-gray-500", children: o.brand })
|
|
2273
1579
|
] }),
|
|
2274
|
-
/* @__PURE__ */
|
|
2275
|
-
/* @__PURE__ */
|
|
1580
|
+
/* @__PURE__ */ t.jsx("div", { className: "px-2 pb-2", children: /* @__PURE__ */ t.jsx("span", { className: "text-sm font-bold text-blue-600", children: o.price > 0 ? `$${o.price.toFixed(2)}` : "Price on request" }) }),
|
|
1581
|
+
/* @__PURE__ */ t.jsx("div", { className: "px-2 pb-2", children: /* @__PURE__ */ t.jsx(
|
|
2276
1582
|
"button",
|
|
2277
1583
|
{
|
|
2278
1584
|
className: "w-full bg-blue-600 text-white text-xs py-1.5 rounded-md hover:bg-blue-700",
|
|
2279
|
-
onClick: (
|
|
2280
|
-
|
|
1585
|
+
onClick: (N) => {
|
|
1586
|
+
N.stopPropagation(), d == null || d(o);
|
|
2281
1587
|
},
|
|
2282
1588
|
children: "Buy Now"
|
|
2283
1589
|
}
|
|
2284
1590
|
) })
|
|
2285
1591
|
]
|
|
2286
1592
|
},
|
|
2287
|
-
`${
|
|
1593
|
+
`${o.id}-${w}`
|
|
2288
1594
|
);
|
|
2289
1595
|
}) })
|
|
2290
1596
|
]
|
|
2291
1597
|
},
|
|
2292
|
-
|
|
1598
|
+
s
|
|
2293
1599
|
);
|
|
2294
1600
|
})
|
|
2295
1601
|
]
|
|
2296
1602
|
}
|
|
2297
1603
|
);
|
|
2298
|
-
},
|
|
2299
|
-
onTranscript:
|
|
2300
|
-
onSpeechEnd:
|
|
2301
|
-
language:
|
|
2302
|
-
mode:
|
|
1604
|
+
}, Wt = ({
|
|
1605
|
+
onTranscript: n,
|
|
1606
|
+
onSpeechEnd: l,
|
|
1607
|
+
language: i = "en-NZ",
|
|
1608
|
+
mode: f = "toggle"
|
|
2303
1609
|
} = {}) => {
|
|
2304
|
-
const [
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
}, [
|
|
2308
|
-
const
|
|
2309
|
-
if (
|
|
2310
|
-
|
|
2311
|
-
const
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
},
|
|
2315
|
-
let
|
|
2316
|
-
for (let
|
|
2317
|
-
const
|
|
2318
|
-
|
|
1610
|
+
const [d, _] = U(!1), [b, E] = U(""), [g, x] = U(""), [u, p] = U(null), [h, j] = U(!1), C = V(null), P = V(""), R = V(n), I = V(l);
|
|
1611
|
+
X(() => {
|
|
1612
|
+
R.current = n, I.current = l;
|
|
1613
|
+
}, [n, l]), X(() => {
|
|
1614
|
+
const a = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
1615
|
+
if (a) {
|
|
1616
|
+
j(!0);
|
|
1617
|
+
const o = new a();
|
|
1618
|
+
o.continuous = f === "ptt", o.interimResults = !0, o.lang = i, o.maxAlternatives = 1, o.onstart = () => {
|
|
1619
|
+
_(!0), p(null);
|
|
1620
|
+
}, o.onresult = (w) => {
|
|
1621
|
+
let k = "", N = "";
|
|
1622
|
+
for (let O = w.resultIndex; O < w.results.length; O++) {
|
|
1623
|
+
const y = w.results[O][0].transcript;
|
|
1624
|
+
w.results[O].isFinal ? N += y : k += y;
|
|
2319
1625
|
}
|
|
2320
|
-
|
|
2321
|
-
},
|
|
2322
|
-
switch (
|
|
1626
|
+
N && (P.current = N, E(N), R.current && R.current(N)), x(k);
|
|
1627
|
+
}, o.onerror = (w) => {
|
|
1628
|
+
switch (_(!1), w.error) {
|
|
2323
1629
|
case "no-speech":
|
|
2324
|
-
|
|
1630
|
+
p("No speech detected. Please try again.");
|
|
2325
1631
|
break;
|
|
2326
1632
|
case "audio-capture":
|
|
2327
|
-
|
|
1633
|
+
p("No microphone found. Please check your device.");
|
|
2328
1634
|
break;
|
|
2329
1635
|
case "not-allowed":
|
|
2330
|
-
|
|
1636
|
+
p("Microphone permission denied. Please allow access.");
|
|
2331
1637
|
break;
|
|
2332
1638
|
default:
|
|
2333
|
-
|
|
1639
|
+
p("Speech recognition error. Please try again.");
|
|
2334
1640
|
}
|
|
2335
|
-
},
|
|
2336
|
-
|
|
2337
|
-
},
|
|
1641
|
+
}, o.onend = () => {
|
|
1642
|
+
_(!1), x(""), P.current && I.current && I.current(P.current), P.current = "";
|
|
1643
|
+
}, C.current = o;
|
|
2338
1644
|
}
|
|
2339
1645
|
return () => {
|
|
2340
|
-
|
|
1646
|
+
C.current && C.current.stop();
|
|
2341
1647
|
};
|
|
2342
|
-
}, [
|
|
2343
|
-
const
|
|
2344
|
-
|
|
2345
|
-
},
|
|
2346
|
-
|
|
1648
|
+
}, [i, f]);
|
|
1649
|
+
const s = () => {
|
|
1650
|
+
C.current && !d && (E(""), x(""), p(null), C.current.start());
|
|
1651
|
+
}, m = () => {
|
|
1652
|
+
C.current && d && C.current.stop();
|
|
2347
1653
|
};
|
|
2348
1654
|
return {
|
|
2349
|
-
isListening:
|
|
2350
|
-
transcript:
|
|
2351
|
-
interimTranscript:
|
|
2352
|
-
error:
|
|
2353
|
-
isSupported:
|
|
2354
|
-
startListening:
|
|
2355
|
-
stopListening:
|
|
1655
|
+
isListening: d,
|
|
1656
|
+
transcript: b,
|
|
1657
|
+
interimTranscript: g,
|
|
1658
|
+
error: u,
|
|
1659
|
+
isSupported: h,
|
|
1660
|
+
startListening: s,
|
|
1661
|
+
stopListening: m,
|
|
2356
1662
|
toggleListening: () => {
|
|
2357
|
-
|
|
1663
|
+
d ? m() : s();
|
|
2358
1664
|
}
|
|
2359
1665
|
};
|
|
2360
|
-
},
|
|
2361
|
-
messages:
|
|
2362
|
-
input:
|
|
2363
|
-
setInput:
|
|
2364
|
-
isLoading:
|
|
2365
|
-
onSend:
|
|
2366
|
-
onKeyPress:
|
|
2367
|
-
onInputFocus:
|
|
2368
|
-
onInputBlur:
|
|
2369
|
-
chatEndRef:
|
|
2370
|
-
isMuted:
|
|
2371
|
-
onToggleMute:
|
|
2372
|
-
isSpeaking:
|
|
1666
|
+
}, Ut = ({
|
|
1667
|
+
messages: n,
|
|
1668
|
+
input: l,
|
|
1669
|
+
setInput: i,
|
|
1670
|
+
isLoading: f,
|
|
1671
|
+
onSend: d,
|
|
1672
|
+
onKeyPress: _,
|
|
1673
|
+
onInputFocus: b,
|
|
1674
|
+
onInputBlur: E,
|
|
1675
|
+
chatEndRef: g,
|
|
1676
|
+
isMuted: x = !1,
|
|
1677
|
+
onToggleMute: u,
|
|
1678
|
+
isSpeaking: p = !1
|
|
2373
1679
|
}) => {
|
|
2374
|
-
const [
|
|
2375
|
-
isListening:
|
|
1680
|
+
const [h, j] = U(!1), C = V(null), P = V(!1), {
|
|
1681
|
+
isListening: R,
|
|
2376
1682
|
interimTranscript: I,
|
|
2377
|
-
error:
|
|
2378
|
-
isSupported:
|
|
2379
|
-
startListening:
|
|
2380
|
-
stopListening:
|
|
2381
|
-
} =
|
|
2382
|
-
onTranscript: (
|
|
1683
|
+
error: s,
|
|
1684
|
+
isSupported: m,
|
|
1685
|
+
startListening: v,
|
|
1686
|
+
stopListening: a
|
|
1687
|
+
} = Wt({
|
|
1688
|
+
onTranscript: (O) => i(O),
|
|
2383
1689
|
language: "en-NZ",
|
|
2384
1690
|
mode: "ptt"
|
|
2385
1691
|
});
|
|
2386
|
-
|
|
2387
|
-
I &&
|
|
2388
|
-
}, [I,
|
|
2389
|
-
const
|
|
2390
|
-
|
|
2391
|
-
}, [
|
|
2392
|
-
|
|
2393
|
-
|
|
1692
|
+
X(() => {
|
|
1693
|
+
I && i(I);
|
|
1694
|
+
}, [I, i]);
|
|
1695
|
+
const o = q(() => {
|
|
1696
|
+
f || P.current || (P.current = !0, navigator.vibrate && navigator.vibrate(10), v());
|
|
1697
|
+
}, [f, v]), w = q(() => {
|
|
1698
|
+
P.current && (P.current = !1, navigator.vibrate && navigator.vibrate(10), a(), setTimeout(() => {
|
|
1699
|
+
d();
|
|
2394
1700
|
}, 150));
|
|
2395
|
-
}, [
|
|
2396
|
-
return /* @__PURE__ */
|
|
1701
|
+
}, [a, d]), k = [...n].reverse().find((O) => O.role === "assistant"), N = k != null && k.content ? k.content.length > 50 ? k.content.slice(0, 50) + "..." : k.content : "Ask Bob about car parts...";
|
|
1702
|
+
return /* @__PURE__ */ t.jsxs(
|
|
2397
1703
|
"div",
|
|
2398
1704
|
{
|
|
2399
|
-
ref:
|
|
2400
|
-
className: `fixed bottom-0 left-0 right-0 bg-white/95 backdrop-blur-md border-t border-gray-200 transition-all duration-300 ease-out shadow-[0_-4px_20px_rgba(0,0,0,0.15)] ${
|
|
1705
|
+
ref: C,
|
|
1706
|
+
className: `fixed bottom-0 left-0 right-0 bg-white/95 backdrop-blur-md border-t border-gray-200 transition-all duration-300 ease-out shadow-[0_-4px_20px_rgba(0,0,0,0.15)] ${h ? "h-[55vh]" : "h-auto"}`,
|
|
2401
1707
|
style: {
|
|
2402
1708
|
zIndex: 60,
|
|
2403
1709
|
paddingBottom: "env(safe-area-inset-bottom, 8px)"
|
|
2404
1710
|
},
|
|
2405
1711
|
children: [
|
|
2406
|
-
/* @__PURE__ */
|
|
1712
|
+
/* @__PURE__ */ t.jsx(
|
|
2407
1713
|
"button",
|
|
2408
1714
|
{
|
|
2409
|
-
onClick: () =>
|
|
1715
|
+
onClick: () => j(!h),
|
|
2410
1716
|
className: "absolute -top-5 left-1/2 -translate-x-1/2 bg-white border border-gray-200 rounded-full p-1.5 shadow-lg z-40",
|
|
2411
|
-
"aria-label":
|
|
2412
|
-
children:
|
|
1717
|
+
"aria-label": h ? "Collapse chat" : "Expand chat",
|
|
1718
|
+
children: h ? /* @__PURE__ */ t.jsx("svg", { className: "h-4 w-4 text-gray-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) }) : /* @__PURE__ */ t.jsx("svg", { className: "h-4 w-4 text-gray-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 15l7-7 7 7" }) })
|
|
2413
1719
|
}
|
|
2414
1720
|
),
|
|
2415
|
-
!
|
|
2416
|
-
|
|
2417
|
-
[...
|
|
2418
|
-
/* @__PURE__ */
|
|
1721
|
+
!h && /* @__PURE__ */ t.jsx("div", { className: "px-3 pt-2 pb-0.5", onClick: () => j(!0), children: /* @__PURE__ */ t.jsx("p", { className: "text-xs text-gray-500 line-clamp-1", children: N }) }),
|
|
1722
|
+
h && /* @__PURE__ */ t.jsxs("div", { className: "h-[calc(100%-100px)] overflow-y-auto p-4 space-y-2", children: [
|
|
1723
|
+
[...n].reverse().map((O, y) => /* @__PURE__ */ t.jsx("div", { className: `flex ${O.role === "user" ? "justify-end" : "justify-start"}`, children: /* @__PURE__ */ t.jsx("div", { className: `max-w-[85%] rounded-lg px-3 py-2 text-sm ${O.role === "user" ? "bg-blue-600 text-white" : "bg-gray-100 text-gray-900"}`, children: O.content }) }, y)),
|
|
1724
|
+
/* @__PURE__ */ t.jsx("div", { ref: g })
|
|
2419
1725
|
] }),
|
|
2420
|
-
/* @__PURE__ */
|
|
2421
|
-
|
|
2422
|
-
/* @__PURE__ */
|
|
1726
|
+
/* @__PURE__ */ t.jsxs("div", { className: `px-2 pb-1.5 ${h ? "pt-2 border-t border-gray-200" : "pt-0.5"}`, children: [
|
|
1727
|
+
R && /* @__PURE__ */ t.jsxs("div", { className: "mb-2 text-xs text-gray-500 flex items-center gap-2", children: [
|
|
1728
|
+
/* @__PURE__ */ t.jsx("span", { className: "inline-block w-2 h-2 bg-red-500 rounded-full animate-pulse" }),
|
|
2423
1729
|
"Listening..."
|
|
2424
1730
|
] }),
|
|
2425
|
-
|
|
2426
|
-
/* @__PURE__ */
|
|
2427
|
-
|
|
1731
|
+
s && /* @__PURE__ */ t.jsx("div", { className: "mb-2 text-xs text-red-500", children: s }),
|
|
1732
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex gap-1.5 items-center", children: [
|
|
1733
|
+
u && h && /* @__PURE__ */ t.jsx(
|
|
2428
1734
|
"button",
|
|
2429
1735
|
{
|
|
2430
|
-
onClick:
|
|
2431
|
-
className: `shrink-0 h-9 w-9 flex items-center justify-center rounded-md hover:bg-gray-100 ${
|
|
2432
|
-
title:
|
|
2433
|
-
children:
|
|
2434
|
-
/* @__PURE__ */
|
|
2435
|
-
/* @__PURE__ */
|
|
2436
|
-
] }) : /* @__PURE__ */
|
|
1736
|
+
onClick: u,
|
|
1737
|
+
className: `shrink-0 h-9 w-9 flex items-center justify-center rounded-md hover:bg-gray-100 ${p ? "text-blue-600 animate-pulse" : "text-gray-600"}`,
|
|
1738
|
+
title: x ? "Unmute" : "Mute",
|
|
1739
|
+
children: x ? /* @__PURE__ */ t.jsxs("svg", { className: "h-4 w-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: [
|
|
1740
|
+
/* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" }),
|
|
1741
|
+
/* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M17 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2" })
|
|
1742
|
+
] }) : /* @__PURE__ */ t.jsx("svg", { className: "h-4 w-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" }) })
|
|
2437
1743
|
}
|
|
2438
1744
|
),
|
|
2439
|
-
/* @__PURE__ */
|
|
1745
|
+
/* @__PURE__ */ t.jsx(
|
|
2440
1746
|
"input",
|
|
2441
1747
|
{
|
|
2442
1748
|
type: "text",
|
|
2443
|
-
value:
|
|
2444
|
-
onChange: (
|
|
2445
|
-
onKeyPress:
|
|
2446
|
-
onFocus:
|
|
2447
|
-
onBlur:
|
|
1749
|
+
value: l,
|
|
1750
|
+
onChange: (O) => i(O.target.value),
|
|
1751
|
+
onKeyPress: _,
|
|
1752
|
+
onFocus: b,
|
|
1753
|
+
onBlur: E,
|
|
2448
1754
|
placeholder: "Message Bob...",
|
|
2449
|
-
disabled:
|
|
1755
|
+
disabled: f,
|
|
2450
1756
|
className: "flex-1 h-10 text-base px-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:opacity-50"
|
|
2451
1757
|
}
|
|
2452
1758
|
),
|
|
2453
|
-
|
|
1759
|
+
m && /* @__PURE__ */ t.jsx(
|
|
2454
1760
|
"button",
|
|
2455
1761
|
{
|
|
2456
|
-
onTouchStart:
|
|
2457
|
-
onTouchEnd:
|
|
2458
|
-
onTouchCancel:
|
|
2459
|
-
onMouseDown:
|
|
2460
|
-
onMouseUp:
|
|
2461
|
-
onMouseLeave:
|
|
2462
|
-
disabled:
|
|
2463
|
-
className: `shrink-0 h-12 w-12 rounded-full flex items-center justify-center select-none touch-none ${
|
|
1762
|
+
onTouchStart: o,
|
|
1763
|
+
onTouchEnd: w,
|
|
1764
|
+
onTouchCancel: w,
|
|
1765
|
+
onMouseDown: o,
|
|
1766
|
+
onMouseUp: w,
|
|
1767
|
+
onMouseLeave: w,
|
|
1768
|
+
disabled: f,
|
|
1769
|
+
className: `shrink-0 h-12 w-12 rounded-full flex items-center justify-center select-none touch-none ${R ? "bg-red-500 text-white animate-pulse ring-2 ring-red-300 scale-110" : "bg-blue-600 text-white"} disabled:opacity-50`,
|
|
2464
1770
|
title: "Hold to talk",
|
|
2465
|
-
children: /* @__PURE__ */
|
|
1771
|
+
children: /* @__PURE__ */ t.jsx("svg", { className: "h-5 w-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z" }) })
|
|
2466
1772
|
}
|
|
2467
1773
|
)
|
|
2468
1774
|
] })
|
|
@@ -2470,51 +1776,51 @@ const ms = (e) => {
|
|
|
2470
1776
|
]
|
|
2471
1777
|
}
|
|
2472
1778
|
);
|
|
2473
|
-
},
|
|
2474
|
-
currentImage:
|
|
2475
|
-
animationState:
|
|
2476
|
-
backdropUrl:
|
|
2477
|
-
counterOverlayUrl:
|
|
2478
|
-
counterHeightPercent:
|
|
2479
|
-
messages:
|
|
2480
|
-
input:
|
|
2481
|
-
setInput:
|
|
2482
|
-
isLoading:
|
|
2483
|
-
onSend:
|
|
2484
|
-
onKeyPress:
|
|
2485
|
-
onInputFocus:
|
|
2486
|
-
onInputBlur:
|
|
2487
|
-
chatEndRef:
|
|
2488
|
-
isMuted:
|
|
2489
|
-
onToggleMute:
|
|
2490
|
-
isSpeaking:
|
|
1779
|
+
}, Vt = ({
|
|
1780
|
+
currentImage: n,
|
|
1781
|
+
animationState: l,
|
|
1782
|
+
backdropUrl: i,
|
|
1783
|
+
counterOverlayUrl: f,
|
|
1784
|
+
counterHeightPercent: d = 22,
|
|
1785
|
+
messages: _,
|
|
1786
|
+
input: b,
|
|
1787
|
+
setInput: E,
|
|
1788
|
+
isLoading: g,
|
|
1789
|
+
onSend: x,
|
|
1790
|
+
onKeyPress: u,
|
|
1791
|
+
onInputFocus: p,
|
|
1792
|
+
onInputBlur: h,
|
|
1793
|
+
chatEndRef: j,
|
|
1794
|
+
isMuted: C,
|
|
1795
|
+
onToggleMute: P,
|
|
1796
|
+
isSpeaking: R,
|
|
2491
1797
|
products: I,
|
|
2492
|
-
servicePackages:
|
|
2493
|
-
highlightedPartType:
|
|
2494
|
-
highlightedProduct:
|
|
2495
|
-
onProductClick:
|
|
2496
|
-
onPackageSelect:
|
|
2497
|
-
isResearching:
|
|
2498
|
-
vehicle:
|
|
2499
|
-
onChangeVehicle:
|
|
1798
|
+
servicePackages: s,
|
|
1799
|
+
highlightedPartType: m,
|
|
1800
|
+
highlightedProduct: v,
|
|
1801
|
+
onProductClick: a,
|
|
1802
|
+
onPackageSelect: o,
|
|
1803
|
+
isResearching: w,
|
|
1804
|
+
vehicle: k,
|
|
1805
|
+
onChangeVehicle: N
|
|
2500
1806
|
}) => {
|
|
2501
|
-
const
|
|
2502
|
-
|
|
2503
|
-
if (
|
|
2504
|
-
|
|
2505
|
-
else if (
|
|
2506
|
-
if (
|
|
2507
|
-
M("left"),
|
|
2508
|
-
const
|
|
2509
|
-
|
|
1807
|
+
const O = typeof window < "u" && window.self !== window.top, [y, M] = U("center"), [$, S] = U("hidden"), H = I.length > 0 || s.length > 0;
|
|
1808
|
+
X(() => {
|
|
1809
|
+
if (w && $ !== "loading" && $ !== "visible")
|
|
1810
|
+
S("loading"), y === "center" && M("left");
|
|
1811
|
+
else if (H && $ !== "visible")
|
|
1812
|
+
if (y === "center") {
|
|
1813
|
+
M("left"), S("transitioning");
|
|
1814
|
+
const F = setTimeout(() => {
|
|
1815
|
+
S("visible");
|
|
2510
1816
|
}, 400);
|
|
2511
|
-
return () => clearTimeout(
|
|
1817
|
+
return () => clearTimeout(F);
|
|
2512
1818
|
} else
|
|
2513
|
-
|
|
2514
|
-
else !
|
|
2515
|
-
}, [
|
|
2516
|
-
const
|
|
2517
|
-
return /* @__PURE__ */
|
|
1819
|
+
S("visible");
|
|
1820
|
+
else !H && !w && $ !== "hidden" && (S("hidden"), M("center"));
|
|
1821
|
+
}, [H, w, $, y]);
|
|
1822
|
+
const ge = $ !== "hidden";
|
|
1823
|
+
return /* @__PURE__ */ t.jsxs(
|
|
2518
1824
|
"div",
|
|
2519
1825
|
{
|
|
2520
1826
|
className: "fixed inset-0 overflow-hidden",
|
|
@@ -2523,13 +1829,13 @@ const ms = (e) => {
|
|
|
2523
1829
|
touchAction: "manipulation"
|
|
2524
1830
|
},
|
|
2525
1831
|
children: [
|
|
2526
|
-
|
|
2527
|
-
/* @__PURE__ */
|
|
1832
|
+
i && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
1833
|
+
/* @__PURE__ */ t.jsx(
|
|
2528
1834
|
"div",
|
|
2529
1835
|
{
|
|
2530
1836
|
className: "absolute inset-0 z-0",
|
|
2531
1837
|
style: {
|
|
2532
|
-
backgroundImage: `url(${
|
|
1838
|
+
backgroundImage: `url(${i})`,
|
|
2533
1839
|
backgroundSize: "cover",
|
|
2534
1840
|
backgroundPosition: "center bottom",
|
|
2535
1841
|
filter: "blur(12px) brightness(0.7)",
|
|
@@ -2537,7 +1843,7 @@ const ms = (e) => {
|
|
|
2537
1843
|
}
|
|
2538
1844
|
}
|
|
2539
1845
|
),
|
|
2540
|
-
/* @__PURE__ */
|
|
1846
|
+
/* @__PURE__ */ t.jsx(
|
|
2541
1847
|
"div",
|
|
2542
1848
|
{
|
|
2543
1849
|
className: "absolute inset-0 z-[1]",
|
|
@@ -2547,37 +1853,37 @@ const ms = (e) => {
|
|
|
2547
1853
|
}
|
|
2548
1854
|
)
|
|
2549
1855
|
] }),
|
|
2550
|
-
/* @__PURE__ */
|
|
2551
|
-
|
|
1856
|
+
/* @__PURE__ */ t.jsx(
|
|
1857
|
+
$t,
|
|
2552
1858
|
{
|
|
2553
|
-
currentImage:
|
|
2554
|
-
animationState:
|
|
2555
|
-
counterOverlayUrl:
|
|
2556
|
-
counterHeightPercent:
|
|
1859
|
+
currentImage: n,
|
|
1860
|
+
animationState: l,
|
|
1861
|
+
counterOverlayUrl: f,
|
|
1862
|
+
counterHeightPercent: d,
|
|
2557
1863
|
scale: 200,
|
|
2558
|
-
position:
|
|
1864
|
+
position: y
|
|
2559
1865
|
}
|
|
2560
1866
|
),
|
|
2561
|
-
|
|
1867
|
+
k && !O && /* @__PURE__ */ t.jsx("div", { className: "absolute top-2 left-2 right-2 z-20", children: /* @__PURE__ */ t.jsxs(
|
|
2562
1868
|
"div",
|
|
2563
1869
|
{
|
|
2564
1870
|
className: "bg-white/90 backdrop-blur-sm rounded-lg px-3 py-2 border border-gray-200 shadow-lg flex items-center justify-between",
|
|
2565
1871
|
style: { paddingTop: "calc(env(safe-area-inset-top, 4px) + 8px)" },
|
|
2566
1872
|
children: [
|
|
2567
|
-
/* @__PURE__ */
|
|
2568
|
-
/* @__PURE__ */
|
|
2569
|
-
|
|
1873
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
1874
|
+
/* @__PURE__ */ t.jsxs("p", { className: "text-xs font-medium text-gray-900 truncate", children: [
|
|
1875
|
+
k.year,
|
|
2570
1876
|
" ",
|
|
2571
|
-
|
|
1877
|
+
k.make,
|
|
2572
1878
|
" ",
|
|
2573
|
-
|
|
1879
|
+
k.model
|
|
2574
1880
|
] }),
|
|
2575
|
-
|
|
1881
|
+
k.rego && /* @__PURE__ */ t.jsx("p", { className: "text-[10px] text-gray-500", children: k.rego })
|
|
2576
1882
|
] }),
|
|
2577
|
-
|
|
1883
|
+
N && /* @__PURE__ */ t.jsx(
|
|
2578
1884
|
"button",
|
|
2579
1885
|
{
|
|
2580
|
-
onClick:
|
|
1886
|
+
onClick: N,
|
|
2581
1887
|
className: "text-xs text-blue-600 hover:underline ml-2 shrink-0",
|
|
2582
1888
|
children: "Change"
|
|
2583
1889
|
}
|
|
@@ -2585,262 +1891,264 @@ const ms = (e) => {
|
|
|
2585
1891
|
]
|
|
2586
1892
|
}
|
|
2587
1893
|
) }),
|
|
2588
|
-
/* @__PURE__ */
|
|
2589
|
-
|
|
1894
|
+
/* @__PURE__ */ t.jsx(
|
|
1895
|
+
Ft,
|
|
2590
1896
|
{
|
|
2591
1897
|
products: I,
|
|
2592
|
-
servicePackages:
|
|
2593
|
-
highlightedPartType:
|
|
2594
|
-
highlightedProduct:
|
|
2595
|
-
onProductClick:
|
|
2596
|
-
onPackageSelect:
|
|
2597
|
-
isResearching:
|
|
2598
|
-
visible:
|
|
2599
|
-
counterHeightPercent:
|
|
2600
|
-
hasVehicle: !!
|
|
1898
|
+
servicePackages: s,
|
|
1899
|
+
highlightedPartType: m,
|
|
1900
|
+
highlightedProduct: v,
|
|
1901
|
+
onProductClick: a,
|
|
1902
|
+
onPackageSelect: o,
|
|
1903
|
+
isResearching: w,
|
|
1904
|
+
visible: ge,
|
|
1905
|
+
counterHeightPercent: d,
|
|
1906
|
+
hasVehicle: !!k
|
|
2601
1907
|
}
|
|
2602
1908
|
),
|
|
2603
|
-
/* @__PURE__ */
|
|
2604
|
-
|
|
1909
|
+
/* @__PURE__ */ t.jsx(
|
|
1910
|
+
Ut,
|
|
2605
1911
|
{
|
|
2606
|
-
messages:
|
|
2607
|
-
input:
|
|
2608
|
-
setInput:
|
|
2609
|
-
isLoading:
|
|
2610
|
-
onSend:
|
|
2611
|
-
onKeyPress:
|
|
2612
|
-
onInputFocus:
|
|
2613
|
-
onInputBlur:
|
|
2614
|
-
chatEndRef:
|
|
2615
|
-
isMuted:
|
|
2616
|
-
onToggleMute:
|
|
2617
|
-
isSpeaking:
|
|
1912
|
+
messages: _,
|
|
1913
|
+
input: b,
|
|
1914
|
+
setInput: E,
|
|
1915
|
+
isLoading: g,
|
|
1916
|
+
onSend: x,
|
|
1917
|
+
onKeyPress: u,
|
|
1918
|
+
onInputFocus: p,
|
|
1919
|
+
onInputBlur: h,
|
|
1920
|
+
chatEndRef: j,
|
|
1921
|
+
isMuted: C,
|
|
1922
|
+
onToggleMute: P,
|
|
1923
|
+
isSpeaking: R
|
|
2618
1924
|
}
|
|
2619
1925
|
)
|
|
2620
1926
|
]
|
|
2621
1927
|
}
|
|
2622
1928
|
);
|
|
2623
|
-
},
|
|
2624
|
-
variant:
|
|
2625
|
-
initialState:
|
|
2626
|
-
showChat:
|
|
2627
|
-
className:
|
|
2628
|
-
backdropUrl:
|
|
2629
|
-
counterOverlayUrl:
|
|
2630
|
-
counterHeightPercent:
|
|
2631
|
-
defaultBobImage:
|
|
2632
|
-
verticalOffset:
|
|
2633
|
-
scale:
|
|
1929
|
+
}, Zt = ({
|
|
1930
|
+
variant: n = "inline",
|
|
1931
|
+
initialState: l = "idle",
|
|
1932
|
+
showChat: i = !0,
|
|
1933
|
+
className: f = "",
|
|
1934
|
+
backdropUrl: d,
|
|
1935
|
+
counterOverlayUrl: _,
|
|
1936
|
+
counterHeightPercent: b,
|
|
1937
|
+
defaultBobImage: E,
|
|
1938
|
+
verticalOffset: g = 0,
|
|
1939
|
+
scale: x = 100
|
|
2634
1940
|
}) => {
|
|
2635
|
-
const { callbacks:
|
|
2636
|
-
animationState:
|
|
2637
|
-
setAnimationState:
|
|
2638
|
-
getCurrentImage:
|
|
2639
|
-
availableStates:
|
|
2640
|
-
isLoading:
|
|
2641
|
-
} =
|
|
2642
|
-
setAnimationState:
|
|
1941
|
+
const { callbacks: u } = Be(), {
|
|
1942
|
+
animationState: p,
|
|
1943
|
+
setAnimationState: h,
|
|
1944
|
+
getCurrentImage: j,
|
|
1945
|
+
availableStates: C,
|
|
1946
|
+
isLoading: P
|
|
1947
|
+
} = Pt(), { activeBackdrop: R } = Bt(), [I, s] = U([]), [m, v] = U([]), [a, o] = U(null), [w, k] = U(null), [N, O] = U(!1), y = Ot({
|
|
1948
|
+
setAnimationState: h,
|
|
2643
1949
|
manualMode: !1,
|
|
2644
1950
|
onReadyToSpeak: () => {
|
|
2645
1951
|
console.log("[BobWidget] Ready to speak");
|
|
2646
1952
|
},
|
|
2647
1953
|
onStreamComplete: () => {
|
|
2648
|
-
|
|
1954
|
+
h(C.find((F) => F.includes("idle")) || "idle");
|
|
2649
1955
|
},
|
|
2650
1956
|
onResearchStart: () => {
|
|
2651
|
-
|
|
1957
|
+
O(!0);
|
|
2652
1958
|
},
|
|
2653
|
-
onHighlightPart: (
|
|
2654
|
-
|
|
1959
|
+
onHighlightPart: (F) => {
|
|
1960
|
+
o(F), setTimeout(() => o(null), 8e3);
|
|
2655
1961
|
},
|
|
2656
|
-
onHighlightProduct: (
|
|
2657
|
-
|
|
1962
|
+
onHighlightProduct: (F) => {
|
|
1963
|
+
k(F), setTimeout(() => k(null), 8e3);
|
|
2658
1964
|
},
|
|
2659
1965
|
onAutoFetchComplete: () => {
|
|
2660
|
-
|
|
1966
|
+
O(!1);
|
|
2661
1967
|
}
|
|
2662
1968
|
});
|
|
2663
|
-
|
|
2664
|
-
const
|
|
2665
|
-
return
|
|
2666
|
-
|
|
2667
|
-
const
|
|
2668
|
-
id:
|
|
2669
|
-
name:
|
|
2670
|
-
brand:
|
|
2671
|
-
price:
|
|
2672
|
-
sku:
|
|
2673
|
-
partNumber:
|
|
2674
|
-
partslotDescription:
|
|
2675
|
-
image_url:
|
|
1969
|
+
X(() => {
|
|
1970
|
+
const F = u.onPartsFound, ee = u.onServicePackagesFound;
|
|
1971
|
+
return u.onPartsFound = (re) => {
|
|
1972
|
+
O(!1);
|
|
1973
|
+
const be = re.map((K, Ee) => ({
|
|
1974
|
+
id: K.SKU || K.sku || `part-${Ee}`,
|
|
1975
|
+
name: K["Part Product Type"] || K.partslot_description || "Unknown Part",
|
|
1976
|
+
brand: K.Brand || K.brand,
|
|
1977
|
+
price: K["Metro Retail Price"] || K.price || 0,
|
|
1978
|
+
sku: K.SKU || K.sku,
|
|
1979
|
+
partNumber: K["Part Number"] || K.part_number,
|
|
1980
|
+
partslotDescription: K["Part Product Type"] || K.partslot_description,
|
|
1981
|
+
image_url: K.image_url
|
|
2676
1982
|
}));
|
|
2677
|
-
|
|
2678
|
-
},
|
|
2679
|
-
|
|
1983
|
+
s(be), F == null || F(re);
|
|
1984
|
+
}, u.onServicePackagesFound = (re) => {
|
|
1985
|
+
v(re), ee == null || ee(re);
|
|
2680
1986
|
}, () => {
|
|
2681
|
-
|
|
1987
|
+
u.onPartsFound = F, u.onServicePackagesFound = ee;
|
|
2682
1988
|
};
|
|
2683
|
-
}, [
|
|
2684
|
-
const M =
|
|
2685
|
-
if (
|
|
2686
|
-
return /* @__PURE__ */
|
|
2687
|
-
|
|
1989
|
+
}, [u]);
|
|
1990
|
+
const M = d || (R == null ? void 0 : R.image_url), $ = _ || (R == null ? void 0 : R.counter_overlay_url) || void 0, S = b || (R == null ? void 0 : R.counter_height_percent) || 12, H = j() || E || "";
|
|
1991
|
+
if (n === "mobile" || n === "fullscreen")
|
|
1992
|
+
return /* @__PURE__ */ t.jsx(
|
|
1993
|
+
Vt,
|
|
2688
1994
|
{
|
|
2689
|
-
currentImage:
|
|
2690
|
-
animationState:
|
|
1995
|
+
currentImage: H,
|
|
1996
|
+
animationState: p,
|
|
2691
1997
|
backdropUrl: M,
|
|
2692
|
-
counterOverlayUrl:
|
|
2693
|
-
counterHeightPercent:
|
|
2694
|
-
messages:
|
|
2695
|
-
input:
|
|
2696
|
-
setInput:
|
|
2697
|
-
isLoading:
|
|
2698
|
-
onSend:
|
|
2699
|
-
onKeyPress:
|
|
2700
|
-
onInputFocus:
|
|
2701
|
-
onInputBlur:
|
|
2702
|
-
chatEndRef:
|
|
2703
|
-
isMuted:
|
|
2704
|
-
onToggleMute:
|
|
2705
|
-
isSpeaking:
|
|
1998
|
+
counterOverlayUrl: $,
|
|
1999
|
+
counterHeightPercent: S,
|
|
2000
|
+
messages: y.messages,
|
|
2001
|
+
input: y.input,
|
|
2002
|
+
setInput: y.setInput,
|
|
2003
|
+
isLoading: y.isLoading,
|
|
2004
|
+
onSend: y.handleSend,
|
|
2005
|
+
onKeyPress: y.handleKeyPress,
|
|
2006
|
+
onInputFocus: y.handleInputFocus,
|
|
2007
|
+
onInputBlur: y.handleInputBlur,
|
|
2008
|
+
chatEndRef: y.chatEndRef,
|
|
2009
|
+
isMuted: y.isMuted,
|
|
2010
|
+
onToggleMute: y.toggleMute,
|
|
2011
|
+
isSpeaking: y.isSpeaking,
|
|
2706
2012
|
products: I,
|
|
2707
|
-
servicePackages:
|
|
2708
|
-
highlightedPartType:
|
|
2709
|
-
highlightedProduct:
|
|
2710
|
-
onProductClick: (
|
|
2711
|
-
var
|
|
2712
|
-
return (
|
|
2713
|
-
product_id:
|
|
2714
|
-
product_name:
|
|
2013
|
+
servicePackages: m,
|
|
2014
|
+
highlightedPartType: a,
|
|
2015
|
+
highlightedProduct: w,
|
|
2016
|
+
onProductClick: (F) => {
|
|
2017
|
+
var ee;
|
|
2018
|
+
return (ee = u.onAddToCart) == null ? void 0 : ee.call(u, {
|
|
2019
|
+
product_id: F.id,
|
|
2020
|
+
product_name: F.name,
|
|
2715
2021
|
quantity: 1,
|
|
2716
|
-
unit_price:
|
|
2717
|
-
sku:
|
|
2718
|
-
brand:
|
|
2022
|
+
unit_price: F.price,
|
|
2023
|
+
sku: F.sku,
|
|
2024
|
+
brand: F.brand
|
|
2719
2025
|
});
|
|
2720
2026
|
},
|
|
2721
|
-
onPackageSelect: (
|
|
2722
|
-
isResearching:
|
|
2723
|
-
vehicle:
|
|
2027
|
+
onPackageSelect: (F) => console.log("[BobWidget] Package selected:", F),
|
|
2028
|
+
isResearching: N,
|
|
2029
|
+
vehicle: y.identifiedVehicle
|
|
2724
2030
|
}
|
|
2725
2031
|
);
|
|
2726
|
-
const
|
|
2032
|
+
const ge = {
|
|
2727
2033
|
inline: "",
|
|
2728
2034
|
floating: "fixed bottom-4 right-4 w-96 z-50 shadow-2xl rounded-lg overflow-hidden",
|
|
2729
2035
|
fullscreen: "fixed inset-0 z-50 bg-black/80",
|
|
2730
2036
|
mobile: ""
|
|
2731
2037
|
};
|
|
2732
|
-
return /* @__PURE__ */
|
|
2733
|
-
|
|
2734
|
-
|
|
2038
|
+
return /* @__PURE__ */ t.jsxs("div", { className: `${ge[n]} ${f}`, children: [
|
|
2039
|
+
H && /* @__PURE__ */ t.jsx(
|
|
2040
|
+
At,
|
|
2735
2041
|
{
|
|
2736
|
-
currentImage:
|
|
2737
|
-
animationState:
|
|
2042
|
+
currentImage: H,
|
|
2043
|
+
animationState: p,
|
|
2738
2044
|
backdropUrl: M,
|
|
2739
|
-
counterOverlayUrl:
|
|
2740
|
-
counterHeightPercent:
|
|
2741
|
-
verticalOffset:
|
|
2742
|
-
scale:
|
|
2045
|
+
counterOverlayUrl: $,
|
|
2046
|
+
counterHeightPercent: S,
|
|
2047
|
+
verticalOffset: g,
|
|
2048
|
+
scale: x
|
|
2743
2049
|
}
|
|
2744
2050
|
),
|
|
2745
|
-
|
|
2746
|
-
|
|
2051
|
+
i && /* @__PURE__ */ t.jsx(
|
|
2052
|
+
Mt,
|
|
2747
2053
|
{
|
|
2748
|
-
messages:
|
|
2749
|
-
input:
|
|
2750
|
-
setInput:
|
|
2751
|
-
isLoading:
|
|
2752
|
-
onSend:
|
|
2753
|
-
onKeyPress:
|
|
2754
|
-
onInputFocus:
|
|
2755
|
-
onInputBlur:
|
|
2756
|
-
chatEndRef:
|
|
2757
|
-
isMuted:
|
|
2758
|
-
onToggleMute:
|
|
2759
|
-
isSpeaking:
|
|
2054
|
+
messages: y.messages,
|
|
2055
|
+
input: y.input,
|
|
2056
|
+
setInput: y.setInput,
|
|
2057
|
+
isLoading: y.isLoading,
|
|
2058
|
+
onSend: y.handleSend,
|
|
2059
|
+
onKeyPress: y.handleKeyPress,
|
|
2060
|
+
onInputFocus: y.handleInputFocus,
|
|
2061
|
+
onInputBlur: y.handleInputBlur,
|
|
2062
|
+
chatEndRef: y.chatEndRef,
|
|
2063
|
+
isMuted: y.isMuted,
|
|
2064
|
+
onToggleMute: y.toggleMute,
|
|
2065
|
+
isSpeaking: y.isSpeaking
|
|
2760
2066
|
}
|
|
2761
2067
|
)
|
|
2762
2068
|
] });
|
|
2763
|
-
},
|
|
2764
|
-
states:
|
|
2765
|
-
setAnimationState:
|
|
2766
|
-
manualMode:
|
|
2069
|
+
}, Kt = 6e4, er = ({
|
|
2070
|
+
states: n,
|
|
2071
|
+
setAnimationState: l,
|
|
2072
|
+
manualMode: i
|
|
2767
2073
|
}) => {
|
|
2768
|
-
const [
|
|
2769
|
-
(
|
|
2770
|
-
), [
|
|
2771
|
-
(
|
|
2772
|
-
), [
|
|
2773
|
-
const
|
|
2074
|
+
const [f, d] = U("page_load"), [_, b] = U(!1), E = V(null), g = q((a) => n.find((o) => o.chat_trigger === a && o.is_active), [n]), x = q(() => n.find(
|
|
2075
|
+
(a) => a.chat_trigger === "awaiting_input" || a.state_key === "talk_pause" || a.title.toLowerCase().includes("listen") || a.title.toLowerCase().includes("pause")
|
|
2076
|
+
), [n]), u = q(() => n.find(
|
|
2077
|
+
(a) => a.state_key === "idle" || a.title.toLowerCase().includes("idle")
|
|
2078
|
+
), [n]), p = q((a) => {
|
|
2079
|
+
const o = n.find((w) => w.state_key === a);
|
|
2774
2080
|
return {
|
|
2775
|
-
speed: (
|
|
2776
|
-
pauseDuration: (
|
|
2777
|
-
loopCount: (
|
|
2081
|
+
speed: (o == null ? void 0 : o.animation_speed) || 400,
|
|
2082
|
+
pauseDuration: (o == null ? void 0 : o.pause_duration) || 0,
|
|
2083
|
+
loopCount: (o == null ? void 0 : o.loop_count) || 0
|
|
2778
2084
|
};
|
|
2779
|
-
}, [
|
|
2780
|
-
|
|
2781
|
-
}, []),
|
|
2782
|
-
|
|
2783
|
-
const
|
|
2784
|
-
|
|
2785
|
-
},
|
|
2786
|
-
}, [
|
|
2787
|
-
if (
|
|
2788
|
-
const
|
|
2789
|
-
|
|
2790
|
-
}, [
|
|
2791
|
-
if (
|
|
2792
|
-
const
|
|
2793
|
-
|
|
2794
|
-
}, [
|
|
2795
|
-
|
|
2796
|
-
|
|
2085
|
+
}, [n]), h = q(() => {
|
|
2086
|
+
E.current && (clearTimeout(E.current), E.current = null);
|
|
2087
|
+
}, []), j = q(() => {
|
|
2088
|
+
h(), !i && (E.current = setTimeout(() => {
|
|
2089
|
+
const a = u();
|
|
2090
|
+
a && (d("idle"), l(a.state_key));
|
|
2091
|
+
}, Kt));
|
|
2092
|
+
}, [i, u, l, h]), C = q((a) => {
|
|
2093
|
+
if (i) return;
|
|
2094
|
+
const o = g(a);
|
|
2095
|
+
o && l(o.state_key);
|
|
2096
|
+
}, [i, g, l]), P = q(() => {
|
|
2097
|
+
if (i) return;
|
|
2098
|
+
const a = x();
|
|
2099
|
+
a && (d("awaiting_input"), l(a.state_key), j());
|
|
2100
|
+
}, [i, x, l, j]), R = q(() => {
|
|
2101
|
+
_ || i || (b(!0), d("page_load"), C("page_load"), setTimeout(() => {
|
|
2102
|
+
P();
|
|
2797
2103
|
}, 3e3));
|
|
2798
|
-
}, [
|
|
2799
|
-
|
|
2800
|
-
}, [
|
|
2801
|
-
|
|
2802
|
-
}, [
|
|
2803
|
-
|
|
2804
|
-
|
|
2104
|
+
}, [_, i, C, P]), I = q(() => {
|
|
2105
|
+
h(), d("processing_input"), C("processing_input");
|
|
2106
|
+
}, [C, h]), s = q(() => {
|
|
2107
|
+
h(), d("streaming_response"), C("streaming_response");
|
|
2108
|
+
}, [C, h]), m = q(() => {
|
|
2109
|
+
d("response_complete"), C("response_complete"), setTimeout(() => {
|
|
2110
|
+
P();
|
|
2805
2111
|
}, 3e3);
|
|
2806
|
-
}, [
|
|
2807
|
-
|
|
2808
|
-
const
|
|
2809
|
-
(
|
|
2112
|
+
}, [C, P]), v = q(() => {
|
|
2113
|
+
d("showing_product");
|
|
2114
|
+
const a = n.find(
|
|
2115
|
+
(o) => o.chat_trigger === "showing_product" || o.state_key === "showing_product"
|
|
2810
2116
|
);
|
|
2811
|
-
|
|
2812
|
-
|
|
2117
|
+
a && l(a.state_key), setTimeout(() => {
|
|
2118
|
+
P();
|
|
2813
2119
|
}, 4e3);
|
|
2814
|
-
}, [
|
|
2815
|
-
return
|
|
2816
|
-
chatStage:
|
|
2817
|
-
initialize:
|
|
2120
|
+
}, [n, l, P]);
|
|
2121
|
+
return X(() => () => h(), [h]), {
|
|
2122
|
+
chatStage: f,
|
|
2123
|
+
initialize: R,
|
|
2818
2124
|
onUserInput: I,
|
|
2819
|
-
onStreamStart:
|
|
2820
|
-
onStreamComplete:
|
|
2821
|
-
onShowingProduct:
|
|
2822
|
-
getStateSettings:
|
|
2125
|
+
onStreamStart: s,
|
|
2126
|
+
onStreamComplete: m,
|
|
2127
|
+
onShowingProduct: v,
|
|
2128
|
+
getStateSettings: p
|
|
2823
2129
|
};
|
|
2824
2130
|
};
|
|
2825
2131
|
export {
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2132
|
+
gt as BOB_VERSION,
|
|
2133
|
+
Zt as Bob,
|
|
2134
|
+
At as BobCharacter,
|
|
2135
|
+
Ht as BobProvider,
|
|
2136
|
+
Mt as ChatInterface,
|
|
2137
|
+
$t as MobileBobCharacter,
|
|
2138
|
+
Vt as MobileBobLayout,
|
|
2139
|
+
Ut as MobileChatDrawer,
|
|
2140
|
+
Ft as MobileProductColumn,
|
|
2141
|
+
Gt as getBobVersion,
|
|
2142
|
+
Pt as useBobAnimation,
|
|
2143
|
+
Lt as useBobAnimationData,
|
|
2144
|
+
Bt as useBobBackdrop,
|
|
2145
|
+
Qt as useBobCallbacks,
|
|
2146
|
+
Ot as useBobChat,
|
|
2147
|
+
Be as useBobContext,
|
|
2148
|
+
er as useBobStateTransitions,
|
|
2149
|
+
bt as useBobSupabase,
|
|
2150
|
+
Xt as useHostApiConfig,
|
|
2151
|
+
Jt as useHostContext,
|
|
2152
|
+
Wt as useSpeechRecognition,
|
|
2153
|
+
St as useSpeechSynthesis
|
|
2846
2154
|
};
|