tanya-chatbot 0.4.1 → 0.4.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.
@@ -1,8 +1,8 @@
1
- import { useEffect as it, useState as z, useRef as Ft } from "react";
1
+ import { useEffect as it, useState as z, useRef as It } from "react";
2
2
  import { jsx as a, jsxs as u, Fragment as re } from "react/jsx-runtime";
3
3
  import { createHttpLink as sr, ApolloClient as lr, InMemoryCache as cr, ApolloProvider as dr } from "@apollo/client";
4
- import { Provider as ur, useDispatch as Ae, useSelector as Ht } from "react-redux";
5
- import { createSlice as De, configureStore as pr } from "@reduxjs/toolkit";
4
+ import { Provider as ur, useDispatch as De, useSelector as Ht } from "react-redux";
5
+ import { createSlice as je, configureStore as pr } from "@reduxjs/toolkit";
6
6
  import * as Le from "@radix-ui/react-popover";
7
7
  import "clsx";
8
8
  import "tailwind-merge";
@@ -55,7 +55,7 @@ const mr = {
55
55
  mobile: []
56
56
  }
57
57
  }
58
- }, Be = De({
58
+ }, Be = je({
59
59
  name: "store",
60
60
  initialState: mr,
61
61
  reducers: {
@@ -65,7 +65,7 @@ const mr = {
65
65
  }
66
66
  }), { setStore: ko } = Be.actions, hr = Be.reducer, wr = {
67
67
  product: null
68
- }, Ue = De({
68
+ }, Ue = je({
69
69
  name: "product",
70
70
  initialState: wr,
71
71
  reducers: {
@@ -129,17 +129,17 @@ async function Ot() {
129
129
  var b;
130
130
  const t = H(), e = "access_token_" + t, r = "expires_in_" + t, o = localStorage.getItem(r), n = localStorage.getItem(e);
131
131
  console.log(n);
132
- const s = ((b = JSON.parse(sessionStorage.getItem("customerData") || "{}")) == null ? void 0 : b.isGuest) || !0;
132
+ const d = ((b = JSON.parse(sessionStorage.getItem("customerData") || "{}")) == null ? void 0 : b.isGuest) || !0;
133
133
  if (o && n && (/* @__PURE__ */ new Date()).getTime() < parseInt(o))
134
134
  return console.log("access token found in local storage"), { access_token: n, expires_in: o };
135
- const { serverUrl: l } = lt(), d = JSON.parse(
135
+ const { serverUrl: s } = lt(), l = JSON.parse(
136
136
  sessionStorage.getItem("customerData") || "{}"
137
137
  ).dwsid, i = JSON.parse(
138
138
  sessionStorage.getItem("customerData") || "{}"
139
139
  ).usrRef;
140
140
  try {
141
- const h = s ? "unregister-auth" : "register-auth", S = await T.get(
142
- `${l}sc-api/${h}?dwsid=${d}&email=${i}&pubCfg=${Z()}&envRef=${tt()}&orgRef=${et()}&siteId=${H()}&token=true`,
141
+ const h = d ? "unregister-auth" : "register-auth", S = await T.get(
142
+ `${s}sc-api/${h}?dwsid=${l}&email=${i}&pubCfg=${Z()}&envRef=${tt()}&orgRef=${et()}&siteId=${H()}&token=true`,
143
143
  {
144
144
  withCredentials: !0
145
145
  }
@@ -147,7 +147,7 @@ async function Ot() {
147
147
  return localStorage.setItem(e, S.data.access_token), localStorage.setItem(
148
148
  r,
149
149
  String((/* @__PURE__ */ new Date()).getTime() + S.data.expires_in * 1e3)
150
- ), localStorage.setItem("isGuest", s ? "true" : "false"), S.data;
150
+ ), localStorage.setItem("isGuest", d ? "true" : "false"), S.data;
151
151
  } catch (h) {
152
152
  console.log(h);
153
153
  }
@@ -192,13 +192,13 @@ const Q = () => sessionStorage.getItem("Host"), H = () => sessionStorage.getItem
192
192
  if (!t) throw new Error("customerId is required");
193
193
  const e = await qe(), { customer_token: r } = await Me(
194
194
  e
195
- ), { serverUrl: o, basePath: n } = lt(), l = (await Ot()).access_token;
195
+ ), { serverUrl: o, basePath: n } = lt(), s = (await Ot()).access_token;
196
196
  return (await T.get(
197
197
  `${o}${n}/get-interest?baseUrl=${Q()}&customerId=${t}&siteId=${H()}&pubCfg=${Z()}&envRef=${tt()}&orgRef=${et()}`,
198
198
  {
199
199
  headers: {
200
200
  "Content-Type": "application/json",
201
- Authorization: `Bearer ${l}`
201
+ Authorization: `Bearer ${s}`
202
202
  }
203
203
  }
204
204
  )).data;
@@ -214,29 +214,29 @@ const Q = () => sessionStorage.getItem("Host"), H = () => sessionStorage.getItem
214
214
  centAmount: (r = t.masterVariant) == null ? void 0 : r.prices[0].value.centAmount,
215
215
  currencyCode: (o = t.masterVariant) == null ? void 0 : o.prices[0].value.currencyCode
216
216
  };
217
- }, Cr = (t) => t.charAt(0).toUpperCase() + t.slice(1), ke = (t, e) => t.length < e ? t : t.slice(0, e) + "...", Xt = (t) => t.split("\\n").map((e, r) => {
217
+ }, _r = (t) => t.charAt(0).toUpperCase() + t.slice(1), ke = (t, e) => t.length < e ? t : t.slice(0, e) + "...", Xt = (t) => t.split("\\n").map((e, r) => {
218
218
  const o = e.match(/^(\d+)\.\s(.+)/);
219
219
  return o ? `<p key=${r} class="mb-2"><strong>${o[1]}.</strong> ${o[2]}</p>` : e.trim() ? `<p key=${r} class="mb-2">${e}</p>` : "<br/>";
220
220
  }).join("");
221
- function _r() {
221
+ function Cr() {
222
222
  const t = () => window.innerWidth < 425 ? 1 : window.innerWidth < 768 ? 2 : 4, [e, r] = z(t);
223
223
  return it(() => {
224
224
  const o = () => r(t());
225
225
  return window.addEventListener("resize", o), () => window.removeEventListener("resize", o);
226
226
  }, []), e;
227
227
  }
228
- const Fr = ({
228
+ const Ir = ({
229
229
  product: t
230
230
  }) => {
231
- const e = Ae(), r = _r(), [o, n] = z(0), s = () => {
231
+ const e = De(), r = Cr(), [o, n] = z(0), d = () => {
232
232
  n(
233
233
  (i) => i + r >= t.length ? 0 : i + r
234
234
  );
235
- }, l = () => {
235
+ }, s = () => {
236
236
  n(
237
237
  (i) => i - r < 0 ? t.length - (t.length % r || r) : i - r
238
238
  );
239
- }, d = async (i) => {
239
+ }, l = async (i) => {
240
240
  const b = await He(i);
241
241
  e(oe(b));
242
242
  };
@@ -244,7 +244,7 @@ const Fr = ({
244
244
  (t == null ? void 0 : t.length) > r && /* @__PURE__ */ a(
245
245
  "button",
246
246
  {
247
- onClick: l,
247
+ onClick: s,
248
248
  className: "absolute z-50 left-0 text-[#000000] bg-[#ffffff] rounded-full p-2 flex items-center h-fit",
249
249
  style: {
250
250
  height: "30px",
@@ -255,13 +255,13 @@ const Fr = ({
255
255
  }
256
256
  ),
257
257
  /* @__PURE__ */ a("div", { className: "flex gap-5 justify-center flex-1 overflow-hidden", children: t.slice(o, o + r).map((i) => {
258
- var b, h, S, _;
258
+ var b, h, S, C;
259
259
  return /* @__PURE__ */ u(
260
260
  "div",
261
261
  {
262
262
  className: "flex-shrink-0 flex flex-col w-[150px] h-[200px] p-2 items-center justify-between cursor-pointer bg-[#FFFFFF] rounded-[10px] shadow-[0px_2px_2px_0px_#9292BC40]",
263
263
  onClick: () => {
264
- d(i.product_id ?? i.productId);
264
+ l(i.product_id ?? i.productId);
265
265
  },
266
266
  children: [
267
267
  /* @__PURE__ */ a("div", { className: "w-full p-2 flex items-center justify-center bg-white", children: /* @__PURE__ */ a(
@@ -304,7 +304,7 @@ const Fr = ({
304
304
  /* @__PURE__ */ u("div", { className: " flex text-center items-center gap-2 text-[14px] text-[#14121F] font-bold font-nunitoSans text-base mb-1", children: [
305
305
  /* @__PURE__ */ a("p", { children: Sr(
306
306
  i != null && i.price ? Number(i == null ? void 0 : i.price) : ve(i).centAmount || 0,
307
- (_ = ve(i)) == null ? void 0 : _.currencyCode
307
+ (C = ve(i)) == null ? void 0 : C.currencyCode
308
308
  ) }),
309
309
  /* @__PURE__ */ u("p", { className: "text-[#14121F] font-normal line-through text-sm font-nunitoSans truncate", children: [
310
310
  "$",
@@ -322,7 +322,7 @@ const Fr = ({
322
322
  (t == null ? void 0 : t.length) > r && /* @__PURE__ */ a(
323
323
  "button",
324
324
  {
325
- onClick: s,
325
+ onClick: d,
326
326
  className: "absolute z-50 right-0 text-[#000000] bg-[#ffffff] rounded-full p-2 flex items-center h-fit",
327
327
  style: {
328
328
  height: "30px",
@@ -333,7 +333,7 @@ const Fr = ({
333
333
  }
334
334
  )
335
335
  ] }) });
336
- }, Ir = ({ chat: t, storeDetails: e }) => /* @__PURE__ */ a("div", { className: "bg-[#FFFFFF] px-7 py-4 rounded-r-xl rounded-bl-2xl w-full", children: t.map((r, o) => /* @__PURE__ */ u(
336
+ }, Fr = ({ chat: t, storeDetails: e }) => /* @__PURE__ */ a("div", { className: "bg-[#FFFFFF] px-7 py-4 rounded-r-xl rounded-bl-2xl w-full", children: t.map((r, o) => /* @__PURE__ */ u(
337
337
  "div",
338
338
  {
339
339
  className: "mb-4 p-3 rounded-xl",
@@ -346,11 +346,11 @@ const Fr = ({
346
346
  "div",
347
347
  {
348
348
  className: "font-nunitoSans font-bold text-sm text-[#494949] p-2 w-fit rounded-[20px]",
349
- children: Cr(r.keyword) || "No keyword"
349
+ children: _r(r.keyword) || "No keyword"
350
350
  }
351
351
  ),
352
352
  /* @__PURE__ */ a(
353
- Fr,
353
+ Ir,
354
354
  {
355
355
  product: r.items,
356
356
  storeDetails: e
@@ -360,11 +360,12 @@ const Fr = ({
360
360
  },
361
361
  o
362
362
  )) }), Ve = async (t, e) => {
363
+ var d, s;
363
364
  const { serverUrl: r, basePath: o } = lt(), n = `${r}`;
364
365
  console.log(`customer_token
365
366
  `, t);
366
367
  try {
367
- return (await T.post(
368
+ const l = await T.post(
368
369
  `${n}${o}/basket/create?baseUrl=${Q()}&siteId=${H()}&pubCfg=${Z()}&envRef=${tt()}&orgRef=${et()}`,
369
370
  e,
370
371
  {
@@ -373,15 +374,22 @@ const Fr = ({
373
374
  Authorization: t
374
375
  }
375
376
  }
376
- )).data;
377
- } catch (s) {
378
- return T.isAxiosError(s) ? console.error("Error creating basket:", s.response || s.message) : console.error("Unexpected error:", s), null;
377
+ );
378
+ return window.postMessage(
379
+ {
380
+ type: "WIDGET_CREATED_BASKET",
381
+ basketId: ((d = l.data) == null ? void 0 : d.basket_id) || ((s = l.data) == null ? void 0 : s.basketId)
382
+ },
383
+ "*"
384
+ ), l.data;
385
+ } catch (l) {
386
+ return T.isAxiosError(l) ? console.error("Error creating basket:", l.response || l.message) : console.error("Unexpected error:", l), null;
379
387
  }
380
388
  }, Rt = async (t, e, r) => {
381
- const { serverUrl: o, basePath: n } = lt(), s = `${o}`;
389
+ const { serverUrl: o, basePath: n } = lt(), d = `${o}`;
382
390
  try {
383
- const l = await T.post(
384
- `${s}${n}/basket/add-product/${t}?baseUrl=${Q()}&siteId=${H()}&pubCfg=${Z()}&envRef=${tt()}&orgRef=${et()}`,
391
+ const s = await T.post(
392
+ `${d}${n}/basket/add-product/${t}?baseUrl=${Q()}&siteId=${H()}&pubCfg=${Z()}&envRef=${tt()}&orgRef=${et()}`,
385
393
  e,
386
394
  {
387
395
  headers: {
@@ -390,21 +398,21 @@ const Fr = ({
390
398
  }
391
399
  }
392
400
  );
393
- return l.status === 200 && l.data ? l.data : null;
394
- } catch (l) {
395
- return T.isAxiosError(l) ? console.error(
401
+ return s.status === 200 && s.data ? s.data : null;
402
+ } catch (s) {
403
+ return T.isAxiosError(s) ? console.error(
396
404
  "Error adding products to basket:",
397
- l.response || l.message
398
- ) : console.error("Unexpected error:", l), null;
405
+ s.response || s.message
406
+ ) : console.error("Unexpected error:", s), null;
399
407
  }
400
408
  }, Re = async ({
401
409
  basketId: t,
402
410
  customer_token: e
403
411
  }) => {
404
- var s;
412
+ var d;
405
413
  const { serverUrl: r, basePath: o } = lt(), n = `${r}`;
406
414
  try {
407
- const l = await T.get(
415
+ const s = await T.get(
408
416
  `${n}${o}/basket/${t}?baseUrl=${Q()}&siteId=${H()}&pubCfg=${Z()}&envRef=${tt()}&orgRef=${et()}`,
409
417
  {
410
418
  headers: {
@@ -413,11 +421,11 @@ const Fr = ({
413
421
  }
414
422
  }
415
423
  );
416
- return { status: l.status, data: l.data };
417
- } catch (l) {
418
- return T.isAxiosError(l) ? { status: (s = l.response) == null ? void 0 : s.status, data: null } : { status: null, data: null };
424
+ return { status: s.status, data: s.data };
425
+ } catch (s) {
426
+ return T.isAxiosError(s) ? { status: (d = s.response) == null ? void 0 : d.status, data: null } : { status: null, data: null };
419
427
  }
420
- }, Yt = "sfcc_basket_id", Se = "sfcc_customer_token", Tt = "sfcc_token_expiry", Nr = 300 * 1e3, It = "1.0.0";
428
+ }, Yt = "sfcc_basket_id", Se = "sfcc_customer_token", Tt = "sfcc_token_expiry", Nr = 300 * 1e3, Ft = "1.0.0";
421
429
  const st = (t) => {
422
430
  try {
423
431
  t ? localStorage.setItem(Yt, t) : localStorage.removeItem(Yt);
@@ -435,34 +443,34 @@ const st = (t) => {
435
443
  } catch (e) {
436
444
  console.error("Error storing token:", e);
437
445
  }
438
- }, Ce = 300, Er = () => {
439
- var d, i, b, h, S, _;
440
- const t = Ae(), e = Ht((F) => F.product.product), r = Ht((F) => F.store.store), [o, n] = z(!!e);
446
+ }, _e = 300, Er = () => {
447
+ var l, i, b, h, S, C;
448
+ const t = De(), e = Ht((I) => I.product.product), r = Ht((I) => I.store.store), [o, n] = z(!!e);
441
449
  if (it(() => {
442
450
  n(!!e);
443
451
  }, [e]), !e) return null;
444
- const s = async () => {
445
- var F, A, K, ct, V, dt, kt, Pt, rt, St, Ct, ut, $t, zt, _t, P;
452
+ const d = async () => {
453
+ var I, D, K, ct, V, dt, kt, Pt, rt, St, _t, ut, $t, zt, Ct, P;
446
454
  console.log(e, "the prod");
447
455
  try {
448
- if (!((A = (F = e == null ? void 0 : e.variants) == null ? void 0 : F[0]) != null && A.product_id) && !(e.type.item || e.type.bundle) && !((ct = (K = e == null ? void 0 : e.variants) == null ? void 0 : K[0]) != null && ct.productId)) {
456
+ if (!((D = (I = e == null ? void 0 : e.variants) == null ? void 0 : I[0]) != null && D.product_id) && !(e.type.item || e.type.bundle) && !((ct = (K = e == null ? void 0 : e.variants) == null ? void 0 : K[0]) != null && ct.productId)) {
449
457
  M.error("Variants not available", {
450
458
  position: "bottom-right",
451
459
  autoClose: 1e3
452
460
  }), console.error("No product variant found");
453
461
  return;
454
462
  }
455
- const C = [
463
+ const _ = [
456
464
  {
457
465
  product_id: ((V = e.variants) == null ? void 0 : V[0].product_id) || ((dt = e.variants) == null ? void 0 : dt[0].productId) || (e == null ? void 0 : e.id),
458
466
  quantity: 1
459
467
  }
460
468
  ];
461
- console.log(C, "the product data");
469
+ console.log(_, "the product data");
462
470
  const k = JSON.parse(
463
471
  sessionStorage.getItem("customerData") || "{}"
464
- ), ot = (k == null ? void 0 : k.basketId) || localStorage.getItem(Yt), Wt = !1, jt = localStorage.getItem(Tt), At = Date.now();
465
- if (!Wt || !jt || At >= parseInt(jt)) {
472
+ ), ot = (k == null ? void 0 : k.basketId) || localStorage.getItem(Yt), Wt = !1, At = localStorage.getItem(Tt), Dt = Date.now();
473
+ if (!Wt || !At || Dt >= parseInt(At)) {
466
474
  let $ = "";
467
475
  {
468
476
  const ft = await Ot();
@@ -472,19 +480,19 @@ const st = (t) => {
472
480
  console.error("Failed to get customer_token");
473
481
  return;
474
482
  }
475
- const pt = At + 300 * 1e3;
483
+ const pt = Dt + 300 * 1e3;
476
484
  if (Kt($), localStorage.setItem(Tt, pt.toString()), ot) {
477
485
  const ft = await Re({
478
486
  basketId: ot,
479
487
  customer_token: $
480
488
  });
481
489
  if (console.log(ot, "basket id from customer"), ft.status === 200 && ft) {
482
- const D = await Rt(
490
+ const j = await Rt(
483
491
  ot,
484
- C,
492
+ _,
485
493
  $
486
494
  );
487
- (((kt = D == null ? void 0 : D.product_items) == null ? void 0 : kt.length) > 0 || ((Pt = D == null ? void 0 : D.productItems) == null ? void 0 : Pt.length) > 0) && (M.success("Added to cart", {
495
+ (((kt = j == null ? void 0 : j.product_items) == null ? void 0 : kt.length) > 0 || ((Pt = j == null ? void 0 : j.productItems) == null ? void 0 : Pt.length) > 0) && (M.success("Added to cart", {
488
496
  position: "bottom-right",
489
497
  autoClose: 3e3,
490
498
  hideProgressBar: !1,
@@ -495,7 +503,7 @@ const st = (t) => {
495
503
  return;
496
504
  }
497
505
  }
498
- const Dt = {
506
+ const jt = {
499
507
  productItems: [
500
508
  {
501
509
  productId: ((rt = e.variants) == null ? void 0 : rt[0].product_id) || ((St = e.variants) == null ? void 0 : St[0].productId) || (e == null ? void 0 : e.id),
@@ -504,7 +512,7 @@ const st = (t) => {
504
512
  ]
505
513
  };
506
514
  console.log("before create basket");
507
- const m = await Ve($, Dt);
515
+ const m = await Ve($, jt);
508
516
  if (console.log(
509
517
  m,
510
518
  m == null ? void 0 : m.basket_id,
@@ -522,10 +530,10 @@ const st = (t) => {
522
530
  ), console.log("adding product to basket");
523
531
  const J = await Rt(
524
532
  (m == null ? void 0 : m.basket_id) || (m == null ? void 0 : m.basketId),
525
- C,
533
+ _,
526
534
  $
527
535
  );
528
- console.log("object added to basket"), (((Ct = J == null ? void 0 : J.product_items) == null ? void 0 : Ct.length) > 0 || ((ut = J == null ? void 0 : J.productItems) == null ? void 0 : ut.length) > 0) && M.success("Added to cart", {
536
+ console.log("object added to basket"), (((_t = J == null ? void 0 : J.product_items) == null ? void 0 : _t.length) > 0 || ((ut = J == null ? void 0 : J.productItems) == null ? void 0 : ut.length) > 0) && M.success("Added to cart", {
529
537
  position: "bottom-right",
530
538
  autoClose: 3e3,
531
539
  hideProgressBar: !1,
@@ -534,17 +542,17 @@ const st = (t) => {
534
542
  draggable: !0
535
543
  }), Vt(m.basket_id || (m == null ? void 0 : m.basketId));
536
544
  }
537
- } catch (C) {
538
- console.error("Error adding to cart:", C), M.error("Failed to add product to cart", {
545
+ } catch (_) {
546
+ console.error("Error adding to cart:", _), M.error("Failed to add product to cart", {
539
547
  position: "bottom-right",
540
548
  autoClose: 3e3
541
- }), (($t = C == null ? void 0 : C.response) == null ? void 0 : $t.status) === 404 || // Basket not found
542
- ((zt = C == null ? void 0 : C.response) == null ? void 0 : zt.status) === 401 ? (((_t = C == null ? void 0 : C.response) == null ? void 0 : _t.status) === 404 && st(null), ((P = C == null ? void 0 : C.response) == null ? void 0 : P.status) === 401 && (st(null), Kt(null))) : (console.error("Failed to add product to basket:", C.message), M.error("Failed to add product to cart", {
549
+ }), (($t = _ == null ? void 0 : _.response) == null ? void 0 : $t.status) === 404 || // Basket not found
550
+ ((zt = _ == null ? void 0 : _.response) == null ? void 0 : zt.status) === 401 ? (((Ct = _ == null ? void 0 : _.response) == null ? void 0 : Ct.status) === 404 && st(null), ((P = _ == null ? void 0 : _.response) == null ? void 0 : P.status) === 401 && (st(null), Kt(null))) : (console.error("Failed to add product to basket:", _.message), M.error("Failed to add product to cart", {
543
551
  position: "bottom-right",
544
552
  autoClose: 3e3
545
553
  }));
546
554
  }
547
- }, l = () => {
555
+ }, s = () => {
548
556
  e && (window.location.href = e.c_pdpUrl);
549
557
  };
550
558
  return console.log(e, "the prod"), /* @__PURE__ */ u(re, { children: [
@@ -553,7 +561,7 @@ const st = (t) => {
553
561
  {
554
562
  className: "fixed inset-0 z-40 bg-black/30",
555
563
  onClick: () => {
556
- n(!1), setTimeout(() => t(oe(null)), Ce);
564
+ n(!1), setTimeout(() => t(oe(null)), _e);
557
565
  }
558
566
  }
559
567
  ),
@@ -566,7 +574,7 @@ const st = (t) => {
566
574
  ${o ? "translate-y-0 md:translate-y-0 md:translate-x-0 opacity-100" : "translate-y-full md:translate-y-0 md:translate-x-full opacity-0 pointer-events-none"}
567
575
  `,
568
576
  style: { willChange: "transform, opacity" },
569
- onClick: (F) => F.stopPropagation(),
577
+ onClick: (I) => I.stopPropagation(),
570
578
  children: [
571
579
  /* @__PURE__ */ u("div", { className: "mt-3 flex flex-row justify-between w-full ", children: [
572
580
  /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a("p", { className: "text-[#000000] font-bold font-nunitoSans", children: e.name }) }),
@@ -578,7 +586,7 @@ const st = (t) => {
578
586
  onClick: () => {
579
587
  n(!1), setTimeout(
580
588
  () => t(oe(null)),
581
- Ce
589
+ _e
582
590
  );
583
591
  }
584
592
  }
@@ -588,20 +596,20 @@ const st = (t) => {
588
596
  /* @__PURE__ */ a("div", { className: "flex flex-row items-center justify-center w-[120px] h-[120px] my-5", children: /* @__PURE__ */ a(
589
597
  "img",
590
598
  {
591
- src: (h = (b = (i = (d = e.imageGroups) == null ? void 0 : d[0]) == null ? void 0 : i.images) == null ? void 0 : b[0]) == null ? void 0 : h.link,
599
+ src: (h = (b = (i = (l = e.imageGroups) == null ? void 0 : l[0]) == null ? void 0 : i.images) == null ? void 0 : b[0]) == null ? void 0 : h.link,
592
600
  alt: e.name,
593
601
  className: "rounded-[10px]"
594
602
  }
595
603
  ) }),
596
604
  /* @__PURE__ */ a("div", { className: "flex flex-col items-center gap-2", children: e.imageGroups.slice(1, 2).map(
597
- (F) => F.images.slice(1, 2).map((A) => /* @__PURE__ */ a(
605
+ (I) => I.images.slice(1, 2).map((D) => /* @__PURE__ */ a(
598
606
  "img",
599
607
  {
600
- src: A.link,
608
+ src: D.link,
601
609
  alt: e.name,
602
610
  className: "rounded-[10px] w-[60px] h-[60px]"
603
611
  },
604
- A.link
612
+ D.link
605
613
  ))
606
614
  ) })
607
615
  ] }),
@@ -644,11 +652,11 @@ const st = (t) => {
644
652
  ] }),
645
653
  /* @__PURE__ */ a("div", { className: "text-[#323135] font-semibold text-sm", children: "Overall Rating" }),
646
654
  /* @__PURE__ */ u("div", { className: "text-[#68656E] font-semibold text-sm", children: [
647
- ((_ = e == null ? void 0 : e.rating) == null ? void 0 : _.count) || 0,
655
+ ((C = e == null ? void 0 : e.rating) == null ? void 0 : C.count) || 0,
648
656
  " ratings"
649
657
  ] })
650
658
  ] }) }),
651
- /* @__PURE__ */ a("div", { className: "mt-2 flex flex-row items-center gap-2", children: Array.from({ length: 5 }).map((F, A) => {
659
+ /* @__PURE__ */ a("div", { className: "mt-2 flex flex-row items-center gap-2", children: Array.from({ length: 5 }).map((I, D) => {
652
660
  var K;
653
661
  return /* @__PURE__ */ a(
654
662
  ge,
@@ -657,10 +665,10 @@ const st = (t) => {
657
665
  width: "20",
658
666
  height: "20",
659
667
  className: `text-yellow-500
660
- ${((K = e == null ? void 0 : e.rating) == null ? void 0 : K.rate) > A ? "text-yellow-500" : "text-gray-300"}
668
+ ${((K = e == null ? void 0 : e.rating) == null ? void 0 : K.rate) > D ? "text-yellow-500" : "text-gray-300"}
661
669
  `
662
670
  },
663
- A
671
+ D
664
672
  );
665
673
  }) })
666
674
  ] }),
@@ -675,7 +683,7 @@ const st = (t) => {
675
683
  {
676
684
  className: "rounded-[5px] shadow-sm text-[#FBFBFC] bg-[#6851C6] p-2 w-full text-center cursor-pointer",
677
685
  style: { backgroundColor: r.tanyaThemeColor },
678
- onClick: s,
686
+ onClick: d,
679
687
  children: "Add to Cart"
680
688
  }
681
689
  ),
@@ -684,7 +692,7 @@ const st = (t) => {
684
692
  {
685
693
  className: "rounded-[5px] shadow-sm text-[#FBFBFC] bg-[#6851C6] p-2 w-full text-center cursor-pointer mb-16",
686
694
  style: { backgroundColor: r.tanyaThemeColor },
687
- onClick: l,
695
+ onClick: s,
688
696
  children: "View more"
689
697
  }
690
698
  )
@@ -713,27 +721,27 @@ const st = (t) => {
713
721
  "Niece/Nephew": "his/her niece/nephew",
714
722
  "My Friends": "his/her friends",
715
723
  Others: "others"
716
- }, n = Ft(null), s = Ft(null), l = Ft(null), d = Ft(null), [i, b] = z(null), [h, S] = z(!1), [_, F] = z(!1), [A, K] = z(!1), [ct, V] = z(!1), [dt, kt] = z(!1), [Pt, rt] = z(!1), [St, Ct] = z(""), [ut, $t] = z(""), zt = (c) => ({
724
+ }, n = It(null), d = It(null), s = It(null), l = It(null), [i, b] = z(null), [h, S] = z(!1), [C, I] = z(!1), [D, K] = z(!1), [ct, V] = z(!1), [dt, kt] = z(!1), [Pt, rt] = z(!1), [St, _t] = z(""), [ut, $t] = z(""), zt = (c) => ({
717
725
  id: c.id,
718
726
  title: c.name,
719
727
  image: c.image ?? "",
720
728
  price: c.price ?? 0
721
- }), [_t, P] = z([]), C = Ft(null), k = Ht((c) => c.store.store), ot = Ht((c) => c.product.product), Wt = () => {
722
- K(!0), setTimeout(() => F(!0), 10);
723
- }, jt = () => {
724
- F(!1), setTimeout(() => K(!1), 300);
729
+ }), [Ct, P] = z([]), _ = It(null), k = Ht((c) => c.store.store), ot = Ht((c) => c.product.product), Wt = () => {
730
+ K(!0), setTimeout(() => I(!0), 10);
731
+ }, At = () => {
732
+ I(!1), setTimeout(() => K(!1), 300);
725
733
  };
726
734
  it(() => {
727
- h ? Wt() : jt();
735
+ h ? Wt() : At();
728
736
  }, [h]);
729
- const At = (c) => {
737
+ const Dt = (c) => {
730
738
  $t(o[c]);
731
739
  };
732
740
  it(() => {
733
- C.current && (C.current.scrollTop += 150);
734
- }, [_t]);
741
+ _.current && (_.current.scrollTop += 150);
742
+ }, [Ct]);
735
743
  let $ = null, pt = null;
736
- const Dt = async () => {
744
+ const jt = async () => {
737
745
  if ($ && pt && Date.now() < pt)
738
746
  return $;
739
747
  try {
@@ -779,16 +787,16 @@ const st = (t) => {
779
787
  ).customerId;
780
788
  return (await kr(c || "")).c_interests;
781
789
  }, ft = async (c, v) => {
782
- console.log("in secondary flow", It);
790
+ console.log("in secondary flow", Ft);
783
791
  const w = await J();
784
- if (console.log(w, "interests of customer", It), !!w)
792
+ if (console.log(w, "interests of customer", Ft), !!w)
785
793
  try {
786
794
  P(
787
795
  (U) => U.map(
788
796
  (R, Y) => Y === U.length - 1 ? { ...R, secondaryLoading: !0 } : R
789
797
  )
790
798
  );
791
- const x = await Dt();
799
+ const x = await jt();
792
800
  if (!x) throw new Error("Failed to fetch token");
793
801
  const p = localStorage.getItem("customerNumber"), g = localStorage.getItem("isLoggedIn"), mt = `https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({
794
802
  registered: String(g || !1),
@@ -827,8 +835,8 @@ const st = (t) => {
827
835
  try {
828
836
  const q = JSON.parse(f);
829
837
  q.index === 0 && P(
830
- (I) => I.map(
831
- (O, G) => G === I.length - 1 ? {
838
+ (F) => F.map(
839
+ (O, G) => G === F.length - 1 ? {
832
840
  ...O,
833
841
  secondaryResponse: q.data,
834
842
  secondaryLoading: !1
@@ -837,8 +845,8 @@ const st = (t) => {
837
845
  );
838
846
  } catch (q) {
839
847
  P(
840
- (I) => I.map(
841
- (O, G) => G === I.length - 1 ? { ...O, secondaryLoading: !1 } : O
848
+ (F) => F.map(
849
+ (O, G) => G === F.length - 1 ? { ...O, secondaryLoading: !1 } : O
842
850
  )
843
851
  ), console.error("Secondary flow JSON parse error:", q);
844
852
  }
@@ -847,10 +855,10 @@ const st = (t) => {
847
855
  } catch (x) {
848
856
  console.error("Secondary flow error:", x);
849
857
  }
850
- }, D = async (c) => {
858
+ }, j = async (c) => {
851
859
  const v = c || St.trim();
852
860
  if (v) {
853
- kt(!0), Ct(""), n.current = null, s.current = null, l.current = null, d.current = null, P((w) => [
861
+ kt(!0), _t(""), n.current = null, d.current = null, s.current = null, l.current = null, P((w) => [
854
862
  ...w,
855
863
  {
856
864
  query: v,
@@ -861,7 +869,7 @@ const st = (t) => {
861
869
  }
862
870
  ]);
863
871
  try {
864
- const w = ut, x = localStorage.getItem("customerNumber"), p = localStorage.getItem("isLoggedIn"), g = await Dt();
872
+ const w = ut, x = localStorage.getItem("customerNumber"), p = localStorage.getItem("isLoggedIn"), g = await jt();
865
873
  if (!g)
866
874
  throw new Error("Failed to obtain access token");
867
875
  const mt = `https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({
@@ -900,17 +908,17 @@ const st = (t) => {
900
908
  if (f.startsWith("data:")) {
901
909
  const q = f.slice(5).trim();
902
910
  try {
903
- const I = JSON.parse(q);
904
- I.index == 1 && (U = I.data), P(
911
+ const F = JSON.parse(q);
912
+ F.index == 1 && (U = F.data), P(
905
913
  (O) => O.map(
906
914
  (G, Lt) => Lt === O.length - 1 ? {
907
915
  ...G,
908
- [I.index == 0 ? "response" : I.index == 1 ? "keywords" : I.index == 2 ? "potentialQuestions" : "end"]: I.data
916
+ [F.index == 0 ? "response" : F.index == 1 ? "keywords" : F.index == 2 ? "potentialQuestions" : "end"]: F.data
909
917
  } : G
910
918
  )
911
919
  );
912
- } catch (I) {
913
- console.error("Error parsing JSON:", I);
920
+ } catch (F) {
921
+ console.error("Error parsing JSON:", F);
914
922
  }
915
923
  }
916
924
  }
@@ -924,7 +932,7 @@ const st = (t) => {
924
932
  }, er = (c) => {
925
933
  const v = c.match(
926
934
  /top five relevant product or category names are: (.*)/i
927
- ), p = (v ? v[1] : c).split(", ").map((j) => j.replace(/\s*(Toys|Bags|Miniature|etc\.*)\s*/gi, "").trim());
935
+ ), p = (v ? v[1] : c).split(", ").map((A) => A.replace(/\s*(Toys|Bags|Miniature|etc\.*)\s*/gi, "").trim());
928
936
  return [...new Set(p)].filter(Boolean).join(",");
929
937
  }, rr = async (c) => {
930
938
  if (typeof c == "string") {
@@ -934,7 +942,7 @@ const st = (t) => {
934
942
  const x = await be(w);
935
943
  if (rt(!1), (x == null ? void 0 : x.length) > 0 && (P(
936
944
  (p) => p.map(
937
- (g, j) => j === p.length - 1 ? {
945
+ (g, A) => A === p.length - 1 ? {
938
946
  ...g,
939
947
  products: [
940
948
  ...g.products || [],
@@ -942,11 +950,11 @@ const st = (t) => {
942
950
  ]
943
951
  } : g
944
952
  )
945
- ), !n.current || s.current == null)) {
953
+ ), !n.current || d.current == null)) {
946
954
  const p = x[0];
947
- n.current = String((p == null ? void 0 : p.product_name) ?? ""), l.current = p.image.link, s.current = p.product_id;
955
+ n.current = String((p == null ? void 0 : p.product_name) ?? ""), s.current = p.image.link, d.current = p.product_id;
948
956
  const g = typeof (p == null ? void 0 : p.price) == "number" ? p.price : void 0;
949
- d.current = typeof g == "number" && Number.isFinite(g) ? g : null;
957
+ l.current = typeof g == "number" && Number.isFinite(g) ? g : null;
950
958
  }
951
959
  }
952
960
  } else
@@ -970,10 +978,10 @@ const st = (t) => {
970
978
  (x, p) => p === w.length - 1 ? {
971
979
  ...x,
972
980
  productSnapshot: {
973
- id: s.current,
981
+ id: d.current,
974
982
  name: n.current,
975
- image: l.current,
976
- price: d.current ?? null,
983
+ image: s.current,
984
+ price: l.current ?? null,
977
985
  points: 0,
978
986
  quantity: 1
979
987
  }
@@ -983,11 +991,11 @@ const st = (t) => {
983
991
  const v = JSON.parse(
984
992
  sessionStorage.getItem("customerData") || "{}"
985
993
  );
986
- (v == null ? void 0 : v.isGuest) == !1 ? (console.log("running secondary flow", It), ft(n.current, 0)) : console.log("not running secondary flow", It);
994
+ (v == null ? void 0 : v.isGuest) == !1 ? (console.log("running secondary flow", Ft), ft(n.current, 0)) : console.log("not running secondary flow", Ft);
987
995
  }
988
996
  rt(!1);
989
997
  }, or = async (c, v) => {
990
- var w, x, p, g, j, mt, ht, L, wt, gt, B, U, R, Y, W;
998
+ var w, x, p, g, A, mt, ht, L, wt, gt, B, U, R, Y, W;
991
999
  V(!0);
992
1000
  try {
993
1001
  const f = await He(c.id);
@@ -1000,14 +1008,14 @@ const st = (t) => {
1000
1008
  }
1001
1009
  const q = [
1002
1010
  {
1003
- product_id: ((j = f.variants) == null ? void 0 : j[0].product_id) || ((mt = f.variants) == null ? void 0 : mt[0].productId) || (f == null ? void 0 : f.id),
1011
+ product_id: ((A = f.variants) == null ? void 0 : A[0].product_id) || ((mt = f.variants) == null ? void 0 : mt[0].productId) || (f == null ? void 0 : f.id),
1004
1012
  quantity: v
1005
1013
  }
1006
1014
  ];
1007
- console.log(q, "product data", "app version", It);
1008
- const I = JSON.parse(
1015
+ console.log(q, "product data", "app version", Ft);
1016
+ const F = JSON.parse(
1009
1017
  sessionStorage.getItem("customerData") || "{}"
1010
- ), O = (I == null ? void 0 : I.basketId) || localStorage.getItem(Yt), G = !1, Lt = localStorage.getItem(Tt), he = Date.now();
1018
+ ), O = (F == null ? void 0 : F.basketId) || localStorage.getItem(Yt), G = !1, Lt = localStorage.getItem(Tt), he = Date.now();
1011
1019
  if (!G || !Lt || he >= parseInt(Lt)) {
1012
1020
  const nr = await qe();
1013
1021
  let { customer_token: nt } = await Me(
@@ -1150,7 +1158,7 @@ const st = (t) => {
1150
1158
  ) })
1151
1159
  }
1152
1160
  ),
1153
- A && /* @__PURE__ */ u(re, { children: [
1161
+ D && /* @__PURE__ */ u(re, { children: [
1154
1162
  /* @__PURE__ */ a(
1155
1163
  "div",
1156
1164
  {
@@ -1166,9 +1174,9 @@ const st = (t) => {
1166
1174
  top-0 right-0
1167
1175
  transition-transform duration-300 ease-in-out
1168
1176
  lg:transform
1169
- ${_ ? "lg:translate-x-0" : "lg:translate-x-full"}
1177
+ ${C ? "lg:translate-x-0" : "lg:translate-x-full"}
1170
1178
  // For mobile: animate from bottom
1171
- ${_ ? "translate-y-0" : "translate-y-full"}
1179
+ ${C ? "translate-y-0" : "translate-y-full"}
1172
1180
  lg:translate-y-0
1173
1181
  `,
1174
1182
  style: {
@@ -1303,7 +1311,7 @@ const st = (t) => {
1303
1311
  /* @__PURE__ */ u(
1304
1312
  "div",
1305
1313
  {
1306
- ref: C,
1314
+ ref: _,
1307
1315
  className: "overflow-y-auto pr-5 pb-2 space-y-4 hide-scrollbar flex-grow mb-24",
1308
1316
  children: [
1309
1317
  (k == null ? void 0 : k.whomRequired) && /* @__PURE__ */ u(
@@ -1315,7 +1323,7 @@ const st = (t) => {
1315
1323
  /* @__PURE__ */ a("div", { className: "flex flex-wrap gap-2 mt-2", children: r.map((c) => /* @__PURE__ */ a(
1316
1324
  "button",
1317
1325
  {
1318
- onClick: () => At(c),
1326
+ onClick: () => Dt(c),
1319
1327
  className: "px-2 py-2 font-semibold text-xs text-[#18181B] bg-[#F3F3F3] rounded-2xl",
1320
1328
  style: {
1321
1329
  backgroundColor: ut === o[c] ? "#FFFFFF" : "#F3F3F3",
@@ -1328,7 +1336,7 @@ const st = (t) => {
1328
1336
  ]
1329
1337
  }
1330
1338
  ),
1331
- _t.map((c, v) => {
1339
+ Ct.map((c, v) => {
1332
1340
  var w, x;
1333
1341
  return /* @__PURE__ */ u("div", { children: [
1334
1342
  /* @__PURE__ */ a("div", { className: "flex justify-end", children: /* @__PURE__ */ a("p", { className: "text-sm font-nunitoSans font-bold text-[#000000] bg-[#E2DBFF] border border-[#C9C2DE] rounded-l-xl p-2 m-3 mb-4 rounded-br-xl max-w-[75%]", children: c.query }) }),
@@ -1351,7 +1359,7 @@ const st = (t) => {
1351
1359
  ) }),
1352
1360
  Pt && !c.response.includes("Thinking") && ((w = c.products) == null ? void 0 : w.length) == 0 && /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a("p", { className: "text-sm animate-pulse font-nunitoSans font-bold text-[#000000] bg-[#E2DBFF] border border-[#C9C2DE] rounded-l-xl p-2 m-3 mb-4 rounded-br-xl max-w-[75%]", children: "Finding best products for you" }) }),
1353
1361
  (c == null ? void 0 : c.products) && ((x = c == null ? void 0 : c.products) == null ? void 0 : x.length) > 0 && /* @__PURE__ */ a(
1354
- Ir,
1362
+ Fr,
1355
1363
  {
1356
1364
  chat: c.products,
1357
1365
  storeDetails: k
@@ -1370,7 +1378,7 @@ const st = (t) => {
1370
1378
  "button",
1371
1379
  {
1372
1380
  className: `cursor-pointer font-nunitoSans font-semibold text-[#232323] border bg-[#804C9E0D] border-${k.themeDarkColor} m-1 rounded-xl px-2 py-1`,
1373
- onClick: () => D(p),
1381
+ onClick: () => j(p),
1374
1382
  style: {
1375
1383
  backgroundColor: k.tanyaThemeColorLight
1376
1384
  },
@@ -1482,7 +1490,7 @@ const st = (t) => {
1482
1490
  className: "px-3 py-1 text-sm",
1483
1491
  onClick: () => P(
1484
1492
  (p) => p.map(
1485
- (g, j) => j === v && g.productSnapshot ? {
1493
+ (g, A) => A === v && g.productSnapshot ? {
1486
1494
  ...g,
1487
1495
  productSnapshot: {
1488
1496
  ...g.productSnapshot,
@@ -1508,7 +1516,7 @@ const st = (t) => {
1508
1516
  className: "px-3 py-1 text-sm",
1509
1517
  onClick: () => P(
1510
1518
  (p) => p.map(
1511
- (g, j) => j === v && g.productSnapshot ? {
1519
+ (g, A) => A === v && g.productSnapshot ? {
1512
1520
  ...g,
1513
1521
  productSnapshot: {
1514
1522
  ...g.productSnapshot,
@@ -1573,9 +1581,9 @@ const st = (t) => {
1573
1581
  placeholder: "How can I help you...",
1574
1582
  value: St,
1575
1583
  autoFocus: !0,
1576
- onChange: (c) => Ct(c.target.value),
1584
+ onChange: (c) => _t(c.target.value),
1577
1585
  onKeyDown: (c) => {
1578
- c.key === "Enter" && !dt && D();
1586
+ c.key === "Enter" && !dt && j();
1579
1587
  }
1580
1588
  }
1581
1589
  ),
@@ -1585,7 +1593,7 @@ const st = (t) => {
1585
1593
  type: "submit",
1586
1594
  disabled: dt,
1587
1595
  className: "p-3",
1588
- onClick: () => D(),
1596
+ onClick: () => j(),
1589
1597
  children: dt ? /* @__PURE__ */ a(
1590
1598
  "div",
1591
1599
  {
@@ -1648,7 +1656,7 @@ var X = function() {
1648
1656
  return X = Object.assign || function(e) {
1649
1657
  for (var r, o = 1, n = arguments.length; o < n; o++) {
1650
1658
  r = arguments[o];
1651
- for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (e[s] = r[s]);
1659
+ for (var d in r) Object.prototype.hasOwnProperty.call(r, d) && (e[d] = r[d]);
1652
1660
  }
1653
1661
  return e;
1654
1662
  }, X.apply(this, arguments);
@@ -1661,9 +1669,9 @@ function Pr(t, e) {
1661
1669
  e.indexOf(o[n]) < 0 && Object.prototype.propertyIsEnumerable.call(t, o[n]) && (r[o[n]] = t[o[n]]);
1662
1670
  return r;
1663
1671
  }
1664
- var Qt = "Invariant Violation", _e = Object.setPrototypeOf, $r = _e === void 0 ? function(t, e) {
1672
+ var Qt = "Invariant Violation", Ce = Object.setPrototypeOf, $r = Ce === void 0 ? function(t, e) {
1665
1673
  return t.__proto__ = e, t;
1666
- } : _e, Ye = (
1674
+ } : Ce, Ye = (
1667
1675
  /** @class */
1668
1676
  (function(t) {
1669
1677
  Or(e, t);
@@ -1715,13 +1723,13 @@ const ae = xt(function() {
1715
1723
  xt(function() {
1716
1724
  return xt.constructor("return this")();
1717
1725
  });
1718
- var Fe = /* @__PURE__ */ new Map();
1719
- function jr(t) {
1720
- var e = Fe.get(t) || 1;
1721
- return Fe.set(t, e + 1), "".concat(t, ":").concat(e, ":").concat(Math.random().toString(36).slice(2));
1726
+ var Ie = /* @__PURE__ */ new Map();
1727
+ function Ar(t) {
1728
+ var e = Ie.get(t) || 1;
1729
+ return Ie.set(t, e + 1), "".concat(t, ":").concat(e, ":").concat(Math.random().toString(36).slice(2));
1722
1730
  }
1723
- function Ar(t, e) {
1724
- var r = jr("stringifyForDisplay");
1731
+ function Dr(t, e) {
1732
+ var r = Ar("stringifyForDisplay");
1725
1733
  return JSON.stringify(t, function(o, n) {
1726
1734
  return n === void 0 ? r : n;
1727
1735
  }, e).split(JSON.stringify(r)).join("<undefined>");
@@ -1752,19 +1760,19 @@ function We(t) {
1752
1760
  e[r - 1] = arguments[r];
1753
1761
  return new Ye(le(t, e) || ce(t, e));
1754
1762
  }
1755
- var Ie = Symbol.for("ApolloErrorMessageHandler_" + Je);
1763
+ var Fe = Symbol.for("ApolloErrorMessageHandler_" + Je);
1756
1764
  function Ge(t) {
1757
1765
  if (typeof t == "string")
1758
1766
  return t;
1759
1767
  try {
1760
- return Ar(t, 2).slice(0, 1e3);
1768
+ return Dr(t, 2).slice(0, 1e3);
1761
1769
  } catch {
1762
1770
  return "<non-serializable>";
1763
1771
  }
1764
1772
  }
1765
1773
  function le(t, e) {
1766
1774
  if (e === void 0 && (e = []), !!t)
1767
- return ae[Ie] && ae[Ie](t, e.map(Ge));
1775
+ return ae[Fe] && ae[Fe](t, e.map(Ge));
1768
1776
  }
1769
1777
  function ce(t, e) {
1770
1778
  if (e === void 0 && (e = []), !!t)
@@ -1774,7 +1782,7 @@ function ce(t, e) {
1774
1782
  args: e.map(Ge)
1775
1783
  })));
1776
1784
  }
1777
- function Dr(t) {
1785
+ function jr(t) {
1778
1786
  return t.definitions.filter(function(e) {
1779
1787
  return e.kind === "OperationDefinition" && !!e.name;
1780
1788
  }).map(function(e) {
@@ -1808,15 +1816,15 @@ const Br = () => class {
1808
1816
  return N.slots[this.id];
1809
1817
  }
1810
1818
  withValue(e, r, o, n) {
1811
- const s = {
1819
+ const d = {
1812
1820
  __proto__: null,
1813
1821
  [this.id]: e
1814
- }, l = N;
1815
- N = { parent: l, slots: s };
1822
+ }, s = N;
1823
+ N = { parent: s, slots: d };
1816
1824
  try {
1817
1825
  return r.apply(n, o);
1818
1826
  } finally {
1819
- N = l;
1827
+ N = s;
1820
1828
  }
1821
1829
  }
1822
1830
  // Capture the current context and wrap a callback function so that it
@@ -1880,7 +1888,7 @@ Array[te] || (function(t) {
1880
1888
  } finally {
1881
1889
  return t;
1882
1890
  }
1883
- })(Br()), { bind: Co, noContext: _o } = de;
1891
+ })(Br()), { bind: _o, noContext: Co } = de;
1884
1892
  new de();
1885
1893
  function qr(t, e) {
1886
1894
  var r = typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
@@ -1997,8 +2005,8 @@ function Ze(t, e, r) {
1997
2005
  se(t), n && n.call(o);
1998
2006
  break;
1999
2007
  }
2000
- } catch (s) {
2001
- vt(s);
2008
+ } catch (d) {
2009
+ vt(d);
2002
2010
  }
2003
2011
  t._state === "closed" ? Qe(t) : t._state === "running" && (t._state = "ready");
2004
2012
  }
@@ -2029,8 +2037,8 @@ var Yr = /* @__PURE__ */ (function() {
2029
2037
  var n = new Kr(this);
2030
2038
  try {
2031
2039
  this._cleanup = o.call(void 0, n);
2032
- } catch (s) {
2033
- n.error(s);
2040
+ } catch (d) {
2041
+ n.error(d);
2034
2042
  }
2035
2043
  this._state === "initializing" && (this._state = "ready");
2036
2044
  }
@@ -2075,83 +2083,83 @@ var Yr = /* @__PURE__ */ (function() {
2075
2083
  }), new Yr(o, this._subscriber);
2076
2084
  }, e.forEach = function(o) {
2077
2085
  var n = this;
2078
- return new Promise(function(s, l) {
2086
+ return new Promise(function(d, s) {
2079
2087
  if (typeof o != "function") {
2080
- l(new TypeError(o + " is not a function"));
2088
+ s(new TypeError(o + " is not a function"));
2081
2089
  return;
2082
2090
  }
2083
- function d() {
2084
- i.unsubscribe(), s();
2091
+ function l() {
2092
+ i.unsubscribe(), d();
2085
2093
  }
2086
2094
  var i = n.subscribe({
2087
2095
  next: function(b) {
2088
2096
  try {
2089
- o(b, d);
2097
+ o(b, l);
2090
2098
  } catch (h) {
2091
- l(h), i.unsubscribe();
2099
+ s(h), i.unsubscribe();
2092
2100
  }
2093
2101
  },
2094
- error: l,
2095
- complete: s
2102
+ error: s,
2103
+ complete: d
2096
2104
  });
2097
2105
  });
2098
2106
  }, e.map = function(o) {
2099
2107
  var n = this;
2100
2108
  if (typeof o != "function") throw new TypeError(o + " is not a function");
2101
- var s = Nt(this);
2102
- return new s(function(l) {
2109
+ var d = Nt(this);
2110
+ return new d(function(s) {
2103
2111
  return n.subscribe({
2104
- next: function(d) {
2112
+ next: function(l) {
2105
2113
  try {
2106
- d = o(d);
2114
+ l = o(l);
2107
2115
  } catch (i) {
2108
- return l.error(i);
2116
+ return s.error(i);
2109
2117
  }
2110
- l.next(d);
2118
+ s.next(l);
2111
2119
  },
2112
- error: function(d) {
2113
- l.error(d);
2120
+ error: function(l) {
2121
+ s.error(l);
2114
2122
  },
2115
2123
  complete: function() {
2116
- l.complete();
2124
+ s.complete();
2117
2125
  }
2118
2126
  });
2119
2127
  });
2120
2128
  }, e.filter = function(o) {
2121
2129
  var n = this;
2122
2130
  if (typeof o != "function") throw new TypeError(o + " is not a function");
2123
- var s = Nt(this);
2124
- return new s(function(l) {
2131
+ var d = Nt(this);
2132
+ return new d(function(s) {
2125
2133
  return n.subscribe({
2126
- next: function(d) {
2134
+ next: function(l) {
2127
2135
  try {
2128
- if (!o(d)) return;
2136
+ if (!o(l)) return;
2129
2137
  } catch (i) {
2130
- return l.error(i);
2138
+ return s.error(i);
2131
2139
  }
2132
- l.next(d);
2140
+ s.next(l);
2133
2141
  },
2134
- error: function(d) {
2135
- l.error(d);
2142
+ error: function(l) {
2143
+ s.error(l);
2136
2144
  },
2137
2145
  complete: function() {
2138
- l.complete();
2146
+ s.complete();
2139
2147
  }
2140
2148
  });
2141
2149
  });
2142
2150
  }, e.reduce = function(o) {
2143
2151
  var n = this;
2144
2152
  if (typeof o != "function") throw new TypeError(o + " is not a function");
2145
- var s = Nt(this), l = arguments.length > 1, d = !1, i = arguments[1], b = i;
2146
- return new s(function(h) {
2153
+ var d = Nt(this), s = arguments.length > 1, l = !1, i = arguments[1], b = i;
2154
+ return new d(function(h) {
2147
2155
  return n.subscribe({
2148
2156
  next: function(S) {
2149
- var _ = !d;
2150
- if (d = !0, !_ || l)
2157
+ var C = !l;
2158
+ if (l = !0, !C || s)
2151
2159
  try {
2152
2160
  b = o(b, S);
2153
- } catch (F) {
2154
- return h.error(F);
2161
+ } catch (I) {
2162
+ return h.error(I);
2155
2163
  }
2156
2164
  else
2157
2165
  b = S;
@@ -2160,27 +2168,27 @@ var Yr = /* @__PURE__ */ (function() {
2160
2168
  h.error(S);
2161
2169
  },
2162
2170
  complete: function() {
2163
- if (!d && !l) return h.error(new TypeError("Cannot reduce an empty sequence"));
2171
+ if (!l && !s) return h.error(new TypeError("Cannot reduce an empty sequence"));
2164
2172
  h.next(b), h.complete();
2165
2173
  }
2166
2174
  });
2167
2175
  });
2168
2176
  }, e.concat = function() {
2169
- for (var o = this, n = arguments.length, s = new Array(n), l = 0; l < n; l++)
2170
- s[l] = arguments[l];
2171
- var d = Nt(this);
2172
- return new d(function(i) {
2177
+ for (var o = this, n = arguments.length, d = new Array(n), s = 0; s < n; s++)
2178
+ d[s] = arguments[s];
2179
+ var l = Nt(this);
2180
+ return new l(function(i) {
2173
2181
  var b, h = 0;
2174
- function S(_) {
2175
- b = _.subscribe({
2176
- next: function(F) {
2177
- i.next(F);
2182
+ function S(C) {
2183
+ b = C.subscribe({
2184
+ next: function(I) {
2185
+ i.next(I);
2178
2186
  },
2179
- error: function(F) {
2180
- i.error(F);
2187
+ error: function(I) {
2188
+ i.error(I);
2181
2189
  },
2182
2190
  complete: function() {
2183
- h === s.length ? (b = void 0, i.complete()) : S(d.from(s[h++]));
2191
+ h === d.length ? (b = void 0, i.complete()) : S(l.from(d[h++]));
2184
2192
  }
2185
2193
  });
2186
2194
  }
@@ -2191,42 +2199,42 @@ var Yr = /* @__PURE__ */ (function() {
2191
2199
  }, e.flatMap = function(o) {
2192
2200
  var n = this;
2193
2201
  if (typeof o != "function") throw new TypeError(o + " is not a function");
2194
- var s = Nt(this);
2195
- return new s(function(l) {
2196
- var d = [], i = n.subscribe({
2202
+ var d = Nt(this);
2203
+ return new d(function(s) {
2204
+ var l = [], i = n.subscribe({
2197
2205
  next: function(h) {
2198
2206
  if (o)
2199
2207
  try {
2200
2208
  h = o(h);
2201
- } catch (_) {
2202
- return l.error(_);
2209
+ } catch (C) {
2210
+ return s.error(C);
2203
2211
  }
2204
- var S = s.from(h).subscribe({
2205
- next: function(_) {
2206
- l.next(_);
2212
+ var S = d.from(h).subscribe({
2213
+ next: function(C) {
2214
+ s.next(C);
2207
2215
  },
2208
- error: function(_) {
2209
- l.error(_);
2216
+ error: function(C) {
2217
+ s.error(C);
2210
2218
  },
2211
2219
  complete: function() {
2212
- var _ = d.indexOf(S);
2213
- _ >= 0 && d.splice(_, 1), b();
2220
+ var C = l.indexOf(S);
2221
+ C >= 0 && l.splice(C, 1), b();
2214
2222
  }
2215
2223
  });
2216
- d.push(S);
2224
+ l.push(S);
2217
2225
  },
2218
2226
  error: function(h) {
2219
- l.error(h);
2227
+ s.error(h);
2220
2228
  },
2221
2229
  complete: function() {
2222
2230
  b();
2223
2231
  }
2224
2232
  });
2225
2233
  function b() {
2226
- i.closed && d.length === 0 && l.complete();
2234
+ i.closed && l.length === 0 && s.complete();
2227
2235
  }
2228
2236
  return function() {
2229
- d.forEach(function(h) {
2237
+ l.forEach(function(h) {
2230
2238
  return h.unsubscribe();
2231
2239
  }), i.unsubscribe();
2232
2240
  };
@@ -2236,47 +2244,47 @@ var Yr = /* @__PURE__ */ (function() {
2236
2244
  }, t.from = function(o) {
2237
2245
  var n = typeof this == "function" ? this : t;
2238
2246
  if (o == null) throw new TypeError(o + " is not an object");
2239
- var s = Jt(o, ie);
2240
- if (s) {
2241
- var l = s.call(o);
2242
- if (Object(l) !== l) throw new TypeError(l + " is not an object");
2243
- return Vr(l) && l.constructor === n ? l : new n(function(d) {
2244
- return l.subscribe(d);
2247
+ var d = Jt(o, ie);
2248
+ if (d) {
2249
+ var s = d.call(o);
2250
+ if (Object(s) !== s) throw new TypeError(s + " is not an object");
2251
+ return Vr(s) && s.constructor === n ? s : new n(function(l) {
2252
+ return s.subscribe(l);
2245
2253
  });
2246
2254
  }
2247
- if (fe("iterator") && (s = Jt(o, Hr), s))
2248
- return new n(function(d) {
2255
+ if (fe("iterator") && (d = Jt(o, Hr), d))
2256
+ return new n(function(l) {
2249
2257
  Mt(function() {
2250
- if (!d.closed) {
2251
- for (var i = qr(s.call(o)), b; !(b = i()).done; ) {
2258
+ if (!l.closed) {
2259
+ for (var i = qr(d.call(o)), b; !(b = i()).done; ) {
2252
2260
  var h = b.value;
2253
- if (d.next(h), d.closed) return;
2261
+ if (l.next(h), l.closed) return;
2254
2262
  }
2255
- d.complete();
2263
+ l.complete();
2256
2264
  }
2257
2265
  });
2258
2266
  });
2259
2267
  if (Array.isArray(o))
2260
- return new n(function(d) {
2268
+ return new n(function(l) {
2261
2269
  Mt(function() {
2262
- if (!d.closed) {
2270
+ if (!l.closed) {
2263
2271
  for (var i = 0; i < o.length; ++i)
2264
- if (d.next(o[i]), d.closed) return;
2265
- d.complete();
2272
+ if (l.next(o[i]), l.closed) return;
2273
+ l.complete();
2266
2274
  }
2267
2275
  });
2268
2276
  });
2269
2277
  throw new TypeError(o + " is not observable");
2270
2278
  }, t.of = function() {
2271
- for (var o = arguments.length, n = new Array(o), s = 0; s < o; s++)
2272
- n[s] = arguments[s];
2273
- var l = typeof this == "function" ? this : t;
2274
- return new l(function(d) {
2279
+ for (var o = arguments.length, n = new Array(o), d = 0; d < o; d++)
2280
+ n[d] = arguments[d];
2281
+ var s = typeof this == "function" ? this : t;
2282
+ return new s(function(l) {
2275
2283
  Mt(function() {
2276
- if (!d.closed) {
2284
+ if (!l.closed) {
2277
2285
  for (var i = 0; i < n.length; ++i)
2278
- if (d.next(n[i]), d.closed) return;
2279
- d.complete();
2286
+ if (l.next(n[i]), l.closed) return;
2287
+ l.complete();
2280
2288
  }
2281
2289
  });
2282
2290
  });
@@ -2332,8 +2340,8 @@ function Wr(t) {
2332
2340
  return t;
2333
2341
  }
2334
2342
  function Gr(t, e) {
2335
- var r = X({}, t), o = function(s) {
2336
- typeof s == "function" ? r = X(X({}, r), s(r)) : r = X(X({}, r), s);
2343
+ var r = X({}, t), o = function(d) {
2344
+ typeof d == "function" ? r = X(X({}, r), d(r)) : r = X(X({}, r), d);
2337
2345
  }, n = function() {
2338
2346
  return X({}, r);
2339
2347
  };
@@ -2352,7 +2360,7 @@ function Xr(t) {
2352
2360
  operationName: t.operationName,
2353
2361
  query: t.query
2354
2362
  };
2355
- return e.operationName || (e.operationName = typeof e.query != "string" ? Dr(e.query) || void 0 : ""), e;
2363
+ return e.operationName || (e.operationName = typeof e.query != "string" ? jr(e.query) || void 0 : ""), e;
2356
2364
  }
2357
2365
  var Qr = Symbol.for("apollo.deprecations"), Zr = ae, to = new de();
2358
2366
  function eo(t) {
@@ -2361,7 +2369,7 @@ function eo(t) {
2361
2369
  function ro(t, e) {
2362
2370
  eo(t) || e();
2363
2371
  }
2364
- function je(t, e) {
2372
+ function Ae(t, e) {
2365
2373
  return e ? e(t) : E.of();
2366
2374
  }
2367
2375
  function Et(t) {
@@ -2385,30 +2393,30 @@ var tr = (
2385
2393
  return r.concat(o);
2386
2394
  });
2387
2395
  }, t.split = function(e, r, o) {
2388
- var n = Et(r), s = Et(o || new t(je)), l;
2389
- return qt(n) && qt(s) ? l = new t(function(d) {
2390
- return e(d) ? n.request(d) || E.of() : s.request(d) || E.of();
2391
- }) : l = new t(function(d, i) {
2392
- return e(d) ? n.request(d, i) || E.of() : s.request(d, i) || E.of();
2393
- }), Object.assign(l, { left: n, right: s });
2396
+ var n = Et(r), d = Et(o || new t(Ae)), s;
2397
+ return qt(n) && qt(d) ? s = new t(function(l) {
2398
+ return e(l) ? n.request(l) || E.of() : d.request(l) || E.of();
2399
+ }) : s = new t(function(l, i) {
2400
+ return e(l) ? n.request(l, i) || E.of() : d.request(l, i) || E.of();
2401
+ }), Object.assign(s, { left: n, right: d });
2394
2402
  }, t.execute = function(e, r) {
2395
2403
  return e.request(Gr(r.context, Xr(Wr(r)))) || E.of();
2396
2404
  }, t.concat = function(e, r) {
2397
2405
  var o = Et(e);
2398
2406
  if (qt(o))
2399
2407
  return globalThis.__DEV__ !== !1 && Zt.warn(47, o), o;
2400
- var n = Et(r), s;
2401
- return qt(n) ? s = new t(function(l) {
2402
- return o.request(l, function(d) {
2403
- return n.request(d) || E.of();
2408
+ var n = Et(r), d;
2409
+ return qt(n) ? d = new t(function(s) {
2410
+ return o.request(s, function(l) {
2411
+ return n.request(l) || E.of();
2404
2412
  }) || E.of();
2405
- }) : s = new t(function(l, d) {
2406
- return o.request(l, function(i) {
2407
- return n.request(i, d) || E.of();
2413
+ }) : d = new t(function(s, l) {
2414
+ return o.request(s, function(i) {
2415
+ return n.request(i, l) || E.of();
2408
2416
  }) || E.of();
2409
- }), Object.assign(s, { left: o, right: n });
2417
+ }), Object.assign(d, { left: o, right: n });
2410
2418
  }, t.prototype.split = function(e, r, o) {
2411
- return this.concat(t.split(e, r, o || new t(je)));
2419
+ return this.concat(t.split(e, r, o || new t(Ae)));
2412
2420
  }, t.prototype.concat = function(e) {
2413
2421
  return t.concat(this, e);
2414
2422
  }, t.prototype.request = function(e, r) {
@@ -2428,17 +2436,17 @@ function oo(t) {
2428
2436
  return new tr(function(e, r) {
2429
2437
  var o = Pr(e, []);
2430
2438
  return new E(function(n) {
2431
- var s, l = !1;
2432
- return Promise.resolve(o).then(function(d) {
2433
- return t(d, e.getContext());
2439
+ var d, s = !1;
2440
+ return Promise.resolve(o).then(function(l) {
2441
+ return t(l, e.getContext());
2434
2442
  }).then(e.setContext).then(function() {
2435
- l || (s = r(e).subscribe({
2443
+ s || (d = r(e).subscribe({
2436
2444
  next: n.next.bind(n),
2437
2445
  error: n.error.bind(n),
2438
2446
  complete: n.complete.bind(n)
2439
2447
  }));
2440
2448
  }).catch(n.error.bind(n)), function() {
2441
- l = !0, s && s.unsubscribe();
2449
+ s = !0, d && d.unsubscribe();
2442
2450
  };
2443
2451
  });
2444
2452
  });
@@ -2479,12 +2487,12 @@ const no = async () => {
2479
2487
  fetchPolicy: "cache-and-network"
2480
2488
  }
2481
2489
  }
2482
- }), Fo = (t) => {
2490
+ }), Io = (t) => {
2483
2491
  const { tanyaConfig: e } = t;
2484
2492
  return /* @__PURE__ */ a(dr, { client: lo, children: /* @__PURE__ */ a(xr, { children: /* @__PURE__ */ a(Tr, { tanyaConfig: e }) }) });
2485
2493
  };
2486
2494
  export {
2487
- Fo as TanyaChatbot,
2495
+ Io as TanyaChatbot,
2488
2496
  vo as TanyaChatbotProvider
2489
2497
  };
2490
2498
  //# sourceMappingURL=tanya-chatbot.es.js.map