@gauravrathod674/super-customizable-chatbot 0.5.6 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*,: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}.prose{color:var(--tw-prose-body);max-width:65ch}.prose :where(p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where([class~=lead]):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-lead);font-size:1.25em;line-height:1.6;margin-top:1.2em;margin-bottom:1.2em}.prose :where(a):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-links);text-decoration:underline;font-weight:500}.prose :where(strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-bold);font-weight:600}.prose :where(a strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(blockquote strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(thead th strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal;margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em}.prose :where(ol[type=A]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=A s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=I]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type=I s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type="1"]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal}.prose :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:disc;margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{font-weight:400;color:var(--tw-prose-counters)}.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{color:var(--tw-prose-bullets)}.prose :where(dt):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;margin-top:1.25em}.prose :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)){border-color:var(--tw-prose-hr);border-top-width:1px;margin-top:3em;margin-bottom:3em}.prose :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:500;font-style:italic;color:var(--tw-prose-quotes);border-inline-start-width:.25rem;border-inline-start-color:var(--tw-prose-quote-borders);quotes:"“""”""‘""’";margin-top:1.6em;margin-bottom:1.6em;padding-inline-start:1em}.prose :where(blockquote p:first-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:open-quote}.prose :where(blockquote p:last-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:close-quote}.prose :where(h1):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:800;font-size:2.25em;margin-top:0;margin-bottom:.8888889em;line-height:1.1111111}.prose :where(h1 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:900;color:inherit}.prose :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:700;font-size:1.5em;margin-top:2em;margin-bottom:1em;line-height:1.3333333}.prose :where(h2 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:800;color:inherit}.prose :where(h3):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;font-size:1.25em;margin-top:1.6em;margin-bottom:.6em;line-height:1.6}.prose :where(h3 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:700;color:inherit}.prose :where(h4):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;margin-top:1.5em;margin-bottom:.5em;line-height:1.5}.prose :where(h4 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:700;color:inherit}.prose :where(img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(picture):not(:where([class~=not-prose],[class~=not-prose] *)){display:block;margin-top:2em;margin-bottom:2em}.prose :where(video):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:500;font-family:inherit;color:var(--tw-prose-kbd);box-shadow:0 0 0 1px rgb(var(--tw-prose-kbd-shadows) / 10%),0 3px rgb(var(--tw-prose-kbd-shadows) / 10%);font-size:.875em;border-radius:.3125rem;padding-top:.1875em;padding-inline-end:.375em;padding-bottom:.1875em;padding-inline-start:.375em}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-code);font-weight:600;font-size:.875em}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:"`"}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:"`"}.prose :where(a code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(h1 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(h2 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.875em}.prose :where(h3 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.9em}.prose :where(h4 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(blockquote code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(thead th code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-pre-code);background-color:var(--tw-prose-pre-bg);overflow-x:auto;font-weight:400;font-size:.875em;line-height:1.7142857;margin-top:1.7142857em;margin-bottom:1.7142857em;border-radius:.375rem;padding-top:.8571429em;padding-inline-end:1.1428571em;padding-bottom:.8571429em;padding-inline-start:1.1428571em}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)){background-color:transparent;border-width:0;border-radius:0;padding:0;font-weight:inherit;color:inherit;font-size:inherit;font-family:inherit;line-height:inherit}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:none}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:none}.prose :where(table):not(:where([class~=not-prose],[class~=not-prose] *)){width:100%;table-layout:auto;margin-top:2em;margin-bottom:2em;font-size:.875em;line-height:1.7142857}.prose :where(thead):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-th-borders)}.prose :where(thead th):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;vertical-align:bottom;padding-inline-end:.5714286em;padding-bottom:.5714286em;padding-inline-start:.5714286em}.prose :where(tbody tr):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-td-borders)}.prose :where(tbody tr:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:0}.prose :where(tbody td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:baseline}.prose :where(tfoot):not(:where([class~=not-prose],[class~=not-prose] *)){border-top-width:1px;border-top-color:var(--tw-prose-th-borders)}.prose :where(tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:top}.prose :where(th,td):not(:where([class~=not-prose],[class~=not-prose] *)){text-align:start}.prose :where(figure>*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(figcaption):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-captions);font-size:.875em;line-height:1.4285714;margin-top:.8571429em}.prose{--tw-prose-body: #374151;--tw-prose-headings: #111827;--tw-prose-lead: #4b5563;--tw-prose-links: #111827;--tw-prose-bold: #111827;--tw-prose-counters: #6b7280;--tw-prose-bullets: #d1d5db;--tw-prose-hr: #e5e7eb;--tw-prose-quotes: #111827;--tw-prose-quote-borders: #e5e7eb;--tw-prose-captions: #6b7280;--tw-prose-kbd: #111827;--tw-prose-kbd-shadows: 17 24 39;--tw-prose-code: #111827;--tw-prose-pre-code: #e5e7eb;--tw-prose-pre-bg: #1f2937;--tw-prose-th-borders: #d1d5db;--tw-prose-td-borders: #e5e7eb;--tw-prose-invert-body: #d1d5db;--tw-prose-invert-headings: #fff;--tw-prose-invert-lead: #9ca3af;--tw-prose-invert-links: #fff;--tw-prose-invert-bold: #fff;--tw-prose-invert-counters: #9ca3af;--tw-prose-invert-bullets: #4b5563;--tw-prose-invert-hr: #374151;--tw-prose-invert-quotes: #f3f4f6;--tw-prose-invert-quote-borders: #374151;--tw-prose-invert-captions: #9ca3af;--tw-prose-invert-kbd: #fff;--tw-prose-invert-kbd-shadows: 255 255 255;--tw-prose-invert-code: #fff;--tw-prose-invert-pre-code: #d1d5db;--tw-prose-invert-pre-bg: rgb(0 0 0 / 50%);--tw-prose-invert-th-borders: #4b5563;--tw-prose-invert-td-borders: #374151;font-size:1rem;line-height:1.75}.prose :where(picture>img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(li):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;margin-bottom:.5em}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.375em}.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.375em}.prose :where(.prose>ul>li p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(.prose>ul>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ul>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(.prose>ol>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ol>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(ul ul,ul ol,ol ul,ol ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(dl):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where(dd):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;padding-inline-start:1.625em}.prose :where(hr+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(h2+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(h3+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(h4+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(thead th:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(thead th:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(tbody td,tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){padding-top:.5714286em;padding-inline-end:.5714286em;padding-bottom:.5714286em;padding-inline-start:.5714286em}.prose :where(tbody td:first-child,tfoot td:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(tbody td:last-child,tfoot td:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(figure):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(.prose>:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(.prose>:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:0}.prose-sm{font-size:.875rem;line-height:1.7142857}.prose-sm :where(p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em;margin-bottom:1.1428571em}.prose-sm :where([class~=lead]):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:1.2857143em;line-height:1.5555556;margin-top:.8888889em;margin-bottom:.8888889em}.prose-sm :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.3333333em;margin-bottom:1.3333333em;padding-inline-start:1.1111111em}.prose-sm :where(h1):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:2.1428571em;margin-top:0;margin-bottom:.8em;line-height:1.2}.prose-sm :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:1.4285714em;margin-top:1.6em;margin-bottom:.8em;line-height:1.4}.prose-sm :where(h3):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:1.2857143em;margin-top:1.5555556em;margin-bottom:.4444444em;line-height:1.5555556}.prose-sm :where(h4):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.4285714em;margin-bottom:.5714286em;line-height:1.4285714}.prose-sm :where(img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.7142857em;margin-bottom:1.7142857em}.prose-sm :where(picture):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.7142857em;margin-bottom:1.7142857em}.prose-sm :where(picture>img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose-sm :where(video):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.7142857em;margin-bottom:1.7142857em}.prose-sm :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em;border-radius:.3125rem;padding-top:.1428571em;padding-inline-end:.3571429em;padding-bottom:.1428571em;padding-inline-start:.3571429em}.prose-sm :where(code):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em}.prose-sm :where(h2 code):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.9em}.prose-sm :where(h3 code):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8888889em}.prose-sm :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em;line-height:1.6666667;margin-top:1.6666667em;margin-bottom:1.6666667em;border-radius:.25rem;padding-top:.6666667em;padding-inline-end:1em;padding-bottom:.6666667em;padding-inline-start:1em}.prose-sm :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em;margin-bottom:1.1428571em;padding-inline-start:1.5714286em}.prose-sm :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em;margin-bottom:1.1428571em;padding-inline-start:1.5714286em}.prose-sm :where(li):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.2857143em;margin-bottom:.2857143em}.prose-sm :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.4285714em}.prose-sm :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.4285714em}.prose-sm :where(.prose-sm>ul>li p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5714286em;margin-bottom:.5714286em}.prose-sm :where(.prose-sm>ul>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em}.prose-sm :where(.prose-sm>ul>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.1428571em}.prose-sm :where(.prose-sm>ol>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em}.prose-sm :where(.prose-sm>ol>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.1428571em}.prose-sm :where(ul ul,ul ol,ol ul,ol ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5714286em;margin-bottom:.5714286em}.prose-sm :where(dl):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em;margin-bottom:1.1428571em}.prose-sm :where(dt):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.1428571em}.prose-sm :where(dd):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.2857143em;padding-inline-start:1.5714286em}.prose-sm :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2.8571429em;margin-bottom:2.8571429em}.prose-sm :where(hr+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose-sm :where(h2+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose-sm :where(h3+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose-sm :where(h4+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose-sm :where(table):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em;line-height:1.5}.prose-sm :where(thead th):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:1em;padding-bottom:.6666667em;padding-inline-start:1em}.prose-sm :where(thead th:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose-sm :where(thead th:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose-sm :where(tbody td,tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){padding-top:.6666667em;padding-inline-end:1em;padding-bottom:.6666667em;padding-inline-start:1em}.prose-sm :where(tbody td:first-child,tfoot td:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose-sm :where(tbody td:last-child,tfoot td:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose-sm :where(figure):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.7142857em;margin-bottom:1.7142857em}.prose-sm :where(figure>*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose-sm :where(figcaption):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.8571429em;line-height:1.3333333;margin-top:.6666667em}.prose-sm :where(.prose-sm>:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose-sm :where(.prose-sm>:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:0}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.-left-1\/2{left:-50%}.-top-1\/2{top:-50%}.bottom-10{bottom:2.5rem}.bottom-5{bottom:1.25rem}.left-1\/2{left:50%}.left-5{left:1.25rem}.right-1{right:.25rem}.right-10{right:2.5rem}.right-5{right:1.25rem}.top-1{top:.25rem}.top-1\/2{top:50%}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.mx-auto{margin-left:auto;margin-right:auto}.mb-1{margin-bottom:.25rem}.mb-12{margin-bottom:3rem}.mb-2{margin-bottom:.5rem}.ml-auto{margin-left:auto}.mr-auto{margin-right:auto}.mt-4{margin-top:1rem}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.h-10{height:2.5rem}.h-12{height:3rem}.h-2{height:.5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-\[200\%\]{height:200%}.h-auto{height:auto}.h-full{height:100%}.h-screen{height:100vh}.w-10{width:2.5rem}.w-12{width:3rem}.w-2{width:.5rem}.w-3{width:.75rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-\[200\%\]{width:200%}.w-full{width:100%}.min-w-0{min-width:0px}.max-w-2xl{max-width:42rem}.max-w-6xl{max-width:72rem}.max-w-\[200px\]{max-width:200px}.max-w-\[85\%\]{max-width:85%}.max-w-full{max-width:100%}.max-w-none{max-width:none}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x: -50%;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-1\/2{--tw-translate-y: -50%;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}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-8{gap:2rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.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))}.self-end{align-self:flex-end}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.rounded-bl-none{border-bottom-left-radius:0}.rounded-br-none{border-bottom-right-radius:0}.border{border-width:1px}.border-2{border-width:2px}.border-t{border-top-width:1px}.border-\[--chatbot-input-border-color\]{border-color:var(--chatbot-input-border-color)}.border-blue-500\/20{border-color:#3b82f633}.border-white\/50{border-color:#ffffff80}.bg-\[--chatbot-bot-msg-bg\]{background-color:var(--chatbot-bot-msg-bg)}.bg-\[--chatbot-user-msg-bg\]{background-color:var(--chatbot-user-msg-bg)}.bg-black\/10{background-color:#0000001a}.bg-black\/20{background-color:#0003}.bg-black\/50{background-color:#00000080}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-slate-900\/70{background-color:#0f172ab3}.bg-slate-950{--tw-bg-opacity: 1;background-color:rgb(2 6 23 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white\/30{background-color:#ffffff4d}.bg-\[radial-gradient\(circle_at_center\,rgba\(139\,92\,246\,0\.3\)_0\,rgba\(139\,92\,246\,0\)_50\%\)\]{background-image:radial-gradient(circle at center,#8b5cf64d 0,#8b5cf600 50%)}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-blue-400{--tw-gradient-from: #60a5fa var(--tw-gradient-from-position);--tw-gradient-to: rgb(96 165 250 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-violet-500{--tw-gradient-to: #8b5cf6 var(--tw-gradient-to-position)}.to-violet-600{--tw-gradient-to: #7c3aed var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.object-cover{-o-object-fit:cover;object-fit:cover}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.pr-6{padding-right:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-5xl{font-size:3rem;line-height:1}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.text-\[--chatbot-input-text-color\]{color:var(--chatbot-input-text-color)}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-inherit{color:inherit}.text-slate-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-white\/70{color:#ffffffb3}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px 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-slate-950\/50{--tw-shadow-color: rgb(2 6 23 / .5);--tw-shadow: var(--tw-shadow-colored)}.ring{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.blur{--tw-blur: blur(8px);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)}.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)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}.\[animation-delay\:-0\.15s\]{animation-delay:-.15s}.\[animation-delay\:-0\.3s\]{animation-delay:-.3s}.\[mask-image\:linear-gradient\(0deg\,\#000\,rgba\(0\,0\,0\,0\.6\)\)\]{-webkit-mask-image:linear-gradient(0deg,#000,rgba(0,0,0,.6));mask-image:linear-gradient(0deg,#000,#0009)}:root{font-family:system-ui,Avenir,Helvetica,Arial,sans-serif;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;display:flex;place-items:center;min-width:320px;min-height:100vh}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;background-color:#1a1a1a;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\:-translate-y-1:hover{--tw-translate-y: -.25rem;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\:border-blue-400\/50:hover{border-color:#60a5fa80}.hover\:bg-black\/70:hover{background-color:#000000b3}.hover\:bg-slate-900:hover{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.hover\:bg-white\/20:hover{background-color:#fff3}.hover\:shadow-xl:hover{--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)}.hover\:shadow-violet-500\/20:hover{--tw-shadow-color: rgb(139 92 246 / .2);--tw-shadow: var(--tw-shadow-colored)}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-\[--chatbot-launcher-bg\]:focus-visible{--tw-ring-color: var(--chatbot-launcher-bg)}.focus-visible\:ring-white:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(255 255 255 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.prose-headings\:my-2 :is(:where(h1,h2,h3,h4,h5,h6,th):not(:where([class~=not-prose],[class~=not-prose] *))){margin-top:.5rem;margin-bottom:.5rem}.prose-p\:my-0 :is(:where(p):not(:where([class~=not-prose],[class~=not-prose] *))){margin-top:0;margin-bottom:0}.prose-ul\:my-1 :is(:where(ul):not(:where([class~=not-prose],[class~=not-prose] *))){margin-top:.25rem;margin-bottom:.25rem}.prose-li\:my-0\.5 :is(:where(li):not(:where([class~=not-prose],[class~=not-prose] *))){margin-top:.125rem;margin-bottom:.125rem}@media (min-width: 768px){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:text-6xl{font-size:3.75rem;line-height:1}}@media (min-width: 1024px){.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}
|
|
@@ -0,0 +1,978 @@
|
|
|
1
|
+
import { jsx as t, jsxs as u, Fragment as He } from "react/jsx-runtime";
|
|
2
|
+
import { useState as R, useRef as j, useMemo as S, useEffect as $, useCallback as Te } from "react";
|
|
3
|
+
import { AnimatePresence as V, motion as x } from "framer-motion";
|
|
4
|
+
import { FontAwesomeIcon as B } from "@fortawesome/react-fontawesome";
|
|
5
|
+
import { faCommentDots as Ge, faFileAlt as Ie, faPaperclip as qe, faMicrophoneSlash as Ve, faMicrophone as _e, faTimes as Ye } from "@fortawesome/free-solid-svg-icons";
|
|
6
|
+
import { GoogleGenerativeAI as Ze } from "@google/generative-ai";
|
|
7
|
+
import Xe from "openai";
|
|
8
|
+
import Je from "@anthropic-ai/sdk";
|
|
9
|
+
import Ke from "groq-sdk";
|
|
10
|
+
import F from "react-markdown";
|
|
11
|
+
const se = (n) => new Promise((c, h) => {
|
|
12
|
+
const a = new FileReader();
|
|
13
|
+
a.readAsDataURL(n), a.onload = () => c(a.result.split(",")[1]), a.onerror = (g) => h(g);
|
|
14
|
+
}), Qe = () => /* @__PURE__ */ u(
|
|
15
|
+
"svg",
|
|
16
|
+
{
|
|
17
|
+
viewBox: "0 0 24 24",
|
|
18
|
+
fill: "none",
|
|
19
|
+
stroke: "currentColor",
|
|
20
|
+
strokeWidth: "1.5",
|
|
21
|
+
className: "w-full h-full",
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ t("path", { d: "M12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4Z" }),
|
|
24
|
+
/* @__PURE__ */ t(
|
|
25
|
+
"path",
|
|
26
|
+
{
|
|
27
|
+
d: "M16.5 14C16.5 14 15 15.5 12 15.5C9 15.5 7.5 14 7.5 14",
|
|
28
|
+
strokeLinecap: "round"
|
|
29
|
+
}
|
|
30
|
+
),
|
|
31
|
+
/* @__PURE__ */ t("circle", { cx: "9", cy: "10", r: "1", fill: "currentColor" }),
|
|
32
|
+
/* @__PURE__ */ t("circle", { cx: "15", cy: "10", r: "1", fill: "currentColor" })
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
), et = () => /* @__PURE__ */ u(
|
|
36
|
+
"svg",
|
|
37
|
+
{
|
|
38
|
+
viewBox: "0 0 24 24",
|
|
39
|
+
fill: "none",
|
|
40
|
+
stroke: "currentColor",
|
|
41
|
+
strokeWidth: "1.5",
|
|
42
|
+
className: "w-full h-full",
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ t(
|
|
45
|
+
"path",
|
|
46
|
+
{
|
|
47
|
+
d: "M12 12C14.2091 12 16 10.2091 16 8C16 5.79086 14.2091 4 12 4C9.79086 4 8 5.79086 8 8C8 10.2091 9.79086 12 12 12Z",
|
|
48
|
+
strokeLinecap: "round"
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
/* @__PURE__ */ t(
|
|
52
|
+
"path",
|
|
53
|
+
{
|
|
54
|
+
d: "M19.21 17.14C19.21 17.14 19 19 12 19C5 19 4.79 17.14 4.79 17.14C4.79 17.14 6.33 15 12 15C17.67 15 19.21 17.14 19.21 17.14Z",
|
|
55
|
+
strokeLinecap: "round"
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
), tt = () => /* @__PURE__ */ u(
|
|
61
|
+
"svg",
|
|
62
|
+
{
|
|
63
|
+
fill: "none",
|
|
64
|
+
viewBox: "0 0 24 24",
|
|
65
|
+
strokeWidth: 1.5,
|
|
66
|
+
stroke: "currentColor",
|
|
67
|
+
className: "w-5 h-5",
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ t(
|
|
70
|
+
"path",
|
|
71
|
+
{
|
|
72
|
+
strokeLinecap: "round",
|
|
73
|
+
strokeLinejoin: "round",
|
|
74
|
+
d: "M6 12L3.269 3.126A59.768 59.768 0 0121.485 12 59.77 59.77 0 013.27 20.875L6 12z"
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
/* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 12h9" })
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
), ot = () => /* @__PURE__ */ u("div", { className: "flex items-center space-x-1 p-3", children: [
|
|
81
|
+
/* @__PURE__ */ t("div", { className: "w-2 h-2 bg-gray-400 rounded-full animate-pulse [animation-delay:-0.3s]" }),
|
|
82
|
+
/* @__PURE__ */ t("div", { className: "w-2 h-2 bg-gray-400 rounded-full animate-pulse [animation-delay:-0.15s]" }),
|
|
83
|
+
/* @__PURE__ */ t("div", { className: "w-2 h-2 bg-gray-400 rounded-full animate-pulse" })
|
|
84
|
+
] }), rt = ({ file: n, onRemove: c }) => {
|
|
85
|
+
const [h, a] = R(null);
|
|
86
|
+
return $(() => {
|
|
87
|
+
if (n && n.type.startsWith("image/")) {
|
|
88
|
+
const g = URL.createObjectURL(n);
|
|
89
|
+
return a(g), () => URL.revokeObjectURL(g);
|
|
90
|
+
}
|
|
91
|
+
a(null);
|
|
92
|
+
}, [n]), n ? /* @__PURE__ */ u("div", { className: "relative inline-flex items-center gap-2 p-2 mb-2 bg-[--chatbot-bot-msg-bg] rounded-lg border border-[--chatbot-input-border-color] max-w-xs", children: [
|
|
93
|
+
/* @__PURE__ */ t("div", { className: "flex-shrink-0 w-10 h-10 flex items-center justify-center bg-black/20 rounded-md", children: h ? /* @__PURE__ */ t(
|
|
94
|
+
"img",
|
|
95
|
+
{
|
|
96
|
+
src: h,
|
|
97
|
+
alt: n.name,
|
|
98
|
+
className: "w-full h-full object-cover rounded-md"
|
|
99
|
+
}
|
|
100
|
+
) : /* @__PURE__ */ t(B, { icon: Ie, className: "w-5 h-5 text-white/70" }) }),
|
|
101
|
+
/* @__PURE__ */ t("div", { className: "flex-1 min-w-0 pr-6", children: /* @__PURE__ */ t(
|
|
102
|
+
"p",
|
|
103
|
+
{
|
|
104
|
+
className: "text-sm font-medium text-[--chatbot-input-text-color] truncate",
|
|
105
|
+
title: n.name,
|
|
106
|
+
children: n.name
|
|
107
|
+
}
|
|
108
|
+
) }),
|
|
109
|
+
/* @__PURE__ */ t(
|
|
110
|
+
"button",
|
|
111
|
+
{
|
|
112
|
+
onClick: c,
|
|
113
|
+
"aria-label": "Remove file",
|
|
114
|
+
className: "absolute top-1 right-1 w-2 h-2 flex items-center justify-center rounded-full bg-black/50 text-white hover:bg-black/70 transition-colors",
|
|
115
|
+
children: /* @__PURE__ */ t(B, { icon: Ye, className: "w-3 h-3" })
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
] }) : null;
|
|
119
|
+
}, nt = ({ fullText: n, onComplete: c, components: h }) => {
|
|
120
|
+
const a = typeof n == "string" ? n : "", [g, l] = R("");
|
|
121
|
+
return $(() => {
|
|
122
|
+
if (a.length === 0) {
|
|
123
|
+
c == null || c();
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
let C = 0;
|
|
127
|
+
l("");
|
|
128
|
+
const m = setInterval(() => {
|
|
129
|
+
if (C < a.length) {
|
|
130
|
+
const v = a.charAt(C);
|
|
131
|
+
l((O) => O + v), C++;
|
|
132
|
+
} else
|
|
133
|
+
clearInterval(m), c == null || c();
|
|
134
|
+
}, 25);
|
|
135
|
+
return () => clearInterval(m);
|
|
136
|
+
}, [a, c]), /* @__PURE__ */ t(
|
|
137
|
+
"div",
|
|
138
|
+
{
|
|
139
|
+
className: "prose prose-sm max-w-none text-inherit prose-p:my-0 prose-headings:my-2 prose-ul:my-1 prose-li:my-0.5",
|
|
140
|
+
style: { color: "inherit" },
|
|
141
|
+
children: /* @__PURE__ */ t(F, { components: h, children: g || "" })
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
}, at = ({ text: n, animationType: c, components: h }) => {
|
|
145
|
+
const a = "prose prose-sm max-w-none text-inherit prose-p:my-0 prose-headings:my-2 prose-ul:my-1 prose-li:my-0.5";
|
|
146
|
+
switch (c) {
|
|
147
|
+
case "typing":
|
|
148
|
+
return /* @__PURE__ */ t(nt, { fullText: n, components: h });
|
|
149
|
+
case "fade-in":
|
|
150
|
+
return /* @__PURE__ */ t(
|
|
151
|
+
x.div,
|
|
152
|
+
{
|
|
153
|
+
initial: { opacity: 0, y: 10 },
|
|
154
|
+
animate: { opacity: 1, y: 0 },
|
|
155
|
+
transition: { duration: 1.5, ease: "easeOut" },
|
|
156
|
+
children: /* @__PURE__ */ t("div", { className: a, children: /* @__PURE__ */ t(F, { components: h, children: n }) })
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
case "slide-up":
|
|
160
|
+
return /* @__PURE__ */ t(
|
|
161
|
+
x.div,
|
|
162
|
+
{
|
|
163
|
+
initial: { y: 50, opacity: 0 },
|
|
164
|
+
animate: { y: 0, opacity: 1 },
|
|
165
|
+
transition: { duration: 0.7, ease: "anticipate" },
|
|
166
|
+
children: /* @__PURE__ */ t("div", { className: a, children: /* @__PURE__ */ t(F, { components: h, children: n }) })
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
case "zoom-in":
|
|
170
|
+
return /* @__PURE__ */ t(
|
|
171
|
+
x.div,
|
|
172
|
+
{
|
|
173
|
+
initial: { scale: 0.5, opacity: 0 },
|
|
174
|
+
animate: { scale: 1, opacity: 1 },
|
|
175
|
+
transition: { duration: 1, ease: "backOut" },
|
|
176
|
+
children: /* @__PURE__ */ t("div", { className: a, children: /* @__PURE__ */ t(F, { components: h, children: n }) })
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
case "flip":
|
|
180
|
+
return /* @__PURE__ */ t(
|
|
181
|
+
x.div,
|
|
182
|
+
{
|
|
183
|
+
initial: { rotateX: -90, opacity: 0 },
|
|
184
|
+
animate: { rotateX: 0, opacity: 1 },
|
|
185
|
+
transition: { duration: 1, ease: "easeOut" },
|
|
186
|
+
style: { transformPerspective: 400 },
|
|
187
|
+
children: /* @__PURE__ */ t("div", { className: a, children: /* @__PURE__ */ t(F, { components: h, children: n }) })
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
default:
|
|
191
|
+
return /* @__PURE__ */ t("div", { className: a, children: /* @__PURE__ */ t(F, { components: h, children: n }) });
|
|
192
|
+
}
|
|
193
|
+
}, st = (n) => {
|
|
194
|
+
const c = [];
|
|
195
|
+
if (!n || n.length === 0)
|
|
196
|
+
return c;
|
|
197
|
+
let a = n.reduce((l, C) => {
|
|
198
|
+
const m = l.length > 0 ? l[l.length - 1] : null;
|
|
199
|
+
if (m && m.sender === C.sender) {
|
|
200
|
+
const v = {
|
|
201
|
+
...m,
|
|
202
|
+
text: `${m.text}
|
|
203
|
+
${C.text}`
|
|
204
|
+
};
|
|
205
|
+
l[l.length - 1] = v;
|
|
206
|
+
} else
|
|
207
|
+
l.push({ ...C });
|
|
208
|
+
return l;
|
|
209
|
+
}, []).map((l) => ({
|
|
210
|
+
role: l.sender === "bot" ? "model" : "user",
|
|
211
|
+
parts: [{ text: l.text }]
|
|
212
|
+
}));
|
|
213
|
+
const g = a.findIndex((l) => l.role === "user");
|
|
214
|
+
if (g > -1)
|
|
215
|
+
a = a.slice(g);
|
|
216
|
+
else
|
|
217
|
+
return [];
|
|
218
|
+
return a;
|
|
219
|
+
}, gt = ({
|
|
220
|
+
botName: n = "ChatBot",
|
|
221
|
+
botAvatar: c = /* @__PURE__ */ t(Qe, {}),
|
|
222
|
+
userAvatar: h = /* @__PURE__ */ t(et, {}),
|
|
223
|
+
welcomeMessage: a = "Hello! How can I help?",
|
|
224
|
+
placeholderText: g = "Type a message...",
|
|
225
|
+
customInstruction: l = "",
|
|
226
|
+
isOpen: C = !1,
|
|
227
|
+
disabled: m = !1,
|
|
228
|
+
isTyping: v = !1,
|
|
229
|
+
onSend: O = () => {
|
|
230
|
+
},
|
|
231
|
+
theme: k = {},
|
|
232
|
+
geminiApiKey: _,
|
|
233
|
+
geminiModelName: ie = "gemini-1.5-flash",
|
|
234
|
+
openaiApiKey: Y,
|
|
235
|
+
openaiModelName: le = "gpt-4o-mini",
|
|
236
|
+
anthropicApiKey: Z,
|
|
237
|
+
anthropicModelName: ce = "claude-3-haiku-20240307",
|
|
238
|
+
grokApiKey: X,
|
|
239
|
+
grokModelName: de = "llama3-8b-8192",
|
|
240
|
+
messages: ue,
|
|
241
|
+
enableMicrophone: Se,
|
|
242
|
+
enableFileUpload: Be = !1,
|
|
243
|
+
fileUploadAccept: Fe = "*",
|
|
244
|
+
onFileUpload: Le = () => {
|
|
245
|
+
}
|
|
246
|
+
}) => {
|
|
247
|
+
const [w] = R(
|
|
248
|
+
() => `chatbot-instance-${Math.random().toString(36).substring(2, 9)}`
|
|
249
|
+
), [I, P] = R(C), [Me, je] = R(() => a ? [{ id: 1, text: a, sender: "bot" }] : []), [L, U] = R(""), [D, W] = R(!1), [J, he] = R(!1), [f, E] = R(null), H = typeof ue < "u", T = H ? ue : Me, K = H ? () => {
|
|
250
|
+
} : je, Q = j(null), be = j(null), me = j(null), ze = j(null), fe = j(null), z = j(null), ee = S(() => {
|
|
251
|
+
if (!_) return null;
|
|
252
|
+
try {
|
|
253
|
+
return new Ze(_).getGenerativeModel({
|
|
254
|
+
model: ie,
|
|
255
|
+
systemInstruction: l
|
|
256
|
+
});
|
|
257
|
+
} catch (e) {
|
|
258
|
+
return console.error("Failed to initialize Gemini:", e), null;
|
|
259
|
+
}
|
|
260
|
+
}, [_, ie, l]), te = S(() => Y ? new Xe({ apiKey: Y, dangerouslyAllowBrowser: !0 }) : null, [Y]), oe = S(() => Z ? new Je({
|
|
261
|
+
apiKey: Z,
|
|
262
|
+
dangerouslyAllowBrowser: !0
|
|
263
|
+
}) : null, [Z]), re = S(() => X ? new Ke({ apiKey: X, dangerouslyAllowBrowser: !0 }) : null, [X]), o = S(() => {
|
|
264
|
+
var s;
|
|
265
|
+
const e = ((s = k == null ? void 0 : k.window) == null ? void 0 : s.placement) === "center", r = {
|
|
266
|
+
launcher: {
|
|
267
|
+
backgroundColor: "#4f46e5",
|
|
268
|
+
iconColor: "#ffffff",
|
|
269
|
+
size: "3.5rem"
|
|
270
|
+
},
|
|
271
|
+
header: {
|
|
272
|
+
backgroundColor: "#4f46e5",
|
|
273
|
+
textColor: "#ffffff",
|
|
274
|
+
fontFamily: "inherit",
|
|
275
|
+
fontWeight: "600"
|
|
276
|
+
},
|
|
277
|
+
messages: {
|
|
278
|
+
userBackgroundColor: "#4f46e5",
|
|
279
|
+
userTextColor: "#ffffff",
|
|
280
|
+
botBackgroundColor: "#f3f4f6",
|
|
281
|
+
botTextColor: "#1f2937",
|
|
282
|
+
fontFamily: "inherit",
|
|
283
|
+
fontSize: "0.9rem",
|
|
284
|
+
showAvatars: !0,
|
|
285
|
+
bubbleShape: "rounded",
|
|
286
|
+
bubblePointer: !0,
|
|
287
|
+
animation: "fade-in",
|
|
288
|
+
markdownStyles: {}
|
|
289
|
+
},
|
|
290
|
+
input: {
|
|
291
|
+
backgroundColor: "#ffffff",
|
|
292
|
+
textColor: "#1f2937",
|
|
293
|
+
placeholderTextColor: "#9ca3af",
|
|
294
|
+
borderColor: "#e5e7eb",
|
|
295
|
+
focusRingColor: "#4f46e5"
|
|
296
|
+
},
|
|
297
|
+
window: {
|
|
298
|
+
backgroundColor: "#ffffff",
|
|
299
|
+
borderColor: "#e5e7eb",
|
|
300
|
+
borderRadius: "0.75rem",
|
|
301
|
+
width: e ? "80vw" : "22rem",
|
|
302
|
+
height: e ? "80vh" : "30rem",
|
|
303
|
+
placement: "bottom-right",
|
|
304
|
+
backdrop: !1,
|
|
305
|
+
backdropColor: "rgba(0, 0, 0, 0.4)",
|
|
306
|
+
backdropBlur: "4px",
|
|
307
|
+
scrollbarThumbColor: "#a1a1aa",
|
|
308
|
+
// neutral-400
|
|
309
|
+
scrollbarTrackColor: "#f1f5f9"
|
|
310
|
+
// slate-100
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
return {
|
|
314
|
+
launcher: { ...r.launcher, ...k.launcher },
|
|
315
|
+
header: { ...r.header, ...k.header },
|
|
316
|
+
messages: { ...r.messages, ...k.messages },
|
|
317
|
+
input: { ...r.input, ...k.input },
|
|
318
|
+
window: { ...r.window, ...k.window }
|
|
319
|
+
};
|
|
320
|
+
}, [k]), Ae = S(
|
|
321
|
+
() => ({
|
|
322
|
+
// Launcher
|
|
323
|
+
"--chatbot-launcher-bg": o.launcher.backgroundColor,
|
|
324
|
+
"--chatbot-launcher-icon-color": o.launcher.iconColor,
|
|
325
|
+
"--chatbot-launcher-size": o.launcher.size,
|
|
326
|
+
// Header
|
|
327
|
+
"--chatbot-header-bg": o.header.backgroundColor,
|
|
328
|
+
"--chatbot-header-text-color": o.header.textColor,
|
|
329
|
+
"--chatbot-header-font-family": o.header.fontFamily,
|
|
330
|
+
"--chatbot-header-font-weight": o.header.fontWeight,
|
|
331
|
+
// Messages
|
|
332
|
+
"--chatbot-user-msg-bg": o.messages.userBackgroundColor,
|
|
333
|
+
"--chatbot-user-msg-text-color": o.messages.userTextColor,
|
|
334
|
+
"--chatbot-bot-msg-bg": o.messages.botBackgroundColor,
|
|
335
|
+
"--chatbot-bot-msg-text-color": o.messages.botTextColor,
|
|
336
|
+
"--chatbot-msg-font-family": o.messages.fontFamily,
|
|
337
|
+
"--chatbot-msg-font-size": o.messages.fontSize,
|
|
338
|
+
// Input
|
|
339
|
+
"--chatbot-input-bg": o.input.backgroundColor,
|
|
340
|
+
"--chatbot-input-text-color": o.input.textColor,
|
|
341
|
+
"--chatbot-input-placeholder-color": o.input.placeholderTextColor,
|
|
342
|
+
"--chatbot-input-border-color": o.input.borderColor,
|
|
343
|
+
"--chatbot-input-focus-ring": o.input.focusRingColor,
|
|
344
|
+
// Window
|
|
345
|
+
"--chatbot-window-bg": o.window.backgroundColor,
|
|
346
|
+
"--chatbot-window-border-color": o.window.borderColor,
|
|
347
|
+
"--chatbot-window-border-radius": o.window.borderRadius,
|
|
348
|
+
"--chatbot-window-width": o.window.width,
|
|
349
|
+
"--chatbot-window-height": o.window.height
|
|
350
|
+
}),
|
|
351
|
+
[o]
|
|
352
|
+
), pe = S(() => {
|
|
353
|
+
const e = o.messages.markdownStyles || {};
|
|
354
|
+
return {
|
|
355
|
+
strong: ({ node: r, ...s }) => /* @__PURE__ */ t("strong", { style: { color: e.boldColor || "inherit" }, ...s }),
|
|
356
|
+
em: ({ node: r, ...s }) => /* @__PURE__ */ t("em", { style: { color: e.italicColor || "inherit" }, ...s }),
|
|
357
|
+
a: ({ node: r, ...s }) => /* @__PURE__ */ t("a", { style: { color: e.linkColor || "#3b82f6" }, ...s }),
|
|
358
|
+
code: ({ node: r, ...s }) => /* @__PURE__ */ t(
|
|
359
|
+
"code",
|
|
360
|
+
{
|
|
361
|
+
style: {
|
|
362
|
+
color: e.codeColor || "inherit",
|
|
363
|
+
backgroundColor: e.codeBackgroundColor || "rgba(0, 0, 0, 0.1)",
|
|
364
|
+
padding: "0.1rem 0.3rem",
|
|
365
|
+
borderRadius: "0.25rem"
|
|
366
|
+
},
|
|
367
|
+
...s
|
|
368
|
+
}
|
|
369
|
+
)
|
|
370
|
+
};
|
|
371
|
+
}, [o.messages.markdownStyles]);
|
|
372
|
+
$(() => {
|
|
373
|
+
const e = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
374
|
+
if (e) {
|
|
375
|
+
const r = new e();
|
|
376
|
+
r.continuous = !0, r.interimResults = !1, r.lang = "en-US", r.onstart = () => he(!0), r.onresult = (s) => {
|
|
377
|
+
const i = s.results[s.results.length - 1][0].transcript;
|
|
378
|
+
U((d) => d + (d ? " " : "") + i);
|
|
379
|
+
}, r.onerror = (s) => {
|
|
380
|
+
console.error("Speech error:", s);
|
|
381
|
+
}, r.onend = () => {
|
|
382
|
+
}, z.current = r;
|
|
383
|
+
}
|
|
384
|
+
}, []), $(() => {
|
|
385
|
+
var d;
|
|
386
|
+
const e = o.window.scrollbarThumbColor, r = o.window.scrollbarTrackColor, s = `scrollbar-style-${w}`;
|
|
387
|
+
(d = document.getElementById(s)) == null || d.remove();
|
|
388
|
+
const i = document.createElement("style");
|
|
389
|
+
return i.id = s, i.innerHTML = `
|
|
390
|
+
/* Target both the message list and the textarea input */
|
|
391
|
+
#${w} .chatbot-message-list,
|
|
392
|
+
#${w} .chatbot-textarea-input {
|
|
393
|
+
scrollbar-width: thin;
|
|
394
|
+
scrollbar-color: ${e} ${r};
|
|
395
|
+
}
|
|
396
|
+
/* WebKit-based browsers (Chrome, Safari, Edge) */
|
|
397
|
+
#${w} .chatbot-message-list::-webkit-scrollbar,
|
|
398
|
+
#${w} .chatbot-textarea-input::-webkit-scrollbar {
|
|
399
|
+
width: 8px;
|
|
400
|
+
}
|
|
401
|
+
#${w} .chatbot-message-list::-webkit-scrollbar-track,
|
|
402
|
+
#${w} .chatbot-textarea-input::-webkit-scrollbar-track {
|
|
403
|
+
background: ${r};
|
|
404
|
+
border-radius: 4px;
|
|
405
|
+
}
|
|
406
|
+
#${w} .chatbot-message-list::-webkit-scrollbar-thumb,
|
|
407
|
+
#${w} .chatbot-textarea-input::-webkit-scrollbar-thumb {
|
|
408
|
+
background-color: ${e};
|
|
409
|
+
border-radius: 4px;
|
|
410
|
+
border: 2px solid ${r};
|
|
411
|
+
}
|
|
412
|
+
`, document.head.appendChild(i), () => {
|
|
413
|
+
var A;
|
|
414
|
+
(A = document.getElementById(s)) == null || A.remove();
|
|
415
|
+
};
|
|
416
|
+
}, [
|
|
417
|
+
w,
|
|
418
|
+
o.window.scrollbarThumbColor,
|
|
419
|
+
o.window.scrollbarTrackColor
|
|
420
|
+
]), $(() => {
|
|
421
|
+
W(v);
|
|
422
|
+
}, [v]), $(() => {
|
|
423
|
+
var e;
|
|
424
|
+
(e = be.current) == null || e.scrollIntoView({ behavior: "smooth" });
|
|
425
|
+
}, [T, D, v]), $(() => {
|
|
426
|
+
var e, r;
|
|
427
|
+
I ? (e = Q.current) == null || e.focus() : (r = me.current) == null || r.focus();
|
|
428
|
+
}, [I]), $(() => {
|
|
429
|
+
const e = (r) => {
|
|
430
|
+
r.key === "Escape" && I && P(!1);
|
|
431
|
+
};
|
|
432
|
+
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
433
|
+
}, [I]), $(() => {
|
|
434
|
+
const e = Q.current;
|
|
435
|
+
if (!e) return;
|
|
436
|
+
e.style.height = "auto", e.style.height = `${e.scrollHeight}px`;
|
|
437
|
+
const s = e.scrollHeight - e.clientHeight > 4;
|
|
438
|
+
e.style.overflowY = s ? "auto" : "hidden";
|
|
439
|
+
}, [L]);
|
|
440
|
+
const ne = Te(async () => {
|
|
441
|
+
var A, we, ye, xe, ve, Ce, ke, Ne, Re, $e;
|
|
442
|
+
const e = L.trim();
|
|
443
|
+
if (!e && !f || m || D || v)
|
|
444
|
+
return;
|
|
445
|
+
const r = f ? {
|
|
446
|
+
name: f.name,
|
|
447
|
+
type: f.type,
|
|
448
|
+
size: f.size,
|
|
449
|
+
// Create a temporary URL for rendering in the message list.
|
|
450
|
+
// This URL is valid for the current browser session.
|
|
451
|
+
previewUrl: f.type.startsWith("image/") ? URL.createObjectURL(f) : null
|
|
452
|
+
} : null, s = {
|
|
453
|
+
id: `user-${Date.now()}`,
|
|
454
|
+
text: e,
|
|
455
|
+
sender: "user",
|
|
456
|
+
// Attach file metadata to the message for potential future use (not displayed).
|
|
457
|
+
attachment: r
|
|
458
|
+
};
|
|
459
|
+
H || K((b) => [...b, s]), O(e, f), U(""), W(!0);
|
|
460
|
+
const i = f;
|
|
461
|
+
E(null);
|
|
462
|
+
let d = "Sorry, an error occurred. Please check the console for details.";
|
|
463
|
+
try {
|
|
464
|
+
if (ee) {
|
|
465
|
+
const b = ee.startChat({
|
|
466
|
+
history: st(T)
|
|
467
|
+
}), p = [e];
|
|
468
|
+
if (i) {
|
|
469
|
+
const y = await se(i);
|
|
470
|
+
p.push({
|
|
471
|
+
inlineData: {
|
|
472
|
+
data: y,
|
|
473
|
+
mimeType: i.type
|
|
474
|
+
}
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
d = await (await (await b.sendMessage(p)).response).text() || "(no response from Gemini)";
|
|
478
|
+
} else if (te) {
|
|
479
|
+
const b = T.map((y) => ({
|
|
480
|
+
role: y.sender === "bot" ? "assistant" : "user",
|
|
481
|
+
content: y.text
|
|
482
|
+
})), p = [{ type: "text", text: e }];
|
|
483
|
+
if (i && i.type.startsWith("image/")) {
|
|
484
|
+
const y = await se(i);
|
|
485
|
+
p.push({
|
|
486
|
+
type: "image_url",
|
|
487
|
+
image_url: { url: `data:${i.type};base64,${y}` }
|
|
488
|
+
});
|
|
489
|
+
} else i && (console.warn(
|
|
490
|
+
"OpenAI integration currently only supports image files. File was ignored."
|
|
491
|
+
), d = "Note: The attached file was not an image and was ignored. ");
|
|
492
|
+
const N = ((xe = (ye = (we = (A = (await te.chat.completions.create({
|
|
493
|
+
model: le,
|
|
494
|
+
messages: [
|
|
495
|
+
...b,
|
|
496
|
+
{ role: "user", content: p }
|
|
497
|
+
]
|
|
498
|
+
})).choices) == null ? void 0 : A[0]) == null ? void 0 : we.message) == null ? void 0 : ye.content) == null ? void 0 : xe.trim()) || "(no response from OpenAI)";
|
|
499
|
+
d = i && !i.type.startsWith("image/") ? d + N : N;
|
|
500
|
+
} else if (oe) {
|
|
501
|
+
const b = T.map((y) => ({
|
|
502
|
+
role: y.sender === "bot" ? "assistant" : "user",
|
|
503
|
+
content: y.text
|
|
504
|
+
})), p = [{ type: "text", text: e }];
|
|
505
|
+
if (i && i.type.startsWith("image/")) {
|
|
506
|
+
const y = await se(i);
|
|
507
|
+
p.unshift({
|
|
508
|
+
type: "image",
|
|
509
|
+
source: {
|
|
510
|
+
type: "base64",
|
|
511
|
+
media_type: i.type,
|
|
512
|
+
data: y
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
} else i && (console.warn(
|
|
516
|
+
"Anthropic integration currently only supports image files. File was ignored."
|
|
517
|
+
), d = "Note: The attached file was not an image and was ignored. ");
|
|
518
|
+
const N = ((ke = (Ce = (ve = (await oe.messages.create({
|
|
519
|
+
model: ce,
|
|
520
|
+
system: l,
|
|
521
|
+
messages: [
|
|
522
|
+
...b,
|
|
523
|
+
{ role: "user", content: p }
|
|
524
|
+
],
|
|
525
|
+
max_tokens: 1024
|
|
526
|
+
})).content) == null ? void 0 : ve[0]) == null ? void 0 : Ce.text) == null ? void 0 : ke.trim()) || "(no response from Claude)";
|
|
527
|
+
d = i && !i.type.startsWith("image/") ? d + N : N;
|
|
528
|
+
} else if (re) {
|
|
529
|
+
let b = "";
|
|
530
|
+
i && (console.warn(
|
|
531
|
+
"Groq API does not support file uploads. Sending text only."
|
|
532
|
+
), b = `Note: The attached file was ignored as this AI model does not support file uploads. Here is my response to your text:
|
|
533
|
+
|
|
534
|
+
`);
|
|
535
|
+
const p = T.map((N) => ({
|
|
536
|
+
role: N.sender === "bot" ? "assistant" : "user",
|
|
537
|
+
content: N.text
|
|
538
|
+
})), q = await re.chat.completions.create({
|
|
539
|
+
messages: [
|
|
540
|
+
...p,
|
|
541
|
+
{ role: "user", content: e }
|
|
542
|
+
],
|
|
543
|
+
model: de
|
|
544
|
+
});
|
|
545
|
+
d = b + ((($e = (Re = (Ne = q.choices[0]) == null ? void 0 : Ne.message) == null ? void 0 : Re.content) == null ? void 0 : $e.trim()) || "(no response from Groq)");
|
|
546
|
+
} else
|
|
547
|
+
d = `You said: "${e}"`, i && (d += ` and attached a file named "${i.name}".`), await new Promise((b) => setTimeout(b, 800));
|
|
548
|
+
} catch (b) {
|
|
549
|
+
console.error("ChatBot handleSend Error:", b), d = "An error occurred while processing your request.";
|
|
550
|
+
} finally {
|
|
551
|
+
const b = {
|
|
552
|
+
id: `bot-${Date.now()}`,
|
|
553
|
+
text: d,
|
|
554
|
+
sender: "bot",
|
|
555
|
+
attachment: null
|
|
556
|
+
};
|
|
557
|
+
K((p) => [...p, b]), W(!1);
|
|
558
|
+
}
|
|
559
|
+
}, [
|
|
560
|
+
// Dependency array ensures the function is recreated only when necessary.
|
|
561
|
+
L,
|
|
562
|
+
f,
|
|
563
|
+
m,
|
|
564
|
+
D,
|
|
565
|
+
v,
|
|
566
|
+
H,
|
|
567
|
+
T,
|
|
568
|
+
O,
|
|
569
|
+
K,
|
|
570
|
+
E,
|
|
571
|
+
U,
|
|
572
|
+
W,
|
|
573
|
+
l,
|
|
574
|
+
ee,
|
|
575
|
+
te,
|
|
576
|
+
oe,
|
|
577
|
+
re,
|
|
578
|
+
le,
|
|
579
|
+
ce,
|
|
580
|
+
de
|
|
581
|
+
]), Oe = Te(
|
|
582
|
+
(e) => {
|
|
583
|
+
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), ne());
|
|
584
|
+
},
|
|
585
|
+
[ne]
|
|
586
|
+
), Pe = () => {
|
|
587
|
+
z.current && !J && z.current.start();
|
|
588
|
+
}, Ue = () => {
|
|
589
|
+
z.current && J && (z.current.stop(), he(!1));
|
|
590
|
+
}, De = () => {
|
|
591
|
+
var e;
|
|
592
|
+
(e = fe.current) == null || e.click();
|
|
593
|
+
}, We = (e) => {
|
|
594
|
+
var s;
|
|
595
|
+
const r = (s = e.target.files) == null ? void 0 : s[0];
|
|
596
|
+
r && (E(r), Le(r)), e.target && (e.target.value = null);
|
|
597
|
+
}, ae = (e) => typeof e == "string" ? /* @__PURE__ */ t(
|
|
598
|
+
"img",
|
|
599
|
+
{
|
|
600
|
+
src: e,
|
|
601
|
+
alt: "avatar",
|
|
602
|
+
className: "w-8 h-8 rounded-full object-cover"
|
|
603
|
+
}
|
|
604
|
+
) : /* @__PURE__ */ t("div", { className: "w-8 h-8 rounded-full text-gray-500", children: e }), G = D || v, ge = {
|
|
605
|
+
"bottom-right": "bottom-5 right-5",
|
|
606
|
+
"bottom-left": "bottom-5 left-5",
|
|
607
|
+
center: "top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"
|
|
608
|
+
}, Ee = o.window.placement === "center", M = {
|
|
609
|
+
rounded: "rounded-xl",
|
|
610
|
+
square: "rounded-md"
|
|
611
|
+
};
|
|
612
|
+
return /* @__PURE__ */ u("div", { id: w, style: Ae, className: "font-sans", children: [
|
|
613
|
+
/* @__PURE__ */ t(V, { children: !I && /* @__PURE__ */ t(
|
|
614
|
+
x.button,
|
|
615
|
+
{
|
|
616
|
+
ref: me,
|
|
617
|
+
onClick: () => P(!0),
|
|
618
|
+
"aria-label": "Open Chat",
|
|
619
|
+
initial: { scale: 0, opacity: 0 },
|
|
620
|
+
animate: { scale: 1, opacity: 1 },
|
|
621
|
+
exit: { scale: 0, opacity: 0 },
|
|
622
|
+
transition: { duration: 0.2, ease: "easeOut" },
|
|
623
|
+
className: "fixed bottom-10 right-10 z-50 rounded-full shadow-lg flex items-center justify-center cursor-pointer border-2 border-white/50 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[--chatbot-launcher-bg]",
|
|
624
|
+
style: {
|
|
625
|
+
backgroundColor: "var(--chatbot-launcher-bg)",
|
|
626
|
+
color: "var(--chatbot-launcher-icon-color)",
|
|
627
|
+
width: "var(--chatbot-launcher-size)",
|
|
628
|
+
height: "var(--chatbot-launcher-size)"
|
|
629
|
+
},
|
|
630
|
+
children: /* @__PURE__ */ t(B, { icon: Ge })
|
|
631
|
+
}
|
|
632
|
+
) }),
|
|
633
|
+
/* @__PURE__ */ u(V, { children: [
|
|
634
|
+
I && Ee && o.window.backdrop && /* @__PURE__ */ t(
|
|
635
|
+
x.div,
|
|
636
|
+
{
|
|
637
|
+
initial: { opacity: 0 },
|
|
638
|
+
animate: { opacity: 1 },
|
|
639
|
+
exit: { opacity: 0 },
|
|
640
|
+
style: {
|
|
641
|
+
backgroundColor: o.window.backdropColor,
|
|
642
|
+
backdropFilter: `blur(${o.window.backdropBlur})`,
|
|
643
|
+
// For Safari compatibility
|
|
644
|
+
WebkitBackdropFilter: `blur(${o.window.backdropBlur})`
|
|
645
|
+
},
|
|
646
|
+
className: "fixed inset-0 z-40",
|
|
647
|
+
onClick: () => P(!1)
|
|
648
|
+
},
|
|
649
|
+
"chatbot-backdrop"
|
|
650
|
+
),
|
|
651
|
+
I && /* @__PURE__ */ u(
|
|
652
|
+
"div",
|
|
653
|
+
{
|
|
654
|
+
ref: ze,
|
|
655
|
+
"aria-modal": "true",
|
|
656
|
+
role: "dialog",
|
|
657
|
+
className: `fixed ${ge[o.window.placement] || ge["bottom-right"]} z-50 flex flex-col overflow-hidden shadow-2xl border`,
|
|
658
|
+
style: {
|
|
659
|
+
width: "var(--chatbot-window-width)",
|
|
660
|
+
height: "var(--chatbot-window-height)",
|
|
661
|
+
borderRadius: "var(--chatbot-window-border-radius)",
|
|
662
|
+
backgroundColor: "var(--chatbot-window-bg)",
|
|
663
|
+
borderColor: "var(--chatbot-window-border-color)"
|
|
664
|
+
},
|
|
665
|
+
children: [
|
|
666
|
+
/* @__PURE__ */ u(
|
|
667
|
+
"header",
|
|
668
|
+
{
|
|
669
|
+
className: "flex items-center justify-between p-3 flex-shrink-0",
|
|
670
|
+
style: {
|
|
671
|
+
background: "var(--chatbot-header-bg)",
|
|
672
|
+
color: "var(--chatbot-header-text-color)"
|
|
673
|
+
},
|
|
674
|
+
children: [
|
|
675
|
+
/* @__PURE__ */ u("div", { className: "flex items-center space-x-3", children: [
|
|
676
|
+
/* @__PURE__ */ t("div", { className: "w-10 h-10 rounded-full bg-white/30 flex items-center justify-center p-1", children: ae(c) }),
|
|
677
|
+
/* @__PURE__ */ t(
|
|
678
|
+
"span",
|
|
679
|
+
{
|
|
680
|
+
style: {
|
|
681
|
+
fontFamily: "var(--chatbot-header-font-family)",
|
|
682
|
+
fontWeight: "var(--chatbot-header-font-weight)"
|
|
683
|
+
},
|
|
684
|
+
className: "text-lg",
|
|
685
|
+
children: n
|
|
686
|
+
}
|
|
687
|
+
)
|
|
688
|
+
] }),
|
|
689
|
+
/* @__PURE__ */ t(
|
|
690
|
+
"button",
|
|
691
|
+
{
|
|
692
|
+
onClick: () => P(!1),
|
|
693
|
+
"aria-label": "Close Chat",
|
|
694
|
+
className: "p-1 rounded-full hover:bg-white/20 focus:outline-none focus-visible:ring-2 focus-visible:ring-white",
|
|
695
|
+
children: /* @__PURE__ */ t(
|
|
696
|
+
"svg",
|
|
697
|
+
{
|
|
698
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
699
|
+
fill: "none",
|
|
700
|
+
viewBox: "0 0 24 24",
|
|
701
|
+
strokeWidth: 2,
|
|
702
|
+
stroke: "currentColor",
|
|
703
|
+
className: "w-6 h-6",
|
|
704
|
+
children: /* @__PURE__ */ t(
|
|
705
|
+
"path",
|
|
706
|
+
{
|
|
707
|
+
strokeLinecap: "round",
|
|
708
|
+
strokeLinejoin: "round",
|
|
709
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
710
|
+
}
|
|
711
|
+
)
|
|
712
|
+
}
|
|
713
|
+
)
|
|
714
|
+
}
|
|
715
|
+
)
|
|
716
|
+
]
|
|
717
|
+
}
|
|
718
|
+
),
|
|
719
|
+
/* @__PURE__ */ u(
|
|
720
|
+
"div",
|
|
721
|
+
{
|
|
722
|
+
role: "log",
|
|
723
|
+
"aria-live": "polite",
|
|
724
|
+
className: "chatbot-message-list flex-1 p-4 overflow-y-auto space-y-4",
|
|
725
|
+
children: [
|
|
726
|
+
/* @__PURE__ */ t(V, { initial: !1, children: T.map((e, r) => /* @__PURE__ */ u(
|
|
727
|
+
x.div,
|
|
728
|
+
{
|
|
729
|
+
layout: !0,
|
|
730
|
+
initial: { opacity: 0, y: 20 },
|
|
731
|
+
animate: { opacity: 1, y: 0 },
|
|
732
|
+
exit: { opacity: 0, y: -10 },
|
|
733
|
+
transition: { duration: 0.3, ease: "easeOut" },
|
|
734
|
+
className: `flex items-end max-w-[85%] gap-2 ${e.sender === "user" ? "ml-auto flex-row-reverse" : "mr-auto"}`,
|
|
735
|
+
children: [
|
|
736
|
+
o.messages.showAvatars && /* @__PURE__ */ t("div", { className: "w-7 h-7 rounded-full flex-shrink-0 overflow-hidden", children: ae(
|
|
737
|
+
e.sender === "user" ? h : c
|
|
738
|
+
) }),
|
|
739
|
+
/* @__PURE__ */ u(
|
|
740
|
+
"div",
|
|
741
|
+
{
|
|
742
|
+
className: `flex flex-col ${e.sender === "user" ? "items-end" : "items-start"}`,
|
|
743
|
+
children: [
|
|
744
|
+
e.sender === "user" && e.attachment && /* @__PURE__ */ t(
|
|
745
|
+
"div",
|
|
746
|
+
{
|
|
747
|
+
className: `p-2 mb-1 max-w-full self-end ${M[o.messages.bubbleShape] || M.rounded} ${// Add pointer ONLY if there's no text bubble below it
|
|
748
|
+
!e.text && o.messages.bubblePointer ? "rounded-br-none" : ""}`,
|
|
749
|
+
style: {
|
|
750
|
+
backgroundColor: "var(--chatbot-user-msg-bg)",
|
|
751
|
+
color: "var(--chatbot-user-msg-text-color)"
|
|
752
|
+
},
|
|
753
|
+
children: e.attachment.previewUrl ? /* @__PURE__ */ t(
|
|
754
|
+
"img",
|
|
755
|
+
{
|
|
756
|
+
src: e.attachment.previewUrl,
|
|
757
|
+
alt: e.attachment.name,
|
|
758
|
+
className: "w-full h-auto object-cover rounded-md max-w-[200px]"
|
|
759
|
+
}
|
|
760
|
+
) : /* @__PURE__ */ u("div", { className: "flex items-center gap-2 text-sm", children: [
|
|
761
|
+
/* @__PURE__ */ t(
|
|
762
|
+
B,
|
|
763
|
+
{
|
|
764
|
+
icon: Ie,
|
|
765
|
+
className: "w-4 h-4 flex-shrink-0"
|
|
766
|
+
}
|
|
767
|
+
),
|
|
768
|
+
/* @__PURE__ */ t("span", { className: "truncate", children: e.attachment.name })
|
|
769
|
+
] })
|
|
770
|
+
}
|
|
771
|
+
),
|
|
772
|
+
e.text && /* @__PURE__ */ t(
|
|
773
|
+
x.div,
|
|
774
|
+
{
|
|
775
|
+
layout: "position",
|
|
776
|
+
transition: { duration: 0.2, ease: "easeOut" },
|
|
777
|
+
className: `px-3 py-2 ${M[o.messages.bubbleShape] || M.rounded} ${// The text bubble always gets the pointer if it exists
|
|
778
|
+
o.messages.bubblePointer ? e.sender === "user" ? "rounded-br-none" : "rounded-bl-none" : ""}`,
|
|
779
|
+
style: {
|
|
780
|
+
backgroundColor: e.sender === "user" ? "var(--chatbot-user-msg-bg)" : "var(--chatbot-bot-msg-bg)",
|
|
781
|
+
color: e.sender === "user" ? "var(--chatbot-user-msg-text-color)" : "var(--chatbot-bot-msg-text-color)",
|
|
782
|
+
fontFamily: "var(--chatbot-msg-font-family)",
|
|
783
|
+
fontSize: "var(--chatbot-msg-font-size)"
|
|
784
|
+
},
|
|
785
|
+
children: e.sender === "bot" && r === T.length - 1 ? /* @__PURE__ */ t(
|
|
786
|
+
at,
|
|
787
|
+
{
|
|
788
|
+
text: e.text,
|
|
789
|
+
animationType: o.messages.animation,
|
|
790
|
+
components: pe
|
|
791
|
+
}
|
|
792
|
+
) : /* @__PURE__ */ t(
|
|
793
|
+
"div",
|
|
794
|
+
{
|
|
795
|
+
className: "prose prose-sm max-w-none text-inherit prose-p:my-0",
|
|
796
|
+
style: { color: "inherit" },
|
|
797
|
+
children: /* @__PURE__ */ t(F, { components: pe, children: e.text })
|
|
798
|
+
}
|
|
799
|
+
)
|
|
800
|
+
}
|
|
801
|
+
)
|
|
802
|
+
]
|
|
803
|
+
}
|
|
804
|
+
)
|
|
805
|
+
]
|
|
806
|
+
},
|
|
807
|
+
e.id
|
|
808
|
+
)) }),
|
|
809
|
+
G && /* @__PURE__ */ u(
|
|
810
|
+
"div",
|
|
811
|
+
{
|
|
812
|
+
className: "flex items-end max-w-[85%] gap-2 mr-auto",
|
|
813
|
+
children: [
|
|
814
|
+
o.messages.showAvatars && /* @__PURE__ */ t("div", { className: "w-7 h-7 rounded-full flex-shrink-0 overflow-hidden", children: ae(c) }),
|
|
815
|
+
/* @__PURE__ */ t(
|
|
816
|
+
"div",
|
|
817
|
+
{
|
|
818
|
+
className: `px-3 py-2 ${M[o.messages.bubbleShape] || M.rounded} rounded-bl-none`,
|
|
819
|
+
style: { backgroundColor: "var(--chatbot-bot-msg-bg)" },
|
|
820
|
+
children: /* @__PURE__ */ t(ot, {})
|
|
821
|
+
}
|
|
822
|
+
)
|
|
823
|
+
]
|
|
824
|
+
},
|
|
825
|
+
"typing-indicator"
|
|
826
|
+
),
|
|
827
|
+
/* @__PURE__ */ t("div", { ref: be })
|
|
828
|
+
]
|
|
829
|
+
}
|
|
830
|
+
),
|
|
831
|
+
/* @__PURE__ */ u(
|
|
832
|
+
"footer",
|
|
833
|
+
{
|
|
834
|
+
className: "p-3 border-t flex-shrink-0",
|
|
835
|
+
style: {
|
|
836
|
+
borderColor: "var(--chatbot-window-border-color)",
|
|
837
|
+
backgroundColor: "var(--chatbot-input-bg)"
|
|
838
|
+
},
|
|
839
|
+
children: [
|
|
840
|
+
/* @__PURE__ */ t(V, { children: f && /* @__PURE__ */ t(
|
|
841
|
+
x.div,
|
|
842
|
+
{
|
|
843
|
+
initial: { opacity: 0, height: 0 },
|
|
844
|
+
animate: { opacity: 1, height: "auto" },
|
|
845
|
+
exit: { opacity: 0, height: 0 },
|
|
846
|
+
transition: { duration: 0.2 },
|
|
847
|
+
children: /* @__PURE__ */ t(rt, { file: f, onRemove: () => E(null) })
|
|
848
|
+
}
|
|
849
|
+
) }),
|
|
850
|
+
/* @__PURE__ */ u("div", { className: "flex items-end space-x-2", children: [
|
|
851
|
+
Be && /* @__PURE__ */ u(He, { children: [
|
|
852
|
+
/* @__PURE__ */ t(
|
|
853
|
+
"button",
|
|
854
|
+
{
|
|
855
|
+
onClick: De,
|
|
856
|
+
disabled: m || G,
|
|
857
|
+
"aria-label": "Upload File",
|
|
858
|
+
className: "w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
859
|
+
style: {
|
|
860
|
+
backgroundColor: "var(--chatbot-user-msg-bg)",
|
|
861
|
+
color: "var(--chatbot-user-msg-text-color)",
|
|
862
|
+
"--tw-ring-color": "var(--chatbot-user-msg-bg)"
|
|
863
|
+
},
|
|
864
|
+
children: /* @__PURE__ */ t(B, { icon: qe, className: "w-5 h-5" })
|
|
865
|
+
}
|
|
866
|
+
),
|
|
867
|
+
/* @__PURE__ */ t(
|
|
868
|
+
"input",
|
|
869
|
+
{
|
|
870
|
+
type: "file",
|
|
871
|
+
ref: fe,
|
|
872
|
+
onChange: We,
|
|
873
|
+
accept: Fe,
|
|
874
|
+
style: { display: "none" },
|
|
875
|
+
"aria-hidden": "true"
|
|
876
|
+
}
|
|
877
|
+
)
|
|
878
|
+
] }),
|
|
879
|
+
/* @__PURE__ */ t(
|
|
880
|
+
"textarea",
|
|
881
|
+
{
|
|
882
|
+
ref: Q,
|
|
883
|
+
rows: "1",
|
|
884
|
+
value: L,
|
|
885
|
+
onChange: (e) => U(e.target.value),
|
|
886
|
+
onKeyDown: Oe,
|
|
887
|
+
placeholder: g,
|
|
888
|
+
disabled: m || G,
|
|
889
|
+
"aria-label": "Chat input",
|
|
890
|
+
className: "chatbot-textarea-input flex-1 w-full px-4 py-2 bg-transparent rounded-xl border focus:outline-none focus:ring-2 disabled:cursor-not-allowed disabled:opacity-60 resize-none overflow-hidden",
|
|
891
|
+
style: {
|
|
892
|
+
color: "var(--chatbot-input-text-color)",
|
|
893
|
+
borderColor: "var(--chatbot-input-border-color)",
|
|
894
|
+
"--tw-ring-color": "var(--chatbot-input-focus-ring)",
|
|
895
|
+
maxHeight: "100px",
|
|
896
|
+
// Set a max-height before scrollbar appears
|
|
897
|
+
overflowY: "hidden",
|
|
898
|
+
// Add scrollbar when content exceeds max-height
|
|
899
|
+
lineHeight: "1.5"
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
),
|
|
903
|
+
J ? (
|
|
904
|
+
// 1. ALWAYS show STOP button when recording is active.
|
|
905
|
+
/* @__PURE__ */ t(
|
|
906
|
+
x.button,
|
|
907
|
+
{
|
|
908
|
+
onClick: Ue,
|
|
909
|
+
"aria-label": "Stop Recording",
|
|
910
|
+
className: "px-4 h-10 rounded-full flex items-center justify-center flex-shrink-0 font-semibold text-sm transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
911
|
+
style: {
|
|
912
|
+
backgroundColor: "var(--chatbot-user-msg-bg)",
|
|
913
|
+
color: "var(--chatbot-user-msg-text-color)",
|
|
914
|
+
"--tw-ring-color": "var(--chatbot-user-msg-bg)"
|
|
915
|
+
},
|
|
916
|
+
animate: { opacity: [1, 0.8, 1], scale: [1, 1.1, 1] },
|
|
917
|
+
transition: {
|
|
918
|
+
duration: 1,
|
|
919
|
+
repeat: 1 / 0,
|
|
920
|
+
ease: "easeInOut"
|
|
921
|
+
},
|
|
922
|
+
children: /* @__PURE__ */ t(
|
|
923
|
+
B,
|
|
924
|
+
{
|
|
925
|
+
icon: Ve,
|
|
926
|
+
className: "w-5 h-5"
|
|
927
|
+
}
|
|
928
|
+
)
|
|
929
|
+
}
|
|
930
|
+
)
|
|
931
|
+
) : Se && !L.trim() ? (
|
|
932
|
+
// 2. Show START button ONLY if not recording, STT is enabled, and there is no text.
|
|
933
|
+
/* @__PURE__ */ t(
|
|
934
|
+
x.button,
|
|
935
|
+
{
|
|
936
|
+
onClick: Pe,
|
|
937
|
+
"aria-label": "Start Recording",
|
|
938
|
+
className: "px-4 h-10 rounded-full flex items-center justify-center flex-shrink-0 font-semibold text-sm transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
939
|
+
style: {
|
|
940
|
+
backgroundColor: "var(--chatbot-user-msg-bg)",
|
|
941
|
+
color: "var(--chatbot-user-msg-text-color)",
|
|
942
|
+
"--tw-ring-color": "var(--chatbot-user-msg-bg)"
|
|
943
|
+
},
|
|
944
|
+
children: /* @__PURE__ */ t(B, { icon: _e, className: "w-5 h-5" })
|
|
945
|
+
}
|
|
946
|
+
)
|
|
947
|
+
) : (
|
|
948
|
+
// 3. Otherwise, show the SEND button.
|
|
949
|
+
/* @__PURE__ */ t(
|
|
950
|
+
"button",
|
|
951
|
+
{
|
|
952
|
+
onClick: ne,
|
|
953
|
+
disabled: !L.trim() || m || G,
|
|
954
|
+
"aria-label": "Send Message",
|
|
955
|
+
className: "px-4 h-10 rounded-full flex items-center justify-center flex-shrink-0 font-semibold text-sm transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
956
|
+
style: {
|
|
957
|
+
backgroundColor: "var(--chatbot-user-msg-bg)",
|
|
958
|
+
color: "var(--chatbot-user-msg-text-color)",
|
|
959
|
+
"--tw-ring-color": "var(--chatbot-user-msg-bg)"
|
|
960
|
+
},
|
|
961
|
+
children: /* @__PURE__ */ t(tt, {})
|
|
962
|
+
}
|
|
963
|
+
)
|
|
964
|
+
)
|
|
965
|
+
] })
|
|
966
|
+
]
|
|
967
|
+
}
|
|
968
|
+
)
|
|
969
|
+
]
|
|
970
|
+
},
|
|
971
|
+
"chatbot-window"
|
|
972
|
+
)
|
|
973
|
+
] })
|
|
974
|
+
] });
|
|
975
|
+
};
|
|
976
|
+
export {
|
|
977
|
+
gt as ChatBot
|
|
978
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
(function(u,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react/jsx-runtime"),require("react"),require("framer-motion"),require("@fortawesome/react-fontawesome"),require("@fortawesome/free-solid-svg-icons"),require("@google/generative-ai"),require("openai"),require("@anthropic-ai/sdk"),require("groq-sdk"),require("react-markdown")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","framer-motion","@fortawesome/react-fontawesome","@fortawesome/free-solid-svg-icons","@google/generative-ai","openai","@anthropic-ai/sdk","groq-sdk","react-markdown"],e):(u=typeof globalThis<"u"?globalThis:u||self,e(u.SuperCustomizableChatbot={},u.jsxRuntime,u.React,u.framerMotion,u.ReactFontAwesome,u.FreeSolidIcons,u.GoogleGenerativeAI,u.OpenAI,u.Anthropic,u.Groq,u.ReactMarkdown))})(this,function(u,e,s,p,I,S,Ne,Te,$e,Ie,A){"use strict";const M=a=>new Promise((d,b)=>{const n=new FileReader;n.readAsDataURL(a),n.onload=()=>d(n.result.split(",")[1]),n.onerror=y=>b(y)}),Se=()=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-full h-full",children:[e.jsx("path",{d:"M12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4Z"}),e.jsx("path",{d:"M16.5 14C16.5 14 15 15.5 12 15.5C9 15.5 7.5 14 7.5 14",strokeLinecap:"round"}),e.jsx("circle",{cx:"9",cy:"10",r:"1",fill:"currentColor"}),e.jsx("circle",{cx:"15",cy:"10",r:"1",fill:"currentColor"})]}),Ae=()=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-full h-full",children:[e.jsx("path",{d:"M12 12C14.2091 12 16 10.2091 16 8C16 5.79086 14.2091 4 12 4C9.79086 4 8 5.79086 8 8C8 10.2091 9.79086 12 12 12Z",strokeLinecap:"round"}),e.jsx("path",{d:"M19.21 17.14C19.21 17.14 19 19 12 19C5 19 4.79 17.14 4.79 17.14C4.79 17.14 6.33 15 12 15C17.67 15 19.21 17.14 19.21 17.14Z",strokeLinecap:"round"})]}),Fe=()=>e.jsxs("svg",{fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-5 h-5",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 12L3.269 3.126A59.768 59.768 0 0121.485 12 59.77 59.77 0 013.27 20.875L6 12z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 12h9"})]}),Be=()=>e.jsxs("div",{className:"flex items-center space-x-1 p-3",children:[e.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-pulse [animation-delay:-0.3s]"}),e.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-pulse [animation-delay:-0.15s]"}),e.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-pulse"})]}),je=({file:a,onRemove:d})=>{const[b,n]=s.useState(null);return s.useEffect(()=>{if(a&&a.type.startsWith("image/")){const y=URL.createObjectURL(a);return n(y),()=>URL.revokeObjectURL(y)}n(null)},[a]),a?e.jsxs("div",{className:"relative inline-flex items-center gap-2 p-2 mb-2 bg-[--chatbot-bot-msg-bg] rounded-lg border border-[--chatbot-input-border-color] max-w-xs",children:[e.jsx("div",{className:"flex-shrink-0 w-10 h-10 flex items-center justify-center bg-black/20 rounded-md",children:b?e.jsx("img",{src:b,alt:a.name,className:"w-full h-full object-cover rounded-md"}):e.jsx(I.FontAwesomeIcon,{icon:S.faFileAlt,className:"w-5 h-5 text-white/70"})}),e.jsx("div",{className:"flex-1 min-w-0 pr-6",children:e.jsx("p",{className:"text-sm font-medium text-[--chatbot-input-text-color] truncate",title:a.name,children:a.name})}),e.jsx("button",{onClick:d,"aria-label":"Remove file",className:"absolute top-1 right-1 w-2 h-2 flex items-center justify-center rounded-full bg-black/50 text-white hover:bg-black/70 transition-colors",children:e.jsx(I.FontAwesomeIcon,{icon:S.faTimes,className:"w-3 h-3"})})]}):null},Le=({fullText:a,onComplete:d,components:b})=>{const n=typeof a=="string"?a:"",[y,c]=s.useState("");return s.useEffect(()=>{if(n.length===0){d==null||d();return}let k=0;c("");const g=setInterval(()=>{if(k<n.length){const C=n.charAt(k);c(P=>P+C),k++}else clearInterval(g),d==null||d()},25);return()=>clearInterval(g)},[n,d]),e.jsx("div",{className:"prose prose-sm max-w-none text-inherit prose-p:my-0 prose-headings:my-2 prose-ul:my-1 prose-li:my-0.5",style:{color:"inherit"},children:e.jsx(A,{components:b,children:y||""})})},Ee=({text:a,animationType:d,components:b})=>{const n="prose prose-sm max-w-none text-inherit prose-p:my-0 prose-headings:my-2 prose-ul:my-1 prose-li:my-0.5";switch(d){case"typing":return e.jsx(Le,{fullText:a,components:b});case"fade-in":return e.jsx(p.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:1.5,ease:"easeOut"},children:e.jsx("div",{className:n,children:e.jsx(A,{components:b,children:a})})});case"slide-up":return e.jsx(p.motion.div,{initial:{y:50,opacity:0},animate:{y:0,opacity:1},transition:{duration:.7,ease:"anticipate"},children:e.jsx("div",{className:n,children:e.jsx(A,{components:b,children:a})})});case"zoom-in":return e.jsx(p.motion.div,{initial:{scale:.5,opacity:0},animate:{scale:1,opacity:1},transition:{duration:1,ease:"backOut"},children:e.jsx("div",{className:n,children:e.jsx(A,{components:b,children:a})})});case"flip":return e.jsx(p.motion.div,{initial:{rotateX:-90,opacity:0},animate:{rotateX:0,opacity:1},transition:{duration:1,ease:"easeOut"},style:{transformPerspective:400},children:e.jsx("div",{className:n,children:e.jsx(A,{components:b,children:a})})});default:return e.jsx("div",{className:n,children:e.jsx(A,{components:b,children:a})})}},Pe=a=>{const d=[];if(!a||a.length===0)return d;let n=a.reduce((c,k)=>{const g=c.length>0?c[c.length-1]:null;if(g&&g.sender===k.sender){const C={...g,text:`${g.text}
|
|
2
|
+
${k.text}`};c[c.length-1]=C}else c.push({...k});return c},[]).map(c=>({role:c.sender==="bot"?"model":"user",parts:[{text:c.text}]}));const y=n.findIndex(c=>c.role==="user");if(y>-1)n=n.slice(y);else return[];return n},ze=({botName:a="ChatBot",botAvatar:d=e.jsx(Se,{}),userAvatar:b=e.jsx(Ae,{}),welcomeMessage:n="Hello! How can I help?",placeholderText:y="Type a message...",customInstruction:c="",isOpen:k=!1,disabled:g=!1,isTyping:C=!1,onSend:P=()=>{},theme:N={},geminiApiKey:V,geminiModelName:se="gemini-1.5-flash",openaiApiKey:_,openaiModelName:ae="gpt-4o-mini",anthropicApiKey:Y,anthropicModelName:ne="claude-3-haiku-20240307",grokApiKey:Z,grokModelName:le="llama3-8b-8192",messages:ie,enableMicrophone:qe,enableFileUpload:Oe=!1,fileUploadAccept:Ue="*",onFileUpload:De=()=>{}})=>{const[x]=s.useState(()=>`chatbot-instance-${Math.random().toString(36).substring(2,9)}`),[F,z]=s.useState(k),[We,He]=s.useState(()=>n?[{id:1,text:n,sender:"bot"}]:[]),[B,q]=s.useState(""),[O,U]=s.useState(!1),[X,ce]=s.useState(!1),[m,D]=s.useState(null),W=typeof ie<"u",$=W?ie:We,J=W?()=>{}:He,K=s.useRef(null),de=s.useRef(null),he=s.useRef(null),Ge=s.useRef(null),ue=s.useRef(null),L=s.useRef(null),Q=s.useMemo(()=>{if(!V)return null;try{return new Ne.GoogleGenerativeAI(V).getGenerativeModel({model:se,systemInstruction:c})}catch(t){return console.error("Failed to initialize Gemini:",t),null}},[V,se,c]),R=s.useMemo(()=>_?new Te({apiKey:_,dangerouslyAllowBrowser:!0}):null,[_]),ee=s.useMemo(()=>Y?new $e({apiKey:Y,dangerouslyAllowBrowser:!0}):null,[Y]),te=s.useMemo(()=>Z?new Ie({apiKey:Z,dangerouslyAllowBrowser:!0}):null,[Z]),o=s.useMemo(()=>{var l;const t=((l=N==null?void 0:N.window)==null?void 0:l.placement)==="center",r={launcher:{backgroundColor:"#4f46e5",iconColor:"#ffffff",size:"3.5rem"},header:{backgroundColor:"#4f46e5",textColor:"#ffffff",fontFamily:"inherit",fontWeight:"600"},messages:{userBackgroundColor:"#4f46e5",userTextColor:"#ffffff",botBackgroundColor:"#f3f4f6",botTextColor:"#1f2937",fontFamily:"inherit",fontSize:"0.9rem",showAvatars:!0,bubbleShape:"rounded",bubblePointer:!0,animation:"fade-in",markdownStyles:{}},input:{backgroundColor:"#ffffff",textColor:"#1f2937",placeholderTextColor:"#9ca3af",borderColor:"#e5e7eb",focusRingColor:"#4f46e5"},window:{backgroundColor:"#ffffff",borderColor:"#e5e7eb",borderRadius:"0.75rem",width:t?"80vw":"22rem",height:t?"80vh":"30rem",placement:"bottom-right",backdrop:!1,backdropColor:"rgba(0, 0, 0, 0.4)",backdropBlur:"4px",scrollbarThumbColor:"#a1a1aa",scrollbarTrackColor:"#f1f5f9"}};return{launcher:{...r.launcher,...N.launcher},header:{...r.header,...N.header},messages:{...r.messages,...N.messages},input:{...r.input,...N.input},window:{...r.window,...N.window}}},[N]),Me=s.useMemo(()=>({"--chatbot-launcher-bg":o.launcher.backgroundColor,"--chatbot-launcher-icon-color":o.launcher.iconColor,"--chatbot-launcher-size":o.launcher.size,"--chatbot-header-bg":o.header.backgroundColor,"--chatbot-header-text-color":o.header.textColor,"--chatbot-header-font-family":o.header.fontFamily,"--chatbot-header-font-weight":o.header.fontWeight,"--chatbot-user-msg-bg":o.messages.userBackgroundColor,"--chatbot-user-msg-text-color":o.messages.userTextColor,"--chatbot-bot-msg-bg":o.messages.botBackgroundColor,"--chatbot-bot-msg-text-color":o.messages.botTextColor,"--chatbot-msg-font-family":o.messages.fontFamily,"--chatbot-msg-font-size":o.messages.fontSize,"--chatbot-input-bg":o.input.backgroundColor,"--chatbot-input-text-color":o.input.textColor,"--chatbot-input-placeholder-color":o.input.placeholderTextColor,"--chatbot-input-border-color":o.input.borderColor,"--chatbot-input-focus-ring":o.input.focusRingColor,"--chatbot-window-bg":o.window.backgroundColor,"--chatbot-window-border-color":o.window.borderColor,"--chatbot-window-border-radius":o.window.borderRadius,"--chatbot-window-width":o.window.width,"--chatbot-window-height":o.window.height}),[o]),be=s.useMemo(()=>{const t=o.messages.markdownStyles||{};return{strong:({node:r,...l})=>e.jsx("strong",{style:{color:t.boldColor||"inherit"},...l}),em:({node:r,...l})=>e.jsx("em",{style:{color:t.italicColor||"inherit"},...l}),a:({node:r,...l})=>e.jsx("a",{style:{color:t.linkColor||"#3b82f6"},...l}),code:({node:r,...l})=>e.jsx("code",{style:{color:t.codeColor||"inherit",backgroundColor:t.codeBackgroundColor||"rgba(0, 0, 0, 0.1)",padding:"0.1rem 0.3rem",borderRadius:"0.25rem"},...l})}},[o.messages.markdownStyles]);s.useEffect(()=>{const t=window.SpeechRecognition||window.webkitSpeechRecognition;if(t){const r=new t;r.continuous=!0,r.interimResults=!1,r.lang="en-US",r.onstart=()=>ce(!0),r.onresult=l=>{const i=l.results[l.results.length-1][0].transcript;q(h=>h+(h?" ":"")+i)},r.onerror=l=>{console.error("Speech error:",l)},r.onend=()=>{},L.current=r}},[]),s.useEffect(()=>{var h;const t=o.window.scrollbarThumbColor,r=o.window.scrollbarTrackColor,l=`scrollbar-style-${x}`;(h=document.getElementById(l))==null||h.remove();const i=document.createElement("style");return i.id=l,i.innerHTML=`
|
|
3
|
+
/* Target both the message list and the textarea input */
|
|
4
|
+
#${x} .chatbot-message-list,
|
|
5
|
+
#${x} .chatbot-textarea-input {
|
|
6
|
+
scrollbar-width: thin;
|
|
7
|
+
scrollbar-color: ${t} ${r};
|
|
8
|
+
}
|
|
9
|
+
/* WebKit-based browsers (Chrome, Safari, Edge) */
|
|
10
|
+
#${x} .chatbot-message-list::-webkit-scrollbar,
|
|
11
|
+
#${x} .chatbot-textarea-input::-webkit-scrollbar {
|
|
12
|
+
width: 8px;
|
|
13
|
+
}
|
|
14
|
+
#${x} .chatbot-message-list::-webkit-scrollbar-track,
|
|
15
|
+
#${x} .chatbot-textarea-input::-webkit-scrollbar-track {
|
|
16
|
+
background: ${r};
|
|
17
|
+
border-radius: 4px;
|
|
18
|
+
}
|
|
19
|
+
#${x} .chatbot-message-list::-webkit-scrollbar-thumb,
|
|
20
|
+
#${x} .chatbot-textarea-input::-webkit-scrollbar-thumb {
|
|
21
|
+
background-color: ${t};
|
|
22
|
+
border-radius: 4px;
|
|
23
|
+
border: 2px solid ${r};
|
|
24
|
+
}
|
|
25
|
+
`,document.head.appendChild(i),()=>{var E;(E=document.getElementById(l))==null||E.remove()}},[x,o.window.scrollbarThumbColor,o.window.scrollbarTrackColor]),s.useEffect(()=>{U(C)},[C]),s.useEffect(()=>{var t;(t=de.current)==null||t.scrollIntoView({behavior:"smooth"})},[$,O,C]),s.useEffect(()=>{var t,r;F?(t=K.current)==null||t.focus():(r=he.current)==null||r.focus()},[F]),s.useEffect(()=>{const t=r=>{r.key==="Escape"&&F&&z(!1)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[F]),s.useEffect(()=>{const t=K.current;if(!t)return;t.style.height="auto",t.style.height=`${t.scrollHeight}px`;const l=t.scrollHeight-t.clientHeight>4;t.style.overflowY=l?"auto":"hidden"},[B]);const oe=s.useCallback(async()=>{var E,pe,ge,me,we,ye,xe,ve,Ce,ke;const t=B.trim();if(!t&&!m||g||O||C)return;const r=m?{name:m.name,type:m.type,size:m.size,previewUrl:m.type.startsWith("image/")?URL.createObjectURL(m):null}:null,l={id:`user-${Date.now()}`,text:t,sender:"user",attachment:r};W||J(f=>[...f,l]),P(t,m),q(""),U(!0);const i=m;D(null);let h="Sorry, an error occurred. Please check the console for details.";try{if(Q){const f=Q.startChat({history:Pe($)}),w=[t];if(i){const v=await M(i);w.push({inlineData:{data:v,mimeType:i.type}})}h=await(await(await f.sendMessage(w)).response).text()||"(no response from Gemini)"}else if(R){const f=$.map(v=>({role:v.sender==="bot"?"assistant":"user",content:v.text})),w=[{type:"text",text:t}];if(i&&i.type.startsWith("image/")){const v=await M(i);w.push({type:"image_url",image_url:{url:`data:${i.type};base64,${v}`}})}else i&&(console.warn("OpenAI integration currently only supports image files. File was ignored."),h="Note: The attached file was not an image and was ignored. ");const T=((me=(ge=(pe=(E=(await R.chat.completions.create({model:ae,messages:[...f,{role:"user",content:w}]})).choices)==null?void 0:E[0])==null?void 0:pe.message)==null?void 0:ge.content)==null?void 0:me.trim())||"(no response from OpenAI)";h=i&&!i.type.startsWith("image/")?h+T:T}else if(ee){const f=$.map(v=>({role:v.sender==="bot"?"assistant":"user",content:v.text})),w=[{type:"text",text:t}];if(i&&i.type.startsWith("image/")){const v=await M(i);w.unshift({type:"image",source:{type:"base64",media_type:i.type,data:v}})}else i&&(console.warn("Anthropic integration currently only supports image files. File was ignored."),h="Note: The attached file was not an image and was ignored. ");const T=((xe=(ye=(we=(await ee.messages.create({model:ne,system:c,messages:[...f,{role:"user",content:w}],max_tokens:1024})).content)==null?void 0:we[0])==null?void 0:ye.text)==null?void 0:xe.trim())||"(no response from Claude)";h=i&&!i.type.startsWith("image/")?h+T:T}else if(te){let f="";i&&(console.warn("Groq API does not support file uploads. Sending text only."),f=`Note: The attached file was ignored as this AI model does not support file uploads. Here is my response to your text:
|
|
26
|
+
|
|
27
|
+
`);const w=$.map(T=>({role:T.sender==="bot"?"assistant":"user",content:T.text})),G=await te.chat.completions.create({messages:[...w,{role:"user",content:t}],model:le});h=f+(((ke=(Ce=(ve=G.choices[0])==null?void 0:ve.message)==null?void 0:Ce.content)==null?void 0:ke.trim())||"(no response from Groq)")}else h=`You said: "${t}"`,i&&(h+=` and attached a file named "${i.name}".`),await new Promise(f=>setTimeout(f,800))}catch(f){console.error("ChatBot handleSend Error:",f),h="An error occurred while processing your request."}finally{const f={id:`bot-${Date.now()}`,text:h,sender:"bot",attachment:null};J(w=>[...w,f]),U(!1)}},[B,m,g,O,C,W,$,P,J,D,q,U,c,Q,R,ee,te,ae,ne,le]),Ve=s.useCallback(t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),oe())},[oe]),_e=()=>{L.current&&!X&&L.current.start()},Ye=()=>{L.current&&X&&(L.current.stop(),ce(!1))},Ze=()=>{var t;(t=ue.current)==null||t.click()},Xe=t=>{var l;const r=(l=t.target.files)==null?void 0:l[0];r&&(D(r),De(r)),t.target&&(t.target.value=null)},re=t=>typeof t=="string"?e.jsx("img",{src:t,alt:"avatar",className:"w-8 h-8 rounded-full object-cover"}):e.jsx("div",{className:"w-8 h-8 rounded-full text-gray-500",children:t}),H=O||C,fe={"bottom-right":"bottom-5 right-5","bottom-left":"bottom-5 left-5",center:"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"},Je=o.window.placement==="center",j={rounded:"rounded-xl",square:"rounded-md"};return e.jsxs("div",{id:x,style:Me,className:"font-sans",children:[e.jsx(p.AnimatePresence,{children:!F&&e.jsx(p.motion.button,{ref:he,onClick:()=>z(!0),"aria-label":"Open Chat",initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:{duration:.2,ease:"easeOut"},className:"fixed bottom-10 right-10 z-50 rounded-full shadow-lg flex items-center justify-center cursor-pointer border-2 border-white/50 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-[--chatbot-launcher-bg]",style:{backgroundColor:"var(--chatbot-launcher-bg)",color:"var(--chatbot-launcher-icon-color)",width:"var(--chatbot-launcher-size)",height:"var(--chatbot-launcher-size)"},children:e.jsx(I.FontAwesomeIcon,{icon:S.faCommentDots})})}),e.jsxs(p.AnimatePresence,{children:[F&&Je&&o.window.backdrop&&e.jsx(p.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},style:{backgroundColor:o.window.backdropColor,backdropFilter:`blur(${o.window.backdropBlur})`,WebkitBackdropFilter:`blur(${o.window.backdropBlur})`},className:"fixed inset-0 z-40",onClick:()=>z(!1)},"chatbot-backdrop"),F&&e.jsxs("div",{ref:Ge,"aria-modal":"true",role:"dialog",className:`fixed ${fe[o.window.placement]||fe["bottom-right"]} z-50 flex flex-col overflow-hidden shadow-2xl border`,style:{width:"var(--chatbot-window-width)",height:"var(--chatbot-window-height)",borderRadius:"var(--chatbot-window-border-radius)",backgroundColor:"var(--chatbot-window-bg)",borderColor:"var(--chatbot-window-border-color)"},children:[e.jsxs("header",{className:"flex items-center justify-between p-3 flex-shrink-0",style:{background:"var(--chatbot-header-bg)",color:"var(--chatbot-header-text-color)"},children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-white/30 flex items-center justify-center p-1",children:re(d)}),e.jsx("span",{style:{fontFamily:"var(--chatbot-header-font-family)",fontWeight:"var(--chatbot-header-font-weight)"},className:"text-lg",children:a})]}),e.jsx("button",{onClick:()=>z(!1),"aria-label":"Close Chat",className:"p-1 rounded-full hover:bg-white/20 focus:outline-none focus-visible:ring-2 focus-visible:ring-white",children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",className:"w-6 h-6",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{role:"log","aria-live":"polite",className:"chatbot-message-list flex-1 p-4 overflow-y-auto space-y-4",children:[e.jsx(p.AnimatePresence,{initial:!1,children:$.map((t,r)=>e.jsxs(p.motion.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.3,ease:"easeOut"},className:`flex items-end max-w-[85%] gap-2 ${t.sender==="user"?"ml-auto flex-row-reverse":"mr-auto"}`,children:[o.messages.showAvatars&&e.jsx("div",{className:"w-7 h-7 rounded-full flex-shrink-0 overflow-hidden",children:re(t.sender==="user"?b:d)}),e.jsxs("div",{className:`flex flex-col ${t.sender==="user"?"items-end":"items-start"}`,children:[t.sender==="user"&&t.attachment&&e.jsx("div",{className:`p-2 mb-1 max-w-full self-end ${j[o.messages.bubbleShape]||j.rounded} ${!t.text&&o.messages.bubblePointer?"rounded-br-none":""}`,style:{backgroundColor:"var(--chatbot-user-msg-bg)",color:"var(--chatbot-user-msg-text-color)"},children:t.attachment.previewUrl?e.jsx("img",{src:t.attachment.previewUrl,alt:t.attachment.name,className:"w-full h-auto object-cover rounded-md max-w-[200px]"}):e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(I.FontAwesomeIcon,{icon:S.faFileAlt,className:"w-4 h-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:t.attachment.name})]})}),t.text&&e.jsx(p.motion.div,{layout:"position",transition:{duration:.2,ease:"easeOut"},className:`px-3 py-2 ${j[o.messages.bubbleShape]||j.rounded} ${o.messages.bubblePointer?t.sender==="user"?"rounded-br-none":"rounded-bl-none":""}`,style:{backgroundColor:t.sender==="user"?"var(--chatbot-user-msg-bg)":"var(--chatbot-bot-msg-bg)",color:t.sender==="user"?"var(--chatbot-user-msg-text-color)":"var(--chatbot-bot-msg-text-color)",fontFamily:"var(--chatbot-msg-font-family)",fontSize:"var(--chatbot-msg-font-size)"},children:t.sender==="bot"&&r===$.length-1?e.jsx(Ee,{text:t.text,animationType:o.messages.animation,components:be}):e.jsx("div",{className:"prose prose-sm max-w-none text-inherit prose-p:my-0",style:{color:"inherit"},children:e.jsx(A,{components:be,children:t.text})})})]})]},t.id))}),H&&e.jsxs("div",{className:"flex items-end max-w-[85%] gap-2 mr-auto",children:[o.messages.showAvatars&&e.jsx("div",{className:"w-7 h-7 rounded-full flex-shrink-0 overflow-hidden",children:re(d)}),e.jsx("div",{className:`px-3 py-2 ${j[o.messages.bubbleShape]||j.rounded} rounded-bl-none`,style:{backgroundColor:"var(--chatbot-bot-msg-bg)"},children:e.jsx(Be,{})})]},"typing-indicator"),e.jsx("div",{ref:de})]}),e.jsxs("footer",{className:"p-3 border-t flex-shrink-0",style:{borderColor:"var(--chatbot-window-border-color)",backgroundColor:"var(--chatbot-input-bg)"},children:[e.jsx(p.AnimatePresence,{children:m&&e.jsx(p.motion.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2},children:e.jsx(je,{file:m,onRemove:()=>D(null)})})}),e.jsxs("div",{className:"flex items-end space-x-2",children:[Oe&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:Ze,disabled:g||H,"aria-label":"Upload File",className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",style:{backgroundColor:"var(--chatbot-user-msg-bg)",color:"var(--chatbot-user-msg-text-color)","--tw-ring-color":"var(--chatbot-user-msg-bg)"},children:e.jsx(I.FontAwesomeIcon,{icon:S.faPaperclip,className:"w-5 h-5"})}),e.jsx("input",{type:"file",ref:ue,onChange:Xe,accept:Ue,style:{display:"none"},"aria-hidden":"true"})]}),e.jsx("textarea",{ref:K,rows:"1",value:B,onChange:t=>q(t.target.value),onKeyDown:Ve,placeholder:y,disabled:g||H,"aria-label":"Chat input",className:"chatbot-textarea-input flex-1 w-full px-4 py-2 bg-transparent rounded-xl border focus:outline-none focus:ring-2 disabled:cursor-not-allowed disabled:opacity-60 resize-none overflow-hidden",style:{color:"var(--chatbot-input-text-color)",borderColor:"var(--chatbot-input-border-color)","--tw-ring-color":"var(--chatbot-input-focus-ring)",maxHeight:"100px",overflowY:"hidden",lineHeight:"1.5"}}),X?e.jsx(p.motion.button,{onClick:Ye,"aria-label":"Stop Recording",className:"px-4 h-10 rounded-full flex items-center justify-center flex-shrink-0 font-semibold text-sm transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",style:{backgroundColor:"var(--chatbot-user-msg-bg)",color:"var(--chatbot-user-msg-text-color)","--tw-ring-color":"var(--chatbot-user-msg-bg)"},animate:{opacity:[1,.8,1],scale:[1,1.1,1]},transition:{duration:1,repeat:1/0,ease:"easeInOut"},children:e.jsx(I.FontAwesomeIcon,{icon:S.faMicrophoneSlash,className:"w-5 h-5"})}):qe&&!B.trim()?e.jsx(p.motion.button,{onClick:_e,"aria-label":"Start Recording",className:"px-4 h-10 rounded-full flex items-center justify-center flex-shrink-0 font-semibold text-sm transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",style:{backgroundColor:"var(--chatbot-user-msg-bg)",color:"var(--chatbot-user-msg-text-color)","--tw-ring-color":"var(--chatbot-user-msg-bg)"},children:e.jsx(I.FontAwesomeIcon,{icon:S.faMicrophone,className:"w-5 h-5"})}):e.jsx("button",{onClick:oe,disabled:!B.trim()||g||H,"aria-label":"Send Message",className:"px-4 h-10 rounded-full flex items-center justify-center flex-shrink-0 font-semibold text-sm transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",style:{backgroundColor:"var(--chatbot-user-msg-bg)",color:"var(--chatbot-user-msg-text-color)","--tw-ring-color":"var(--chatbot-user-msg-bg)"},children:e.jsx(Fe,{})})]})]})]},"chatbot-window")]})]})};u.ChatBot=ze,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
package/dist/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gauravrathod674/super-customizable-chatbot",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.8",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"description": "A highly customizable React chatbot component with support for Gemini, OpenAI, Anthropic, and Groq APIs.",
|