tanya-chatbot 0.5.9 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,17 +1,17 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react"),n=require("react/jsx-runtime"),Mt=require("@apollo/client"),nt=require("react-redux"),ie=require("@reduxjs/toolkit"),ar=require("@radix-ui/react-popover");require("clsx");require("tailwind-merge");const N=require("axios");require("crypto-js");const ge=require("@iconify/react"),L=require("react-toastify");function sr(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const Ae=sr(ar),ir='*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media(min-width:640px){.container{max-width:640px}}@media(min-width:768px){.container{max-width:768px}}@media(min-width:1024px){.container{max-width:1024px}}@media(min-width:1280px){.container{max-width:1280px}}@media(min-width:1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.bottom-0{bottom:0}.left-0{left:0}.right-0{right:0}.top-0{top:0}.top-full{top:100%}.z-40{z-index:40}.z-50{z-index:50}.m-1{margin:.25rem}.m-3{margin:.75rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-5{margin-top:1.25rem;margin-bottom:1.25rem}.mb-1{margin-bottom:.25rem}.mb-16{margin-bottom:4rem}.mb-2{margin-bottom:.5rem}.mb-20{margin-bottom:5rem}.mb-24{margin-bottom:6rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.h-12{height:3rem}.h-28{height:7rem}.h-3{height:.75rem}.h-6{height:1.5rem}.h-\\[120px\\]{height:120px}.h-\\[200px\\]{height:200px}.h-\\[60px\\]{height:60px}.h-\\[90vh\\]{height:90vh}.h-fit{height:-moz-fit-content;height:fit-content}.h-full{height:100%}.h-screen{height:100vh}.w-28{width:7rem}.w-3{width:.75rem}.w-5\\/6{width:83.333333%}.w-6{width:1.5rem}.w-72{width:18rem}.w-\\[100vw\\]{width:100vw}.w-\\[120px\\]{width:120px}.w-\\[150px\\]{width:150px}.w-\\[60px\\]{width:60px}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.max-w-\\[200px\\]{max-width:200px}.max-w-\\[75\\%\\]{max-width:75%}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-full{--tw-translate-y: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize{resize:both}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-stretch{align-items:stretch}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-scroll{overflow-y:scroll}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\\[10px\\]{border-radius:10px}.rounded-\\[20px\\]{border-radius:20px}.rounded-\\[5px\\]{border-radius:5px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-xl{border-radius:.75rem}.rounded-l-\\[20px\\]{border-top-left-radius:20px;border-bottom-left-radius:20px}.rounded-l-xl{border-top-left-radius:.75rem;border-bottom-left-radius:.75rem}.rounded-r-xl{border-top-right-radius:.75rem;border-bottom-right-radius:.75rem}.rounded-bl-2xl{border-bottom-left-radius:1rem}.rounded-br-xl{border-bottom-right-radius:.75rem}.rounded-tr-\\[20px\\]{border-top-right-radius:20px}.rounded-tr-\\[5px\\]{border-top-right-radius:5px}.border{border-width:1px}.border-0{border-width:0px}.border-b-2{border-bottom-width:2px}.border-l-2{border-left-width:2px}.border-t-2{border-top-width:2px}.border-none{border-style:none}.border-\\[\\#C9C2DE\\]{--tw-border-opacity: 1;border-color:rgb(201 194 222 / var(--tw-border-opacity, 1))}.border-\\[\\#E5E5E5\\]{--tw-border-opacity: 1;border-color:rgb(229 229 229 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.bg-\\[\\#553D94\\]{--tw-bg-opacity: 1;background-color:rgb(85 61 148 / var(--tw-bg-opacity, 1))}.bg-\\[\\#6851C6\\]{--tw-bg-opacity: 1;background-color:rgb(104 81 198 / var(--tw-bg-opacity, 1))}.bg-\\[\\#804C9E0D\\]{background-color:#804c9e0d}.bg-\\[\\#A21CAF\\]{--tw-bg-opacity: 1;background-color:rgb(162 28 175 / var(--tw-bg-opacity, 1))}.bg-\\[\\#AB192D\\]{--tw-bg-opacity: 1;background-color:rgb(171 25 45 / var(--tw-bg-opacity, 1))}.bg-\\[\\#E2DBFF\\]{--tw-bg-opacity: 1;background-color:rgb(226 219 255 / var(--tw-bg-opacity, 1))}.bg-\\[\\#E3DEEF\\]{--tw-bg-opacity: 1;background-color:rgb(227 222 239 / var(--tw-bg-opacity, 1))}.bg-\\[\\#F3F3F3\\]{--tw-bg-opacity: 1;background-color:rgb(243 243 243 / var(--tw-bg-opacity, 1))}.bg-\\[\\#FFFFFF\\],.bg-\\[\\#ffffff\\]{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-black\\/30{background-color:#0000004d}.bg-indigo-300{--tw-bg-opacity: 1;background-color:rgb(165 180 252 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-\\[1px\\]{padding:1px}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-7{padding-left:1.75rem;padding-right:1.75rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.pb-2{padding-bottom:.5rem}.pl-2{padding-left:.5rem}.pr-5{padding-right:1.25rem}.text-left{text-align:left}.text-center{text-align:center}.font-nunitoSans{font-family:Nunito Sans}.text-\\[12px\\]{font-size:12px}.text-\\[14px\\]{font-size:14px}.text-\\[15px\\]{font-size:15px}.text-base{font-size:1rem;line-height:1.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.italic{font-style:italic}.leading-snug{line-height:1.375}.text-\\[\\#000000\\]{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-\\[\\#14121F\\]{--tw-text-opacity: 1;color:rgb(20 18 31 / var(--tw-text-opacity, 1))}.text-\\[\\#18181B\\]{--tw-text-opacity: 1;color:rgb(24 24 27 / var(--tw-text-opacity, 1))}.text-\\[\\#232323\\]{--tw-text-opacity: 1;color:rgb(35 35 35 / var(--tw-text-opacity, 1))}.text-\\[\\#323135\\]{--tw-text-opacity: 1;color:rgb(50 49 53 / var(--tw-text-opacity, 1))}.text-\\[\\#494949\\]{--tw-text-opacity: 1;color:rgb(73 73 73 / var(--tw-text-opacity, 1))}.text-\\[\\#555555\\]{--tw-text-opacity: 1;color:rgb(85 85 85 / var(--tw-text-opacity, 1))}.text-\\[\\#5B5B5B\\]{--tw-text-opacity: 1;color:rgb(91 91 91 / var(--tw-text-opacity, 1))}.text-\\[\\#68656E\\]{--tw-text-opacity: 1;color:rgb(104 101 110 / var(--tw-text-opacity, 1))}.text-\\[\\#959595\\]{--tw-text-opacity: 1;color:rgb(149 149 149 / var(--tw-text-opacity, 1))}.text-\\[\\#EC5050\\]{--tw-text-opacity: 1;color:rgb(236 80 80 / var(--tw-text-opacity, 1))}.text-\\[\\#FBFBFC\\]{--tw-text-opacity: 1;color:rgb(251 251 252 / var(--tw-text-opacity, 1))}.text-\\[\\#FFFFFF\\]{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.line-through{text-decoration-line:line-through}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-80{opacity:.8}.shadow-\\[0px_2px_2px_0px_\\#9292BC40\\]{--tw-shadow: 0px 2px 2px 0px #9292BC40;--tw-shadow-colored: 0px 2px 2px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0px_4px_10px_0px_\\#5F499840\\]{--tw-shadow: 0px 4px 10px 0px #5F499840;--tw-shadow-colored: 0px 4px 10px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.duration-300{animation-duration:.3s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.running{animation-play-state:running}html,body,#root{margin:0;padding:0}:root{line-height:1.5;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}a{font-weight:500;color:#646cff;text-decoration:inherit}a:hover{color:#535bf2}body{margin:0;padding:0}h1{font-size:3.2em;line-height:1.1}button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;cursor:pointer;transition:border-color .25s}button:hover{border-color:#646cff}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}@media(prefers-color-scheme:light){:root{color:#213547;background-color:#fff}a:hover{color:#747bff}button{background-color:#f9f9f9}}.hover\\:scale-125:hover{--tw-scale-x: 1.25;--tw-scale-y: 1.25;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:text-\\[\\#6952C7\\]:hover{--tw-text-opacity: 1;color:rgb(105 82 199 / var(--tw-text-opacity, 1))}.hover\\:opacity-90:hover{opacity:.9}.group:hover .group-hover\\:opacity-100{opacity:1}.data-\\[state\\=open\\]\\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\\[state\\=closed\\]\\:animate-out[data-state=closed]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\\[state\\=closed\\]\\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\\[state\\=open\\]\\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}.data-\\[state\\=closed\\]\\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\\[state\\=open\\]\\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\\[side\\=bottom\\]\\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\\[side\\=left\\]\\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\\[side\\=right\\]\\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\\[side\\=top\\]\\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}@media(min-width:640px){.sm\\:w-\\[80vw\\]{width:80vw}}@media(min-width:768px){.md\\:h-\\[100vh\\]{height:100vh}.md\\:w-1\\/2{width:50%}.md\\:w-\\[770px\\]{width:770px}.md\\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\\:translate-x-full{--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\\:translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\\:flex-row{flex-direction:row}}@media(min-width:1024px){.lg\\:h-\\[100vh\\]{height:100vh}.lg\\:w-1\\/2{width:50%}.lg\\:w-2\\/3{width:66.666667%}.lg\\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\\:translate-x-full{--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\\:translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\\:transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\\:flex-row{flex-direction:row}.lg\\:rounded-l-xl{border-top-left-radius:.75rem;border-bottom-left-radius:.75rem}.lg\\:rounded-bl-xl{border-bottom-left-radius:.75rem}}';function lr(){return g.useEffect(()=>{if(typeof document<"u"){const t=document.createElement("style");return t.textContent=ir,document.head.appendChild(t),()=>{document.head.removeChild(t)}}},[]),null}const cr={store:{storeCode:"",storeName:"",storeDescription:"",activeCatalogId:0,isDefault:!1,logoDarkBg:"",logoLightBg:"",logoTransparent:"",catalogs:[],themeColor:"",themeContrastColor:"",tanyaThemeColor:"",tanyaThemeColorLight:"",favicon:"",websiteTitle:"",flowId:"",aliasId:"",searchConfigs:{endpoint:"",accessKey:"",secretKey:""},homePageCategories:[],carouselImages:{web:[],mobile:[]},otherImages:{web:[],mobile:[]}}},De=ie.createSlice({name:"store",initialState:cr,reducers:{setStore:(t,e)=>{t.store=e.payload}}}),{setStore:ao}=De.actions,dr=De.reducer,ur={product:null},Le=ie.createSlice({name:"product",initialState:ur,reducers:{setProduct:(t,e)=>{t.product=e.payload}}}),{setProduct:ee}=Le.actions,fr=Le.reducer,pr=ie.configureStore({reducer:{store:dr,product:fr}}),hr=({children:t})=>n.jsx(nt.Provider,{store:pr,children:t}),Rt=t=>{const e=new CustomEvent("reactCartUpdated",{detail:{cartUpdated:!0,basketId:t}});window.dispatchEvent(e)};function mr({...t}){return n.jsx(Ae.Root,{"data-slot":"popover",...t})}function wr({...t}){return n.jsx(Ae.Trigger,{"data-slot":"popover-trigger",...t})}const vt=()=>({aiConversationUrl:"https://mdv3qwfi2j.execute-api.us-east-1.amazonaws.com/dev/api/bedrock/invoke/stream",xAPIKey:"BJBtjpPkqGatuoa3qJqdR8aHXSsHkgvGaootbubi",serverUrl:"https://tanya-sfcc-server.vercel.app/",basePath:"sc-api"}),qe=async()=>{const t="https://tanya-sfcc-server.vercel.app/";try{const e=await N.post(`${t}api/auth/token-bm-grant?baseUrl=${Q()}&siteId=${V()}`);return e.status===200&&e.data.access_token?e.data.access_token:(console.error("Failed to fetch token:",e.data),null)}catch(e){return N.isAxiosError(e)?console.error("Error fetching token:",e.response||e.message):console.error("Unexpected error:",e),null}},Be=async t=>{const e="https://tanya-sfcc-server.vercel.app/";try{const r=JSON.parse(sessionStorage.getItem("customerData")||"{}").dwsid,o=await N.post(`${e}api/auth/token-existing-guest-customer?dwsid=${r}&baseUrl=${Q()}&siteId=${V()}&pubCfg=${at()}&envRef=${st()}&orgRef=${it()}`,{},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});return o.status===200&&o.data?o.data:null}catch(r){return N.isAxiosError(r)?console.error("Error creating basket:",r.response||r.message):console.error("Unexpected error:",r),null}};async function Tt(){var c;const t=V(),e="access_token_"+t,r="expires_in_"+t,o=localStorage.getItem(r),a=localStorage.getItem(e);return console.log(a),(c=JSON.parse(sessionStorage.getItem("customerData")||"{}"))!=null&&c.isGuest,console.log("access token found in local storage"),{access_token:a,expires_in:o}}const Q=()=>sessionStorage.getItem("Host"),V=()=>sessionStorage.getItem("SiteId"),at=()=>sessionStorage.getItem("pubCfg"),st=()=>sessionStorage.getItem("envRef"),it=()=>sessionStorage.getItem("orgRef"),xe=async t=>{console.log("fetching results");const{serverUrl:e,basePath:r}=vt();let o="";{const a=await Tt();console.log("the token from getSearchResults",a),o=a.access_token}try{const a=Q();return(await N.get(`${e}${r}/search-sfcc?baseUrl=${a}&query=${t}&siteId=${V()}&pubCfg=${at()}&envRef=${st()}&orgRef=${it()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}})).data.hits}catch(a){throw console.error("Error fetching search results:",a),a}},Ue=async t=>{if(!t)throw new Error("Product ID is required");const{serverUrl:e,basePath:r}=vt(),o=Q();console.log("calling access");const{access_token:a}=await Tt();return(await N.get(`${e}${r}/product-sfcc/${t}?baseUrl=${o}&siteId=${V()}&pubCfg=${at()}&envRef=${st()}&orgRef=${it()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`}})).data},gr=async t=>{if(!t)throw new Error("customerId is required");const e=await qe(),{customer_token:r}=await Be(e),{serverUrl:o,basePath:a}=vt(),l=(await Tt()).access_token;return(await N.get(`${o}${a}/get-interest?baseUrl=${Q()}&customerId=${t}&siteId=${V()}&pubCfg=${at()}&envRef=${st()}&orgRef=${it()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${l}`}})).data},be=t=>String(typeof t=="string"?t:t["en-US"]||t),ye=t=>t!=null&&t.image?[t.image]:"variants"in t?t.variants[0].images:t.masterVariant.images.map(e=>e.url),xr=(t,e)=>t.toLocaleString("en-US",{style:"currency",currency:e||"USD"}),ve=t=>{var e,r,o;return"variants"in t?{centAmount:(e=t.variants[0])==null?void 0:e.prices.EUR.max,currencyCode:"DOL"}:{centAmount:(r=t.masterVariant)==null?void 0:r.prices[0].value.centAmount,currencyCode:(o=t.masterVariant)==null?void 0:o.prices[0].value.currencyCode}},br=t=>t.charAt(0).toUpperCase()+t.slice(1),ke=(t,e)=>t.length<e?t:t.slice(0,e)+"...",Gt=t=>t.split("\\n").map((e,r)=>{const o=e.match(/^(\d+)\.\s(.+)/);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/>"}).join("");function yr(){const t=()=>window.innerWidth<425?1:window.innerWidth<768?2:4,[e,r]=g.useState(t);return g.useEffect(()=>{const o=()=>r(t());return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),e}const vr=({product:t})=>{const e=nt.useDispatch(),r=yr(),[o,a]=g.useState(0),c=()=>{a(i=>i+r>=t.length?0:i+r)},l=()=>{a(i=>i-r<0?t.length-(t.length%r||r):i-r)},d=async i=>{const y=await Ue(i);e(ee(y))};return n.jsx("div",{className:"mt-2 overflow-x-hidden",children:n.jsxs("div",{className:"flex items-center justify-center gap-4 relative",children:[(t==null?void 0:t.length)>r&&n.jsx("button",{onClick:l,className:"absolute z-50 left-0 text-[#000000] bg-[#ffffff] rounded-full p-2 flex items-center h-fit",style:{height:"30px",width:"30px",boxShadow:"0 4px 10px rgba(0, 0, 0, 0.25)"},children:"<"}),n.jsx("div",{className:"flex gap-5 justify-center flex-1 overflow-hidden",children:t.slice(o,o+r).map(i=>{var y,v,_,j;return n.jsxs("div",{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]",onClick:()=>{d(i.product_id??i.productId)},children:[n.jsx("div",{className:"w-full p-2 flex items-center justify-center bg-white",children:n.jsx("img",{src:((y=ye(i)[0])==null?void 0:y.link)||ye(i)[0]||"https://via.placeholder.com/120",alt:i!=null&&i.productName?i.productName:"Product",className:"w-28 h-28 rounded-[10px] transition-transform duration-300 hover:scale-125 object-cover"})}),n.jsxs("div",{className:"text-white w-full p-2 text-[12px] text-center h-[60px]",children:[n.jsxs("div",{className:"relative inline-block group",children:[n.jsx("div",{className:"w-full line-clamp-1 overflow-hidden text-ellipsis text-[#000000] font-medium font-nunitoSans",children:i!=null&&i.productName?i.productName:i!=null&&i.product_name?i.product_name:ke(be((v=i==null?void 0:i.name)==null?void 0:v["en-US"]),60)||"Product"}),n.jsx("div",{className:"absolute left-0 top-full mt-1 w-max max-w-[200px] p-2 bg-white shadow-lg text-black text-xs rounded opacity-0 transition-opacity duration-300 group-hover:opacity-100 z-50 pointer-events-auto",style:{position:"absolute",top:"-100%",left:"0",marginBottom:"5px",zIndex:50},children:i!=null&&i.productName?i.productName:i!=null&&i.product_name?i.product_name:ke(be((_=i==null?void 0:i.name)==null?void 0:_["en-US"]),60)||"Product"})]}),n.jsxs("div",{className:" flex text-center items-center gap-2 text-[14px] text-[#14121F] font-bold font-nunitoSans text-base mb-1",children:[n.jsx("p",{children:xr(i!=null&&i.price?Number(i==null?void 0:i.price):ve(i).centAmount||0,(j=ve(i))==null?void 0:j.currencyCode)}),n.jsxs("p",{className:"text-[#14121F] font-normal line-through text-sm font-nunitoSans truncate",children:["$",Number(i==null?void 0:i.price).toFixed(2)??5]})]})]})]},i.productId)})}),(t==null?void 0:t.length)>r&&n.jsx("button",{onClick:c,className:"absolute z-50 right-0 text-[#000000] bg-[#ffffff] rounded-full p-2 flex items-center h-fit",style:{height:"30px",width:"30px",boxShadow:"0 4px 10px rgba(0, 0, 0, 0.25)"},children:">"})]})})},kr=({chat:t,storeDetails:e})=>n.jsx("div",{className:"bg-[#FFFFFF] px-7 py-4 rounded-r-xl rounded-bl-2xl w-full",children:t.map((r,o)=>n.jsxs("div",{className:"mb-4 p-3 rounded-xl",style:{background:"linear-gradient(109.52deg, #F0EEF5 36.91%, #F4F3EE 100.34%"},children:[n.jsx("div",{className:"font-nunitoSans font-bold text-sm text-[#494949] p-2 w-fit rounded-[20px]",children:br(r.keyword)||"No keyword"}),n.jsx(vr,{product:r.items,storeDetails:e})]},o))}),Me=async(t,e)=>{var c,l;const{serverUrl:r,basePath:o}=vt(),a=`${r}`;try{const d=await N.post(`${a}${o}/basket/create?baseUrl=${Q()}&siteId=${V()}&pubCfg=${at()}&envRef=${st()}&orgRef=${it()}`,e,{headers:{"Content-Type":"application/json",Authorization:t}});return window.postMessage({type:"WIDGET_CREATED_BASKET",basketId:((c=d.data)==null?void 0:c.basket_id)||((l=d.data)==null?void 0:l.basketId)},"*"),d.data}catch(d){return N.isAxiosError(d)?console.error("Error creating basket:",d.response||d.message):console.error("Unexpected error:",d),null}},re=async(t,e,r)=>{const{serverUrl:o,basePath:a}=vt(),c=`${o}`;try{const l=await N.post(`${c}${a}/basket/add-product/${t}?baseUrl=${Q()}&siteId=${V()}&pubCfg=${at()}&envRef=${st()}&orgRef=${it()}`,e,{headers:{"Content-Type":"application/json",Authorization:r}});return l.status===200&&l.data?l.data:null}catch(l){return N.isAxiosError(l)?console.error("Error adding products to basket:",l.response||l.message):console.error("Unexpected error:",l),null}},Re=async({basketId:t,customer_token:e})=>{var c;const{serverUrl:r,basePath:o}=vt(),a=`${r}`;try{const l=await N.get(`${a}${o}/basket/${t}?baseUrl=${Q()}&siteId=${V()}&pubCfg=${at()}&envRef=${st()}&orgRef=${it()}`,{headers:{"Content-Type":"application/json",Authorization:e}});return{status:l.status,data:l.data}}catch(l){return N.isAxiosError(l)?{status:(c=l.response)==null?void 0:c.status,data:null}:{status:null,data:null}}},Ht="sfcc_basket_id",Se="sfcc_customer_token",Et="sfcc_token_expiry",Sr=300*1e3,It="1.0.0";const ot=t=>{try{t?localStorage.setItem(Ht,t):localStorage.removeItem(Ht)}catch(e){console.error("Error saving basket ID to storage:",e)}},Vt=t=>{try{if(t){localStorage.setItem(Se,t);const e=Date.now()+Sr;localStorage.setItem(Et,e.toString())}else localStorage.removeItem(Se)}catch(e){console.error("Error storing token:",e)}},je=300,jr=({addToCartPwa:t})=>{var i,y,v,_,j,T;const e=nt.useDispatch(),r=nt.useSelector(O=>O.product.product),o=nt.useSelector(O=>O.store.store),[a,c]=g.useState(!!r);if(g.useEffect(()=>{c(!!r)},[r]),!r)return null;const l=async()=>{var O,P,q,kt,lt,B,ct,St,Pt,Z,jt,_t,dt,Ot,$t,Y;try{if(!((P=(O=r==null?void 0:r.variants)==null?void 0:O[0])!=null&&P.product_id)&&!(r.type.item||r.type.bundle)&&!((kt=(q=r==null?void 0:r.variants)==null?void 0:q[0])!=null&&kt.productId)){L.toast.error("Variants not available",{position:"bottom-right",autoClose:1e3}),console.error("No product variant found");return}const x=[{product_id:((lt=r.variants)==null?void 0:lt[0].product_id)||((B=r.variants)==null?void 0:B[0].productId)||(r==null?void 0:r.id),quantity:1}],tt=JSON.parse(sessionStorage.getItem("customerData")||"{}"),k=(tt==null?void 0:tt.basketId)||localStorage.getItem(Ht),Kt=!1,zt=localStorage.getItem(Et),At=Date.now();if(!Kt||!zt||At>=parseInt(zt)){let U="";if(U="Bearer "+(await Tt()).access_token,!U){console.error("Failed to get customer_token");return}const et=At+300*1e3;if(Vt(U),localStorage.setItem(Et,et.toString()),k){const Ct=await Re({basketId:k,customer_token:U});if(Ct.status===200&&Ct){const J=await re(k,x,U);(((ct=J==null?void 0:J.product_items)==null?void 0:ct.length)>0||((St=J==null?void 0:J.productItems)==null?void 0:St.length)>0)&&(L.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Rt(k));return}}const ut={productItems:[{productId:((Pt=r.variants)==null?void 0:Pt[0].product_id)||((Z=r.variants)==null?void 0:Z[0].productId)||(r==null?void 0:r.id),quantity:1}]},S=await Me(U,ut);if(!(S!=null&&S.basket_id)&&!(S!=null&&S.basketId)){console.error("Failed to create basket");return}ot((S==null?void 0:S.basket_id)||(S==null?void 0:S.basketId)),console.log("adding product to basket");const K=await re((S==null?void 0:S.basket_id)||(S==null?void 0:S.basketId),x,U);console.log("object added to basket"),(((jt=K==null?void 0:K.product_items)==null?void 0:jt.length)>0||((_t=K==null?void 0:K.productItems)==null?void 0:_t.length)>0)&&L.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Rt(S.basket_id||(S==null?void 0:S.basketId))}}catch(x){console.error("Error adding to cart:",x),L.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}),((dt=x==null?void 0:x.response)==null?void 0:dt.status)===404||((Ot=x==null?void 0:x.response)==null?void 0:Ot.status)===401?((($t=x==null?void 0:x.response)==null?void 0:$t.status)===404&&ot(null),((Y=x==null?void 0:x.response)==null?void 0:Y.status)===401&&(ot(null),Vt(null))):(console.error("Failed to add product to basket:",x.message),L.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}))}},d=()=>{r&&(window.location.href=r.c_pdpUrl)};return console.log(r,"the prod"),n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:()=>{c(!1),setTimeout(()=>e(ee(null)),je)}}),n.jsxs("div",{className:`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react"),n=require("react/jsx-runtime"),Mt=require("@apollo/client"),ot=require("react-redux"),se=require("@reduxjs/toolkit"),nr=require("@radix-ui/react-popover");require("clsx");require("tailwind-merge");const E=require("axios");require("crypto-js");const we=require("@iconify/react"),B=require("react-toastify");function ar(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const ze=ar(nr),sr='*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media(min-width:640px){.container{max-width:640px}}@media(min-width:768px){.container{max-width:768px}}@media(min-width:1024px){.container{max-width:1024px}}@media(min-width:1280px){.container{max-width:1280px}}@media(min-width:1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.bottom-0{bottom:0}.left-0{left:0}.right-0{right:0}.top-0{top:0}.top-full{top:100%}.z-40{z-index:40}.z-50{z-index:50}.m-1{margin:.25rem}.m-3{margin:.75rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-5{margin-top:1.25rem;margin-bottom:1.25rem}.mb-1{margin-bottom:.25rem}.mb-16{margin-bottom:4rem}.mb-2{margin-bottom:.5rem}.mb-20{margin-bottom:5rem}.mb-24{margin-bottom:6rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.h-12{height:3rem}.h-28{height:7rem}.h-3{height:.75rem}.h-6{height:1.5rem}.h-\\[120px\\]{height:120px}.h-\\[200px\\]{height:200px}.h-\\[60px\\]{height:60px}.h-\\[90vh\\]{height:90vh}.h-fit{height:-moz-fit-content;height:fit-content}.h-full{height:100%}.h-screen{height:100vh}.w-28{width:7rem}.w-3{width:.75rem}.w-5\\/6{width:83.333333%}.w-6{width:1.5rem}.w-72{width:18rem}.w-\\[100vw\\]{width:100vw}.w-\\[120px\\]{width:120px}.w-\\[150px\\]{width:150px}.w-\\[60px\\]{width:60px}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.max-w-\\[200px\\]{max-width:200px}.max-w-\\[75\\%\\]{max-width:75%}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-full{--tw-translate-y: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize{resize:both}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-stretch{align-items:stretch}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-scroll{overflow-y:scroll}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\\[10px\\]{border-radius:10px}.rounded-\\[20px\\]{border-radius:20px}.rounded-\\[5px\\]{border-radius:5px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-xl{border-radius:.75rem}.rounded-l-\\[20px\\]{border-top-left-radius:20px;border-bottom-left-radius:20px}.rounded-l-xl{border-top-left-radius:.75rem;border-bottom-left-radius:.75rem}.rounded-r-xl{border-top-right-radius:.75rem;border-bottom-right-radius:.75rem}.rounded-bl-2xl{border-bottom-left-radius:1rem}.rounded-br-xl{border-bottom-right-radius:.75rem}.rounded-tr-\\[20px\\]{border-top-right-radius:20px}.rounded-tr-\\[5px\\]{border-top-right-radius:5px}.border{border-width:1px}.border-0{border-width:0px}.border-b-2{border-bottom-width:2px}.border-l-2{border-left-width:2px}.border-t-2{border-top-width:2px}.border-none{border-style:none}.border-\\[\\#C9C2DE\\]{--tw-border-opacity: 1;border-color:rgb(201 194 222 / var(--tw-border-opacity, 1))}.border-\\[\\#E5E5E5\\]{--tw-border-opacity: 1;border-color:rgb(229 229 229 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.bg-\\[\\#553D94\\]{--tw-bg-opacity: 1;background-color:rgb(85 61 148 / var(--tw-bg-opacity, 1))}.bg-\\[\\#6851C6\\]{--tw-bg-opacity: 1;background-color:rgb(104 81 198 / var(--tw-bg-opacity, 1))}.bg-\\[\\#804C9E0D\\]{background-color:#804c9e0d}.bg-\\[\\#A21CAF\\]{--tw-bg-opacity: 1;background-color:rgb(162 28 175 / var(--tw-bg-opacity, 1))}.bg-\\[\\#AB192D\\]{--tw-bg-opacity: 1;background-color:rgb(171 25 45 / var(--tw-bg-opacity, 1))}.bg-\\[\\#E2DBFF\\]{--tw-bg-opacity: 1;background-color:rgb(226 219 255 / var(--tw-bg-opacity, 1))}.bg-\\[\\#E3DEEF\\]{--tw-bg-opacity: 1;background-color:rgb(227 222 239 / var(--tw-bg-opacity, 1))}.bg-\\[\\#F3F3F3\\]{--tw-bg-opacity: 1;background-color:rgb(243 243 243 / var(--tw-bg-opacity, 1))}.bg-\\[\\#FFFFFF\\],.bg-\\[\\#ffffff\\]{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-black\\/30{background-color:#0000004d}.bg-indigo-300{--tw-bg-opacity: 1;background-color:rgb(165 180 252 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-\\[1px\\]{padding:1px}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-7{padding-left:1.75rem;padding-right:1.75rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.pb-2{padding-bottom:.5rem}.pl-2{padding-left:.5rem}.pr-5{padding-right:1.25rem}.text-left{text-align:left}.text-center{text-align:center}.font-nunitoSans{font-family:Nunito Sans}.text-\\[12px\\]{font-size:12px}.text-\\[14px\\]{font-size:14px}.text-\\[15px\\]{font-size:15px}.text-base{font-size:1rem;line-height:1.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.italic{font-style:italic}.leading-snug{line-height:1.375}.text-\\[\\#000000\\]{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-\\[\\#14121F\\]{--tw-text-opacity: 1;color:rgb(20 18 31 / var(--tw-text-opacity, 1))}.text-\\[\\#18181B\\]{--tw-text-opacity: 1;color:rgb(24 24 27 / var(--tw-text-opacity, 1))}.text-\\[\\#232323\\]{--tw-text-opacity: 1;color:rgb(35 35 35 / var(--tw-text-opacity, 1))}.text-\\[\\#323135\\]{--tw-text-opacity: 1;color:rgb(50 49 53 / var(--tw-text-opacity, 1))}.text-\\[\\#494949\\]{--tw-text-opacity: 1;color:rgb(73 73 73 / var(--tw-text-opacity, 1))}.text-\\[\\#555555\\]{--tw-text-opacity: 1;color:rgb(85 85 85 / var(--tw-text-opacity, 1))}.text-\\[\\#5B5B5B\\]{--tw-text-opacity: 1;color:rgb(91 91 91 / var(--tw-text-opacity, 1))}.text-\\[\\#68656E\\]{--tw-text-opacity: 1;color:rgb(104 101 110 / var(--tw-text-opacity, 1))}.text-\\[\\#959595\\]{--tw-text-opacity: 1;color:rgb(149 149 149 / var(--tw-text-opacity, 1))}.text-\\[\\#EC5050\\]{--tw-text-opacity: 1;color:rgb(236 80 80 / var(--tw-text-opacity, 1))}.text-\\[\\#FBFBFC\\]{--tw-text-opacity: 1;color:rgb(251 251 252 / var(--tw-text-opacity, 1))}.text-\\[\\#FFFFFF\\]{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.line-through{text-decoration-line:line-through}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-80{opacity:.8}.shadow-\\[0px_2px_2px_0px_\\#9292BC40\\]{--tw-shadow: 0px 2px 2px 0px #9292BC40;--tw-shadow-colored: 0px 2px 2px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0px_4px_10px_0px_\\#5F499840\\]{--tw-shadow: 0px 4px 10px 0px #5F499840;--tw-shadow-colored: 0px 4px 10px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.duration-300{animation-duration:.3s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.running{animation-play-state:running}html,body,#root{margin:0;padding:0}:root{line-height:1.5;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}a{font-weight:500;color:#646cff;text-decoration:inherit}a:hover{color:#535bf2}body{margin:0;padding:0}h1{font-size:3.2em;line-height:1.1}button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;cursor:pointer;transition:border-color .25s}button:hover{border-color:#646cff}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}@media(prefers-color-scheme:light){:root{color:#213547;background-color:#fff}a:hover{color:#747bff}button{background-color:#f9f9f9}}.hover\\:scale-125:hover{--tw-scale-x: 1.25;--tw-scale-y: 1.25;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:text-\\[\\#6952C7\\]:hover{--tw-text-opacity: 1;color:rgb(105 82 199 / var(--tw-text-opacity, 1))}.hover\\:opacity-90:hover{opacity:.9}.group:hover .group-hover\\:opacity-100{opacity:1}.data-\\[state\\=open\\]\\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\\[state\\=closed\\]\\:animate-out[data-state=closed]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\\[state\\=closed\\]\\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\\[state\\=open\\]\\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}.data-\\[state\\=closed\\]\\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\\[state\\=open\\]\\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\\[side\\=bottom\\]\\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\\[side\\=left\\]\\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\\[side\\=right\\]\\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\\[side\\=top\\]\\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}@media(min-width:640px){.sm\\:w-\\[80vw\\]{width:80vw}}@media(min-width:768px){.md\\:h-\\[100vh\\]{height:100vh}.md\\:w-1\\/2{width:50%}.md\\:w-\\[770px\\]{width:770px}.md\\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\\:translate-x-full{--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\\:translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\\:flex-row{flex-direction:row}}@media(min-width:1024px){.lg\\:h-\\[100vh\\]{height:100vh}.lg\\:w-1\\/2{width:50%}.lg\\:w-2\\/3{width:66.666667%}.lg\\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\\:translate-x-full{--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\\:translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\\:transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\\:flex-row{flex-direction:row}.lg\\:rounded-l-xl{border-top-left-radius:.75rem;border-bottom-left-radius:.75rem}.lg\\:rounded-bl-xl{border-bottom-left-radius:.75rem}}';function ir(){return x.useEffect(()=>{if(typeof document<"u"){const t=document.createElement("style");return t.textContent=sr,document.head.appendChild(t),()=>{document.head.removeChild(t)}}},[]),null}const lr={store:{storeCode:"",storeName:"",storeDescription:"",activeCatalogId:0,isDefault:!1,logoDarkBg:"",logoLightBg:"",logoTransparent:"",catalogs:[],themeColor:"",themeContrastColor:"",tanyaThemeColor:"",tanyaThemeColorLight:"",favicon:"",websiteTitle:"",flowId:"",aliasId:"",searchConfigs:{endpoint:"",accessKey:"",secretKey:""},homePageCategories:[],carouselImages:{web:[],mobile:[]},otherImages:{web:[],mobile:[]}}},Ae=se.createSlice({name:"store",initialState:lr,reducers:{setStore:(t,e)=>{t.store=e.payload}}}),{setStore:no}=Ae.actions,cr=Ae.reducer,dr={product:null},De=se.createSlice({name:"product",initialState:dr,reducers:{setProduct:(t,e)=>{t.product=e.payload}}}),{setProduct:te}=De.actions,ur=De.reducer,fr=se.configureStore({reducer:{store:cr,product:ur}}),pr=({children:t})=>n.jsx(ot.Provider,{store:fr,children:t}),Rt=t=>{const e=new CustomEvent("reactCartUpdated",{detail:{cartUpdated:!0,basketId:t}});window.dispatchEvent(e)};function hr({...t}){return n.jsx(ze.Root,{"data-slot":"popover",...t})}function mr({...t}){return n.jsx(ze.Trigger,{"data-slot":"popover-trigger",...t})}const vt=()=>({aiConversationUrl:"https://mdv3qwfi2j.execute-api.us-east-1.amazonaws.com/dev/api/bedrock/invoke/stream",xAPIKey:"BJBtjpPkqGatuoa3qJqdR8aHXSsHkgvGaootbubi",serverUrl:"https://tanya-sfcc-server.vercel.app/",basePath:"sc-api"}),Le=async()=>{const t="https://tanya-sfcc-server.vercel.app/";try{const e=await E.post(`${t}api/auth/token-bm-grant?baseUrl=${Q()}&siteId=${Y()}`);return e.status===200&&e.data.access_token?e.data.access_token:(console.error("Failed to fetch token:",e.data),null)}catch(e){return E.isAxiosError(e)?console.error("Error fetching token:",e.response||e.message):console.error("Unexpected error:",e),null}},qe=async t=>{const e="https://tanya-sfcc-server.vercel.app/";try{const r=JSON.parse(sessionStorage.getItem("customerData")||"{}").dwsid,o=await E.post(`${e}api/auth/token-existing-guest-customer?dwsid=${r}&baseUrl=${Q()}&siteId=${Y()}&pubCfg=${nt()}&envRef=${at()}&orgRef=${st()}`,{},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});return o.status===200&&o.data?o.data:null}catch(r){return E.isAxiosError(r)?console.error("Error creating basket:",r.response||r.message):console.error("Unexpected error:",r),null}};async function Et(){var c;const t=Y(),e="access_token_"+t,r="expires_in_"+t,o=localStorage.getItem(r),a=localStorage.getItem(e);return console.log(a),(c=JSON.parse(sessionStorage.getItem("customerData")||"{}"))!=null&&c.isGuest,console.log("access token found in local storage"),{access_token:a,expires_in:o}}const Q=()=>sessionStorage.getItem("Host"),Y=()=>sessionStorage.getItem("SiteId"),nt=()=>sessionStorage.getItem("pubCfg"),at=()=>sessionStorage.getItem("envRef"),st=()=>sessionStorage.getItem("orgRef"),ge=async t=>{console.log("fetching results");const{serverUrl:e,basePath:r}=vt();let o="";{const a=await Et();console.log("the token from getSearchResults",a),o=a.access_token}try{const a=Q();return(await E.get(`${e}${r}/search-sfcc?baseUrl=${a}&query=${t}&siteId=${Y()}&pubCfg=${nt()}&envRef=${at()}&orgRef=${st()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}})).data.hits}catch(a){throw console.error("Error fetching search results:",a),a}},Be=async t=>{if(!t)throw new Error("Product ID is required");const{serverUrl:e,basePath:r}=vt(),o=Q();console.log("calling access");const{access_token:a}=await Et();return(await E.get(`${e}${r}/product-sfcc/${t}?baseUrl=${o}&siteId=${Y()}&pubCfg=${nt()}&envRef=${at()}&orgRef=${st()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`}})).data},wr=async t=>{if(!t)throw new Error("customerId is required");const e=await Le(),{customer_token:r}=await qe(e),{serverUrl:o,basePath:a}=vt(),l=(await Et()).access_token;return(await E.get(`${o}${a}/get-interest?baseUrl=${Q()}&customerId=${t}&siteId=${Y()}&pubCfg=${nt()}&envRef=${at()}&orgRef=${st()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${l}`}})).data},xe=t=>String(typeof t=="string"?t:t["en-US"]||t),be=t=>t!=null&&t.image?[t.image]:"variants"in t?t.variants[0].images:t.masterVariant.images.map(e=>e.url),gr=(t,e)=>t.toLocaleString("en-US",{style:"currency",currency:e||"USD"}),ye=t=>{var e,r,o;return"variants"in t?{centAmount:(e=t.variants[0])==null?void 0:e.prices.EUR.max,currencyCode:"DOL"}:{centAmount:(r=t.masterVariant)==null?void 0:r.prices[0].value.centAmount,currencyCode:(o=t.masterVariant)==null?void 0:o.prices[0].value.currencyCode}},xr=t=>t.charAt(0).toUpperCase()+t.slice(1),ve=(t,e)=>t.length<e?t:t.slice(0,e)+"...",Wt=t=>t.split("\\n").map((e,r)=>{const o=e.match(/^(\d+)\.\s(.+)/);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/>"}).join("");function br(){const t=()=>window.innerWidth<425?1:window.innerWidth<768?2:4,[e,r]=x.useState(t);return x.useEffect(()=>{const o=()=>r(t());return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),e}const yr=({product:t})=>{const e=ot.useDispatch(),r=br(),[o,a]=x.useState(0),c=()=>{a(i=>i+r>=t.length?0:i+r)},l=()=>{a(i=>i-r<0?t.length-(t.length%r||r):i-r)},d=async i=>{const b=await Be(i);e(te(b))};return n.jsx("div",{className:"mt-2 overflow-x-hidden",children:n.jsxs("div",{className:"flex items-center justify-center gap-4 relative",children:[(t==null?void 0:t.length)>r&&n.jsx("button",{onClick:l,className:"absolute z-50 left-0 text-[#000000] bg-[#ffffff] rounded-full p-2 flex items-center h-fit",style:{height:"30px",width:"30px",boxShadow:"0 4px 10px rgba(0, 0, 0, 0.25)"},children:"<"}),n.jsx("div",{className:"flex gap-5 justify-center flex-1 overflow-hidden",children:t.slice(o,o+r).map(i=>{var b,y,_,S;return n.jsxs("div",{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]",onClick:()=>{d(i.product_id??i.productId)},children:[n.jsx("div",{className:"w-full p-2 flex items-center justify-center bg-white",children:n.jsx("img",{src:((b=be(i)[0])==null?void 0:b.link)||be(i)[0]||"https://via.placeholder.com/120",alt:i!=null&&i.productName?i.productName:"Product",className:"w-28 h-28 rounded-[10px] transition-transform duration-300 hover:scale-125 object-cover"})}),n.jsxs("div",{className:"text-white w-full p-2 text-[12px] text-center h-[60px]",children:[n.jsxs("div",{className:"relative inline-block group",children:[n.jsx("div",{className:"w-full line-clamp-1 overflow-hidden text-ellipsis text-[#000000] font-medium font-nunitoSans",children:i!=null&&i.productName?i.productName:i!=null&&i.product_name?i.product_name:ve(xe((y=i==null?void 0:i.name)==null?void 0:y["en-US"]),60)||"Product"}),n.jsx("div",{className:"absolute left-0 top-full mt-1 w-max max-w-[200px] p-2 bg-white shadow-lg text-black text-xs rounded opacity-0 transition-opacity duration-300 group-hover:opacity-100 z-50 pointer-events-auto",style:{position:"absolute",top:"-100%",left:"0",marginBottom:"5px",zIndex:50},children:i!=null&&i.productName?i.productName:i!=null&&i.product_name?i.product_name:ve(xe((_=i==null?void 0:i.name)==null?void 0:_["en-US"]),60)||"Product"})]}),n.jsxs("div",{className:" flex text-center items-center gap-2 text-[14px] text-[#14121F] font-bold font-nunitoSans text-base mb-1",children:[n.jsx("p",{children:gr(i!=null&&i.price?Number(i==null?void 0:i.price):ye(i).centAmount||0,(S=ye(i))==null?void 0:S.currencyCode)}),n.jsxs("p",{className:"text-[#14121F] font-normal line-through text-sm font-nunitoSans truncate",children:["$",Number(i==null?void 0:i.price).toFixed(2)??5]})]})]})]},i.productId)})}),(t==null?void 0:t.length)>r&&n.jsx("button",{onClick:c,className:"absolute z-50 right-0 text-[#000000] bg-[#ffffff] rounded-full p-2 flex items-center h-fit",style:{height:"30px",width:"30px",boxShadow:"0 4px 10px rgba(0, 0, 0, 0.25)"},children:">"})]})})},vr=({chat:t,storeDetails:e})=>n.jsx("div",{className:"bg-[#FFFFFF] px-7 py-4 rounded-r-xl rounded-bl-2xl w-full",children:t.map((r,o)=>n.jsxs("div",{className:"mb-4 p-3 rounded-xl",style:{background:"linear-gradient(109.52deg, #F0EEF5 36.91%, #F4F3EE 100.34%"},children:[n.jsx("div",{className:"font-nunitoSans font-bold text-sm text-[#494949] p-2 w-fit rounded-[20px]",children:xr(r.keyword)||"No keyword"}),n.jsx(yr,{product:r.items,storeDetails:e})]},o))}),Ue=async(t,e)=>{var c,l;const{serverUrl:r,basePath:o}=vt(),a=`${r}`;try{const d=await E.post(`${a}${o}/basket/create?baseUrl=${Q()}&siteId=${Y()}&pubCfg=${nt()}&envRef=${at()}&orgRef=${st()}`,e,{headers:{"Content-Type":"application/json",Authorization:t}});return window.postMessage({type:"WIDGET_CREATED_BASKET",basketId:((c=d.data)==null?void 0:c.basket_id)||((l=d.data)==null?void 0:l.basketId)},"*"),d.data}catch(d){return E.isAxiosError(d)?console.error("Error creating basket:",d.response||d.message):console.error("Unexpected error:",d),null}},ee=async(t,e,r)=>{const{serverUrl:o,basePath:a}=vt(),c=`${o}`;try{const l=await E.post(`${c}${a}/basket/add-product/${t}?baseUrl=${Q()}&siteId=${Y()}&pubCfg=${nt()}&envRef=${at()}&orgRef=${st()}`,e,{headers:{"Content-Type":"application/json",Authorization:r}});return l.status===200&&l.data?l.data:null}catch(l){return E.isAxiosError(l)?console.error("Error adding products to basket:",l.response||l.message):console.error("Unexpected error:",l),null}},Me=async({basketId:t,customer_token:e})=>{var c;const{serverUrl:r,basePath:o}=vt(),a=`${r}`;try{const l=await E.get(`${a}${o}/basket/${t}?baseUrl=${Q()}&siteId=${Y()}&pubCfg=${nt()}&envRef=${at()}&orgRef=${st()}`,{headers:{"Content-Type":"application/json",Authorization:e}});return{status:l.status,data:l.data}}catch(l){return E.isAxiosError(l)?{status:(c=l.response)==null?void 0:c.status,data:null}:{status:null,data:null}}},Ht="sfcc_basket_id",ke="sfcc_customer_token",Nt="sfcc_token_expiry",kr=300*1e3,Ct="1.0.0";const rt=t=>{try{t?localStorage.setItem(Ht,t):localStorage.removeItem(Ht)}catch(e){console.error("Error saving basket ID to storage:",e)}},Vt=t=>{try{if(t){localStorage.setItem(ke,t);const e=Date.now()+kr;localStorage.setItem(Nt,e.toString())}else localStorage.removeItem(ke)}catch(e){console.error("Error storing token:",e)}},Se=300,Sr=({addToCartPwa:t})=>{var i,b,y,_,S,U;const e=ot.useDispatch(),r=ot.useSelector(F=>F.product.product),o=ot.useSelector(F=>F.store.store),[a,c]=x.useState(!!r);if(x.useEffect(()=>{c(!!r)},[r]),!r)return null;const l=async()=>{var F,$,K,it,M,lt,kt,Tt,Z,St,jt,ct,Pt,Ot,tt,T;try{if(!(($=(F=r==null?void 0:r.variants)==null?void 0:F[0])!=null&&$.product_id)&&!(r.type.item||r.type.bundle)&&!((it=(K=r==null?void 0:r.variants)==null?void 0:K[0])!=null&&it.productId)){B.toast.error("Variants not available",{position:"bottom-right",autoClose:1e3}),console.error("No product variant found");return}const j=[{product_id:((M=r.variants)==null?void 0:M[0].product_id)||((lt=r.variants)==null?void 0:lt[0].productId)||(r==null?void 0:r.id),quantity:1}],v=JSON.parse(sessionStorage.getItem("customerData")||"{}"),dt=(v==null?void 0:v.basketId)||localStorage.getItem(Ht),Kt=!1,$t=localStorage.getItem(Nt),zt=Date.now();if(!Kt||!$t||zt>=parseInt($t)){let O="";if(O="Bearer "+(await Et()).access_token,!O){console.error("Failed to get customer_token");return}const ut=zt+300*1e3;if(Vt(O),localStorage.setItem(Nt,ut.toString()),dt){const _t=await Me({basketId:dt,customer_token:O});if(_t.status===200&&_t){const A=await ee(dt,j,O);(((kt=A==null?void 0:A.product_items)==null?void 0:kt.length)>0||((Tt=A==null?void 0:A.productItems)==null?void 0:Tt.length)>0)&&(B.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Rt(dt));return}}const At={productItems:[{productId:((Z=r.variants)==null?void 0:Z[0].product_id)||((St=r.variants)==null?void 0:St[0].productId)||(r==null?void 0:r.id),quantity:1}]},k=await Ue(O,At);if(!(k!=null&&k.basket_id)&&!(k!=null&&k.basketId)){console.error("Failed to create basket");return}rt((k==null?void 0:k.basket_id)||(k==null?void 0:k.basketId)),console.log("adding product to basket");const J=await ee((k==null?void 0:k.basket_id)||(k==null?void 0:k.basketId),j,O);console.log("object added to basket"),(((jt=J==null?void 0:J.product_items)==null?void 0:jt.length)>0||((ct=J==null?void 0:J.productItems)==null?void 0:ct.length)>0)&&B.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Rt(k.basket_id||(k==null?void 0:k.basketId))}}catch(j){console.error("Error adding to cart:",j),B.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}),((Pt=j==null?void 0:j.response)==null?void 0:Pt.status)===404||((Ot=j==null?void 0:j.response)==null?void 0:Ot.status)===401?(((tt=j==null?void 0:j.response)==null?void 0:tt.status)===404&&rt(null),((T=j==null?void 0:j.response)==null?void 0:T.status)===401&&(rt(null),Vt(null))):(console.error("Failed to add product to basket:",j.message),B.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}))}},d=()=>{r&&(window.location.href=r.c_pdpUrl)};return console.log(r,"the prod"),n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:()=>{c(!1),setTimeout(()=>e(te(null)),Se)}}),n.jsxs("div",{className:`
2
2
  flex flex-col gap-2 items-center h-[90vh] absolute right-0 bottom-0 z-50 w-full md:w-1/2 md:h-[100vh] lg:w-1/2 lg:h-[100vh] shadow-xl p-2 border-l-2 bg-white border-gray-200 overflow-y-scroll
3
3
  transition-all duration-300
4
4
  ${a?"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"}
5
- `,style:{willChange:"transform, opacity"},onClick:O=>O.stopPropagation(),children:[n.jsxs("div",{className:"mt-3 flex flex-row justify-between w-full ",children:[n.jsx("div",{children:n.jsx("p",{className:"text-[#000000] font-bold font-nunitoSans",children:r.name})}),n.jsx("div",{children:n.jsx(ge.Icon,{icon:"mdi:close",className:"text-[#555555] w-6 h-6 cursor-pointer",onClick:()=>{c(!1),setTimeout(()=>e(ee(null)),je)}})})]}),n.jsxs("div",{className:"flex flex-row gap-2 items-center flex-wrap",children:[n.jsx("div",{className:"flex flex-row items-center justify-center w-[120px] h-[120px] my-5",children:n.jsx("img",{src:(_=(v=(y=(i=r.imageGroups)==null?void 0:i[0])==null?void 0:y.images)==null?void 0:v[0])==null?void 0:_.link,alt:r.name,className:"rounded-[10px]"})}),n.jsx("div",{className:"flex flex-col items-center gap-2",children:r.imageGroups.slice(1,2).map(O=>O.images.slice(1,2).map(P=>n.jsx("img",{src:P.link,alt:r.name,className:"rounded-[10px] w-[60px] h-[60px]"},P.link)))})]}),n.jsxs("div",{className:"flex flex-row items-center justify-between w-full",children:[n.jsxs("div",{className:"flex flex-row items-center gap-2",children:[n.jsxs("p",{className:"text-[#14121F] font-bold font-nunitoSans",children:[" ","$",r.price.toFixed(2)]})," ",n.jsxs("p",{className:"text-[#14121F] font-normal line-through text-sm font-nunitoSans",children:[" ","$",(r.price+5).toFixed(2)]})]}),n.jsx("div",{children:n.jsx("p",{className:"text-[#EC5050] font-bold font-nunitoSans",children:r.discount})})]}),n.jsx("div",{className:"mt-2 w-full border-t-2 border-gray-200"}),n.jsxs("div",{className:"w-full text-left",children:[n.jsx("div",{className:"text-[#323135] font-bold font-nunitoSans mt-3 text-[14px]",children:"Product Details"}),n.jsx("div",{className:"text-[#68656E] font-normal font-nunitoSans text-xs pl-2 mt-3",dangerouslySetInnerHTML:{__html:r.short_description||r.longDescription}})]}),n.jsxs("div",{className:"mt-4 flex flex-col gap-2 w-full p-2",children:[n.jsx("div",{className:"flex flex-row items-center gap-2",children:n.jsxs("div",{className:"flex items-center gap-2 text-left font-nunitoSans",children:[n.jsxs("div",{className:"text-[#323135] font-bold",children:[((j=r==null?void 0:r.rating)==null?void 0:j.rate)||0," /"," ",n.jsx("span",{className:"text-[#68656E]",children:"5"})]}),n.jsx("div",{className:"text-[#323135] font-semibold text-sm",children:"Overall Rating"}),n.jsxs("div",{className:"text-[#68656E] font-semibold text-sm",children:[((T=r==null?void 0:r.rating)==null?void 0:T.count)||0," ratings"]})]})}),n.jsx("div",{className:"mt-2 flex flex-row items-center gap-2",children:Array.from({length:5}).map((O,P)=>{var q;return n.jsx(ge.Icon,{icon:"mdi:star",width:"20",height:"20",className:`text-yellow-500
6
- ${((q=r==null?void 0:r.rating)==null?void 0:q.rate)>P?"text-yellow-500":"text-gray-300"}
7
- `},P)})})]}),n.jsxs("div",{className:"flex flex-col items-center justify-between font-nunitoSans font-semibold w-5/6 text-black gap-2",style:{marginTop:"150px"},children:[n.jsx("button",{className:"rounded-[5px] shadow-sm text-[#FBFBFC] bg-[#6851C6] p-2 w-full text-center cursor-pointer",style:{backgroundColor:o.tanyaThemeColor},onClick:l,children:"Add to Cart"}),n.jsx("button",{className:"rounded-[5px] shadow-sm text-[#FBFBFC] bg-[#6851C6] p-2 w-full text-center cursor-pointer mb-16",style:{backgroundColor:o.tanyaThemeColor},onClick:d,children:"View more"})]})]})]})},_r=({tanyaConfig:t,basketId:e,addToCart:r})=>{const o=["Myself","My Child","My Grandchild","Niece/Nephew","My Friends","Others"],a={Myself:"himself/herself","My Child":"his/her child","My Grandchild":"his/her grandchild","Niece/Nephew":"his/her niece/nephew","My Friends":"his/her friends",Others:"others"},c=g.useRef(null),l=g.useRef(null),d=g.useRef(null),i=g.useRef(null),[y,v]=g.useState(null),_=g.useRef(null),[j,T]=g.useState(!1),[O,P]=g.useState(!1),[q,kt]=g.useState(!1),[lt,B]=g.useState(!1),[ct,St]=g.useState(!1),[Pt,Z]=g.useState(!1),[jt,_t]=g.useState(""),[dt,Ot]=g.useState(""),$t=s=>({id:s.id,title:s.name,image:s.image??"",price:s.price??0}),[Y,x]=g.useState([]),tt=g.useRef(null),k=nt.useSelector(s=>s.store.store),Kt=nt.useSelector(s=>s.product.product);g.useEffect(()=>{const s=localStorage.getItem(`access_token_${t.siteId}`),h=localStorage.getItem(`chat-token-${t.siteId}`);if(s&&h===s){const p=localStorage.getItem("chatHistory");p&&x(JSON.parse(p))}else localStorage.setItem("chatHistory",JSON.stringify([])),localStorage.setItem(`chat-token-${t.siteId}`,s||"")},[]),g.useEffect(()=>{localStorage.setItem("chatHistory",JSON.stringify(Y));const s=localStorage.getItem(`access_token_${t.siteId}`);s&&localStorage.setItem(`chat-token-${t.siteId}`,s)},[Y]);const zt=()=>{kt(!0),setTimeout(()=>P(!0),10)},At=()=>{P(!1),setTimeout(()=>kt(!1),300)};g.useEffect(()=>{j?zt():At()},[j]);const U=s=>{Ot(a[s])};g.useEffect(()=>{tt.current&&(tt.current.scrollTop+=150)},[Y]);let et=null,ut=null;const S=async()=>{if(et&&ut&&Date.now()<ut)return et;try{const s="https://us-east-1lsr29ln3u.auth.us-east-1.amazoncognito.com/oauth2/token",h=new URLSearchParams({grant_type:"client_credentials",client_id:"4i8rd70sgt961tc4dhskgf08c",client_secret:"bnsfq1220loh2cn2cm2ttn8fdhdpt0u8m1fgj8vfk2rn61aurjg",scope:"default-m2m-resource-server-8xzfzo/read"}),p=await fetch(s,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:h});if(!p.ok)throw new Error(`Token request failed! status: ${p.status}`);const w=await p.json();et=w.access_token;const u=w.expires_in||3600;return ut=Date.now()+(u-60)*1e3,et}catch(s){return console.error("Error obtaining JWT token:",s),et=null,ut=null,null}},K=async()=>{const s=await Tt();s!=null&&v(s)};g.useEffect(()=>{if(t!=null&&t.siteId){const{clientID:s,host:h,organizationID:p,shortCode:w,siteId:u}=t;sessionStorage.setItem("Host",h),sessionStorage.setItem("SiteId",u),sessionStorage.setItem("pubCfg",btoa(s)),sessionStorage.setItem("envRef",w),sessionStorage.setItem("orgRef",p)}K(),console.log("scapi environment v1")},[]),g.useEffect(()=>{e&&(console.log("setting the basket id",e),ot(e))},[e]);const Ct=async()=>{const s=JSON.parse(sessionStorage.getItem("customerData")||"{}").customerId;return(await gr(s||"")).c_interests},J=async(s,h)=>{console.log("in secondary flow",It);const p=await Ct();if(console.log(p,"interests of customer",It),!!p)try{x(D=>D.map((M,R)=>R===D.length-1?{...M,secondaryLoading:!0}:M));const w=await S();if(!w)throw new Error("Failed to fetch token");const u=localStorage.getItem("customerNumber"),m=localStorage.getItem("isLoggedIn"),ft=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(m||!1),userId:String(u||new Date().getTime())}).toString()}`,pt=JSON.stringify({flowId:"Q166PR519W",flowAliasId:"HKFUVLWVH2",input:{loyaltyPoints:"",productName:s,productPoints:String(h||0),interests:p}}),z=await fetch(ft,{signal:AbortSignal.timeout(3e4),method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${w}`},body:pt});if(!z.body)throw new Error("Readable stream not supported");const ht=z.body.getReader(),mt=new TextDecoder;let A="";for(;;){const{done:D,value:M}=await ht.read();if(D)break;A+=mt.decode(M,{stream:!0});const R=A.split(`
8
- `);A=R.pop()||"";for(const W of R)if(W.startsWith("data:")){const f=W.slice(5).trim();try{const H=JSON.parse(f);H.index===0&&x(C=>C.map((E,G)=>G===C.length-1?{...E,secondaryResponse:H.data,secondaryLoading:!1}:E))}catch(H){x(C=>C.map((E,G)=>G===C.length-1?{...E,secondaryLoading:!1}:E)),console.error("Secondary flow JSON parse error:",H)}}}}catch(w){console.error("Secondary flow error:",w)}},Jt=async s=>{const h=s||jt.trim();if(h){St(!0),_t(""),c.current=null,l.current=null,d.current=null,i.current=null,x(p=>[...p,{query:h,response:"Thinking for what suits you best...",potentialQuestions:"",products:[],keywords:"Thinking for best products..."}]);try{const p=dt,w=localStorage.getItem("customerNumber"),u=localStorage.getItem("isLoggedIn"),m=await S();if(!m)throw new Error("Failed to obtain access token");const ft=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(u||!1),userId:String(w||new Date().getTime())}).toString()}`,pt=JSON.stringify({flowId:"MMHQKYI1NE",flowAliasId:"SZF9ZK1ATE",input:{userPrompt:h,whom:p}}),z=await fetch(ft,{signal:AbortSignal.timeout(3e4),method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${m}`},body:pt});if(!z.ok)throw new Error(`HTTP error! status: ${z.status}`);if(!z.body)throw new Error("Readable stream not supported");const ht=z.body.getReader(),mt=new TextDecoder;let A="",D="";for(;;){Z(!0);const{done:M,value:R}=await ht.read();if(M)break;A+=mt.decode(R,{stream:!0});const W=A.split(`
9
- `);A=W.pop()||"";for(const f of W)if(f.startsWith("data:")){const H=f.slice(5).trim();try{const C=JSON.parse(H);C.index==1&&(D=C.data),x(E=>E.map((G,Dt)=>Dt===E.length-1?{...G,[C.index==0?"response":C.index==1?"keywords":C.index==2?"potentialQuestions":"end"]:C.data}:G))}catch(C){console.error("Error parsing JSON:",C)}}}tr(Ze(D))}catch(p){console.error("Error sending message to Tanya:",p)}finally{St(!1)}}},Ze=s=>{const h=s.match(/top five relevant product or category names are: (.*)/i),u=(h?h[1]:s).split(", ").map($=>$.replace(/\s*(Toys|Bags|Miniature|etc\.*)\s*/gi,"").trim());return[...new Set(u)].filter(Boolean).join(",")},tr=async s=>{if(typeof s=="string"){console.log(s,"keywords");const h=s.split(",");for(const p of h){const w=await xe(p);if(Z(!1),(w==null?void 0:w.length)>0&&(x(u=>u.map((m,$)=>$===u.length-1?{...m,products:[...m.products||[],{keyword:p,items:w,loading:!1}]}:m)),!c.current||l.current==null)){const u=w[0];c.current=String((u==null?void 0:u.product_name)??""),d.current=u.image.link,l.current=u.product_id;const m=typeof(u==null?void 0:u.price)=="number"?u.price:void 0;i.current=typeof m=="number"&&Number.isFinite(m)?m:null}}}else for(const h of s){const p=await xe(h);Z(!1),(p==null?void 0:p.length)>0&&x(w=>w.map((u,m)=>m===w.length-1?{...u,products:[...u.products||[],{keyword:h,items:p,loading:!1}]}:u))}if(c.current){x(p=>p.map((w,u)=>u===p.length-1?{...w,productSnapshot:{id:l.current,name:c.current,image:d.current,price:i.current??null,points:0,quantity:1}}:w));const h=JSON.parse(sessionStorage.getItem("customerData")||"{}");(h==null?void 0:h.isGuest)==!1?(console.log("running secondary flow",It),J(c.current,0)):console.log("not running secondary flow",It)}Z(!1)},er=async(s,h)=>{var p,w,u,m,$,ft,pt,z,ht,mt,A,D,M,R,W;B(!0);try{const f=await Ue(s.id);if(!((w=(p=f==null?void 0:f.variants)==null?void 0:p[0])!=null&&w.product_id||(m=(u=f==null?void 0:f.variants)==null?void 0:u[0])!=null&&m.productId)&&!(f.type.item||f.type.bundle)){B(!1),L.toast.error("Variants not found",{position:"bottom-right",autoClose:1e3}),console.error("No product variant found");return}const H=[{product_id:(($=f.variants)==null?void 0:$[0].product_id)||((ft=f.variants)==null?void 0:ft[0].productId)||(f==null?void 0:f.id),quantity:h}];console.log(H,"product data","app version",It);const C=JSON.parse(sessionStorage.getItem("customerData")||"{}"),E=(C==null?void 0:C.basketId)||localStorage.getItem(Ht),G=!1,Dt=localStorage.getItem(Et),me=Date.now();if(!G||!Dt||me>=parseInt(Dt)){const rr=await qe();let{customer_token:wt}=await Be(rr);if(wt="Bearer "+y.access_token,!wt){console.error("Failed to get customer_token");return}const or=me+300*1e3;if(Vt(wt),localStorage.setItem(Et,or.toString()),console.log(E,"basketIdFromCustomer"),E){const we=await Re({basketId:E,customer_token:wt});if(we.status===200&&we){const Wt=await re(E,H,wt);((pt=Wt==null?void 0:Wt.product_items)==null?void 0:pt.length)>0&&(L.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Rt(E),B(!1));return}}const nr={productItems:[{productId:((z=f.variants)==null?void 0:z[0].product_id)||((ht=f.variants)==null?void 0:ht[0].productId)||(f==null?void 0:f.id),quantity:1}]},b=await Me(wt,nr);if(console.log(b,b==null?void 0:b.basket_id,b==null?void 0:b.basketId,"the basket response"),!(b!=null&&b.basket_id||!(b!=null&&b.basketId))){B(!1),console.error("Failed to create basket");return}ot((b==null?void 0:b.basket_id)||(b==null?void 0:b.basketId));const gt=await r({productId:l,quantity:h},(b==null?void 0:b.basket_id)||(b==null?void 0:b.basketId));(((mt=gt==null?void 0:gt.product_items)==null?void 0:mt.length)>0||((A=gt==null?void 0:gt.productItems)==null?void 0:A.length)>0)&&L.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Rt(b.basket_id||(b==null?void 0:b.basketId))}}catch(f){B(!1),console.error("Error adding to cart:",f),L.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}),((D=f==null?void 0:f.response)==null?void 0:D.status)===404||((M=f==null?void 0:f.response)==null?void 0:M.status)===401?(((R=f==null?void 0:f.response)==null?void 0:R.status)===404&&ot(null),((W=f==null?void 0:f.response)==null?void 0:W.status)===401&&(ot(null),Vt(null))):(console.error("Failed to add product to basket:",f.message),L.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}))}B(!1)};return g.useEffect(()=>{_.current&&_.current.scrollIntoView({behavior:"smooth"})},[_.current]),g.useEffect(()=>{q?setTimeout(()=>P(!0),10):P(!1)},[q]),n.jsx("div",{className:"relative flex justify-center",children:n.jsxs(mr,{open:j,onOpenChange:T,children:[n.jsx(wr,{onClick:()=>T(!0),style:{},className:"flex items-center rounded-lg cursor-pointer hover:opacity-90 transition-opacity p-0",children:n.jsx("div",{className:"flex flex-col",children:n.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsxs("g",{clipPath:"url(#clip0_958_585)",children:[n.jsx("path",{d:"M30.0002 5C31.7683 5 33.464 5.70238 34.7142 6.95262C35.9644 8.20286 36.6668 9.89856 36.6668 11.6667V25C36.6668 26.7681 35.9644 28.4638 34.7142 29.714C33.464 30.9643 31.7683 31.6667 30.0002 31.6667H25.6902L21.1785 36.1783C20.8915 36.4653 20.5097 36.6377 20.1046 36.6631C19.6996 36.6886 19.2992 36.5654 18.9785 36.3167L18.8218 36.1783L14.3085 31.6667H10.0002C8.28976 31.6667 6.64478 31.0093 5.40548 29.8305C4.16617 28.6516 3.42735 27.0416 3.34183 25.3333L3.3335 25V11.6667C3.3335 9.89856 4.03588 8.20286 5.28612 6.95262C6.53636 5.70238 8.23205 5 10.0002 5H30.0002Z",fill:"url(#paint0_linear_958_585)"}),n.jsx("path",{d:"M28.3335 15.6511V11.6667C28.3335 11.6667 22.2774 12.6042 20.1148 15.4167C17.9521 18.2292 18.6644 26.6667 18.6644 26.6667H22.5321C22.5321 26.6667 22.0614 18.9323 23.4989 17.2917C24.9364 15.6511 28.3335 15.6511 28.3335 15.6511Z",fill:"white"}),n.jsx("path",{d:"M13.3335 11.6667H19.6184V15.4167H13.3335V11.6667Z",fill:"white"})]}),n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"paint0_linear_958_585",x1:"20.0002",y1:"5",x2:"35.0002",y2:"30",gradientUnits:"userSpaceOnUse",children:[n.jsx("stop",{stopColor:"#452697"}),n.jsx("stop",{offset:"1",stopColor:"#7C5BFF"})]}),n.jsx("clipPath",{id:"clip0_958_585",children:n.jsx("rect",{width:"40",height:"40",fill:"white"})})]})]})})}),q&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:()=>T(!1)}),n.jsxs("div",{className:`
5
+ `,style:{willChange:"transform, opacity"},onClick:F=>F.stopPropagation(),children:[n.jsxs("div",{className:"mt-3 flex flex-row justify-between w-full ",children:[n.jsx("div",{children:n.jsx("p",{className:"text-[#000000] font-bold font-nunitoSans",children:r.name})}),n.jsx("div",{children:n.jsx(we.Icon,{icon:"mdi:close",className:"text-[#555555] w-6 h-6 cursor-pointer",onClick:()=>{c(!1),setTimeout(()=>e(te(null)),Se)}})})]}),n.jsxs("div",{className:"flex flex-row gap-2 items-center flex-wrap",children:[n.jsx("div",{className:"flex flex-row items-center justify-center w-[120px] h-[120px] my-5",children:n.jsx("img",{src:(_=(y=(b=(i=r.imageGroups)==null?void 0:i[0])==null?void 0:b.images)==null?void 0:y[0])==null?void 0:_.link,alt:r.name,className:"rounded-[10px]"})}),n.jsx("div",{className:"flex flex-col items-center gap-2",children:r.imageGroups.slice(1,2).map(F=>F.images.slice(1,2).map($=>n.jsx("img",{src:$.link,alt:r.name,className:"rounded-[10px] w-[60px] h-[60px]"},$.link)))})]}),n.jsxs("div",{className:"flex flex-row items-center justify-between w-full",children:[n.jsxs("div",{className:"flex flex-row items-center gap-2",children:[n.jsxs("p",{className:"text-[#14121F] font-bold font-nunitoSans",children:[" ","$",r.price.toFixed(2)]})," ",n.jsxs("p",{className:"text-[#14121F] font-normal line-through text-sm font-nunitoSans",children:[" ","$",(r.price+5).toFixed(2)]})]}),n.jsx("div",{children:n.jsx("p",{className:"text-[#EC5050] font-bold font-nunitoSans",children:r.discount})})]}),n.jsx("div",{className:"mt-2 w-full border-t-2 border-gray-200"}),n.jsxs("div",{className:"w-full text-left",children:[n.jsx("div",{className:"text-[#323135] font-bold font-nunitoSans mt-3 text-[14px]",children:"Product Details"}),n.jsx("div",{className:"text-[#68656E] font-normal font-nunitoSans text-xs pl-2 mt-3",dangerouslySetInnerHTML:{__html:r.short_description||r.longDescription}})]}),n.jsxs("div",{className:"mt-4 flex flex-col gap-2 w-full p-2",children:[n.jsx("div",{className:"flex flex-row items-center gap-2",children:n.jsxs("div",{className:"flex items-center gap-2 text-left font-nunitoSans",children:[n.jsxs("div",{className:"text-[#323135] font-bold",children:[((S=r==null?void 0:r.rating)==null?void 0:S.rate)||0," /"," ",n.jsx("span",{className:"text-[#68656E]",children:"5"})]}),n.jsx("div",{className:"text-[#323135] font-semibold text-sm",children:"Overall Rating"}),n.jsxs("div",{className:"text-[#68656E] font-semibold text-sm",children:[((U=r==null?void 0:r.rating)==null?void 0:U.count)||0," ratings"]})]})}),n.jsx("div",{className:"mt-2 flex flex-row items-center gap-2",children:Array.from({length:5}).map((F,$)=>{var K;return n.jsx(we.Icon,{icon:"mdi:star",width:"20",height:"20",className:`text-yellow-500
6
+ ${((K=r==null?void 0:r.rating)==null?void 0:K.rate)>$?"text-yellow-500":"text-gray-300"}
7
+ `},$)})})]}),n.jsxs("div",{className:"flex flex-col items-center justify-between font-nunitoSans font-semibold w-5/6 text-black gap-2",style:{marginTop:"150px"},children:[n.jsx("button",{className:"rounded-[5px] shadow-sm text-[#FBFBFC] bg-[#6851C6] p-2 w-full text-center cursor-pointer",style:{backgroundColor:o.tanyaThemeColor},onClick:l,children:"Add to Cart"}),n.jsx("button",{className:"rounded-[5px] shadow-sm text-[#FBFBFC] bg-[#6851C6] p-2 w-full text-center cursor-pointer mb-16",style:{backgroundColor:o.tanyaThemeColor},onClick:d,children:"View more"})]})]})]})},jr=({tanyaConfig:t,basketId:e,addToCart:r})=>{const o=["Myself","My Child","My Grandchild","Niece/Nephew","My Friends","Others"],a={Myself:"himself/herself","My Child":"his/her child","My Grandchild":"his/her grandchild","Niece/Nephew":"his/her niece/nephew","My Friends":"his/her friends",Others:"others"},c=x.useRef(null),l=x.useRef(null),d=x.useRef(null),i=x.useRef(null),[b,y]=x.useState(null);x.useRef(null);const[_,S]=x.useState(!1),[U,F]=x.useState(!1),[$,K]=x.useState(!1),[it,M]=x.useState(!1),[lt,kt]=x.useState(!1),[Tt,Z]=x.useState(!1),[St,jt]=x.useState(""),[ct,Pt]=x.useState(""),Ot=s=>({id:s.id,title:s.name,image:s.image??"",price:s.price??0}),[tt,T]=x.useState([]),j=x.useRef(null),v=ot.useSelector(s=>s.store.store),dt=ot.useSelector(s=>s.product.product);x.useEffect(()=>{const s=localStorage.getItem(`access_token_${t.siteId}`),m=localStorage.getItem(`chat-token-${t.siteId}`);if(s&&m===s){const p=localStorage.getItem("chatHistory");p&&T(JSON.parse(p))}else localStorage.setItem("chatHistory",JSON.stringify([])),localStorage.setItem(`chat-token-${t.siteId}`,s||"")},[]),x.useEffect(()=>{localStorage.setItem("chatHistory",JSON.stringify(tt));const s=localStorage.getItem(`access_token_${t.siteId}`);s&&localStorage.setItem(`chat-token-${t.siteId}`,s)},[tt]);const Kt=()=>{K(!0),setTimeout(()=>F(!0),10)},$t=()=>{F(!1),setTimeout(()=>K(!1),300)};x.useEffect(()=>{_?Kt():$t()},[_]);const zt=s=>{Pt(a[s])};x.useEffect(()=>{j.current&&(j.current.scrollTop+=150)},[tt]);let O=null,ut=null;const At=async()=>{if(O&&ut&&Date.now()<ut)return O;try{const s="https://us-east-1lsr29ln3u.auth.us-east-1.amazoncognito.com/oauth2/token",m=new URLSearchParams({grant_type:"client_credentials",client_id:"4i8rd70sgt961tc4dhskgf08c",client_secret:"bnsfq1220loh2cn2cm2ttn8fdhdpt0u8m1fgj8vfk2rn61aurjg",scope:"default-m2m-resource-server-8xzfzo/read"}),p=await fetch(s,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:m});if(!p.ok)throw new Error(`Token request failed! status: ${p.status}`);const w=await p.json();O=w.access_token;const u=w.expires_in||3600;return ut=Date.now()+(u-60)*1e3,O}catch(s){return console.error("Error obtaining JWT token:",s),O=null,ut=null,null}},k=async()=>{const s=await Et();s!=null&&y(s)};x.useEffect(()=>{if(t!=null&&t.siteId){const{clientID:s,host:m,organizationID:p,shortCode:w,siteId:u}=t;sessionStorage.setItem("Host",m),sessionStorage.setItem("SiteId",u),sessionStorage.setItem("pubCfg",btoa(s)),sessionStorage.setItem("envRef",w),sessionStorage.setItem("orgRef",p)}k(),console.log("scapi environment v1")},[]),x.useEffect(()=>{e&&(console.log("setting the basket id",e),rt(e))},[e]);const J=async()=>{const s=JSON.parse(sessionStorage.getItem("customerData")||"{}").customerId;return(await wr(s||"")).c_interests},_t=async(s,m)=>{console.log("in secondary flow",Ct);const p=await J();if(console.log(p,"interests of customer",Ct),!!p)try{T(q=>q.map((R,H)=>H===q.length-1?{...R,secondaryLoading:!0}:R));const w=await At();if(!w)throw new Error("Failed to fetch token");const u=localStorage.getItem("customerNumber"),h=localStorage.getItem("isLoggedIn"),ft=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(h||!1),userId:String(u||new Date().getTime())}).toString()}`,pt=JSON.stringify({flowId:"Q166PR519W",flowAliasId:"HKFUVLWVH2",input:{loyaltyPoints:"",productName:s,productPoints:String(m||0),interests:p}}),D=await fetch(ft,{signal:AbortSignal.timeout(3e4),method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${w}`},body:pt});if(!D.body)throw new Error("Readable stream not supported");const ht=D.body.getReader(),mt=new TextDecoder;let L="";for(;;){const{done:q,value:R}=await ht.read();if(q)break;L+=mt.decode(R,{stream:!0});const H=L.split(`
8
+ `);L=H.pop()||"";for(const W of H)if(W.startsWith("data:")){const f=W.slice(5).trim();try{const V=JSON.parse(f);V.index===0&&T(C=>C.map((P,G)=>G===C.length-1?{...P,secondaryResponse:V.data,secondaryLoading:!1}:P))}catch(V){T(C=>C.map((P,G)=>G===C.length-1?{...P,secondaryLoading:!1}:P)),console.error("Secondary flow JSON parse error:",V)}}}}catch(w){console.error("Secondary flow error:",w)}},A=async s=>{const m=s||St.trim();if(m){kt(!0),jt(""),c.current=null,l.current=null,d.current=null,i.current=null,T(p=>[...p,{query:m,response:"Thinking for what suits you best...",potentialQuestions:"",products:[],keywords:"Thinking for best products..."}]);try{const p=ct,w=localStorage.getItem("customerNumber"),u=localStorage.getItem("isLoggedIn"),h=await At();if(!h)throw new Error("Failed to obtain access token");const ft=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(u||!1),userId:String(w||new Date().getTime())}).toString()}`,pt=JSON.stringify({flowId:"MMHQKYI1NE",flowAliasId:"SZF9ZK1ATE",input:{userPrompt:m,whom:p}}),D=await fetch(ft,{signal:AbortSignal.timeout(3e4),method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${h}`},body:pt});if(!D.ok)throw new Error(`HTTP error! status: ${D.status}`);if(!D.body)throw new Error("Readable stream not supported");const ht=D.body.getReader(),mt=new TextDecoder;let L="",q="";for(;;){Z(!0);const{done:R,value:H}=await ht.read();if(R)break;L+=mt.decode(H,{stream:!0});const W=L.split(`
9
+ `);L=W.pop()||"";for(const f of W)if(f.startsWith("data:")){const V=f.slice(5).trim();try{const C=JSON.parse(V);C.index==1&&(q=C.data),T(P=>P.map((G,Dt)=>Dt===P.length-1?{...G,[C.index==0?"response":C.index==1?"keywords":C.index==2?"potentialQuestions":"end"]:C.data}:G))}catch(C){console.error("Error parsing JSON:",C)}}}Ze(Qe(q))}catch(p){console.error("Error sending message to Tanya:",p)}finally{kt(!1)}}},Qe=s=>{const m=s.match(/top five relevant product or category names are: (.*)/i),u=(m?m[1]:s).split(", ").map(z=>z.replace(/\s*(Toys|Bags|Miniature|etc\.*)\s*/gi,"").trim());return[...new Set(u)].filter(Boolean).join(",")},Ze=async s=>{if(typeof s=="string"){console.log(s,"keywords");const m=s.split(",");for(const p of m){const w=await ge(p);if(Z(!1),(w==null?void 0:w.length)>0&&(T(u=>u.map((h,z)=>z===u.length-1?{...h,products:[...h.products||[],{keyword:p,items:w,loading:!1}]}:h)),!c.current||l.current==null)){const u=w[0];c.current=String((u==null?void 0:u.product_name)??""),d.current=u.image.link,l.current=u.product_id;const h=typeof(u==null?void 0:u.price)=="number"?u.price:void 0;i.current=typeof h=="number"&&Number.isFinite(h)?h:null}}}else for(const m of s){const p=await ge(m);Z(!1),(p==null?void 0:p.length)>0&&T(w=>w.map((u,h)=>h===w.length-1?{...u,products:[...u.products||[],{keyword:m,items:p,loading:!1}]}:u))}if(c.current){T(p=>p.map((w,u)=>u===p.length-1?{...w,productSnapshot:{id:l.current,name:c.current,image:d.current,price:i.current??null,points:0,quantity:1}}:w));const m=JSON.parse(sessionStorage.getItem("customerData")||"{}");(m==null?void 0:m.isGuest)==!1?(console.log("running secondary flow",Ct),_t(c.current,0)):console.log("not running secondary flow",Ct)}Z(!1)},tr=async(s,m)=>{var p,w,u,h,z,ft,pt,D,ht,mt,L,q,R,H,W;M(!0);try{const f=await Be(s.id);if(!((w=(p=f==null?void 0:f.variants)==null?void 0:p[0])!=null&&w.product_id||(h=(u=f==null?void 0:f.variants)==null?void 0:u[0])!=null&&h.productId)&&!(f.type.item||f.type.bundle)){M(!1),B.toast.error("Variants not found",{position:"bottom-right",autoClose:1e3}),console.error("No product variant found");return}const V=[{product_id:((z=f.variants)==null?void 0:z[0].product_id)||((ft=f.variants)==null?void 0:ft[0].productId)||(f==null?void 0:f.id),quantity:m}];console.log(V,"product data","app version",Ct);const C=JSON.parse(sessionStorage.getItem("customerData")||"{}"),P=(C==null?void 0:C.basketId)||localStorage.getItem(Ht),G=!1,Dt=localStorage.getItem(Nt),he=Date.now();if(!G||!Dt||he>=parseInt(Dt)){const er=await Le();let{customer_token:wt}=await qe(er);if(wt="Bearer "+b.access_token,!wt){console.error("Failed to get customer_token");return}const rr=he+300*1e3;if(Vt(wt),localStorage.setItem(Nt,rr.toString()),console.log(P,"basketIdFromCustomer"),P){const me=await Me({basketId:P,customer_token:wt});if(me.status===200&&me){const Jt=await ee(P,V,wt);((pt=Jt==null?void 0:Jt.product_items)==null?void 0:pt.length)>0&&(B.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Rt(P),M(!1));return}}const or={productItems:[{productId:((D=f.variants)==null?void 0:D[0].product_id)||((ht=f.variants)==null?void 0:ht[0].productId)||(f==null?void 0:f.id),quantity:1}]},g=await Ue(wt,or);if(console.log(g,g==null?void 0:g.basket_id,g==null?void 0:g.basketId,"the basket response"),!(g!=null&&g.basket_id||!(g!=null&&g.basketId))){M(!1),console.error("Failed to create basket");return}rt((g==null?void 0:g.basket_id)||(g==null?void 0:g.basketId));const gt=await r({productId:l,quantity:m},(g==null?void 0:g.basket_id)||(g==null?void 0:g.basketId));(((mt=gt==null?void 0:gt.product_items)==null?void 0:mt.length)>0||((L=gt==null?void 0:gt.productItems)==null?void 0:L.length)>0)&&B.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Rt(g.basket_id||(g==null?void 0:g.basketId))}}catch(f){M(!1),console.error("Error adding to cart:",f),B.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}),((q=f==null?void 0:f.response)==null?void 0:q.status)===404||((R=f==null?void 0:f.response)==null?void 0:R.status)===401?(((H=f==null?void 0:f.response)==null?void 0:H.status)===404&&rt(null),((W=f==null?void 0:f.response)==null?void 0:W.status)===401&&(rt(null),Vt(null))):(console.error("Failed to add product to basket:",f.message),B.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}))}M(!1)};return x.useEffect(()=>{$?setTimeout(()=>F(!0),10):F(!1)},[$]),n.jsx("div",{className:"relative flex justify-center",children:n.jsxs(hr,{open:_,onOpenChange:S,children:[n.jsx(mr,{onClick:()=>S(!0),style:{},className:"flex items-center rounded-lg cursor-pointer hover:opacity-90 transition-opacity p-0",children:n.jsx("div",{className:"flex flex-col",children:n.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsxs("g",{clipPath:"url(#clip0_958_585)",children:[n.jsx("path",{d:"M30.0002 5C31.7683 5 33.464 5.70238 34.7142 6.95262C35.9644 8.20286 36.6668 9.89856 36.6668 11.6667V25C36.6668 26.7681 35.9644 28.4638 34.7142 29.714C33.464 30.9643 31.7683 31.6667 30.0002 31.6667H25.6902L21.1785 36.1783C20.8915 36.4653 20.5097 36.6377 20.1046 36.6631C19.6996 36.6886 19.2992 36.5654 18.9785 36.3167L18.8218 36.1783L14.3085 31.6667H10.0002C8.28976 31.6667 6.64478 31.0093 5.40548 29.8305C4.16617 28.6516 3.42735 27.0416 3.34183 25.3333L3.3335 25V11.6667C3.3335 9.89856 4.03588 8.20286 5.28612 6.95262C6.53636 5.70238 8.23205 5 10.0002 5H30.0002Z",fill:"url(#paint0_linear_958_585)"}),n.jsx("path",{d:"M28.3335 15.6511V11.6667C28.3335 11.6667 22.2774 12.6042 20.1148 15.4167C17.9521 18.2292 18.6644 26.6667 18.6644 26.6667H22.5321C22.5321 26.6667 22.0614 18.9323 23.4989 17.2917C24.9364 15.6511 28.3335 15.6511 28.3335 15.6511Z",fill:"white"}),n.jsx("path",{d:"M13.3335 11.6667H19.6184V15.4167H13.3335V11.6667Z",fill:"white"})]}),n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"paint0_linear_958_585",x1:"20.0002",y1:"5",x2:"35.0002",y2:"30",gradientUnits:"userSpaceOnUse",children:[n.jsx("stop",{stopColor:"#452697"}),n.jsx("stop",{offset:"1",stopColor:"#7C5BFF"})]}),n.jsx("clipPath",{id:"clip0_958_585",children:n.jsx("rect",{width:"40",height:"40",fill:"white"})})]})]})})}),$&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:()=>S(!1)}),n.jsxs("div",{className:`
10
10
  fixed z-50 h-screen w-[100vw] sm:w-[80vw] md:w-[770px] border-0 bg-white lg:rounded-l-xl overflow-hidden flex flex-col shadow-[0px_4px_10px_0px_#5F499840]
11
11
  top-0 right-0
12
12
  transition-transform duration-300 ease-in-out
13
13
  lg:transform lg:translate-y-0
14
14
 
15
- `,style:{background:"linear-gradient(170.1deg, #FFFFFF 60.03%, #E3DEEF 99.59%)"},children:[n.jsxs("div",{className:"flex justify-between p-3 bg-[#FFFFFF] border border-b-1 border-[#E5E5E5] ",children:[n.jsx("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsxs("div",{className:"flex gap-2 w-28 h-12 text-center items-center p-2 border rounded-l-[20px] rounded-tr-[20px]",style:{background:"linear-gradient(265.62deg, #6851C6 5.24%, #8668FF 98.49%)"},children:[n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 15 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("path",{d:"M15 4.48438V0.5C15 0.5 8.94395 1.4375 6.78127 4.25C4.61859 7.0625 5.33095 15.5 5.33095 15.5H9.19857C9.19857 15.5 8.72793 7.76562 10.1654 6.125C11.6029 4.48438 15 4.48438 15 4.48438Z",fill:"white"}),n.jsx("path",{d:"M0 0.5H6.28488V4.25H0V0.5Z",fill:"white"})]}),n.jsx("p",{className:"text-[#FFFFFF] font-nunitoSans font-semibold",children:"TANYA"})]}),n.jsxs("p",{className:"text-[#5B5B5B] font-nunitoSans font-semibold",style:{fontStyle:"italic"},children:[" ","Your AI shopping assistant !"," "]})]})}),n.jsx("div",{style:{display:"flex",alignItems:"center",gap:"1.25rem",margin:"0.75rem"},children:n.jsx("button",{onClick:()=>T(!1),children:n.jsxs("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsxs("g",{clipPath:"url(#clip0_501_6036)",children:[n.jsx("path",{d:"M18 6.5L6 18.5",stroke:"#555555",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M6 6.5L18 18.5",stroke:"#555555",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),n.jsx("defs",{children:n.jsx("clipPath",{id:"clip0_501_6036",children:n.jsx("rect",{width:"24",height:"24",fill:"white",transform:"translate(0 0.5)"})})})]})})})]}),n.jsxs("div",{className:"flex h-full md:flex-row lg:flex-row",children:[n.jsxs("div",{className:`flex flex-col h-full ${Kt?"lg:w-2/3 w-full":"w-full"}`,children:[n.jsxs("div",{ref:tt,className:"overflow-y-auto pr-5 pb-2 space-y-4 hide-scrollbar flex-grow mb-24",children:[(k==null?void 0:k.whomRequired)&&n.jsxs("div",{className:"mx-3 p-3 rounded-2xl bg-[#FFFFFF]",children:[n.jsx("div",{className:"flex gap-2 bg-[#FFFFFF]",children:n.jsx("p",{className:"font-bold font-nunitoSans text-[#494949]",children:"Is this for you or someone else?"})}),n.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:o.map(s=>n.jsx("button",{onClick:()=>U(s),className:"px-2 py-2 font-semibold text-xs text-[#18181B] bg-[#F3F3F3] rounded-2xl",style:{backgroundColor:dt===a[s]?"#FFFFFF":"#F3F3F3",borderColor:dt===a[s]?"#BBB3DD":""},children:s},s))})]}),Y.map((s,h)=>{var p,w;return n.jsxs("div",{children:[n.jsx("div",{className:"flex justify-end",ref:h==Y.length-1?_:null,children:n.jsx("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:s.query})}),s.response&&s.response.includes("Thinking")?n.jsx("div",{children:n.jsx("div",{className:"font-nunitoSans animate-pulse font-bold text-sm text-[#494949] bg-[#FFFFFF] px-7 py-1 rounded-r-xl rounded-bl-2xl w-full",dangerouslySetInnerHTML:{__html:Gt(s.response)}})}):n.jsx("div",{children:n.jsx("div",{className:"font-nunitoSans font-bold text-sm text-[#494949] bg-[#FFFFFF] px-7 py-1 rounded-r-xl rounded-bl-2xl w-full",dangerouslySetInnerHTML:{__html:Gt(s.response)}})}),Pt&&!s.response.includes("Thinking")&&((p=s.products)==null?void 0:p.length)==0&&n.jsx("div",{children:n.jsx("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"})}),(s==null?void 0:s.products)&&((w=s==null?void 0:s.products)==null?void 0:w.length)>0&&n.jsx(kr,{chat:s.products,storeDetails:k}),(s==null?void 0:s.potentialQuestions.length)>0&&n.jsxs("div",{className:"my-2 px-4 text-sm text-gray-700",children:[n.jsx("p",{className:"font-nunitoSans font-bold text-sm text-[#494949]",style:{color:k.themeDarkColor},children:"Why not explore these inquiries..."}),s.potentialQuestions.split(",").map((u,m)=>n.jsx("button",{className:`cursor-pointer font-nunitoSans font-semibold text-[#232323] border bg-[#804C9E0D] border-${k.themeDarkColor} m-1 rounded-xl px-2 py-1`,onClick:()=>Jt(u),style:{backgroundColor:k.tanyaThemeColorLight},children:u},m))]}),(s==null?void 0:s.secondaryLoading)&&n.jsx("div",{className:"mt-3 mb-4 px-4",children:n.jsxs("div",{className:"tanya-surprise-wrapper bg-indigo-300 text-sm px-7 py-4 rounded-r-xl rounded-bl-2xl w-full relative overflow-hidden",style:{margin:"0.75rem"},children:[n.jsxs("div",{className:"flex gap-1",children:[n.jsx("div",{className:"tanya-sparkle tanya-sparkle-1",children:"✨"}),n.jsx("div",{className:"tanya-sparkle tanya-sparkle-2",children:"✨"}),n.jsx("div",{className:"tanya-sparkle tanya-sparkle-3",children:"✨"})]}),n.jsx("div",{className:"tanya-shimmer"}),n.jsx("p",{className:"font-semibold tanya-pulse",style:{color:k.themeDarkColor},children:"I’ve found a special surprise crafted just for you… hang on a sec!"}),n.jsx("p",{className:"tanya-dots mt-1",style:{color:k.themeDarkColor},children:"• • •"})]})}),(s==null?void 0:s.secondaryResponse)&&n.jsx(n.Fragment,{children:n.jsxs("div",{className:"mt-3 mb-8 px-4 bg-indigo-300 rounded-tr-[5px]",children:[n.jsx("div",{className:"text-sm text-[#232323] bg-[#FFFFFF] px-7 py-4 rounded-br-xl rounded-bl-2xl w-full",style:{backgroundColor:k.tanyaThemeColorLight},dangerouslySetInnerHTML:{__html:Gt(s.secondaryResponse)}}),s.productSnapshot&&n.jsx("div",{className:"mt-4 w-full",children:n.jsxs("div",{className:"flex gap-4 items-stretch rounded-2xl p-4",style:{backgroundColor:k.tanyaThemeColorLight},children:[n.jsx("div",{className:"flex-shrink-0 rounded-xl overflow-hidden border",style:{width:112,height:112,borderColor:"#eee"},children:s.productSnapshot.image?n.jsx("img",{src:s.productSnapshot.image,alt:s.productSnapshot.name,className:"w-full h-full object-cover"}):n.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-gray-500",children:"No Image"})}),n.jsxs("div",{className:"flex flex-col flex-1 justify-between",children:[n.jsxs("div",{children:[n.jsx("p",{className:"font-semibold text-[15px] leading-snug",children:s.productSnapshot.name}),n.jsx("p",{className:"mt-1 text-[14px] font-medium",children:s.productSnapshot.price!=null?new Intl.NumberFormat(void 0,{style:"currency",currency:(k==null?void 0:k.currency)||"USD"}).format(s.productSnapshot.price):""}),s.productSnapshot.points>0&&n.jsxs("p",{className:"mt-1 text-xs opacity-80",children:["You will earn"," ",n.jsxs("strong",{children:[s.productSnapshot.points," ","points"]})]})]}),n.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[n.jsxs("div",{className:"flex items-center border rounded-full overflow-hidden",children:[n.jsx("button",{className:"px-3 py-1 text-sm",onClick:()=>x(u=>u.map((m,$)=>$===h&&m.productSnapshot?{...m,productSnapshot:{...m.productSnapshot,quantity:Math.max(1,m.productSnapshot.quantity-1)}}:m)),style:{background:"transparent",color:k.themeDarkColor},children:"−"}),n.jsx("div",{className:"px-3 py-1 text-sm select-none",children:s.productSnapshot.quantity}),n.jsx("button",{className:"px-3 py-1 text-sm",onClick:()=>x(u=>u.map((m,$)=>$===h&&m.productSnapshot?{...m,productSnapshot:{...m.productSnapshot,quantity:m.productSnapshot.quantity+1}}:m)),style:{background:"transparent",color:k.themeDarkColor},children:"+"})]}),n.jsx("button",{onClick:()=>{er($t(s.productSnapshot),s.productSnapshot.quantity)},disabled:lt,className:"px-4 py-2 rounded-full font-medium",style:{background:k.tanyaThemeColor,color:(k==null?void 0:k.tanyaThemeContrastColor)||"#fff",opacity:lt?.8:1},children:lt?"Adding...":"Add to cart"})]})]})]})})]})}),n.jsx("div",{className:"mb-20"})]},h)})]}),n.jsx("div",{className:"flex flex-col gap-2 sticky bottom-0 left-0 right-0 bg-[#E3DEEF] z-50 px-4 py-2",children:n.jsx("div",{className:"p-[1px] rounded-xl",style:{background:"linear-gradient(180deg, #B09FFF 0%, #8D79F6 100%)"},children:n.jsxs("div",{className:"flex items-center bg-[#FFFFFF] flex-1 rounded-xl px-2 py-1",children:[n.jsx("input",{className:"flex-1 bg-[#FFFFFF] text-[#232323] outline-none border-none px-2 py-2 text-sm",placeholder:"How can I help you...",value:jt,autoFocus:!0,onChange:s=>_t(s.target.value),onKeyDown:s=>{s.key==="Enter"&&!ct&&Jt()}}),n.jsx("button",{type:"submit",disabled:ct,className:"p-3",onClick:()=>Jt(),children:ct?n.jsx("div",{className:"p-3 animate-spin rounded-full h-3 w-3 border-b-2",style:{borderBottom:"2px solid",color:k.tanyaThemeColor}}):n.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:n.jsx("path",{d:"M16.6357 13.6701L18.3521 8.5208C19.8516 4.02242 20.6013 1.77322 19.414 0.585948C18.2268 -0.601312 15.9776 0.148418 11.4792 1.64788L6.32987 3.36432C2.69923 4.57453 0.883923 5.17964 0.368062 6.06698C-0.122688 6.91112 -0.122688 7.95369 0.368062 8.7978C0.883923 9.6852 2.69923 10.2903 6.32987 11.5005C6.77981 11.6505 7.28601 11.5434 7.62294 11.2096L13.1286 5.75495C13.4383 5.44808 13.9382 5.45041 14.245 5.76015C14.5519 6.06989 14.5496 6.56975 14.2398 6.87662L8.8231 12.2432C8.4518 12.6111 8.3342 13.1742 8.4995 13.6701C9.7097 17.3007 10.3148 19.1161 11.2022 19.6319C12.0463 20.1227 13.0889 20.1227 13.933 19.6319C14.8204 19.1161 15.4255 17.3008 16.6357 13.6701Z",fill:"#6952C7"})})})]})})})]}),n.jsx(jr,{addToCartPwa:r})]})]})]})]})})};var oe=function(t,e){return oe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(r[a]=o[a])},oe(t,e)};function Cr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");oe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var X=function(){return X=Object.assign||function(e){for(var r,o=1,a=arguments.length;o<a;o++){r=arguments[o];for(var c in r)Object.prototype.hasOwnProperty.call(r,c)&&(e[c]=r[c])}return e},X.apply(this,arguments)};function Ir(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,o=Object.getOwnPropertySymbols(t);a<o.length;a++)e.indexOf(o[a])<0&&Object.prototype.propertyIsEnumerable.call(t,o[a])&&(r[o[a]]=t[o[a]]);return r}var Xt="Invariant Violation",_e=Object.setPrototypeOf,Fr=_e===void 0?function(t,e){return t.__proto__=e,t}:_e,He=(function(t){Cr(e,t);function e(r){r===void 0&&(r=Xt);var o=t.call(this,typeof r=="number"?Xt+": "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return o.framesToPop=1,o.name=Xt,Fr(o,e.prototype),o}return e})(Error);function rt(t,e){if(!t)throw new He(e)}var Ve=["debug","log","warn","error","silent"],Nr=Ve.indexOf("log");function Lt(t){return function(){if(Ve.indexOf(t)>=Nr){var e=console[t]||console.log;return e.apply(console,arguments)}}}(function(t){t.debug=Lt("debug"),t.log=Lt("log"),t.warn=Lt("warn"),t.error=Lt("error")})(rt||(rt={}));var Ye="3.14.0";function xt(t){try{return t()}catch{}}const ne=xt(function(){return globalThis})||xt(function(){return window})||xt(function(){return self})||xt(function(){return global})||xt(function(){return xt.constructor("return this")()});var Ce=new Map;function Er(t){var e=Ce.get(t)||1;return Ce.set(t,e+1),"".concat(t,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function Tr(t,e){var r=Er("stringifyForDisplay");return JSON.stringify(t,function(o,a){return a===void 0?r:a},e).split(JSON.stringify(r)).join("<undefined>")}function qt(t){return function(e){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];if(typeof e=="number"){var a=e;e=le(a),e||(e=ce(a,r),r=[])}t.apply(void 0,[e].concat(r))}}var Qt=Object.assign(function(e,r){for(var o=[],a=2;a<arguments.length;a++)o[a-2]=arguments[a];e||rt(e,le(r,o)||ce(r,o))},{debug:qt(rt.debug),log:qt(rt.log),warn:qt(rt.warn),error:qt(rt.error)});function Ke(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return new He(le(t,e)||ce(t,e))}var Ie=Symbol.for("ApolloErrorMessageHandler_"+Ye);function Je(t){if(typeof t=="string")return t;try{return Tr(t,2).slice(0,1e3)}catch{return"<non-serializable>"}}function le(t,e){if(e===void 0&&(e=[]),!!t)return ne[Ie]&&ne[Ie](t,e.map(Je))}function ce(t,e){if(e===void 0&&(e=[]),!!t)return"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({version:Ye,message:t,args:e.map(Je)})))}function Pr(t){return t.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}let I=null;const Fe={};let Or=1;const $r=()=>class{constructor(){this.id=["slot",Or++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=I;e;e=e.parent)if(this.id in e.slots){const r=e.slots[this.id];if(r===Fe)break;return e!==I&&(I.slots[this.id]=r),!0}return I&&(I.slots[this.id]=Fe),!1}getValue(){if(this.hasValue())return I.slots[this.id]}withValue(e,r,o,a){const c={__proto__:null,[this.id]:e},l=I;I={parent:l,slots:c};try{return r.apply(a,o)}finally{I=l}}static bind(e){const r=I;return function(){const o=I;try{return I=r,e.apply(this,arguments)}finally{I=o}}}static noContext(e,r,o){if(I){const a=I;try{return I=null,e.apply(o,r)}finally{I=a}}else return e.apply(o,r)}};function Ne(t){try{return t()}catch{}}const Zt="@wry/context:Slot",zr=Ne(()=>globalThis)||Ne(()=>global)||Object.create(null),Ee=zr,de=Ee[Zt]||Array[Zt]||(function(t){try{Object.defineProperty(Ee,Zt,{value:t,enumerable:!1,writable:!1,configurable:!0})}finally{return t}})($r()),{bind:io,noContext:lo}=de;new de;function Ar(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=Dr(t))||e){r&&(t=r);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
16
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dr(t,e){if(t){if(typeof t=="string")return Te(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Te(t,e)}}function Te(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r<e;r++)o[r]=t[r];return o}function Pe(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function ue(t,e,r){return e&&Pe(t.prototype,e),r&&Pe(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var fe=function(){return typeof Symbol=="function"},pe=function(t){return fe()&&!!Symbol[t]},he=function(t){return pe(t)?Symbol[t]:"@@"+t};fe()&&!pe("observable")&&(Symbol.observable=Symbol("observable"));var Lr=he("iterator"),ae=he("observable"),We=he("species");function Yt(t,e){var r=t[e];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function Ft(t){var e=t.constructor;return e!==void 0&&(e=e[We],e===null&&(e=void 0)),e!==void 0?e:F}function qr(t){return t instanceof F}function yt(t){yt.log?yt.log(t):setTimeout(function(){throw t})}function Ut(t){Promise.resolve().then(function(){try{t()}catch(e){yt(e)}})}function Ge(t){var e=t._cleanup;if(e!==void 0&&(t._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var r=Yt(e,"unsubscribe");r&&r.call(e)}}catch(o){yt(o)}}function se(t){t._observer=void 0,t._queue=void 0,t._state="closed"}function Br(t){var e=t._queue;if(e){t._queue=void 0,t._state="ready";for(var r=0;r<e.length&&(Xe(t,e[r].type,e[r].value),t._state!=="closed");++r);}}function Xe(t,e,r){t._state="running";var o=t._observer;try{var a=Yt(o,e);switch(e){case"next":a&&a.call(o,r);break;case"error":if(se(t),a)a.call(o,r);else throw r;break;case"complete":se(t),a&&a.call(o);break}}catch(c){yt(c)}t._state==="closed"?Ge(t):t._state==="running"&&(t._state="ready")}function te(t,e,r){if(t._state!=="closed"){if(t._state==="buffering"){t._queue.push({type:e,value:r});return}if(t._state!=="ready"){t._state="buffering",t._queue=[{type:e,value:r}],Ut(function(){return Br(t)});return}Xe(t,e,r)}}var Ur=(function(){function t(r,o){this._cleanup=void 0,this._observer=r,this._queue=void 0,this._state="initializing";var a=new Mr(this);try{this._cleanup=o.call(void 0,a)}catch(c){a.error(c)}this._state==="initializing"&&(this._state="ready")}var e=t.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(se(this),Ge(this))},ue(t,[{key:"closed",get:function(){return this._state==="closed"}}]),t})(),Mr=(function(){function t(r){this._subscription=r}var e=t.prototype;return e.next=function(o){te(this._subscription,"next",o)},e.error=function(o){te(this._subscription,"error",o)},e.complete=function(){te(this._subscription,"complete")},ue(t,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),t})(),F=(function(){function t(r){if(!(this instanceof t))throw new TypeError("Observable cannot be called as a function");if(typeof r!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=r}var e=t.prototype;return e.subscribe=function(o){return(typeof o!="object"||o===null)&&(o={next:o,error:arguments[1],complete:arguments[2]}),new Ur(o,this._subscriber)},e.forEach=function(o){var a=this;return new Promise(function(c,l){if(typeof o!="function"){l(new TypeError(o+" is not a function"));return}function d(){i.unsubscribe(),c()}var i=a.subscribe({next:function(y){try{o(y,d)}catch(v){l(v),i.unsubscribe()}},error:l,complete:c})})},e.map=function(o){var a=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var c=Ft(this);return new c(function(l){return a.subscribe({next:function(d){try{d=o(d)}catch(i){return l.error(i)}l.next(d)},error:function(d){l.error(d)},complete:function(){l.complete()}})})},e.filter=function(o){var a=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var c=Ft(this);return new c(function(l){return a.subscribe({next:function(d){try{if(!o(d))return}catch(i){return l.error(i)}l.next(d)},error:function(d){l.error(d)},complete:function(){l.complete()}})})},e.reduce=function(o){var a=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var c=Ft(this),l=arguments.length>1,d=!1,i=arguments[1],y=i;return new c(function(v){return a.subscribe({next:function(_){var j=!d;if(d=!0,!j||l)try{y=o(y,_)}catch(T){return v.error(T)}else y=_},error:function(_){v.error(_)},complete:function(){if(!d&&!l)return v.error(new TypeError("Cannot reduce an empty sequence"));v.next(y),v.complete()}})})},e.concat=function(){for(var o=this,a=arguments.length,c=new Array(a),l=0;l<a;l++)c[l]=arguments[l];var d=Ft(this);return new d(function(i){var y,v=0;function _(j){y=j.subscribe({next:function(T){i.next(T)},error:function(T){i.error(T)},complete:function(){v===c.length?(y=void 0,i.complete()):_(d.from(c[v++]))}})}return _(o),function(){y&&(y.unsubscribe(),y=void 0)}})},e.flatMap=function(o){var a=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var c=Ft(this);return new c(function(l){var d=[],i=a.subscribe({next:function(v){if(o)try{v=o(v)}catch(j){return l.error(j)}var _=c.from(v).subscribe({next:function(j){l.next(j)},error:function(j){l.error(j)},complete:function(){var j=d.indexOf(_);j>=0&&d.splice(j,1),y()}});d.push(_)},error:function(v){l.error(v)},complete:function(){y()}});function y(){i.closed&&d.length===0&&l.complete()}return function(){d.forEach(function(v){return v.unsubscribe()}),i.unsubscribe()}})},e[ae]=function(){return this},t.from=function(o){var a=typeof this=="function"?this:t;if(o==null)throw new TypeError(o+" is not an object");var c=Yt(o,ae);if(c){var l=c.call(o);if(Object(l)!==l)throw new TypeError(l+" is not an object");return qr(l)&&l.constructor===a?l:new a(function(d){return l.subscribe(d)})}if(pe("iterator")&&(c=Yt(o,Lr),c))return new a(function(d){Ut(function(){if(!d.closed){for(var i=Ar(c.call(o)),y;!(y=i()).done;){var v=y.value;if(d.next(v),d.closed)return}d.complete()}})});if(Array.isArray(o))return new a(function(d){Ut(function(){if(!d.closed){for(var i=0;i<o.length;++i)if(d.next(o[i]),d.closed)return;d.complete()}})});throw new TypeError(o+" is not observable")},t.of=function(){for(var o=arguments.length,a=new Array(o),c=0;c<o;c++)a[c]=arguments[c];var l=typeof this=="function"?this:t;return new l(function(d){Ut(function(){if(!d.closed){for(var i=0;i<a.length;++i)if(d.next(a[i]),d.closed)return;d.complete()}})})},ue(t,null,[{key:We,get:function(){return this}}]),t})();fe()&&Object.defineProperty(F,Symbol("extensions"),{value:{symbol:ae,hostReportError:yt},configurable:!0});function Rr(t){var e,r=t.Symbol;if(typeof r=="function")if(r.observable)e=r.observable;else{typeof r.for=="function"?e=r.for("https://github.com/benlesh/symbol-observable"):e=r("https://github.com/benlesh/symbol-observable");try{r.observable=e}catch{}}else e="@@observable";return e}var bt;typeof self<"u"?bt=self:typeof window<"u"?bt=window:typeof global<"u"?bt=global:typeof module<"u"?bt=module:bt=Function("return this")();Rr(bt);var Oe=F.prototype,$e="@@observable";Oe[$e]||(Oe[$e]=function(){return this});function Hr(t){for(var e=["query","operationName","variables","extensions","context"],r=0,o=Object.keys(t);r<o.length;r++){var a=o[r];if(e.indexOf(a)<0)throw Ke(58,a)}return t}function Vr(t,e){var r=X({},t),o=function(c){typeof c=="function"?r=X(X({},r),c(r)):r=X(X({},r),c)},a=function(){return X({},r)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:o}),Object.defineProperty(e,"getContext",{enumerable:!1,value:a}),e}function Yr(t){var e={variables:t.variables||{},extensions:t.extensions||{},operationName:t.operationName,query:t.query};return e.operationName||(e.operationName=typeof e.query!="string"?Pr(e.query)||void 0:""),e}var Kr=Symbol.for("apollo.deprecations"),Jr=ne,Wr=new de;function Gr(t){return Jr[Kr]||(Wr.getValue()||[]).includes(t)}function Xr(t,e){Gr(t)||e()}function ze(t,e){return e?e(t):F.of()}function Nt(t){return typeof t=="function"?new Qe(t):t}function Bt(t){return t.request.length<=1}var Qe=(function(){function t(e){e&&(this.request=e)}return t.empty=function(){return new t(function(){return F.of()})},t.from=function(e){return e.length===0?t.empty():e.map(Nt).reduce(function(r,o){return r.concat(o)})},t.split=function(e,r,o){var a=Nt(r),c=Nt(o||new t(ze)),l;return Bt(a)&&Bt(c)?l=new t(function(d){return e(d)?a.request(d)||F.of():c.request(d)||F.of()}):l=new t(function(d,i){return e(d)?a.request(d,i)||F.of():c.request(d,i)||F.of()}),Object.assign(l,{left:a,right:c})},t.execute=function(e,r){return e.request(Vr(r.context,Yr(Hr(r))))||F.of()},t.concat=function(e,r){var o=Nt(e);if(Bt(o))return globalThis.__DEV__!==!1&&Qt.warn(47,o),o;var a=Nt(r),c;return Bt(a)?c=new t(function(l){return o.request(l,function(d){return a.request(d)||F.of()})||F.of()}):c=new t(function(l,d){return o.request(l,function(i){return a.request(i,d)||F.of()})||F.of()}),Object.assign(c,{left:o,right:a})},t.prototype.split=function(e,r,o){return this.concat(t.split(e,r,o||new t(ze)))},t.prototype.concat=function(e){return t.concat(this,e)},t.prototype.request=function(e,r){throw Ke(48)},t.prototype.onError=function(e,r){if(globalThis.__DEV__!==!1&&Xr("onError",function(){globalThis.__DEV__!==!1&&Qt.warn(49)}),r&&r.error)return r.error(e),!1;throw e},t.prototype.setOnError=function(e){return globalThis.__DEV__!==!1&&globalThis.__DEV__!==!1&&Qt.warn(50),this.onError=e,this},t})();function Qr(t){return new Qe(function(e,r){var o=Ir(e,[]);return new F(function(a){var c,l=!1;return Promise.resolve(o).then(function(d){return t(d,e.getContext())}).then(e.setContext).then(function(){l||(c=r(e).subscribe({next:a.next.bind(a),error:a.error.bind(a),complete:a.complete.bind(a)}))}).catch(a.error.bind(a)),function(){l=!0,c&&c.unsubscribe()}})})}const Zr=async()=>{const t="https://auth.australia-southeast1.gcp.commercetools.com/oauth/token",o="Basic "+btoa(encodeURIComponent("tfegsSBVOYnR7e_yE-AjxVVN")+":"+encodeURIComponent("pyKWgHuTxuMwDygh9JH1ehLEaLvAhBo4"));try{const a=await N.post(t,new URLSearchParams({grant_type:"client_credentials"}),{headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:o}});return a.status===200&&a.data.access_token?a.data.access_token:(console.error("Failed to fetch token:",a.data),null)}catch(a){return N.isAxiosError(a)?console.error("Error fetching token:",a.response||a.message):console.error("Unexpected error:",a),null}},to="https://api.australia-southeast1.gcp.commercetools.com/kt-demo/graphql",eo=Mt.createHttpLink({uri:`${to}`}),ro=Qr(async(t,{headers:e})=>{const r=await Zr();return{headers:{...e,authorization:`Bearer ${r}`}}}),oo=new Mt.ApolloClient({link:ro.concat(eo),cache:new Mt.InMemoryCache,defaultOptions:{watchQuery:{fetchPolicy:"cache-and-network"}}}),no=t=>{const{tanyaConfig:e}=t;return n.jsx(Mt.ApolloProvider,{client:oo,children:n.jsx(hr,{children:n.jsx(_r,{tanyaConfig:e})})})};exports.TanyaChatbot=no;exports.TanyaChatbotProvider=lr;
15
+ `,style:{background:"linear-gradient(170.1deg, #FFFFFF 60.03%, #E3DEEF 99.59%)"},children:[n.jsxs("div",{className:"flex justify-between p-3 bg-[#FFFFFF] border border-b-1 border-[#E5E5E5] ",children:[n.jsx("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsxs("div",{className:"flex gap-2 w-28 h-12 text-center items-center p-2 border rounded-l-[20px] rounded-tr-[20px]",style:{background:"linear-gradient(265.62deg, #6851C6 5.24%, #8668FF 98.49%)"},children:[n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 15 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("path",{d:"M15 4.48438V0.5C15 0.5 8.94395 1.4375 6.78127 4.25C4.61859 7.0625 5.33095 15.5 5.33095 15.5H9.19857C9.19857 15.5 8.72793 7.76562 10.1654 6.125C11.6029 4.48438 15 4.48438 15 4.48438Z",fill:"white"}),n.jsx("path",{d:"M0 0.5H6.28488V4.25H0V0.5Z",fill:"white"})]}),n.jsx("p",{className:"text-[#FFFFFF] font-nunitoSans font-semibold",children:"TANYA"})]}),n.jsxs("p",{className:"text-[#5B5B5B] font-nunitoSans font-semibold",style:{fontStyle:"italic"},children:[" ","Your AI shopping assistant !"," "]})]})}),n.jsx("div",{style:{display:"flex",alignItems:"center",gap:"1.25rem",margin:"0.75rem"},children:n.jsx("button",{onClick:()=>S(!1),children:n.jsxs("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsxs("g",{clipPath:"url(#clip0_501_6036)",children:[n.jsx("path",{d:"M18 6.5L6 18.5",stroke:"#555555",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M6 6.5L18 18.5",stroke:"#555555",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),n.jsx("defs",{children:n.jsx("clipPath",{id:"clip0_501_6036",children:n.jsx("rect",{width:"24",height:"24",fill:"white",transform:"translate(0 0.5)"})})})]})})})]}),n.jsxs("div",{className:"flex h-full md:flex-row lg:flex-row",children:[n.jsxs("div",{className:`flex flex-col h-full ${dt?"lg:w-2/3 w-full":"w-full"}`,children:[n.jsxs("div",{ref:j,className:"overflow-y-auto pr-5 pb-2 space-y-4 hide-scrollbar flex-grow mb-24",children:[(v==null?void 0:v.whomRequired)&&n.jsxs("div",{className:"mx-3 p-3 rounded-2xl bg-[#FFFFFF]",children:[n.jsx("div",{className:"flex gap-2 bg-[#FFFFFF]",children:n.jsx("p",{className:"font-bold font-nunitoSans text-[#494949]",children:"Is this for you or someone else?"})}),n.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:o.map(s=>n.jsx("button",{onClick:()=>zt(s),className:"px-2 py-2 font-semibold text-xs text-[#18181B] bg-[#F3F3F3] rounded-2xl",style:{backgroundColor:ct===a[s]?"#FFFFFF":"#F3F3F3",borderColor:ct===a[s]?"#BBB3DD":""},children:s},s))})]}),tt.map((s,m)=>{var p,w;return n.jsxs("div",{children:[n.jsx("div",{className:"flex justify-end",children:n.jsx("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:s.query})}),s.response&&s.response.includes("Thinking")?n.jsx("div",{children:n.jsx("div",{className:"font-nunitoSans animate-pulse font-bold text-sm text-[#494949] bg-[#FFFFFF] px-7 py-1 rounded-r-xl rounded-bl-2xl w-full",dangerouslySetInnerHTML:{__html:Wt(s.response)}})}):n.jsx("div",{children:n.jsx("div",{className:"font-nunitoSans font-bold text-sm text-[#494949] bg-[#FFFFFF] px-7 py-1 rounded-r-xl rounded-bl-2xl w-full",dangerouslySetInnerHTML:{__html:Wt(s.response)}})}),Tt&&!s.response.includes("Thinking")&&((p=s.products)==null?void 0:p.length)==0&&n.jsx("div",{children:n.jsx("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"})}),(s==null?void 0:s.products)&&((w=s==null?void 0:s.products)==null?void 0:w.length)>0&&n.jsx(vr,{chat:s.products,storeDetails:v}),(s==null?void 0:s.potentialQuestions.length)>0&&n.jsxs("div",{className:"my-2 px-4 text-sm text-gray-700",children:[n.jsx("p",{className:"font-nunitoSans font-bold text-sm text-[#494949]",style:{color:v.themeDarkColor},children:"Why not explore these inquiries..."}),s.potentialQuestions.split(",").map((u,h)=>n.jsx("button",{className:`cursor-pointer font-nunitoSans font-semibold text-[#232323] border bg-[#804C9E0D] border-${v.themeDarkColor} m-1 rounded-xl px-2 py-1`,onClick:()=>A(u),style:{backgroundColor:v.tanyaThemeColorLight},children:u},h))]}),(s==null?void 0:s.secondaryLoading)&&n.jsx("div",{className:"mt-3 mb-4 px-4",children:n.jsxs("div",{className:"tanya-surprise-wrapper bg-indigo-300 text-sm px-7 py-4 rounded-r-xl rounded-bl-2xl w-full relative overflow-hidden",style:{margin:"0.75rem"},children:[n.jsxs("div",{className:"flex gap-1",children:[n.jsx("div",{className:"tanya-sparkle tanya-sparkle-1",children:"✨"}),n.jsx("div",{className:"tanya-sparkle tanya-sparkle-2",children:"✨"}),n.jsx("div",{className:"tanya-sparkle tanya-sparkle-3",children:"✨"})]}),n.jsx("div",{className:"tanya-shimmer"}),n.jsx("p",{className:"font-semibold tanya-pulse",style:{color:v.themeDarkColor},children:"I’ve found a special surprise crafted just for you… hang on a sec!"}),n.jsx("p",{className:"tanya-dots mt-1",style:{color:v.themeDarkColor},children:"• • •"})]})}),(s==null?void 0:s.secondaryResponse)&&n.jsx(n.Fragment,{children:n.jsxs("div",{className:"mt-3 mb-8 px-4 bg-indigo-300 rounded-tr-[5px]",children:[n.jsx("div",{className:"text-sm text-[#232323] bg-[#FFFFFF] px-7 py-4 rounded-br-xl rounded-bl-2xl w-full",style:{backgroundColor:v.tanyaThemeColorLight},dangerouslySetInnerHTML:{__html:Wt(s.secondaryResponse)}}),s.productSnapshot&&n.jsx("div",{className:"mt-4 w-full",children:n.jsxs("div",{className:"flex gap-4 items-stretch rounded-2xl p-4",style:{backgroundColor:v.tanyaThemeColorLight},children:[n.jsx("div",{className:"flex-shrink-0 rounded-xl overflow-hidden border",style:{width:112,height:112,borderColor:"#eee"},children:s.productSnapshot.image?n.jsx("img",{src:s.productSnapshot.image,alt:s.productSnapshot.name,className:"w-full h-full object-cover"}):n.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-gray-500",children:"No Image"})}),n.jsxs("div",{className:"flex flex-col flex-1 justify-between",children:[n.jsxs("div",{children:[n.jsx("p",{className:"font-semibold text-[15px] leading-snug",children:s.productSnapshot.name}),n.jsx("p",{className:"mt-1 text-[14px] font-medium",children:s.productSnapshot.price!=null?new Intl.NumberFormat(void 0,{style:"currency",currency:(v==null?void 0:v.currency)||"USD"}).format(s.productSnapshot.price):""}),s.productSnapshot.points>0&&n.jsxs("p",{className:"mt-1 text-xs opacity-80",children:["You will earn"," ",n.jsxs("strong",{children:[s.productSnapshot.points," ","points"]})]})]}),n.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[n.jsxs("div",{className:"flex items-center border rounded-full overflow-hidden",children:[n.jsx("button",{className:"px-3 py-1 text-sm",onClick:()=>T(u=>u.map((h,z)=>z===m&&h.productSnapshot?{...h,productSnapshot:{...h.productSnapshot,quantity:Math.max(1,h.productSnapshot.quantity-1)}}:h)),style:{background:"transparent",color:v.themeDarkColor},children:"−"}),n.jsx("div",{className:"px-3 py-1 text-sm select-none",children:s.productSnapshot.quantity}),n.jsx("button",{className:"px-3 py-1 text-sm",onClick:()=>T(u=>u.map((h,z)=>z===m&&h.productSnapshot?{...h,productSnapshot:{...h.productSnapshot,quantity:h.productSnapshot.quantity+1}}:h)),style:{background:"transparent",color:v.themeDarkColor},children:"+"})]}),n.jsx("button",{onClick:()=>{tr(Ot(s.productSnapshot),s.productSnapshot.quantity)},disabled:it,className:"px-4 py-2 rounded-full font-medium",style:{background:v.tanyaThemeColor,color:(v==null?void 0:v.tanyaThemeContrastColor)||"#fff",opacity:it?.8:1},children:it?"Adding...":"Add to cart"})]})]})]})})]})}),n.jsx("div",{className:"mb-20"})]},m)})]}),n.jsx("div",{className:"flex flex-col gap-2 sticky bottom-0 left-0 right-0 bg-[#E3DEEF] z-50 px-4 py-2",children:n.jsx("div",{className:"p-[1px] rounded-xl",style:{background:"linear-gradient(180deg, #B09FFF 0%, #8D79F6 100%)"},children:n.jsxs("div",{className:"flex items-center bg-[#FFFFFF] flex-1 rounded-xl px-2 py-1",children:[n.jsx("input",{className:"flex-1 bg-[#FFFFFF] text-[#232323] outline-none border-none px-2 py-2 text-sm",placeholder:"How can I help you...",value:St,autoFocus:!0,onChange:s=>jt(s.target.value),onKeyDown:s=>{s.key==="Enter"&&!lt&&A()}}),n.jsx("button",{type:"submit",disabled:lt,className:"p-3",onClick:()=>A(),children:lt?n.jsx("div",{className:"p-3 animate-spin rounded-full h-3 w-3 border-b-2",style:{borderBottom:"2px solid",color:v.tanyaThemeColor}}):n.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:n.jsx("path",{d:"M16.6357 13.6701L18.3521 8.5208C19.8516 4.02242 20.6013 1.77322 19.414 0.585948C18.2268 -0.601312 15.9776 0.148418 11.4792 1.64788L6.32987 3.36432C2.69923 4.57453 0.883923 5.17964 0.368062 6.06698C-0.122688 6.91112 -0.122688 7.95369 0.368062 8.7978C0.883923 9.6852 2.69923 10.2903 6.32987 11.5005C6.77981 11.6505 7.28601 11.5434 7.62294 11.2096L13.1286 5.75495C13.4383 5.44808 13.9382 5.45041 14.245 5.76015C14.5519 6.06989 14.5496 6.56975 14.2398 6.87662L8.8231 12.2432C8.4518 12.6111 8.3342 13.1742 8.4995 13.6701C9.7097 17.3007 10.3148 19.1161 11.2022 19.6319C12.0463 20.1227 13.0889 20.1227 13.933 19.6319C14.8204 19.1161 15.4255 17.3008 16.6357 13.6701Z",fill:"#6952C7"})})})]})})})]}),n.jsx(Sr,{addToCartPwa:r})]})]})]})]})})};var re=function(t,e){return re=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(r[a]=o[a])},re(t,e)};function _r(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");re(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var X=function(){return X=Object.assign||function(e){for(var r,o=1,a=arguments.length;o<a;o++){r=arguments[o];for(var c in r)Object.prototype.hasOwnProperty.call(r,c)&&(e[c]=r[c])}return e},X.apply(this,arguments)};function Cr(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,o=Object.getOwnPropertySymbols(t);a<o.length;a++)e.indexOf(o[a])<0&&Object.prototype.propertyIsEnumerable.call(t,o[a])&&(r[o[a]]=t[o[a]]);return r}var Gt="Invariant Violation",je=Object.setPrototypeOf,Ir=je===void 0?function(t,e){return t.__proto__=e,t}:je,Re=(function(t){_r(e,t);function e(r){r===void 0&&(r=Gt);var o=t.call(this,typeof r=="number"?Gt+": "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return o.framesToPop=1,o.name=Gt,Ir(o,e.prototype),o}return e})(Error);function et(t,e){if(!t)throw new Re(e)}var He=["debug","log","warn","error","silent"],Fr=He.indexOf("log");function Lt(t){return function(){if(He.indexOf(t)>=Fr){var e=console[t]||console.log;return e.apply(console,arguments)}}}(function(t){t.debug=Lt("debug"),t.log=Lt("log"),t.warn=Lt("warn"),t.error=Lt("error")})(et||(et={}));var Ve="3.14.0";function xt(t){try{return t()}catch{}}const oe=xt(function(){return globalThis})||xt(function(){return window})||xt(function(){return self})||xt(function(){return global})||xt(function(){return xt.constructor("return this")()});var _e=new Map;function Nr(t){var e=_e.get(t)||1;return _e.set(t,e+1),"".concat(t,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function Er(t,e){var r=Nr("stringifyForDisplay");return JSON.stringify(t,function(o,a){return a===void 0?r:a},e).split(JSON.stringify(r)).join("<undefined>")}function qt(t){return function(e){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];if(typeof e=="number"){var a=e;e=ie(a),e||(e=le(a,r),r=[])}t.apply(void 0,[e].concat(r))}}var Xt=Object.assign(function(e,r){for(var o=[],a=2;a<arguments.length;a++)o[a-2]=arguments[a];e||et(e,ie(r,o)||le(r,o))},{debug:qt(et.debug),log:qt(et.log),warn:qt(et.warn),error:qt(et.error)});function Ye(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return new Re(ie(t,e)||le(t,e))}var Ce=Symbol.for("ApolloErrorMessageHandler_"+Ve);function Ke(t){if(typeof t=="string")return t;try{return Er(t,2).slice(0,1e3)}catch{return"<non-serializable>"}}function ie(t,e){if(e===void 0&&(e=[]),!!t)return oe[Ce]&&oe[Ce](t,e.map(Ke))}function le(t,e){if(e===void 0&&(e=[]),!!t)return"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({version:Ve,message:t,args:e.map(Ke)})))}function Tr(t){return t.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}let I=null;const Ie={};let Pr=1;const Or=()=>class{constructor(){this.id=["slot",Pr++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=I;e;e=e.parent)if(this.id in e.slots){const r=e.slots[this.id];if(r===Ie)break;return e!==I&&(I.slots[this.id]=r),!0}return I&&(I.slots[this.id]=Ie),!1}getValue(){if(this.hasValue())return I.slots[this.id]}withValue(e,r,o,a){const c={__proto__:null,[this.id]:e},l=I;I={parent:l,slots:c};try{return r.apply(a,o)}finally{I=l}}static bind(e){const r=I;return function(){const o=I;try{return I=r,e.apply(this,arguments)}finally{I=o}}}static noContext(e,r,o){if(I){const a=I;try{return I=null,e.apply(o,r)}finally{I=a}}else return e.apply(o,r)}};function Fe(t){try{return t()}catch{}}const Qt="@wry/context:Slot",$r=Fe(()=>globalThis)||Fe(()=>global)||Object.create(null),Ne=$r,ce=Ne[Qt]||Array[Qt]||(function(t){try{Object.defineProperty(Ne,Qt,{value:t,enumerable:!1,writable:!1,configurable:!0})}finally{return t}})(Or()),{bind:so,noContext:io}=ce;new ce;function zr(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=Ar(t))||e){r&&(t=r);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
16
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ar(t,e){if(t){if(typeof t=="string")return Ee(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ee(t,e)}}function Ee(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r<e;r++)o[r]=t[r];return o}function Te(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function de(t,e,r){return e&&Te(t.prototype,e),r&&Te(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var ue=function(){return typeof Symbol=="function"},fe=function(t){return ue()&&!!Symbol[t]},pe=function(t){return fe(t)?Symbol[t]:"@@"+t};ue()&&!fe("observable")&&(Symbol.observable=Symbol("observable"));var Dr=pe("iterator"),ne=pe("observable"),Je=pe("species");function Yt(t,e){var r=t[e];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function It(t){var e=t.constructor;return e!==void 0&&(e=e[Je],e===null&&(e=void 0)),e!==void 0?e:N}function Lr(t){return t instanceof N}function yt(t){yt.log?yt.log(t):setTimeout(function(){throw t})}function Ut(t){Promise.resolve().then(function(){try{t()}catch(e){yt(e)}})}function We(t){var e=t._cleanup;if(e!==void 0&&(t._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var r=Yt(e,"unsubscribe");r&&r.call(e)}}catch(o){yt(o)}}function ae(t){t._observer=void 0,t._queue=void 0,t._state="closed"}function qr(t){var e=t._queue;if(e){t._queue=void 0,t._state="ready";for(var r=0;r<e.length&&(Ge(t,e[r].type,e[r].value),t._state!=="closed");++r);}}function Ge(t,e,r){t._state="running";var o=t._observer;try{var a=Yt(o,e);switch(e){case"next":a&&a.call(o,r);break;case"error":if(ae(t),a)a.call(o,r);else throw r;break;case"complete":ae(t),a&&a.call(o);break}}catch(c){yt(c)}t._state==="closed"?We(t):t._state==="running"&&(t._state="ready")}function Zt(t,e,r){if(t._state!=="closed"){if(t._state==="buffering"){t._queue.push({type:e,value:r});return}if(t._state!=="ready"){t._state="buffering",t._queue=[{type:e,value:r}],Ut(function(){return qr(t)});return}Ge(t,e,r)}}var Br=(function(){function t(r,o){this._cleanup=void 0,this._observer=r,this._queue=void 0,this._state="initializing";var a=new Ur(this);try{this._cleanup=o.call(void 0,a)}catch(c){a.error(c)}this._state==="initializing"&&(this._state="ready")}var e=t.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(ae(this),We(this))},de(t,[{key:"closed",get:function(){return this._state==="closed"}}]),t})(),Ur=(function(){function t(r){this._subscription=r}var e=t.prototype;return e.next=function(o){Zt(this._subscription,"next",o)},e.error=function(o){Zt(this._subscription,"error",o)},e.complete=function(){Zt(this._subscription,"complete")},de(t,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),t})(),N=(function(){function t(r){if(!(this instanceof t))throw new TypeError("Observable cannot be called as a function");if(typeof r!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=r}var e=t.prototype;return e.subscribe=function(o){return(typeof o!="object"||o===null)&&(o={next:o,error:arguments[1],complete:arguments[2]}),new Br(o,this._subscriber)},e.forEach=function(o){var a=this;return new Promise(function(c,l){if(typeof o!="function"){l(new TypeError(o+" is not a function"));return}function d(){i.unsubscribe(),c()}var i=a.subscribe({next:function(b){try{o(b,d)}catch(y){l(y),i.unsubscribe()}},error:l,complete:c})})},e.map=function(o){var a=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var c=It(this);return new c(function(l){return a.subscribe({next:function(d){try{d=o(d)}catch(i){return l.error(i)}l.next(d)},error:function(d){l.error(d)},complete:function(){l.complete()}})})},e.filter=function(o){var a=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var c=It(this);return new c(function(l){return a.subscribe({next:function(d){try{if(!o(d))return}catch(i){return l.error(i)}l.next(d)},error:function(d){l.error(d)},complete:function(){l.complete()}})})},e.reduce=function(o){var a=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var c=It(this),l=arguments.length>1,d=!1,i=arguments[1],b=i;return new c(function(y){return a.subscribe({next:function(_){var S=!d;if(d=!0,!S||l)try{b=o(b,_)}catch(U){return y.error(U)}else b=_},error:function(_){y.error(_)},complete:function(){if(!d&&!l)return y.error(new TypeError("Cannot reduce an empty sequence"));y.next(b),y.complete()}})})},e.concat=function(){for(var o=this,a=arguments.length,c=new Array(a),l=0;l<a;l++)c[l]=arguments[l];var d=It(this);return new d(function(i){var b,y=0;function _(S){b=S.subscribe({next:function(U){i.next(U)},error:function(U){i.error(U)},complete:function(){y===c.length?(b=void 0,i.complete()):_(d.from(c[y++]))}})}return _(o),function(){b&&(b.unsubscribe(),b=void 0)}})},e.flatMap=function(o){var a=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var c=It(this);return new c(function(l){var d=[],i=a.subscribe({next:function(y){if(o)try{y=o(y)}catch(S){return l.error(S)}var _=c.from(y).subscribe({next:function(S){l.next(S)},error:function(S){l.error(S)},complete:function(){var S=d.indexOf(_);S>=0&&d.splice(S,1),b()}});d.push(_)},error:function(y){l.error(y)},complete:function(){b()}});function b(){i.closed&&d.length===0&&l.complete()}return function(){d.forEach(function(y){return y.unsubscribe()}),i.unsubscribe()}})},e[ne]=function(){return this},t.from=function(o){var a=typeof this=="function"?this:t;if(o==null)throw new TypeError(o+" is not an object");var c=Yt(o,ne);if(c){var l=c.call(o);if(Object(l)!==l)throw new TypeError(l+" is not an object");return Lr(l)&&l.constructor===a?l:new a(function(d){return l.subscribe(d)})}if(fe("iterator")&&(c=Yt(o,Dr),c))return new a(function(d){Ut(function(){if(!d.closed){for(var i=zr(c.call(o)),b;!(b=i()).done;){var y=b.value;if(d.next(y),d.closed)return}d.complete()}})});if(Array.isArray(o))return new a(function(d){Ut(function(){if(!d.closed){for(var i=0;i<o.length;++i)if(d.next(o[i]),d.closed)return;d.complete()}})});throw new TypeError(o+" is not observable")},t.of=function(){for(var o=arguments.length,a=new Array(o),c=0;c<o;c++)a[c]=arguments[c];var l=typeof this=="function"?this:t;return new l(function(d){Ut(function(){if(!d.closed){for(var i=0;i<a.length;++i)if(d.next(a[i]),d.closed)return;d.complete()}})})},de(t,null,[{key:Je,get:function(){return this}}]),t})();ue()&&Object.defineProperty(N,Symbol("extensions"),{value:{symbol:ne,hostReportError:yt},configurable:!0});function Mr(t){var e,r=t.Symbol;if(typeof r=="function")if(r.observable)e=r.observable;else{typeof r.for=="function"?e=r.for("https://github.com/benlesh/symbol-observable"):e=r("https://github.com/benlesh/symbol-observable");try{r.observable=e}catch{}}else e="@@observable";return e}var bt;typeof self<"u"?bt=self:typeof window<"u"?bt=window:typeof global<"u"?bt=global:typeof module<"u"?bt=module:bt=Function("return this")();Mr(bt);var Pe=N.prototype,Oe="@@observable";Pe[Oe]||(Pe[Oe]=function(){return this});function Rr(t){for(var e=["query","operationName","variables","extensions","context"],r=0,o=Object.keys(t);r<o.length;r++){var a=o[r];if(e.indexOf(a)<0)throw Ye(58,a)}return t}function Hr(t,e){var r=X({},t),o=function(c){typeof c=="function"?r=X(X({},r),c(r)):r=X(X({},r),c)},a=function(){return X({},r)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:o}),Object.defineProperty(e,"getContext",{enumerable:!1,value:a}),e}function Vr(t){var e={variables:t.variables||{},extensions:t.extensions||{},operationName:t.operationName,query:t.query};return e.operationName||(e.operationName=typeof e.query!="string"?Tr(e.query)||void 0:""),e}var Yr=Symbol.for("apollo.deprecations"),Kr=oe,Jr=new ce;function Wr(t){return Kr[Yr]||(Jr.getValue()||[]).includes(t)}function Gr(t,e){Wr(t)||e()}function $e(t,e){return e?e(t):N.of()}function Ft(t){return typeof t=="function"?new Xe(t):t}function Bt(t){return t.request.length<=1}var Xe=(function(){function t(e){e&&(this.request=e)}return t.empty=function(){return new t(function(){return N.of()})},t.from=function(e){return e.length===0?t.empty():e.map(Ft).reduce(function(r,o){return r.concat(o)})},t.split=function(e,r,o){var a=Ft(r),c=Ft(o||new t($e)),l;return Bt(a)&&Bt(c)?l=new t(function(d){return e(d)?a.request(d)||N.of():c.request(d)||N.of()}):l=new t(function(d,i){return e(d)?a.request(d,i)||N.of():c.request(d,i)||N.of()}),Object.assign(l,{left:a,right:c})},t.execute=function(e,r){return e.request(Hr(r.context,Vr(Rr(r))))||N.of()},t.concat=function(e,r){var o=Ft(e);if(Bt(o))return globalThis.__DEV__!==!1&&Xt.warn(47,o),o;var a=Ft(r),c;return Bt(a)?c=new t(function(l){return o.request(l,function(d){return a.request(d)||N.of()})||N.of()}):c=new t(function(l,d){return o.request(l,function(i){return a.request(i,d)||N.of()})||N.of()}),Object.assign(c,{left:o,right:a})},t.prototype.split=function(e,r,o){return this.concat(t.split(e,r,o||new t($e)))},t.prototype.concat=function(e){return t.concat(this,e)},t.prototype.request=function(e,r){throw Ye(48)},t.prototype.onError=function(e,r){if(globalThis.__DEV__!==!1&&Gr("onError",function(){globalThis.__DEV__!==!1&&Xt.warn(49)}),r&&r.error)return r.error(e),!1;throw e},t.prototype.setOnError=function(e){return globalThis.__DEV__!==!1&&globalThis.__DEV__!==!1&&Xt.warn(50),this.onError=e,this},t})();function Xr(t){return new Xe(function(e,r){var o=Cr(e,[]);return new N(function(a){var c,l=!1;return Promise.resolve(o).then(function(d){return t(d,e.getContext())}).then(e.setContext).then(function(){l||(c=r(e).subscribe({next:a.next.bind(a),error:a.error.bind(a),complete:a.complete.bind(a)}))}).catch(a.error.bind(a)),function(){l=!0,c&&c.unsubscribe()}})})}const Qr=async()=>{const t="https://auth.australia-southeast1.gcp.commercetools.com/oauth/token",o="Basic "+btoa(encodeURIComponent("tfegsSBVOYnR7e_yE-AjxVVN")+":"+encodeURIComponent("pyKWgHuTxuMwDygh9JH1ehLEaLvAhBo4"));try{const a=await E.post(t,new URLSearchParams({grant_type:"client_credentials"}),{headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:o}});return a.status===200&&a.data.access_token?a.data.access_token:(console.error("Failed to fetch token:",a.data),null)}catch(a){return E.isAxiosError(a)?console.error("Error fetching token:",a.response||a.message):console.error("Unexpected error:",a),null}},Zr="https://api.australia-southeast1.gcp.commercetools.com/kt-demo/graphql",to=Mt.createHttpLink({uri:`${Zr}`}),eo=Xr(async(t,{headers:e})=>{const r=await Qr();return{headers:{...e,authorization:`Bearer ${r}`}}}),ro=new Mt.ApolloClient({link:eo.concat(to),cache:new Mt.InMemoryCache,defaultOptions:{watchQuery:{fetchPolicy:"cache-and-network"}}}),oo=t=>{const{tanyaConfig:e}=t;return n.jsx(Mt.ApolloProvider,{client:ro,children:n.jsx(pr,{children:n.jsx(jr,{tanyaConfig:e})})})};exports.TanyaChatbot=oo;exports.TanyaChatbotProvider=ir;
17
17
  //# sourceMappingURL=tanya-chatbot.cjs.js.map