@brainfish-ai/components 0.0.29 → 0.0.31

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/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("react"),t=require("lucide-react"),r=require("framer-motion"),a=require("react/jsx-runtime"),o=require("class-variance-authority"),n=require("clsx"),i=require("tailwind-merge"),s=require("@radix-ui/react-dropdown-menu"),l=require("@radix-ui/react-icons"),c=require("@radix-ui/react-tooltip"),d=require("rehype-raw"),m=require("remark-gfm"),u=require("react-syntax-highlighter"),p=require("react-syntax-highlighter/dist/cjs/styles/prism"),g=require("react-markdown"),h=require("mermaid");function f(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var w=f(e),b=f(s),y=f(c);function v(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&a.firstChild?a.insertBefore(o,a.firstChild):a.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}function x(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(r[a[o]]=e[a[o]])}return r}function k(e,t,r,a){return new(r||(r=Promise))((function(o,n){function i(e){try{l(a.next(e))}catch(e){n(e)}}function s(e){try{l(a.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}l((a=a.apply(e,t||[])).next())}))}function E(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function N(...e){return t=>{let r=!1;const a=e.map((e=>{const a=E(e,t);return r||"function"!=typeof a||(r=!0),a}));if(r)return()=>{for(let t=0;t<a.length;t++){const r=a[t];"function"==typeof r?r():E(e[t],null)}}}}v('/*! tailwindcss v3.3.5 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}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,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;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{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-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,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}:root{--background:0 0% 100%;--foreground:0 0% 3.9%;--card:0 0% 100%;--card-foreground:0 0% 3.9%;--popover:0 0% 100%;--popover-foreground:0 0% 3.9%;--primary:0 0% 9%;--primary-foreground:0 0% 98%;--secondary:0 0% 96.1%;--secondary-foreground:0 0% 9%;--muted:0 0% 96.1%;--muted-foreground:0 0% 45.1%;--accent:0 0% 96.1%;--accent-foreground:0 0% 9%;--destructive:0 84.2% 60.2%;--destructive-foreground:0 0% 98%;--border:0 0% 89.8%;--input:0 0% 89.8%;--ring:0 0% 3.9%;--radius:0.5rem}.dark{--background:0 0% 3.9%;--foreground:0 0% 98%;--card:0 0% 3.9%;--card-foreground:0 0% 98%;--popover:0 0% 3.9%;--popover-foreground:0 0% 98%;--primary:0 0% 98%;--primary-foreground:0 0% 9%;--secondary:0 0% 14.9%;--secondary-foreground:0 0% 98%;--muted:0 0% 14.9%;--muted-foreground:0 0% 63.9%;--accent:0 0% 14.9%;--accent-foreground:0 0% 98%;--destructive:0 62.8% 30.6%;--destructive-foreground:0 0% 98%;--border:0 0% 14.9%;--input:0 0% 14.9%;--ring:0 0% 83.1%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}*,:after,:before{--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:rgba(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: }::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:rgba(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: }.container{margin-left:auto;margin-right:auto;padding-left:2rem;padding-right:2rem;width:100%}@media (min-width:1400px){.container{max-width:1400px}}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.bottom-20{bottom:5rem}.bottom-4{bottom:1rem}.left-2{left:.5rem}.left-4{left:1rem}.right-1{right:.25rem}.right-4{right:1rem}.top-1{top:.25rem}.top-1\\/2{top:50%}.isolate{isolation:isolate}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-bottom:.25rem;margin-top:.25rem}.my-2{margin-bottom:.5rem;margin-top:.5rem}.my-4{margin-bottom:1rem;margin-top:1rem}.mb-2{margin-bottom:.5rem}.mb-20{margin-bottom:5rem}.mb-4{margin-bottom:1rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-\\[-5px\\]{margin-top:-5px}.block{display:block}.inline-block{display:inline-block}.\\!inline{display:inline!important}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.hidden{display:none}.h-10{height:2.5rem}.h-2{height:.5rem}.h-3{height:.75rem}.h-3\\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\\[44px\\]{height:44px}.h-full{height:100%}.h-px{height:1px}.max-h-\\[100px\\]{max-height:100px}.min-h-\\[24px\\]{min-height:24px}.min-h-\\[36px\\]{min-height:36px}.min-h-screen{min-height:100vh}.w-1\\/4{width:25%}.w-2{width:.5rem}.w-3{width:.75rem}.w-3\\.5{width:.875rem}.w-3\\/4{width:75%}.w-32{width:8rem}.w-4{width:1rem}.w-40{width:10rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-5\\/6{width:83.333333%}.w-8{width:2rem}.w-9{width:2.25rem}.w-full{width:100%}.min-w-\\[20px\\]{min-width:20px}.min-w-\\[8rem\\]{min-width:8rem}.max-w-3xl{max-width:48rem}.max-w-\\[200px\\]{max-width:200px}.max-w-none{max-width:none}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.border-collapse{border-collapse:collapse}.-translate-y-1\\/2{--tw-translate-y:-50%}.-translate-y-1\\/2,.rotate-180{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate:180deg}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.list-outside{list-style-position:outside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(2rem*var(--tw-space-y-reverse));margin-top:calc(2rem*(1 - var(--tw-space-y-reverse)))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.divide-gray-200>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(229 231 235/var(--tw-divide-opacity))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.truncate{overflow:hidden;text-overflow:ellipsis}.truncate,.whitespace-nowrap{white-space:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-b-lg{border-bottom-left-radius:var(--radius);border-bottom-right-radius:var(--radius)}.rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-none{border-style:none}.border-black{--tw-border-opacity:1;border-color:rgb(0 0 0/var(--tw-border-opacity))}.border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}.border-input{border-color:hsl(var(--input))}.border-slate-300{--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}.border-transparent{border-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\\[\\#86efac\\]{--tw-bg-opacity:1;background-color:rgb(134 239 172/var(--tw-bg-opacity))}.bg-background{background-color:hsl(var(--background))}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity))}.bg-green-100{--tw-bg-opacity:1;background-color:rgb(220 252 231/var(--tw-bg-opacity))}.bg-muted{background-color:hsl(var(--muted))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity))}.bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-slate-200{--tw-bg-opacity:1;background-color:rgb(226 232 240/var(--tw-bg-opacity))}.bg-transparent{background-color:transparent}.bg-zinc-800\\/80{background-color:rgba(39,39,42,.8)}.bg-opacity-50{--tw-bg-opacity:0.5}.fill-current{fill:currentColor}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\\.5{padding:.125rem}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0{padding-bottom:0;padding-top:0}.py-0\\.5{padding-bottom:.125rem;padding-top:.125rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.py-20{padding-bottom:5rem;padding-top:5rem}.py-4{padding-bottom:1rem;padding-top:1rem}.pb-1{padding-bottom:.25rem}.pl-8{padding-left:2rem}.pr-2{padding-right:.5rem}.text-left{text-align:left}.text-center{text-align:center}.font-sans{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-5xl{font-size:3rem;line-height:1}.text-base{font-size:1rem;line-height:1.5rem}.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}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-light{font-weight:300}.font-medium{font-weight:500}.font-semibold{font-weight:600}.lowercase{text-transform:lowercase}.leading-normal{line-height:1.5}.tracking-widest{letter-spacing:.1em}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity))}.text-green-600{--tw-text-opacity:1;color:rgb(22 163 74/var(--tw-text-opacity))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity))}.text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity))}.text-red-600{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity))}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.shadow,.shadow-lg{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 rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.shadow-md,.shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--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(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)}.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{--tw-backdrop-blur:blur(8px);-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-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-transform{transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.animate-in{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-duration:.15s;animation-name:enter}.fade-in-0{--tw-enter-opacity:0}.zoom-in-95{--tw-enter-scale:.95}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.placeholder\\:text-sm::-moz-placeholder{font-size:.875rem;line-height:1.25rem}.placeholder\\:text-sm::placeholder{font-size:.875rem;line-height:1.25rem}.placeholder\\:text-gray-400::-moz-placeholder{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.placeholder\\:text-gray-400::placeholder{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.hover\\:scale-105:hover{--tw-scale-x:1.05;--tw-scale-y:1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:bg-\\[\\#86efac\\]\\/90:hover{background-color:rgba(134,239,172,.9)}.hover\\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\\:bg-destructive\\/90:hover{background-color:hsl(var(--destructive)/.9)}.hover\\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.hover\\:bg-gray-200:hover{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.hover\\:bg-gray-50:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity))}.hover\\:bg-green-200:hover{--tw-bg-opacity:1;background-color:rgb(187 247 208/var(--tw-bg-opacity))}.hover\\:bg-primary\\/90:hover{background-color:hsl(var(--primary)/.9)}.hover\\:bg-red-200:hover{--tw-bg-opacity:1;background-color:rgb(254 202 202/var(--tw-bg-opacity))}.hover\\:bg-secondary\\/80:hover{background-color:hsl(var(--secondary)/.8)}.hover\\:bg-zinc-700\\/50:hover{background-color:rgba(63,63,70,.5)}.hover\\:bg-opacity-50:hover{--tw-bg-opacity:0.5}.hover\\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\\:text-zinc-100:hover{--tw-text-opacity:1;color:rgb(244 244 245/var(--tw-text-opacity))}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:opacity-90:hover{opacity:.9}.focus\\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.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\\:ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:ring-1: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(1px + 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-ring:focus-visible{--tw-ring-color:hsl(var(--ring))}.focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.focus-visible\\:ring-offset-background:focus-visible{--tw-ring-offset-color:hsl(var(--background))}.active\\:scale-95:active{--tw-scale-x:.95;--tw-scale-y:.95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\\:pointer-events-none:disabled{pointer-events:none}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\\:opacity-100{opacity:1}.data-\\[disabled\\]\\:pointer-events-none[data-disabled]{pointer-events:none}.data-\\[state\\=checked\\]\\:translate-x-4[data-state=checked]{--tw-translate-x:1rem}.data-\\[state\\=checked\\]\\:translate-x-4[data-state=checked],.data-\\[state\\=unchecked\\]\\:translate-x-0[data-state=unchecked]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[state\\=unchecked\\]\\:translate-x-0[data-state=unchecked]{--tw-translate-x:0px}.data-\\[state\\=checked\\]\\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\\[state\\=open\\]\\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\\[state\\=unchecked\\]\\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\\[disabled\\]\\:opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=open\\]\\:animate-in[data-state=open]{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-duration:.15s;animation-name:enter}.data-\\[state\\=closed\\]\\:animate-out[data-state=closed]{--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial;animation-duration:.15s;animation-name:exit}.data-\\[state\\=closed\\]\\:fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}:is([data-mode=dark] .dark\\:border-white){--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity))}@media (min-width:640px){.sm\\:ml-3{margin-left:.75rem}.sm\\:block{display:block}.sm\\:h-5{height:1.25rem}.sm\\:h-9{height:2.25rem}.sm\\:h-\\[52px\\]{height:52px}.sm\\:w-5{width:1.25rem}.sm\\:w-9{width:2.25rem}.sm\\:gap-3{gap:.75rem}.sm\\:text-base{font-size:1rem;line-height:1.5rem}.sm\\:placeholder\\:text-base::-moz-placeholder{font-size:1rem;line-height:1.5rem}.sm\\:placeholder\\:text-base::placeholder{font-size:1rem;line-height:1.5rem}}.\\[\\&\\>svg\\]\\:shrink-0>svg{flex-shrink:0}.\\[\\&_svg\\]\\:pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:shrink-0 svg{flex-shrink:0}'),"function"==typeof SuppressedError&&SuppressedError;var C=w.forwardRef(((e,t)=>{const{children:r,...o}=e,n=w.Children.toArray(r),i=n.find(S);if(i){const e=i.props.children,r=n.map((t=>t===i?w.Children.count(e)>1?w.Children.only(null):w.isValidElement(e)?e.props.children:null:t));return a.jsx(j,{...o,ref:t,children:w.isValidElement(e)?w.cloneElement(e,void 0,r):null})}return a.jsx(j,{...o,ref:t,children:r})}));C.displayName="Slot";var j=w.forwardRef(((e,t)=>{const{children:r,...a}=e;if(w.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r);return w.cloneElement(r,{...O(a,r.props),ref:t?N(t,e):e})}return w.Children.count(r)>1?w.Children.only(null):null}));j.displayName="SlotClone";var z=({children:e})=>a.jsx(a.Fragment,{children:e});function S(e){return w.isValidElement(e)&&e.type===z}function O(e,t){const r={...t};for(const a in t){const o=e[a],n=t[a];/^on[A-Z]/.test(a)?o&&n?r[a]=(...e)=>{n(...e),o(...e)}:o&&(r[a]=o):"style"===a?r[a]={...o,...n}:"className"===a&&(r[a]=[o,n].filter(Boolean).join(" "))}return{...e,...r}}function R(...e){return i.twMerge(n.clsx(e))}function I(e){const t={en:[/i(?:\s|['\u2018\u2019])?m(?:\s+really)?\s+not\s+sure/i,/i(?:\s+am)?(?:\s+really)?\s+not\s+sure/i,/i\s+don(?:['\u2018\u2019])?t\s+know/i,/it(?:['\u2018\u2019]s| is) unclear/i,/cannot determine/i,/hard to say/i,/difficult to determine/i,/need more information/i],es:[/no (?:lo )?sé/i,/no estoy seguro/i,/no es claro/i,/desconocido/i],fr:[/je ne sais pas/i,/je ne suis pas sûr/i,/ce n'est pas clair/i,/inconnu/i],de:[/ich weiß nicht/i,/ich bin nicht sicher/i,/es ist unklar/i,/unbekannt/i],it:[/non lo so/i,/non sono sicuro/i,/non è chiaro/i,/sconosciuto/i],pt:[/não sei/i,/não tenho certeza/i,/não está claro/i,/desconhecido/i],nl:[/ik weet het niet/i,/ik weet niet zeker/i,/het is onduidelijk/i,/onbekend/i],pl:[/nie wiem/i,/nie jestem pewien/i,/to nie jest jasne/i,/nieznany/i],ru:[/я не знаю/i,/я не уверен/i,/это не ясно/i,/неизвестно/i],ja:[/知りません/i,/よくわからない/i,/不明です/i,/未知/i],ko:[/모릅니다/i,/잘 모르겠습니다/i,/불확실합니다/i,/알 수 없음/i],zh:[/我不知道/i,/我不确定/i,/不清楚/i,/未知/i],"zh-TW":[/我不知道/i,/我不確定/i,/不清楚/i,/未知/i]};let r=null;for(const[a,o]of Object.entries(t))for(const t of o){const o=e.match(t);o&&(null===r||o.index<r.index)&&(r={index:o.index,language:a})}return r?{uncertain:!0,language:r.language}:{uncertain:!1,language:null}}const L=o.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),T=w.forwardRef(((e,t)=>{var{className:r,variant:a,size:o,asChild:n=!1}=e,i=x(e,["className","variant","size","asChild"]);const s=n?C:"button";return w.createElement(s,Object.assign({className:R(L({variant:a,size:o,className:r})),ref:t},i))}));T.displayName="Button";const $=b.Root,A=b.Trigger;w.forwardRef(((e,t)=>{var{className:r,inset:a,children:o}=e,n=x(e,["className","inset","children"]);return w.createElement(b.SubTrigger,Object.assign({ref:t,className:R("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",a&&"pl-8",r)},n),o,w.createElement(l.ChevronRightIcon,{className:"ml-auto"}))})).displayName=b.SubTrigger.displayName;w.forwardRef(((e,t)=>{var{className:r}=e,a=x(e,["className"]);return w.createElement(b.SubContent,Object.assign({ref:t,className:R("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r)},a))})).displayName=b.SubContent.displayName;const q=w.forwardRef(((e,t)=>{var{className:r,sideOffset:a=4}=e,o=x(e,["className","sideOffset"]);return w.createElement(b.Portal,null,w.createElement(b.Content,Object.assign({ref:t,sideOffset:a,className:R("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r)},o)))}));q.displayName=b.Content.displayName;const P=w.forwardRef(((e,t)=>{var{className:r,inset:a}=e,o=x(e,["className","inset"]);return w.createElement(b.Item,Object.assign({ref:t,className:R("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",a&&"pl-8",r)},o))}));P.displayName=b.Item.displayName;w.forwardRef(((e,t)=>{var{className:r,children:a,checked:o}=e,n=x(e,["className","children","checked"]);return w.createElement(b.CheckboxItem,Object.assign({ref:t,className:R("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),checked:o},n),w.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},w.createElement(b.ItemIndicator,null,w.createElement(l.CheckIcon,{className:"h-4 w-4"}))),a)})).displayName=b.CheckboxItem.displayName;w.forwardRef(((e,t)=>{var{className:r,children:a}=e,o=x(e,["className","children"]);return w.createElement(b.RadioItem,Object.assign({ref:t,className:R("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r)},o),w.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},w.createElement(b.ItemIndicator,null,w.createElement(l.DotFilledIcon,{className:"h-2 w-2 fill-current"}))),a)})).displayName=b.RadioItem.displayName;w.forwardRef(((e,t)=>{var{className:r,inset:a}=e,o=x(e,["className","inset"]);return w.createElement(b.Label,Object.assign({ref:t,className:R("px-2 py-1.5 text-sm font-semibold",a&&"pl-8",r)},o))})).displayName=b.Label.displayName;w.forwardRef(((e,t)=>{var{className:r}=e,a=x(e,["className"]);return w.createElement(b.Separator,Object.assign({ref:t,className:R("-mx-1 my-1 h-px bg-muted",r)},a))})).displayName=b.Separator.displayName;const F=y.Provider,Q=y.Root,_=y.Trigger,M=w.forwardRef(((e,t)=>{var{className:r,sideOffset:a=4}=e,o=x(e,["className","sideOffset"]);return w.createElement(y.Portal,null,w.createElement(y.Content,Object.assign({ref:t,sideOffset:a,className:R("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r)},o)))}));function U({suggestions:t,onQuestionClick:r,borderColor:a,title:o="Suggested questions"}){return t&&0!==t.length?e.createElement("div",{className:"w-full"},e.createElement("h3",{className:"text-base font-medium mb-4 text-gray-900"},o),e.createElement("div",{className:"flex flex-wrap gap-2"},t.map((t=>e.createElement("button",{key:t.id,onClick:()=>r(t),className:"px-4 py-2 rounded-lg border border-gray-300 text-gray-700 hover:bg-gray-50 transition-colors duration-200 text-sm flex items-center gap-2",style:{borderColor:a}},void 0!==t.messageCount&&e.createElement(F,null,e.createElement(Q,null,e.createElement(_,{asChild:!0},e.createElement("span",{className:"bg-gray-100 text-gray-600 px-2 py-0.5 rounded-full text-xs min-w-[20px] border flex items-center justify-center",style:{borderColor:a}},t.messageCount)),e.createElement(M,null,e.createElement("p",null,t.messageCount," messages in this conversation")))),e.createElement("span",null,t.question)))))):null}M.displayName=y.Content.displayName;const D={javascript:".js",python:".py",java:".java",c:".c",cpp:".cpp","c++":".cpp","c#":".cs",ruby:".rb",php:".php",swift:".swift","objective-c":".m",kotlin:".kt",typescript:".ts",go:".go",perl:".pl",rust:".rs",scala:".scala",haskell:".hs",lua:".lua",shell:".sh",sql:".sql",html:".html",css:".css"},B=u.Prism,H=e.memo((({language:r,value:a})=>{const[o,n]=e.useState(!1);return e.createElement("div",{className:"relative font-sans text-sm mt-1"},e.createElement("div",{className:"relative rounded-t-lg bg-zinc-800/80 font-sans text-sm backdrop-blur"},e.createElement("div",{className:"flex h-8 items-center justify-between px-3"},e.createElement("span",{className:"text-xs font-medium text-zinc-400"},r),e.createElement("div",{className:"flex gap-1"},e.createElement(T,{variant:"ghost",size:"icon",className:"size-5 text-zinc-400 hover:bg-zinc-700/50 hover:text-zinc-100",onClick:()=>{k(void 0,void 0,void 0,(function*(){if(navigator.clipboard&&navigator.clipboard.writeText)try{yield navigator.clipboard.writeText(a),n(!0),setTimeout((()=>{n(!1)}),2e3)}catch(e){console.error("Failed to copy:",e)}}))}},o?e.createElement(t.CheckCircle,{size:18}):e.createElement(t.Clipboard,{size:18})),e.createElement(T,{variant:"ghost",size:"icon",className:"size-5 text-zinc-400 hover:bg-zinc-700/50 hover:text-zinc-100",onClick:()=>{const e=D[r]||".file",t=`file-${((e,t=!1)=>{const r="ABCDEFGHJKLMNPQRSTUVWXY3456789";let a="";for(let t=0;t<e;t+=1)a+=r.charAt(Math.floor(30*Math.random()));return t?a.toLowerCase():a})(3,!0)}${e}`,o=new Blob([a],{type:"text/plain"}),n=URL.createObjectURL(o),i=document.createElement("a");i.download=t,i.href=n,i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(n)}},e.createElement(t.Download,{size:18}))))),e.createElement("div",{className:"rounded-b-lg"},e.createElement(B,{language:r,style:p.a11yDark,PreTag:"div",wrapLongLines:!0,customStyle:{margin:0,borderTopLeftRadius:0,borderTopRightRadius:0}},a)))}));H.displayName="CodeBlock";const W=w.forwardRef((({src:e,border:t,width:r="100%",height:a="400px",title:o},n)=>{const[i,s]=w.useState(!1);return w.useEffect((()=>{let e=!0;return setTimeout((()=>{e&&s(!0)}),0),()=>{e=!1}}),[]),w.createElement("div",{className:"overflow-hidden rounded-lg mt-4 "+(t?"border":""),style:{width:r,height:a}},i&&w.createElement(w.Fragment,null,w.createElement("iframe",{ref:n,src:e,sandbox:"allow-same-origin allow-scripts allow-popups allow-forms allow-downloads",width:r,height:a,frameBorder:"0",title:"embed",loading:"lazy",allowFullScreen:!0,className:"block rounded-lg"}),o&&w.createElement("span",{className:"block text-center text-sm font-medium"},o)))}));function Z(e){const t=e.attrs.href.replace("share","embed");return w.createElement(W,Object.assign({},e,{src:t,title:"Loom Embed"}))}function Y(e){return w.createElement(W,Object.assign({},e,{src:e.attrs.href,title:"Supademo Embed"}))}function V(e){return w.createElement(W,Object.assign({},e,{src:e.attrs.href,title:"Typeform Embed"}))}function X(e){const t=e.attrs.href.match(/(http|https)?:\/\/(www\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|)(\d+)(?:\/|\?)?([\d\w]+)?/);if(!t)return null;const r=t[4],a=t[5],o=`https://player.vimeo.com/video/${r}?byline=0${a?`&h=${a}`:""}`;return w.createElement(W,Object.assign({},e,{src:o,title:`Vimeo Embed (${r})`,height:"412px",border:!1}))}function J(e){const t=(e=>{const t=[/^https?:\/\/([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)\/?$/,/^https?:\/\/fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)\/?$/,/^fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)\/?$/,/^([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)\/?$/];for(const r of t){const t=e.match(r);if(t)return t}return null})(e.attrs.href);if(!t)return null;const r=t[1],a=t[2]||t[1],o=r?`https://${r}.wistia.com/embed/iframe/${a}?seo=true&videoFoam=false`:`https://fast.wistia.com/embed/iframe/${a}`;return w.createElement(W,Object.assign({},e,{src:o,border:!0,title:`Wistia Embed (${a})`}))}function K(e){const t=(e=>{const t=e.match(/(?:https?:\/\/)?(?:www\.)?youtu\.?be(?:\.com)?\/?.*(?:watch|embed)?(?:.*v=|v\/|\/)([a-zA-Z0-9_-]{11})$/i);return t?t[1]:null})(e.attrs.href);return t?w.createElement(W,Object.assign({},e,{src:`https://www.youtube.com/embed/${t}?modestbranding=1`,title:`YouTube Embed (${t})`})):null}Z.isMatch=e=>/^https:\/\/(www\.)?(use)?loom\.com\/(embed|share)\/(.*)$/.test(e),Y.isMatch=e=>/^https:\/\/app\.supademo\.com\/embed\/(.*)$/.test(e),V.isMatch=e=>/^https:\/\/([A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)\.typeform\.com\/to\/(.*)$/.test(e),X.isMatch=e=>/^(https?):\/\/(www\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|)?(\d+)(\/)?(?:\?.*|#.*)?$/i.test(e),J.isMatch=e=>[/^https?:\/\/([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i,/^https?:\/\/fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i,/^fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i,/^([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i].some((t=>t.test(e))),K.isMatch=e=>/^(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|embed\/|v\/|shorts\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})(?:\/|[?&].*)?$/i.test(e);const G=[Z,Y,V,K,J,X],ee=t=>{const{href:r}=t.attrs,[a,o]=e.useState(null);if(e.useEffect((()=>{let e=!0;return(()=>{try{const a=G.find((e=>e.isMatch(r)));a&&e&&o({Component:a,props:t})}catch(e){console.error("Error finding embed match:",e)}})(),()=>{e=!1}}),[r,t]),a){const{Component:e,props:t}=a;return w.createElement(e,Object.assign({},t))}return null},te=e.memo(g,((e,t)=>e.children===t.children)),re={startOnLoad:!1,theme:"default",securityLevel:"loose",fontFamily:"inherit"},ae=({content:t})=>{const[r,a]=e.useState(""),[o,n]=e.useState(null),i=e.useRef(null),[s,l]=e.useState(!1);return e.useEffect((()=>{(()=>{try{h.initialize(re),l(!0)}catch(e){console.error("Error initializing mermaid:",e),n("Failed to initialize diagram renderer")}})()}),[]),e.useEffect((()=>{if(!s)return;k(void 0,void 0,void 0,(function*(){try{const e=`mermaid-${Math.random().toString(36).substr(2,9)}`,r=yield h.render(e,t);a(r.svg),n(null)}catch(e){console.error("Error rendering mermaid diagram:",e),n("Failed to render diagram")}}))}),[t,s]),o?e.createElement("div",{className:"text-red-500 bg-red-50 p-4 rounded-md"},o,e.createElement("pre",{className:"mt-2 text-sm"},t)):e.createElement("div",{ref:i,className:"my-4 overflow-auto",dangerouslySetInnerHTML:{__html:r}})},oe=e.memo((({message:t,isStreaming:r})=>{const[a,o]=e.useState(t.content);e.useEffect((()=>{var e;const r=I(t.content);console.log("Content:",t.content),console.log("Uncertainty check result:",r),r.uncertain&&r.language&&(null===(e=t.uncertaintyFallbackText)||void 0===e?void 0:e[r.language])?o(t.uncertaintyFallbackText[r.language]):o(t.content)}),[t.content,t.uncertaintyFallbackText,r]);const n=a.replace(/^\n+|(\n+|\\)+$/g,"");return e.createElement(te,{className:"dark:prose-invert prose flex-1",remarkPlugins:[m],rehypePlugins:[d],components:{code:t=>{var{inline:r,className:a,children:o}=t,n=x(t,["inline","className","children"]);const i=/language-(\w+)/.exec(a||""),s=i&&i[1];return r||"mermaid"!==s&&"mermaidjs"!==s?!r&&s?e.createElement(H,Object.assign({key:Math.random(),language:s,value:String(o).replace(/\n$/,"")},n)):e.createElement("code",Object.assign({className:`text-red-400 bg-slate-200 border-slate-300 border rounded p-0.5 ${a}`.trim()},n),o):e.createElement(ae,{content:String(o).replace(/\n$/,"")})},marker:({children:t})=>e.createElement("div",{className:"my-2"},e.createElement("span",{className:"highlight"},t)),table:({children:t})=>e.createElement("table",{className:"border-collapse border border-black px-3 py-1 dark:border-white"},t),th:({children:t})=>e.createElement("th",{className:"break-words border border-black bg-gray-500 px-3 py-1 text-white dark:border-white"},t),td:({children:t})=>e.createElement("td",{className:"break-words border border-black px-3 py-1 dark:border-white"},t),a(t){var{children:r}=t,a=x(t,["children"]);if(a.href){const t=ee({attrs:{href:a.href}});if(e.isValidElement(t))return t}return e.createElement("a",Object.assign({className:"link",target:"_blank",rel:"noopener noreferrer"},a),r)},pre:({children:t})=>e.createElement(e.Fragment,null,t),img({src:t,alt:r}){const a=ee({attrs:{href:null!=t?t:""}});return e.isValidElement(a)?a:e.createElement("img",{src:t,alt:r,className:"w-full"})},li:t=>{var{children:r}=t,a=x(t,["children"]);return e.createElement("li",Object.assign({className:"py-1"},a),r)},ul:({children:t})=>e.createElement("ul",{className:"ml-4 list-outside list-disc"},t),ol:({children:t})=>e.createElement("ol",{className:"ml-4 list-outside list-decimal"},t),strong:t=>{var{children:r}=t,a=x(t,["children"]);return e.createElement("span",Object.assign({className:"font-semibold"},a),r)},h1:t=>{var{children:r}=t,a=x(t,["children"]);return e.createElement("h1",Object.assign({className:"mb-2 mt-6 text-3xl font-semibold"},a),r)},h2:t=>{var{children:r}=t,a=x(t,["children"]);return e.createElement("h2",Object.assign({className:"mb-2 mt-6 text-2xl font-semibold"},a),r)},h3:t=>{var{children:r}=t,a=x(t,["children"]);return e.createElement("h3",Object.assign({className:"mb-2 mt-6 text-xl font-semibold"},a),r)},h4:t=>{var{children:r}=t,a=x(t,["children"]);return e.createElement("h4",Object.assign({className:"mb-2 mt-6 text-lg font-semibold"},a),r)},h5:t=>{var{children:r}=t,a=x(t,["children"]);return e.createElement("h5",Object.assign({className:"mb-2 mt-6 text-base font-semibold"},a),r)},h6:t=>{var{children:r}=t,a=x(t,["children"]);return e.createElement("h6",Object.assign({className:"mb-2 mt-6 text-sm font-semibold"},a),r)}}},n)}));oe.displayName="FormattedMessage";var ne="generating-star-module_animate-spin__AJjwz";v(".generating-star-module_animate-spin__AJjwz{animation:generating-star-module_rotate__ChndJ 2s linear infinite;transform:none;transform-box:fill-box;transform-origin:center}@keyframes generating-star-module_rotate__ChndJ{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}");const ie=({loading:t,color:r="#000"})=>e.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:"mt-[-5px] inline-block flex-shrink-0",style:{minWidth:"24px",minHeight:"24px"}},e.createElement("path",{className:t?ne:"",d:"M7.54672 16.0031L2.66234 14.2031C2.51881 14.1498 2.39502 14.0539 2.3076 13.9282C2.22019 13.8025 2.17333 13.6531 2.17333 13.5C2.17333 13.3469 2.22019 13.1975 2.3076 13.0718C2.39502 12.9461 2.51881 12.8501 2.66234 12.7969L7.54672 10.9969C7.64981 10.9589 7.74344 10.899 7.82113 10.8213C7.89882 10.7436 7.95873 10.65 7.99672 10.5469L9.79672 5.66249C9.84999 5.51896 9.94592 5.39517 10.0716 5.30775C10.1973 5.22033 10.3467 5.17348 10.4998 5.17348C10.6529 5.17348 10.8024 5.22033 10.9281 5.30775C11.0538 5.39517 11.1497 5.51896 11.203 5.66249L13.003 10.5469C13.041 10.65 13.1009 10.7436 13.1786 10.8213C13.2562 10.899 13.3499 10.9589 13.453 10.9969L18.3373 12.7969C18.4809 12.8501 18.6047 12.9461 18.6921 13.0718C18.7795 13.1975 18.8264 13.3469 18.8264 13.5C18.8264 13.6531 18.7795 13.8025 18.6921 13.9282C18.6047 14.0539 18.4809 14.1498 18.3373 14.2031L13.453 16.0031C13.3499 16.0411 13.2562 16.101 13.1786 16.1787C13.1009 16.2564 13.041 16.35 13.003 16.4531L11.203 21.3375C11.1497 21.481 11.0538 21.6048 10.9281 21.6922C10.8024 21.7796 10.6529 21.8265 10.4998 21.8265C10.3467 21.8265 10.1973 21.7796 10.0716 21.6922C9.94592 21.6048 9.84999 21.481 9.79672 21.3375L7.99672 16.4531C7.95873 16.35 7.89882 16.2564 7.82113 16.1787C7.74344 16.101 7.64981 16.0411 7.54672 16.0031Z",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",fill:t?r:"none",strokeLinejoin:"round"}),e.createElement("path",{d:"M18.7497 3.75L14.2497 3.75",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.createElement("path",{d:"M16.4999 6V1.5",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.createElement("path",{d:"M22.4999 8.25001H19.4999",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.createElement("path",{d:"M20.9998 9.75002V6.75002",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}));function se({answer:a,question:o,theme:n,searchResults:i,isStreaming:s=!1,searchQueryId:l,feedback:c,onFeedback:d,disableFeedback:m=!1,textConfig:u={},isLoading:p=!1,isSearchLoading:g=!1}){const[h,f]=e.useState(!1),[w,b]=e.useState(!1),y=()=>k(this,void 0,void 0,(function*(){try{yield navigator.clipboard.writeText(a),f(!0),setTimeout((()=>f(!1)),2e3)}catch(e){console.error("Failed to copy text:",e)}})),v=e=>{d&&l&&d(e)};return e.createElement("div",{className:"rounded-lg p-6 relative",style:{backgroundColor:n.cardBackground,borderColor:n.border,borderWidth:"1px",borderStyle:"solid"}},e.createElement("div",{className:"flex items-start justify-between"},e.createElement("div",{className:"flex items-center gap-2 mb-4"},e.createElement("div",{className:"mt-1"},e.createElement(ie,{loading:p||s,color:n.primary})),e.createElement("h2",{className:"text-xl leading-normal",style:{color:n.text}},o)),a&&e.createElement(F,null,e.createElement(Q,null,e.createElement(_,{asChild:!0},e.createElement("button",{onClick:()=>{y()},className:"flex items-center justify-center w-8 h-8 rounded-md hover:bg-gray-100 transition-colors duration-200"},h?e.createElement(t.Check,{className:"h-4 w-4 text-green-500"}):e.createElement(t.Copy,{className:"h-4 w-4 text-gray-500"}))),e.createElement(M,null,e.createElement("p",null,h?"Copied!":"Copy"))))),p?e.createElement("div",{className:"space-y-4"},e.createElement("div",{className:"flex items-center gap-2"},e.createElement("div",{className:"animate-pulse h-5 rounded-full w-5",style:{backgroundColor:`${n.primary}30`}}),e.createElement("div",{className:"flex items-center gap-2 text-sm",style:{color:n.text}},g?u.loadingSearchText:u.loadingAnswerText)),e.createElement("div",{className:"space-y-3"},e.createElement("div",{className:"animate-pulse h-4 bg-gray-200 rounded w-3/4",style:{backgroundColor:`${n.border}40`}}),e.createElement("div",{className:"animate-pulse h-4 bg-gray-200 rounded w-full",style:{backgroundColor:`${n.border}40`}}),e.createElement("div",{className:"animate-pulse h-4 bg-gray-200 rounded w-5/6",style:{backgroundColor:`${n.border}40`}})),e.createElement("div",{className:"mt-6 space-y-3"},e.createElement("div",{className:"animate-pulse h-4 bg-gray-200 rounded w-1/4",style:{backgroundColor:`${n.border}40`}}),e.createElement("div",{className:"flex gap-2"},e.createElement("div",{className:"animate-pulse h-8 bg-gray-200 rounded w-32",style:{backgroundColor:`${n.border}40`}}),e.createElement("div",{className:"animate-pulse h-8 bg-gray-200 rounded w-40",style:{backgroundColor:`${n.border}40`}})))):a&&e.createElement("div",{className:"prose prose-sm max-w-none",style:{color:n.text}},e.createElement(oe,{message:{content:a,theme:{primary:n.primary,text:n.text},uncertaintyFallbackText:u.uncertaintyFallbackText},isStreaming:s})),a&&!s&&!m&&e.createElement("div",{className:"mt-2 flex justify-end gap-2"},e.createElement(F,null,e.createElement(Q,null,e.createElement(_,{asChild:!0},e.createElement(T,{variant:"ghost",size:"sm",className:"rounded-md h-8 w-8 flex items-center justify-center transition-all duration-200 transform hover:scale-105 active:scale-95 "+("accept"===c?"bg-green-100 text-green-600 hover:bg-green-200":""),onClick:()=>v("accept"),disabled:Boolean(c)},e.createElement(r.motion.div,{initial:{scale:1},animate:{scale:"accept"===c?[1,1.2,1]:1},transition:{duration:.3}},e.createElement(t.ThumbsUp,{className:"h-4 w-4"})))),e.createElement(M,null,e.createElement("p",null,u.positiveAnswerText||"Helpful")))),e.createElement(F,null,e.createElement(Q,null,e.createElement(_,{asChild:!0},e.createElement(T,{variant:"ghost",size:"sm",className:"rounded-md h-8 w-8 flex items-center justify-center transition-all duration-200 transform hover:scale-105 active:scale-95 "+("reject"===c?"bg-red-100 text-red-600 hover:bg-red-200":""),onClick:()=>v("reject"),disabled:Boolean(c)},e.createElement(r.motion.div,{initial:{scale:1},animate:{scale:"reject"===c?[1,1.2,1]:1},transition:{duration:.3}},e.createElement(t.ThumbsDown,{className:"h-4 w-4"})))),e.createElement(M,null,e.createElement("p",null,u.negativeAnswerText||"Not helpful"))))),i&&i.length>0&&e.createElement("div",{className:"mt-6 rounded-lg overflow-hidden",style:{backgroundColor:n.surface,borderWidth:"1px",borderStyle:"solid",borderColor:n.border}},e.createElement("button",{onClick:()=>b(!w),className:"w-full flex items-center justify-between p-3 transition-all duration-200 hover:bg-opacity-50",style:{color:n.text,borderBottom:w?`1px solid ${n.surfaceBorder}`:"none"}},e.createElement("div",{className:"flex items-center gap-2"},e.createElement(t.FileText,{className:"h-4 w-4 flex-shrink-0",style:{color:n.primary}}),e.createElement("span",{className:"font-medium truncate"},`Related Sources (${i.length})`)),e.createElement(t.ChevronDown,{className:"h-4 w-4 flex-shrink-0 transition-transform duration-200 "+(w?"rotate-180":""),style:{color:n.text}})),e.createElement("div",{className:"overflow-hidden transition-all duration-200 ease-in-out",style:{maxHeight:w?48*i.length+"px":"0",opacity:w?1:0,transform:`translateY(${w?"0":"-10px"})`}},e.createElement("div",{className:"divide-y divide-gray-200"},i.map((r=>e.createElement("a",{key:r.id,href:r.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 transition-colors duration-200 hover:bg-gray-50",style:{color:n.text,backgroundColor:n.surface}},e.createElement("span",{className:"flex-grow truncate"},r.title),e.createElement(t.ExternalLink,{className:"h-4 w-4 flex-shrink-0",style:{color:`${n.text}60`}}))))))))}function le({questions:a,onQuestionClick:o,theme:n}){return a.length?e.createElement(r.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"w-full"},e.createElement("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:n.surface,borderWidth:"1px",borderStyle:"solid",borderColor:n.border}},e.createElement("div",{className:"p-3 border-b",style:{borderColor:n.surfaceBorder}},e.createElement("div",{className:"flex items-center gap-2"},e.createElement(t.HelpCircle,{className:"h-4 w-4 flex-shrink-0",style:{color:n.primary}}),e.createElement("span",{className:"font-medium"},"Follow-up Questions"))),e.createElement("div",{className:"divide-y divide-gray-200"},a.map(((a,i)=>e.createElement(r.motion.button,{key:i,initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:.1*i},onClick:()=>o(a),className:"w-full flex items-center gap-2 p-3 transition-colors duration-200 hover:bg-gray-50 text-left",style:{color:n.text,backgroundColor:n.surface}},e.createElement("span",{className:"flex-grow"},a),e.createElement(t.ChevronRight,{className:"h-4 w-4 flex-shrink-0",style:{color:`${n.text}60`}}))))))):null}function ce({questions:a,activeIndex:o,onNavigate:n,theme:i,offset:s}){const[l,c]=e.useState(o);e.useEffect((()=>{c(o)}),[o]);const d=a.length,m=(()=>{const e=[];let t=null;const r=r=>{null!==t&&r-t>1&&e.push("ellipsis"),e.push(r),t=r};r(0);for(let e=Math.max(1,o-2);e<=Math.min(d-2,o+2);e++)r(e);return d>1&&r(d-1),e})();return e.createElement("nav",{"aria-label":"Question timeline navigation",className:"fixed left-4 top-1/2 -translate-y-1/2 z-40 flex flex-col gap-3",style:Object.assign({},s?{left:`${s}px`}:{})},e.createElement(r.motion.div,{className:"flex flex-col items-center space-y-3",role:"list",initial:!1,animate:{y:0},transition:{type:"spring",stiffness:300,damping:30}},e.createElement(r.AnimatePresence,{mode:"wait"},m.map(((s,c)=>{if("ellipsis"===s)return e.createElement(r.motion.div,{key:`ellipsis-${c}`,className:"h-8 flex items-center justify-center","aria-hidden":"true",initial:{opacity:0,y:l>o?-20:20},animate:{opacity:1,y:0},exit:{opacity:0,y:l>o?20:-20},transition:{duration:.2}},e.createElement(t.MoreVertical,{className:"w-4 h-4",style:{color:i.text}}));const d=s,m=a[d];return e.createElement(r.motion.div,{key:d,className:"relative group isolate",role:"listitem",initial:{opacity:0,y:l>o?-20:20},animate:{opacity:1,y:0},exit:{opacity:0,y:l>o?20:-20},transition:{duration:.2},layout:!0},e.createElement(F,null,e.createElement(Q,null,e.createElement(_,{asChild:!0},e.createElement("button",{onClick:()=>n(d),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||n(d)},className:"flex items-center justify-center w-8 h-8 rounded-full transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 hover:opacity-90",style:{backgroundColor:d===o?i.primary:"#ccc",color:d===o?i.background:"#333",cursor:"pointer","--tw-ring-color":i.primary},"aria-label":`Navigate to question ${d+1}: ${m}`,"aria-current":d===o?"step":void 0},d+1)),e.createElement(M,{side:"right",sideOffset:8},e.createElement("p",{className:"max-w-[200px] break-words"},m)))))})))))}function de({onClick:r,theme:a}){return e.createElement(T,{className:"fixed bottom-20 right-4 rounded-full p-2 transition-opacity duration-300",style:{backgroundColor:a.background,borderColor:a.border,borderWidth:"1px",borderStyle:"solid",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"},onClick:r},e.createElement(t.ArrowDown,{className:"h-5 w-5",style:{color:a.text}}))}const me={maxRetries:3,baseDelay:1e3,shouldRetry:e=>{if(e instanceof TypeError)return!0;const t=e;return!!t.status&&t.status>=500}};let ue=Object.assign({},me),pe=Object.assign({},{emptyResponse:"I apologize, but I couldn't generate an answer at this time. Please try again.",errorResponse:"I encountered an error while processing your request. Please try again."});function ge(e){return k(this,void 0,void 0,(function*(){return new Promise((t=>setTimeout(t,e)))}))}function he(e,t={}){return k(this,void 0,void 0,(function*(){const{retry:r={},headers:a={},body:o,isStream:n=!1,fallback:i={}}=t,s=x(t,["retry","headers","body","isStream","fallback"]),l=Object.assign(Object.assign({},ue),r),c=Object.assign(Object.assign({},pe),i);let d=1;for(;;)try{const t=yield fetch(e,Object.assign(Object.assign({},s),{headers:Object.assign({"Content-Type":"application/json"},a),body:o?JSON.stringify(o):void 0}));if(t.ok){if(n){const e=t.clone();if(!(yield e.text()).trim()){const e=new Error(c.emptyResponse);throw e.name="EmptyResponseError",e}return t}const e=yield t.json();if(!e||"object"==typeof e&&0===Object.keys(e).length){const e=new Error(c.emptyResponse);throw e.name="EmptyResponseError",e}return e}const r=new Error(c.errorResponse);throw r.status=t.status,r.data=yield t.json().catch((()=>{})),r}catch(e){const t=yield Promise.resolve(l.shouldRetry(e,d));if(d>=l.maxRetries||!t){if(e instanceof Error&&"EmptyResponseError"===e.name)return{message:e.message};throw e}console.warn(`Request failed, attempt ${d} of ${l.maxRetries}. Retrying...`);const r=.3*Math.random()+.85;yield ge(l.baseDelay*Math.pow(2,d-1)*r),d++}}))}const fe={maxRetries:3,baseDelay:300,shouldRetry:e=>{if(e instanceof TypeError)return!0;const t=e;return!!t.status&&(t.status>=500||429===t.status)}},we={maxRetries:3,baseDelay:500,shouldRetry:e=>{if(e instanceof TypeError)return!0;const t=e;return!!t.status&&t.status>=500}};function be({endpoint:e,query:t,collectionId:r,headers:a,conversationId:o}){var n;return k(this,void 0,void 0,(function*(){const i=yield he(e,{method:"POST",headers:a,retry:fe,body:Object.assign(Object.assign({query:t,limit:5},r&&"all"!==r&&{collectionId:r}),o&&{conversationId:o})});return{results:null==i?void 0:i.data,searchQueryId:null===(n=null==i?void 0:i.searchQuery)||void 0===n?void 0:n.id}}))}function ye({endpoint:e,searchQueryId:t,headers:r,conversationId:a}){return k(this,void 0,void 0,(function*(){return he(e,{method:"POST",headers:r,retry:we,isStream:!0,fallback:{emptyResponse:"I apologize, but I couldn't generate an answer for your query. Please try rephrasing your question.",errorResponse:"I encountered an issue while generating the answer. Please try again in a moment."},body:Object.assign({searchQueryId:t},a&&{conversationId:a})})}))}function ve(){return`bf-conversation-${Date.now()}-${"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}`}function xe({endpoint:e,conversationId:t,headers:r}){return k(this,void 0,void 0,(function*(){return{data:(yield he(e,{method:"POST",headers:r,body:{conversationId:t}})).data.map((e=>Object.assign(Object.assign({},e),{feedback:e.feedback?"positive"===e.feedback?"accept":"reject":void 0})))}}))}const ke={primary:"#A3E635",accent:"#f9fafb",background:"white",text:"#171717",border:"#171717",hover:"#171717",surface:"#F9FAFB",surfaceBorder:"#E5E7EB",surfaceHover:"#F3F4F6",cardBackground:"white"},Ee={headerText:"How can we help you today?",searchPlaceholder:"Ask a question or type a search term here ...",attachImageText:"Attach image",allDocumentsText:"All documents",loadingSearchText:"Searching for relevant content...",loadingAnswerText:"Crafting a response...",errorText:"Sorry, there was an error generating the answer.",followUpPlaceholder:"Ask follow-up",positiveAnswerText:"Helpful",negativeAnswerText:"Not helpful",uncertaintyFallbackText:{en:"Sorry, I can't find a clear answer to your question. Please try rephrasing or check the related sources below.",es:"Lo siento, no puedo encontrar una respuesta clara. Intente reformular la pregunta o consulte las fuentes relacionadas.",fr:"Désolé, je ne trouve pas de réponse claire. Essayez de reformuler ou consultez les sources connexes.",de:"Entschuldigung, ich finde keine klare Antwort. Versuchen Sie es anders zu formulieren oder sehen Sie sich die verwandten Quellen an.",it:"Mi dispiace, non trovo una risposta chiara. Prova a riformulare o consulta le fonti correlate.",pt:"Desculpe, não encontro uma resposta clara. Tente reformular ou consulte as fontes relacionadas.",nl:"Sorry, ik kan geen duidelijk antwoord vinden. Probeer het anders te formuleren of bekijk de gerelateerde bronnen.",pl:"Przepraszam, nie znajduję jasnej odpowiedzi. Spróbuj przeformułować pytanie lub sprawdź powiązane źródła.",ru:"Извините, я не могу найти четкого ответа. Попробуйте переформулировать или ознакомьтесь со связанными источниками.",ja:"申し訳ありませんが、明確な回答が見つかりません。質問の言い換えや、関連ソースをご確認ください。",ko:"죄송합니다. 명확한 답변을 찾을 수 없습니다. 질문을 다시 작성하거나 관련 소스를 확인해 주세요.",zh:"抱歉,找不到明确的答案。请尝试重新表述或查看相关来源。","zh-TW":"抱歉,找不到明確的答案。請嘗試重新表述或查看相關來源。"}},Ne=e.forwardRef((({suggestions:a,theme:o={},collections:n=[],selectedCollectionId:i,onCollectionChange:s,searchEndpoint:l,answerEndpoint:c,feedbackEndpoint:d,loadConversationEndpoint:m,disableFollowUpQuestions:u=!1,disableImageAttachment:p=!1,disableFeedback:g=!1,siblingNode:h,offset:f=0,headers:w,textConfig:b={},followUpQuestionsEndpoint:y},v)=>{var x;const E=Object.assign(Object.assign({},ke),o),N=Object.assign(Object.assign({},Ee),b),[C,j]=e.useState(""),[z,S]=e.useState(""),[O,R]=e.useState(!1),[L,F]=e.useState(!1),[Q,_]=e.useState([]),[M,D]=e.useState(!1),[B,H]=e.useState(0),[W,Z]=e.useState([]),[Y,V]=e.useState(i),[X,J]=e.useState(!0),[K,G]=e.useState(""),[ee,te]=e.useState(!1),[re,ae]=e.useState(),oe=e.useRef(null),ne=e.useRef(null),ie=e.useRef([]),me=e.useRef(null),ue=e.useRef(null),pe=e.useRef([]);e.useEffect((()=>{const e=new URLSearchParams(window.location.search).get("conversation");if(e&&m)te(!0),F(!0),xe({endpoint:m,conversationId:e,headers:w}).then((t=>{_(t.data),G(e),F(!0)})).catch((e=>{console.error("Error loading conversation:",e),ae(N.errorText||"An error occurred"),F(!1),_([]);const t=ve();G(t);const r=new URL(window.location.href);r.searchParams.delete("conversation"),window.history.replaceState({},"",r.toString())})).finally((()=>{te(!1)}));else{const e=ve();G(e)}}),[m]),e.useEffect((()=>{if(K&&Q.length>0){const e=new URL(window.location.href);e.searchParams.set("conversation",K),window.history.replaceState({},"",e.toString())}}),[K,Q.length]),e.useEffect((()=>{const e={showResults:L,answers:Q,isLoading:ee,error:re};pe.current.forEach((t=>t(e)))}),[L,Q,ee,re]),e.useImperativeHandle(v,(()=>({createNewThread:()=>{j(""),S(""),F(!1),_([]),H(0),Z([]);const e=ve();G(e);const t=new URL(window.location.href);t.searchParams.delete("conversation"),window.history.replaceState({},"",t.toString()),oe.current&&(oe.current.style.height="auto")},showFollowUpThread:e=>{J(e)},subscribeToStateChanges:e=>(pe.current.push(e),e({showResults:L,answers:Q,isLoading:!1,error:void 0}),()=>{pe.current=pe.current.filter((t=>t!==e))})}))),e.useEffect((()=>{V(i)}),[i]);const ge=()=>{requestAnimationFrame((()=>{const e=ie.current[ie.current.length-1];if(e){const t=e.getBoundingClientRect(),r=window.pageYOffset||document.documentElement.scrollTop,a=t.top+r-80;window.scrollTo({top:a,behavior:"smooth"})}}))},fe=e=>k(void 0,void 0,void 0,(function*(){var t;const r=null===(t=e.body)||void 0===t?void 0:t.getReader();if(!r)return;_((e=>{const t=[...e],r=t[t.length-1];return r&&(r.isLoading=!1,r.isStreaming=!0,r.searchResults=r.searchResults||[]),t}));let a="";try{let e,t;for(;({done:e,value:t}=yield r.read()),!e;){const e=(new TextDecoder).decode(t);a+=e;const{uncertain:r,language:o}=I(a);_((e=>{var t;const n=[...e],i=n[n.length-1];return i&&(i.answer=a,i.isLoading=!1,i.isStreaming=!0,i.searchResults=i.searchResults||[],i.isUncertain=r,i.uncertaintyLanguage=o,r&&o&&(null===(t=N.uncertaintyFallbackText)||void 0===t?void 0:t[o])&&(i.uncertaintyFallbackText=N.uncertaintyFallbackText[o])),n}))}}catch(e){console.error("Error streaming answer:",e)}finally{_((e=>{const t=[...e],r=t[t.length-1];return r&&(r.isStreaming=!1,r.isLoading=!1,y&&!u&&r.searchQueryId&&k(void 0,void 0,void 0,(function*(){try{const e=yield function({endpoint:e,searchQueryId:t,headers:r,conversationId:a}){return k(this,void 0,void 0,(function*(){return(yield he(e,{method:"POST",headers:r,body:Object.assign({searchQueryId:t},a&&{conversationId:a})})).questions}))}({endpoint:y,searchQueryId:r.searchQueryId,headers:w,conversationId:K});_((t=>{const r=[...t],a=r[r.length-1];return a&&(a.followUpQuestions=e),r}))}catch(e){console.error("Error fetching follow-up questions:",e)}}))),t})),r.releaseLock()}})),we=(e,t,r)=>k(void 0,void 0,void 0,(function*(){if(d){_((t=>{const a=[...t];return a[r]&&(a[r]=Object.assign(Object.assign({},a[r]),{feedback:e})),a}));try{yield function({endpoint:e,searchQueryId:t,response:r,headers:a,conversationId:o}){return k(this,void 0,void 0,(function*(){yield he(e,{method:"POST",headers:a,body:Object.assign({searchQueryId:t,response:r},o&&{conversationId:o})})}))}({endpoint:d,searchQueryId:t,response:e,headers:w,conversationId:K})}catch(e){console.error("Error sending feedback:",e),_((e=>{const t=[...e];return t[r]&&(t[r]=Object.assign(Object.assign({},t[r]),{feedback:void 0})),t}))}}})),Ne=(e=C.trim())=>k(void 0,void 0,void 0,(function*(){if(e){R(!0),F(!0);const t=K||ve();K||G(t);const r={question:e,answer:"",isLoading:!0,isSearchLoading:!0,searchResults:[],searchQueryId:void 0,isStreaming:!1};_((e=>[...e,r]));const a=Q.length;H(a),ge(),yield Promise.resolve();try{const r=yield be({endpoint:l,query:e,collectionId:Y,headers:w,conversationId:t});_((e=>{const t=[...e];return t[t.length-1]&&(t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{searchResults:r.results,searchQueryId:r.searchQueryId,isSearchLoading:!1})),t}));const a=yield ye({endpoint:c,searchQueryId:r.searchQueryId,headers:w,conversationId:t});yield fe(a)}catch(e){console.error("Error generating answer:",e),_((e=>{const t=[...e];return t[t.length-1]&&(t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{answer:N.errorText||"An error occurred",isLoading:!1,isSearchLoading:!1,isStreaming:!1})),t}))}finally{R(!1)}}})),Ce=()=>k(void 0,void 0,void 0,(function*(){if(z.trim()){const e=z;j(e),S(""),ne.current&&(ne.current.style.height="auto"),yield Ne(e)}}));e.useEffect((()=>{const e=()=>{const e=window.innerHeight+window.pageYOffset>=document.documentElement.scrollHeight-100;D(!e)};return window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)}),[]),e.useEffect((()=>()=>{W.forEach((e=>URL.revokeObjectURL(e.preview)))}),[W]);e.useEffect((()=>{const e=()=>{new URLSearchParams(window.location.search).get("conversation")||(j(""),S(""),F(!1),_([]),H(0),Z([]),oe.current&&(oe.current.style.height="auto"))};return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)}),[]);const je=e=>{Ne(e)};return e.createElement("div",{className:"relative min-h-screen"},e.createElement("div",{ref:me,className:"w-full max-w-3xl mx-auto flex flex-col items-center space-y-8 px-4 py-20",style:{"--surface-border":E.surfaceBorder,"--surface-hover":E.surfaceHover}},e.createElement(r.AnimatePresence,null,ee?e.createElement(r.motion.div,{key:"loading",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"w-full flex items-center justify-center py-20"},e.createElement("div",{className:"flex flex-col items-center gap-4"},e.createElement("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-t-transparent",style:{borderColor:E.primary}}),e.createElement("p",{className:"text-sm",style:{color:E.text}},"Loading conversation..."))):L?e.createElement(r.motion.div,{key:"results",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.5},className:"w-full space-y-4 py-4 mb-20"},Q.map(((t,a)=>e.createElement(r.motion.div,{key:a,ref:e=>ie.current[a]=e,initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.1*a}},e.createElement(se,{answer:t.answer,question:t.question,theme:E,searchResults:t.searchResults,isStreaming:t.isStreaming,searchQueryId:t.searchQueryId,feedback:t.feedback,onFeedback:g||!d?void 0:e=>we(e,t.searchQueryId,a),disableFeedback:g||!d,textConfig:N,isLoading:t.isLoading,isSearchLoading:t.isSearchLoading}),a===Q.length-1&&!u&&t.followUpQuestions&&!t.isStreaming&&e.createElement("div",{className:"mt-4"},e.createElement(le,{questions:t.followUpQuestions,onQuestionClick:je,theme:E})))))):e.createElement(r.motion.div,{key:"search",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.5},className:"w-full space-y-8"},e.createElement("div",{className:"w-full text-center space-y-4"},e.createElement(r.motion.h1,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.3},className:"text-5xl font-bold",style:{color:E.text}},N.headerText)),e.createElement(r.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.4}},e.createElement("div",{className:"relative w-full rounded-md overflow-hidden",style:{backgroundColor:E.background,borderColor:E.border,borderWidth:"1px",borderStyle:"solid"}},e.createElement("div",{className:"p-3 flex items-center"},e.createElement(t.Search,{className:"h-5 w-5 text-gray-400 mr-2"}),e.createElement("textarea",{ref:oe,placeholder:N.searchPlaceholder,value:C,onChange:e=>{var t;j(e.target.value),(t=e.target).style.height="auto",t.style.height=`${t.scrollHeight}px`},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),Ne())},className:"w-full resize-none outline-none text-lg py-1 font-light min-h-[36px] overflow-hidden placeholder:text-gray-400 border-none bg-transparent",style:{color:E.text,outline:"none",boxShadow:"none",fontSize:"16px"},rows:1})),!p&&W.length>0&&e.createElement("div",{className:"flex gap-2 mt-3 overflow-x-auto pb-1 px-3"},W.map(((r,a)=>e.createElement("div",{key:a,className:"relative group rounded-lg overflow-hidden flex-shrink-0",style:{width:"80px",height:"80px"}},e.createElement("img",{src:r.preview,alt:`Attached ${a+1}`,className:"w-full h-full object-cover"}),e.createElement("button",{onClick:()=>(e=>{Z((t=>(URL.revokeObjectURL(t[e].preview),t.filter(((t,r)=>r!==e)))))})(a),className:"absolute top-1 right-1 bg-black bg-opacity-50 rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200"},e.createElement(t.X,{className:"h-3 w-3 text-white"})))))),e.createElement("div",{className:"flex items-center justify-between px-3 py-2 bg-gray-100 border-t border-gray-200"},e.createElement("div",{className:"flex gap-2"},n.length>0&&e.createElement($,null,e.createElement(A,{asChild:!0},e.createElement(T,{variant:"ghost",size:"sm",className:"hover:bg-gray-200 transition-all duration-200 rounded-md h-8 flex items-center gap-2 text-gray-700"},Y&&"all"!==Y?e.createElement(t.CheckCircle2,{className:"h-5 w-5 text-green-500"}):e.createElement(t.Circle,{className:"h-5 w-5 text-gray-400"}),(null===(x=n.find((e=>e.id===Y)))||void 0===x?void 0:x.name)||N.allDocumentsText,e.createElement(t.ChevronDown,{className:"h-4 w-4 opacity-50"}))),e.createElement(q,null,n.map((r=>e.createElement(P,{key:r.id,onClick:()=>{return e=r.id,V(e),void(null==s||s(e));var e},className:r.id===Y?"bg-gray-100":""},r.id===Y?e.createElement(t.CheckCircle2,{className:"h-4 w-4 mr-2 text-green-500"}):e.createElement(t.Circle,{className:"h-4 w-4 mr-2 text-gray-400"}),r.name))))),!p&&e.createElement(e.Fragment,null,e.createElement("input",{type:"file",ref:ue,accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{const t=e.target.files;if(t){const e=Array.from(t).map((e=>({file:e,preview:URL.createObjectURL(e)})));Z((t=>[...t,...e]))}ue.current&&(ue.current.value="")}}),e.createElement(T,{variant:"ghost",size:"sm",className:"hover:bg-gray-200 rounded-md h-8 text-gray-700",onClick:()=>{var e;return null===(e=ue.current)||void 0===e?void 0:e.click()}},e.createElement(t.Image,{className:"h-4 w-4 mr-1.5"}),N.attachImageText))),e.createElement("div",{className:"flex items-center"},e.createElement(T,{size:"sm",disabled:!C||O,className:"rounded-md h-8 w-8 bg-[#86efac] hover:bg-[#86efac]/90 disabled:opacity-50",onClick:()=>{Ne()}},O?e.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-2 border-t-transparent",style:{borderColor:"white"}}):e.createElement(t.ArrowRight,{className:"h-4 w-4 text-gray-700"})))))),e.createElement(U,{suggestions:a||[],onQuestionClick:e=>{if(e.conversationId&&m)return te(!0),F(!0),void xe({endpoint:m,conversationId:e.conversationId,headers:w}).then((t=>{_(t.data),G(e.conversationId),F(!0)})).catch((e=>{console.error("Error loading conversation:",e),ae(N.errorText||"An error occurred"),F(!1),_([]);const t=ve();G(t);const r=new URL(window.location.href);r.searchParams.delete("conversation"),window.history.replaceState({},"",r.toString())})).finally((()=>{te(!1)}));if(F(!0),R(!0),!K){const e=ve();G(e)}_((t=>[...t,{question:e.question,answer:"",isLoading:!0,isSearchLoading:!0}])),k(void 0,void 0,void 0,(function*(){try{const t=yield be({endpoint:l,query:e.question,collectionId:Y,headers:w,conversationId:K}),r=t.results;_((e=>{const a=[...e];return a[a.length-1]=Object.assign(Object.assign({},a[a.length-1]),{searchResults:r,searchQueryId:t.searchQueryId,isSearchLoading:!1}),a}));const a=yield ye({endpoint:c,searchQueryId:t.searchQueryId,headers:w,conversationId:K});yield fe(a)}catch(e){console.error("Error generating answer:",e),_((e=>{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{answer:N.errorText||"An error occurred",isLoading:!1,isSearchLoading:!1}),t}))}finally{R(!1),ge()}}))},borderColor:E.border,title:N.suggestionsTitle}),h)),L&&Q.length>1&&e.createElement("div",{className:"hidden sm:block"},e.createElement(ce,{questions:Q.map((e=>e.question)),currentIndex:O?Q.length-1:B,activeIndex:B,onNavigate:e=>{H(e),(e=>{requestAnimationFrame((()=>{const t=ie.current[e];if(t){const e=t.getBoundingClientRect(),r=window.pageYOffset||document.documentElement.scrollTop,a=e.top+r-80;window.scrollTo({top:a,behavior:"smooth"})}}))})(e)},theme:E,offset:f})),L&&X&&e.createElement(r.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},className:"fixed bottom-4 left-4 right-4 max-w-3xl mx-auto z-10",style:{left:`${f}px`}},e.createElement("div",{className:"rounded-full h-[44px] sm:h-[52px] flex items-center justify-between",style:{backgroundColor:E.background,borderColor:E.border,borderWidth:"1px",borderStyle:"solid",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",padding:"0 15px"}},e.createElement("div",{className:"flex items-center gap-2 sm:gap-3 flex-grow overflow-hidden h-full"},e.createElement(t.Search,{className:"h-4 w-4 sm:h-5 sm:w-5 flex-shrink-0",style:{color:E.primary}}),e.createElement("div",{className:"flex-grow",style:{paddingTop:"15px",paddingBottom:"10px"}},e.createElement("textarea",{ref:ne,placeholder:N.followUpPlaceholder,value:z,onChange:e=>{S(e.target.value);e.target.style.height="auto",e.target.style.height=`${Math.min(e.target.scrollHeight,100)}px`,e.target.scrollHeight>100?e.target.style.overflowY="auto":e.target.style.overflowY="hidden"},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),Ce())},disabled:O,className:"w-full bg-transparent outline-none text-sm sm:text-base resize-none overflow-hidden disabled:opacity-50 border-none min-h-[24px] max-h-[100px] placeholder:text-sm sm:placeholder:text-base",style:{color:E.text,outline:"none",boxShadow:"none",fontSize:"16px",lineHeight:"24px"},rows:1}))),e.createElement("div",{className:"flex items-center gap-2 sm:gap-3 ml-2 sm:ml-3 flex-shrink-0"},e.createElement(T,{size:"icon",variant:"ghost",disabled:O||!z.trim(),className:"rounded-full transition-colors duration-200 disabled:opacity-50 h-8 w-8 sm:h-9 sm:w-9 flex items-center justify-center",style:{color:E.text,backgroundColor:"transparent"},onClick:()=>{Ce()}},O?e.createElement("div",{className:"animate-spin rounded-full h-4 w-4 sm:h-5 sm:w-5 border-2",style:{borderColor:`${E.text}40`,borderTopColor:E.text}}):e.createElement(t.ArrowUp,{className:"h-4 w-4 sm:h-5 sm:w-5"}))))),M&&L&&e.createElement(de,{onClick:ge,theme:E})))}));Ne.displayName="ChatSearch",exports.ChatSearch=Ne;
1
+ "use strict";var e=require("react"),t=require("lucide-react"),r=require("framer-motion"),a=require("react/jsx-runtime"),o=require("class-variance-authority"),n=require("clsx"),i=require("tailwind-merge"),s=require("@radix-ui/react-dropdown-menu"),l=require("@radix-ui/react-icons"),c=require("@radix-ui/react-tooltip"),d=require("rehype-raw"),m=require("remark-gfm"),u=require("react-syntax-highlighter"),p=require("react-syntax-highlighter/dist/cjs/styles/prism"),g=require("react-markdown"),h=require("mermaid");function f(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var w=f(e),b=f(s),y=f(c);function v(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&a.firstChild?a.insertBefore(o,a.firstChild):a.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}function x(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(r[a[o]]=e[a[o]])}return r}function k(e,t,r,a){return new(r||(r=Promise))((function(o,n){function i(e){try{l(a.next(e))}catch(e){n(e)}}function s(e){try{l(a.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}l((a=a.apply(e,t||[])).next())}))}function E(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function N(...e){return t=>{let r=!1;const a=e.map((e=>{const a=E(e,t);return r||"function"!=typeof a||(r=!0),a}));if(r)return()=>{for(let t=0;t<a.length;t++){const r=a[t];"function"==typeof r?r():E(e[t],null)}}}}v('*,:after,:before{--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:rgba(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:rgba(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: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}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,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height: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,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background:0 0% 100%;--foreground:0 0% 3.9%;--card:0 0% 100%;--card-foreground:0 0% 3.9%;--popover:0 0% 100%;--popover-foreground:0 0% 3.9%;--primary:0 0% 9%;--primary-foreground:0 0% 98%;--secondary:0 0% 96.1%;--secondary-foreground:0 0% 9%;--muted:0 0% 96.1%;--muted-foreground:0 0% 45.1%;--accent:0 0% 96.1%;--accent-foreground:0 0% 9%;--destructive:0 84.2% 60.2%;--destructive-foreground:0 0% 98%;--border:0 0% 89.8%;--input:0 0% 89.8%;--ring:0 0% 3.9%;--radius:0.5rem}.dark{--background:0 0% 3.9%;--foreground:0 0% 98%;--card:0 0% 3.9%;--card-foreground:0 0% 98%;--popover:0 0% 3.9%;--popover-foreground:0 0% 98%;--primary:0 0% 98%;--primary-foreground:0 0% 9%;--secondary:0 0% 14.9%;--secondary-foreground:0 0% 98%;--muted:0 0% 14.9%;--muted-foreground:0 0% 63.9%;--accent:0 0% 14.9%;--accent-foreground:0 0% 98%;--destructive:0 62.8% 30.6%;--destructive-foreground:0 0% 98%;--border:0 0% 14.9%;--input:0 0% 14.9%;--ring:0 0% 83.1%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}.container{margin-left:auto;margin-right:auto;padding-left:2rem;padding-right:2rem;width:100%}@media (min-width:1400px){.container{max-width:1400px}}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.bottom-20{bottom:5rem}.bottom-4{bottom:1rem}.left-2{left:.5rem}.left-4{left:1rem}.right-1{right:.25rem}.right-4{right:1rem}.top-1{top:.25rem}.top-1\\/2{top:50%}.isolate{isolation:isolate}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-bottom:.25rem;margin-top:.25rem}.my-2{margin-bottom:.5rem;margin-top:.5rem}.my-4{margin-bottom:1rem;margin-top:1rem}.mb-2{margin-bottom:.5rem}.mb-20{margin-bottom:5rem}.mb-4{margin-bottom:1rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-auto{margin-left:auto}.mr-1\\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-\\[-5px\\]{margin-top:-5px}.block{display:block}.inline-block{display:inline-block}.\\!inline{display:inline!important}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.hidden{display:none}.size-5{height:1.25rem;width:1.25rem}.h-10{height:2.5rem}.h-2{height:.5rem}.h-3{height:.75rem}.h-3\\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\\[44px\\]{height:44px}.h-full{height:100%}.h-px{height:1px}.max-h-\\[100px\\]{max-height:100px}.min-h-\\[24px\\]{min-height:24px}.min-h-\\[36px\\]{min-height:36px}.min-h-screen{min-height:100vh}.w-1\\/4{width:25%}.w-2{width:.5rem}.w-3{width:.75rem}.w-3\\.5{width:.875rem}.w-3\\/4{width:75%}.w-32{width:8rem}.w-4{width:1rem}.w-40{width:10rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-5\\/6{width:83.333333%}.w-8{width:2rem}.w-9{width:2.25rem}.w-full{width:100%}.min-w-\\[20px\\]{min-width:20px}.min-w-\\[8rem\\]{min-width:8rem}.max-w-3xl{max-width:48rem}.max-w-\\[200px\\]{max-width:200px}.max-w-none{max-width:none}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.border-collapse{border-collapse:collapse}.-translate-y-1\\/2{--tw-translate-y:-50%}.-translate-y-1\\/2,.rotate-180{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate:180deg}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.list-outside{list-style-position:outside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(2rem*var(--tw-space-y-reverse));margin-top:calc(2rem*(1 - var(--tw-space-y-reverse)))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.divide-gray-200>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(229 231 235/var(--tw-divide-opacity,1))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.truncate{overflow:hidden;text-overflow:ellipsis}.truncate,.whitespace-nowrap{white-space:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-b-lg{border-bottom-left-radius:var(--radius);border-bottom-right-radius:var(--radius)}.rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-none{border-style:none}.border-black{--tw-border-opacity:1;border-color:rgb(0 0 0/var(--tw-border-opacity,1))}.border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}.border-input{border-color:hsl(var(--input))}.border-slate-300{--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity,1))}.border-transparent{border-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\\[\\#86efac\\]{--tw-bg-opacity:1;background-color:rgb(134 239 172/var(--tw-bg-opacity,1))}.bg-background{background-color:hsl(var(--background))}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}.bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.bg-green-100{--tw-bg-opacity:1;background-color:rgb(220 252 231/var(--tw-bg-opacity,1))}.bg-muted{background-color:hsl(var(--muted))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity,1))}.bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity,1))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-slate-200{--tw-bg-opacity:1;background-color:rgb(226 232 240/var(--tw-bg-opacity,1))}.bg-transparent{background-color:transparent}.bg-zinc-800\\/80{background-color:rgba(39,39,42,.8)}.bg-opacity-50{--tw-bg-opacity:0.5}.fill-current{fill:currentColor}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0\\.5{padding:.125rem}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\\.5{padding-bottom:.125rem;padding-top:.125rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.py-20{padding-bottom:5rem;padding-top:5rem}.py-4{padding-bottom:1rem;padding-top:1rem}.pb-1{padding-bottom:.25rem}.pl-8{padding-left:2rem}.pr-2{padding-right:.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-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-5xl{font-size:3rem;line-height:1}.text-base{font-size:1rem;line-height:1.5rem}.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}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-light{font-weight:300}.font-medium{font-weight:500}.font-semibold{font-weight:600}.lowercase{text-transform:lowercase}.leading-normal{line-height:1.5}.tracking-widest{letter-spacing:.1em}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.text-green-600{--tw-text-opacity:1;color:rgb(22 163 74/var(--tw-text-opacity,1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.text-red-600{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity,1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.shadow,.shadow-lg{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 rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.shadow-md,.shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--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(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)}.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{--tw-backdrop-blur:blur(8px);-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-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-transform{transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.animate-in{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-duration:.15s;animation-name:enter}.fade-in-0{--tw-enter-opacity:0}.zoom-in-95{--tw-enter-scale:.95}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.placeholder\\:text-sm::-moz-placeholder{font-size:.875rem;line-height:1.25rem}.placeholder\\:text-sm::placeholder{font-size:.875rem;line-height:1.25rem}.placeholder\\:text-gray-400::-moz-placeholder{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.placeholder\\:text-gray-400::placeholder{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.hover\\:scale-105:hover{--tw-scale-x:1.05;--tw-scale-y:1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:bg-\\[\\#86efac\\]\\/90:hover{background-color:rgba(134,239,172,.9)}.hover\\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\\:bg-destructive\\/90:hover{background-color:hsl(var(--destructive)/.9)}.hover\\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.hover\\:bg-gray-200:hover{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}.hover\\:bg-gray-50:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}.hover\\:bg-green-200:hover{--tw-bg-opacity:1;background-color:rgb(187 247 208/var(--tw-bg-opacity,1))}.hover\\:bg-primary\\/90:hover{background-color:hsl(var(--primary)/.9)}.hover\\:bg-red-200:hover{--tw-bg-opacity:1;background-color:rgb(254 202 202/var(--tw-bg-opacity,1))}.hover\\:bg-secondary\\/80:hover{background-color:hsl(var(--secondary)/.8)}.hover\\:bg-zinc-700\\/50:hover{background-color:rgba(63,63,70,.5)}.hover\\:bg-opacity-50:hover{--tw-bg-opacity:0.5}.hover\\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\\:text-zinc-100:hover{--tw-text-opacity:1;color:rgb(244 244 245/var(--tw-text-opacity,1))}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:opacity-90:hover{opacity:.9}.focus\\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.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\\:ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:ring-1: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(1px + 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-ring:focus-visible{--tw-ring-color:hsl(var(--ring))}.focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.focus-visible\\:ring-offset-background:focus-visible{--tw-ring-offset-color:hsl(var(--background))}.active\\:scale-95:active{--tw-scale-x:.95;--tw-scale-y:.95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\\:pointer-events-none:disabled{pointer-events:none}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\\:opacity-100{opacity:1}.data-\\[disabled\\]\\:pointer-events-none[data-disabled]{pointer-events:none}.data-\\[state\\=checked\\]\\:translate-x-4[data-state=checked]{--tw-translate-x:1rem}.data-\\[state\\=checked\\]\\:translate-x-4[data-state=checked],.data-\\[state\\=unchecked\\]\\:translate-x-0[data-state=unchecked]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[state\\=unchecked\\]\\:translate-x-0[data-state=unchecked]{--tw-translate-x:0px}.data-\\[state\\=checked\\]\\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\\[state\\=open\\]\\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\\[state\\=unchecked\\]\\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\\[disabled\\]\\:opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=open\\]\\:animate-in[data-state=open]{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-duration:.15s;animation-name:enter}.data-\\[state\\=closed\\]\\:animate-out[data-state=closed]{--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial;animation-duration:.15s;animation-name:exit}.data-\\[state\\=closed\\]\\:fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}.dark\\:border-white:is([data-mode=dark] *){--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity,1))}@media (min-width:640px){.sm\\:ml-3{margin-left:.75rem}.sm\\:block{display:block}.sm\\:h-5{height:1.25rem}.sm\\:h-9{height:2.25rem}.sm\\:h-\\[52px\\]{height:52px}.sm\\:w-5{width:1.25rem}.sm\\:w-9{width:2.25rem}.sm\\:gap-3{gap:.75rem}.sm\\:text-base{font-size:1rem;line-height:1.5rem}.sm\\:placeholder\\:text-base::-moz-placeholder{font-size:1rem;line-height:1.5rem}.sm\\:placeholder\\:text-base::placeholder{font-size:1rem;line-height:1.5rem}}.\\[\\&\\>svg\\]\\:size-4>svg{height:1rem;width:1rem}.\\[\\&\\>svg\\]\\:shrink-0>svg{flex-shrink:0}.\\[\\&_svg\\]\\:pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:size-4 svg{height:1rem;width:1rem}.\\[\\&_svg\\]\\:shrink-0 svg{flex-shrink:0}'),"function"==typeof SuppressedError&&SuppressedError;var C=w.forwardRef(((e,t)=>{const{children:r,...o}=e,n=w.Children.toArray(r),i=n.find(S);if(i){const e=i.props.children,r=n.map((t=>t===i?w.Children.count(e)>1?w.Children.only(null):w.isValidElement(e)?e.props.children:null:t));return a.jsx(j,{...o,ref:t,children:w.isValidElement(e)?w.cloneElement(e,void 0,r):null})}return a.jsx(j,{...o,ref:t,children:r})}));C.displayName="Slot";var j=w.forwardRef(((e,t)=>{const{children:r,...a}=e;if(w.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r);return w.cloneElement(r,{...O(a,r.props),ref:t?N(t,e):e})}return w.Children.count(r)>1?w.Children.only(null):null}));j.displayName="SlotClone";var z=({children:e})=>a.jsx(a.Fragment,{children:e});function S(e){return w.isValidElement(e)&&e.type===z}function O(e,t){const r={...t};for(const a in t){const o=e[a],n=t[a];/^on[A-Z]/.test(a)?o&&n?r[a]=(...e)=>{n(...e),o(...e)}:o&&(r[a]=o):"style"===a?r[a]={...o,...n}:"className"===a&&(r[a]=[o,n].filter(Boolean).join(" "))}return{...e,...r}}function R(...e){return i.twMerge(n.clsx(e))}function I(e){const t={en:[/i(?:\s|['\u2018\u2019])?m(?:\s+really)?\s+not\s+sure/i,/i(?:\s+am)?(?:\s+really)?\s+not\s+sure/i,/i\s+don(?:['\u2018\u2019])?t\s+know/i,/it(?:['\u2018\u2019]s| is) unclear/i,/cannot determine/i,/hard to say/i,/difficult to determine/i,/need more information/i],es:[/no (?:lo )?sé/i,/no estoy seguro/i,/no es claro/i,/desconocido/i],fr:[/je ne sais pas/i,/je ne suis pas sûr/i,/ce n'est pas clair/i,/inconnu/i],de:[/ich weiß nicht/i,/ich bin nicht sicher/i,/es ist unklar/i,/unbekannt/i],it:[/non lo so/i,/non sono sicuro/i,/non è chiaro/i,/sconosciuto/i],pt:[/não sei/i,/não tenho certeza/i,/não está claro/i,/desconhecido/i],nl:[/ik weet het niet/i,/ik weet niet zeker/i,/het is onduidelijk/i,/onbekend/i],pl:[/nie wiem/i,/nie jestem pewien/i,/to nie jest jasne/i,/nieznany/i],ru:[/я не знаю/i,/я не уверен/i,/это не ясно/i,/неизвестно/i],ja:[/知りません/i,/よくわからない/i,/不明です/i,/未知/i],ko:[/모릅니다/i,/잘 모르겠습니다/i,/불확실합니다/i,/알 수 없음/i],zh:[/我不知道/i,/我不确定/i,/不清楚/i,/未知/i],"zh-TW":[/我不知道/i,/我不確定/i,/不清楚/i,/未知/i]};let r=null;for(const[a,o]of Object.entries(t))for(const t of o){const o=e.match(t);o&&(null===r||o.index<r.index)&&(r={index:o.index,language:a})}return r?{uncertain:!0,language:r.language}:{uncertain:!1,language:null}}const L=o.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),T=w.forwardRef(((e,t)=>{var{className:r,variant:a,size:o,asChild:n=!1}=e,i=x(e,["className","variant","size","asChild"]);const s=n?C:"button";return w.createElement(s,Object.assign({className:R(L({variant:a,size:o,className:r})),ref:t},i))}));T.displayName="Button";const $=b.Root,A=b.Trigger;w.forwardRef(((e,t)=>{var{className:r,inset:a,children:o}=e,n=x(e,["className","inset","children"]);return w.createElement(b.SubTrigger,Object.assign({ref:t,className:R("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",a&&"pl-8",r)},n),o,w.createElement(l.ChevronRightIcon,{className:"ml-auto"}))})).displayName=b.SubTrigger.displayName;w.forwardRef(((e,t)=>{var{className:r}=e,a=x(e,["className"]);return w.createElement(b.SubContent,Object.assign({ref:t,className:R("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r)},a))})).displayName=b.SubContent.displayName;const q=w.forwardRef(((e,t)=>{var{className:r,sideOffset:a=4}=e,o=x(e,["className","sideOffset"]);return w.createElement(b.Portal,null,w.createElement(b.Content,Object.assign({ref:t,sideOffset:a,className:R("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r)},o)))}));q.displayName=b.Content.displayName;const P=w.forwardRef(((e,t)=>{var{className:r,inset:a}=e,o=x(e,["className","inset"]);return w.createElement(b.Item,Object.assign({ref:t,className:R("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",a&&"pl-8",r)},o))}));P.displayName=b.Item.displayName;w.forwardRef(((e,t)=>{var{className:r,children:a,checked:o}=e,n=x(e,["className","children","checked"]);return w.createElement(b.CheckboxItem,Object.assign({ref:t,className:R("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),checked:o},n),w.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},w.createElement(b.ItemIndicator,null,w.createElement(l.CheckIcon,{className:"h-4 w-4"}))),a)})).displayName=b.CheckboxItem.displayName;w.forwardRef(((e,t)=>{var{className:r,children:a}=e,o=x(e,["className","children"]);return w.createElement(b.RadioItem,Object.assign({ref:t,className:R("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r)},o),w.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},w.createElement(b.ItemIndicator,null,w.createElement(l.DotFilledIcon,{className:"h-2 w-2 fill-current"}))),a)})).displayName=b.RadioItem.displayName;w.forwardRef(((e,t)=>{var{className:r,inset:a}=e,o=x(e,["className","inset"]);return w.createElement(b.Label,Object.assign({ref:t,className:R("px-2 py-1.5 text-sm font-semibold",a&&"pl-8",r)},o))})).displayName=b.Label.displayName;w.forwardRef(((e,t)=>{var{className:r}=e,a=x(e,["className"]);return w.createElement(b.Separator,Object.assign({ref:t,className:R("-mx-1 my-1 h-px bg-muted",r)},a))})).displayName=b.Separator.displayName;const F=y.Provider,_=y.Root,Q=y.Trigger,M=w.forwardRef(((e,t)=>{var{className:r,sideOffset:a=4}=e,o=x(e,["className","sideOffset"]);return w.createElement(y.Portal,null,w.createElement(y.Content,Object.assign({ref:t,sideOffset:a,className:R("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r)},o)))}));function U({suggestions:t,onQuestionClick:r,borderColor:a,title:o="Suggested questions"}){return t&&0!==t.length?e.createElement("div",{className:"w-full"},e.createElement("h3",{className:"text-base font-medium mb-4 text-gray-900"},o),e.createElement("div",{className:"flex flex-wrap gap-2"},t.map((t=>e.createElement("button",{key:t.id,onClick:()=>r(t),className:"px-4 py-2 rounded-lg border border-gray-300 text-gray-700 hover:bg-gray-50 transition-colors duration-200 text-sm flex items-center gap-2",style:{borderColor:a}},void 0!==t.messageCount&&e.createElement(F,null,e.createElement(_,null,e.createElement(Q,{asChild:!0},e.createElement("span",{className:"bg-gray-100 text-gray-600 px-2 py-0.5 rounded-full text-xs min-w-[20px] border flex items-center justify-center",style:{borderColor:a}},t.messageCount)),e.createElement(M,null,e.createElement("p",null,t.messageCount," messages in this conversation")))),e.createElement("span",null,t.question)))))):null}M.displayName=y.Content.displayName;const D={javascript:".js",python:".py",java:".java",c:".c",cpp:".cpp","c++":".cpp","c#":".cs",ruby:".rb",php:".php",swift:".swift","objective-c":".m",kotlin:".kt",typescript:".ts",go:".go",perl:".pl",rust:".rs",scala:".scala",haskell:".hs",lua:".lua",shell:".sh",sql:".sql",html:".html",css:".css"},B=u.Prism,W=e.memo((({language:r,value:a})=>{const[o,n]=e.useState(!1);return e.createElement("div",{className:"relative font-sans text-sm mt-1"},e.createElement("div",{className:"relative rounded-t-lg bg-zinc-800/80 font-sans text-sm backdrop-blur"},e.createElement("div",{className:"flex h-8 items-center justify-between px-3"},e.createElement("span",{className:"text-xs font-medium text-zinc-400"},r),e.createElement("div",{className:"flex gap-1"},e.createElement(T,{variant:"ghost",size:"icon",className:"size-5 text-zinc-400 hover:bg-zinc-700/50 hover:text-zinc-100",onClick:()=>{k(void 0,void 0,void 0,(function*(){if(navigator.clipboard&&navigator.clipboard.writeText)try{yield navigator.clipboard.writeText(a),n(!0),setTimeout((()=>{n(!1)}),2e3)}catch(e){console.error("Failed to copy:",e)}}))}},o?e.createElement(t.CheckCircle,{size:18}):e.createElement(t.Clipboard,{size:18})),e.createElement(T,{variant:"ghost",size:"icon",className:"size-5 text-zinc-400 hover:bg-zinc-700/50 hover:text-zinc-100",onClick:()=>{const e=D[r]||".file",t=`file-${((e,t=!1)=>{const r="ABCDEFGHJKLMNPQRSTUVWXY3456789";let a="";for(let t=0;t<e;t+=1)a+=r.charAt(Math.floor(30*Math.random()));return t?a.toLowerCase():a})(3,!0)}${e}`,o=new Blob([a],{type:"text/plain"}),n=URL.createObjectURL(o),i=document.createElement("a");i.download=t,i.href=n,i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(n)}},e.createElement(t.Download,{size:18}))))),e.createElement("div",{className:"rounded-b-lg"},e.createElement(B,{language:r,style:p.a11yDark,PreTag:"div",wrapLongLines:!0,customStyle:{margin:0,borderTopLeftRadius:0,borderTopRightRadius:0}},a)))}));W.displayName="CodeBlock";const Z=w.forwardRef((({src:e,border:t,width:r="100%",height:a="400px",title:o},n)=>{const[i,s]=w.useState(!1);return w.useEffect((()=>{let e=!0;return setTimeout((()=>{e&&s(!0)}),0),()=>{e=!1}}),[]),w.createElement("div",{className:"overflow-hidden rounded-lg mt-4 "+(t?"border":""),style:{width:r,height:a}},i&&w.createElement(w.Fragment,null,w.createElement("iframe",{ref:n,src:e,sandbox:"allow-same-origin allow-scripts allow-popups allow-forms allow-downloads",width:r,height:a,frameBorder:"0",title:"embed",loading:"lazy",allowFullScreen:!0,className:"block rounded-lg"}),o&&w.createElement("span",{className:"block text-center text-sm font-medium"},o)))}));function H(e){const t=e.attrs.href.replace("share","embed");return w.createElement(Z,Object.assign({},e,{src:t,title:"Loom Embed"}))}function Y(e){return w.createElement(Z,Object.assign({},e,{src:e.attrs.href,title:"Supademo Embed"}))}function V(e){return w.createElement(Z,Object.assign({},e,{src:e.attrs.href,title:"Typeform Embed"}))}function X(e){const t=e.attrs.href.match(/(http|https)?:\/\/(www\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|)(\d+)(?:\/|\?)?([\d\w]+)?/);if(!t)return null;const r=t[4],a=t[5],o=`https://player.vimeo.com/video/${r}?byline=0${a?`&h=${a}`:""}`;return w.createElement(Z,Object.assign({},e,{src:o,title:`Vimeo Embed (${r})`,height:"412px",border:!1}))}function J(e){const t=(e=>{const t=[/^https?:\/\/([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)\/?$/,/^https?:\/\/fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)\/?$/,/^fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)\/?$/,/^([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)\/?$/];for(const r of t){const t=e.match(r);if(t)return t}return null})(e.attrs.href);if(!t)return null;const r=t[1],a=t[2]||t[1],o=r?`https://${r}.wistia.com/embed/iframe/${a}?seo=true&videoFoam=false`:`https://fast.wistia.com/embed/iframe/${a}`;return w.createElement(Z,Object.assign({},e,{src:o,border:!0,title:`Wistia Embed (${a})`}))}function K(e){const t=(e=>{const t=e.match(/(?:https?:\/\/)?(?:www\.)?youtu\.?be(?:\.com)?\/?.*(?:watch|embed)?(?:.*v=|v\/|\/)([a-zA-Z0-9_-]{11})$/i);return t?t[1]:null})(e.attrs.href);return t?w.createElement(Z,Object.assign({},e,{src:`https://www.youtube.com/embed/${t}?modestbranding=1`,title:`YouTube Embed (${t})`})):null}H.isMatch=e=>/^https:\/\/(www\.)?(use)?loom\.com\/(embed|share)\/(.*)$/.test(e),Y.isMatch=e=>/^https:\/\/app\.supademo\.com\/embed\/(.*)$/.test(e),V.isMatch=e=>/^https:\/\/([A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)\.typeform\.com\/to\/(.*)$/.test(e),X.isMatch=e=>/^(https?):\/\/(www\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|)?(\d+)(\/)?(?:\?.*|#.*)?$/i.test(e),J.isMatch=e=>[/^https?:\/\/([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i,/^https?:\/\/fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i,/^fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i,/^([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i].some((t=>t.test(e))),K.isMatch=e=>/^(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|embed\/|v\/|shorts\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})(?:\/|[?&].*)?$/i.test(e);const G=[H,Y,V,K,J,X],ee=t=>{const{href:r}=t.attrs,[a,o]=e.useState(null);if(e.useEffect((()=>{let e=!0;return(()=>{try{const a=G.find((e=>e.isMatch(r)));a&&e&&o({Component:a,props:t})}catch(e){console.error("Error finding embed match:",e)}})(),()=>{e=!1}}),[r,t]),a){const{Component:e,props:t}=a;return w.createElement(e,Object.assign({},t))}return null},te=e.memo(g,((e,t)=>e.children===t.children)),re={startOnLoad:!1,theme:"default",securityLevel:"loose",fontFamily:"inherit"},ae=({content:t})=>{const[r,a]=e.useState(""),[o,n]=e.useState(null),i=e.useRef(null),[s,l]=e.useState(!1);return e.useEffect((()=>{(()=>{try{h.initialize(re),l(!0)}catch(e){console.error("Error initializing mermaid:",e),n("Failed to initialize diagram renderer")}})()}),[]),e.useEffect((()=>{if(!s)return;k(void 0,void 0,void 0,(function*(){try{const e=`mermaid-${Math.random().toString(36).substr(2,9)}`,r=yield h.render(e,t);a(r.svg),n(null)}catch(e){console.error("Error rendering mermaid diagram:",e),n("Failed to render diagram")}}))}),[t,s]),o?e.createElement("div",{className:"text-red-500 bg-red-50 p-4 rounded-md"},o,e.createElement("pre",{className:"mt-2 text-sm"},t)):e.createElement("div",{ref:i,className:"my-4 overflow-auto",dangerouslySetInnerHTML:{__html:r}})},oe=e.memo((({message:t,isStreaming:r})=>{const[a,o]=e.useState(t.content);e.useEffect((()=>{var e;const r=I(t.content);r.uncertain&&r.language&&(null===(e=t.uncertaintyFallbackText)||void 0===e?void 0:e[r.language])?o(t.uncertaintyFallbackText[r.language]):o(t.content)}),[t.content,t.uncertaintyFallbackText,r]);const n=a.replace(/^\n+|(\n+|\\)+$/g,"");return e.createElement(te,{className:"dark:prose-invert prose flex-1",remarkPlugins:[m],rehypePlugins:[d],components:{code:t=>{var{inline:r,className:a,children:o}=t,n=x(t,["inline","className","children"]);const i=/language-(\w+)/.exec(a||""),s=i&&i[1];return r||"mermaid"!==s&&"mermaidjs"!==s?!r&&s?e.createElement(W,Object.assign({key:Math.random(),language:s,value:String(o).replace(/\n$/,"")},n)):e.createElement("code",Object.assign({className:`text-red-400 bg-slate-200 border-slate-300 border rounded p-0.5 ${a}`.trim()},n),o):e.createElement(ae,{content:String(o).replace(/\n$/,"")})},marker:({children:t})=>e.createElement("div",{className:"my-2"},e.createElement("span",{className:"highlight"},t)),table:({children:t})=>e.createElement("table",{className:"border-collapse border border-black px-3 py-1 dark:border-white"},t),th:({children:t})=>e.createElement("th",{className:"break-words border border-black bg-gray-500 px-3 py-1 text-white dark:border-white"},t),td:({children:t})=>e.createElement("td",{className:"break-words border border-black px-3 py-1 dark:border-white"},t),a(t){var{children:r}=t,a=x(t,["children"]);if(a.href){const t=ee({attrs:{href:a.href}});if(e.isValidElement(t))return t}return e.createElement("a",Object.assign({className:"link",target:"_blank",rel:"noopener noreferrer"},a),r)},pre:({children:t})=>e.createElement(e.Fragment,null,t),img({src:t,alt:r}){const a=ee({attrs:{href:null!=t?t:""}});return e.isValidElement(a)?a:e.createElement("img",{src:t,alt:r,className:"w-full"})},li:t=>{var{children:r}=t,a=x(t,["children"]);return e.createElement("li",Object.assign({className:"py-1"},a),r)},ul:({children:t})=>e.createElement("ul",{className:"ml-4 list-outside list-disc"},t),ol:({children:t})=>e.createElement("ol",{className:"ml-4 list-outside list-decimal"},t),strong:t=>{var{children:r}=t,a=x(t,["children"]);return e.createElement("span",Object.assign({className:"font-semibold"},a),r)},h1:t=>{var{children:r}=t,a=x(t,["children"]);return e.createElement("h1",Object.assign({className:"mb-2 mt-6 text-3xl font-semibold"},a),r)},h2:t=>{var{children:r}=t,a=x(t,["children"]);return e.createElement("h2",Object.assign({className:"mb-2 mt-6 text-2xl font-semibold"},a),r)},h3:t=>{var{children:r}=t,a=x(t,["children"]);return e.createElement("h3",Object.assign({className:"mb-2 mt-6 text-xl font-semibold"},a),r)},h4:t=>{var{children:r}=t,a=x(t,["children"]);return e.createElement("h4",Object.assign({className:"mb-2 mt-6 text-lg font-semibold"},a),r)},h5:t=>{var{children:r}=t,a=x(t,["children"]);return e.createElement("h5",Object.assign({className:"mb-2 mt-6 text-base font-semibold"},a),r)},h6:t=>{var{children:r}=t,a=x(t,["children"]);return e.createElement("h6",Object.assign({className:"mb-2 mt-6 text-sm font-semibold"},a),r)}}},n)}));oe.displayName="FormattedMessage";var ne="generating-star-module_animate-spin__AJjwz";v(".generating-star-module_animate-spin__AJjwz{animation:generating-star-module_rotate__ChndJ 2s linear infinite;transform:none;transform-box:fill-box;transform-origin:center}@keyframes generating-star-module_rotate__ChndJ{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}");const ie=({loading:t,color:r="#000"})=>e.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:"mt-[-5px] inline-block flex-shrink-0",style:{minWidth:"24px",minHeight:"24px"}},e.createElement("path",{className:t?ne:"",d:"M7.54672 16.0031L2.66234 14.2031C2.51881 14.1498 2.39502 14.0539 2.3076 13.9282C2.22019 13.8025 2.17333 13.6531 2.17333 13.5C2.17333 13.3469 2.22019 13.1975 2.3076 13.0718C2.39502 12.9461 2.51881 12.8501 2.66234 12.7969L7.54672 10.9969C7.64981 10.9589 7.74344 10.899 7.82113 10.8213C7.89882 10.7436 7.95873 10.65 7.99672 10.5469L9.79672 5.66249C9.84999 5.51896 9.94592 5.39517 10.0716 5.30775C10.1973 5.22033 10.3467 5.17348 10.4998 5.17348C10.6529 5.17348 10.8024 5.22033 10.9281 5.30775C11.0538 5.39517 11.1497 5.51896 11.203 5.66249L13.003 10.5469C13.041 10.65 13.1009 10.7436 13.1786 10.8213C13.2562 10.899 13.3499 10.9589 13.453 10.9969L18.3373 12.7969C18.4809 12.8501 18.6047 12.9461 18.6921 13.0718C18.7795 13.1975 18.8264 13.3469 18.8264 13.5C18.8264 13.6531 18.7795 13.8025 18.6921 13.9282C18.6047 14.0539 18.4809 14.1498 18.3373 14.2031L13.453 16.0031C13.3499 16.0411 13.2562 16.101 13.1786 16.1787C13.1009 16.2564 13.041 16.35 13.003 16.4531L11.203 21.3375C11.1497 21.481 11.0538 21.6048 10.9281 21.6922C10.8024 21.7796 10.6529 21.8265 10.4998 21.8265C10.3467 21.8265 10.1973 21.7796 10.0716 21.6922C9.94592 21.6048 9.84999 21.481 9.79672 21.3375L7.99672 16.4531C7.95873 16.35 7.89882 16.2564 7.82113 16.1787C7.74344 16.101 7.64981 16.0411 7.54672 16.0031Z",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",fill:t?r:"none",strokeLinejoin:"round"}),e.createElement("path",{d:"M18.7497 3.75L14.2497 3.75",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.createElement("path",{d:"M16.4999 6V1.5",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.createElement("path",{d:"M22.4999 8.25001H19.4999",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.createElement("path",{d:"M20.9998 9.75002V6.75002",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}));function se({answer:a,question:o,theme:n,searchResults:i,isStreaming:s=!1,searchQueryId:l,feedback:c,onFeedback:d,disableFeedback:m=!1,textConfig:u={},isLoading:p=!1,isSearchLoading:g=!1}){const[h,f]=e.useState(!1),[w,b]=e.useState(!1),y=()=>k(this,void 0,void 0,(function*(){try{yield navigator.clipboard.writeText(a),f(!0),setTimeout((()=>f(!1)),2e3)}catch(e){console.error("Failed to copy text:",e)}})),v=e=>{d&&l&&d(e)};return e.createElement("div",{className:"rounded-lg p-6 relative",style:{backgroundColor:n.cardBackground,borderColor:n.border,borderWidth:"1px",borderStyle:"solid"}},e.createElement("div",{className:"flex items-start justify-between"},e.createElement("div",{className:"flex items-center gap-2 mb-4"},e.createElement("div",{className:"mt-1"},e.createElement(ie,{loading:p||s,color:n.primary})),e.createElement("h2",{className:"text-xl leading-normal font-semibold",style:{color:n.text}},o)),a&&e.createElement(F,null,e.createElement(_,null,e.createElement(Q,{asChild:!0},e.createElement("button",{onClick:()=>{y()},className:"flex items-center justify-center w-8 h-8 rounded-md hover:bg-gray-100 transition-colors duration-200"},h?e.createElement(t.Check,{className:"h-4 w-4 text-green-500"}):e.createElement(t.Copy,{className:"h-4 w-4 text-gray-500"}))),e.createElement(M,null,e.createElement("p",null,h?"Copied!":"Copy"))))),p?e.createElement("div",{className:"space-y-4"},e.createElement("div",{className:"flex items-center gap-2"},e.createElement("div",{className:"animate-pulse h-5 rounded-full w-5",style:{backgroundColor:`${n.primary}30`}}),e.createElement("div",{className:"flex items-center gap-2 text-sm",style:{color:n.text}},g?u.loadingSearchText:u.loadingAnswerText)),e.createElement("div",{className:"space-y-3"},e.createElement("div",{className:"animate-pulse h-4 bg-gray-200 rounded w-3/4",style:{backgroundColor:`${n.border}40`}}),e.createElement("div",{className:"animate-pulse h-4 bg-gray-200 rounded w-full",style:{backgroundColor:`${n.border}40`}}),e.createElement("div",{className:"animate-pulse h-4 bg-gray-200 rounded w-5/6",style:{backgroundColor:`${n.border}40`}})),e.createElement("div",{className:"mt-6 space-y-3"},e.createElement("div",{className:"animate-pulse h-4 bg-gray-200 rounded w-1/4",style:{backgroundColor:`${n.border}40`}}),e.createElement("div",{className:"flex gap-2"},e.createElement("div",{className:"animate-pulse h-8 bg-gray-200 rounded w-32",style:{backgroundColor:`${n.border}40`}}),e.createElement("div",{className:"animate-pulse h-8 bg-gray-200 rounded w-40",style:{backgroundColor:`${n.border}40`}})))):a?e.createElement("div",{className:"prose prose-sm max-w-none",style:{color:n.text}},e.createElement(oe,{message:{content:a,theme:{primary:n.primary,text:n.text},uncertaintyFallbackText:u.uncertaintyFallbackText},isStreaming:s})):e.createElement("div",{className:"prose prose-sm max-w-none",style:{color:n.text}},e.createElement(oe,{message:{content:"Sorry, there was an error generating the answer. Please try again.",theme:{primary:n.primary,text:n.text}},isStreaming:s})),a&&!s&&!m&&e.createElement("div",{className:"mt-2 flex justify-end gap-2"},e.createElement(F,null,e.createElement(_,null,e.createElement(Q,{asChild:!0},e.createElement(T,{variant:"ghost",size:"sm",className:"rounded-md h-8 w-8 flex items-center justify-center transition-all duration-200 transform hover:scale-105 active:scale-95 "+("accept"===c?"bg-green-100 text-green-600 hover:bg-green-200":""),onClick:()=>v("accept"),disabled:Boolean(c)},e.createElement(r.motion.div,{initial:{scale:1},animate:{scale:"accept"===c?[1,1.2,1]:1},transition:{duration:.3}},e.createElement(t.ThumbsUp,{className:"h-4 w-4"})))),e.createElement(M,null,e.createElement("p",null,u.positiveAnswerText||"Helpful")))),e.createElement(F,null,e.createElement(_,null,e.createElement(Q,{asChild:!0},e.createElement(T,{variant:"ghost",size:"sm",className:"rounded-md h-8 w-8 flex items-center justify-center transition-all duration-200 transform hover:scale-105 active:scale-95 "+("reject"===c?"bg-red-100 text-red-600 hover:bg-red-200":""),onClick:()=>v("reject"),disabled:Boolean(c)},e.createElement(r.motion.div,{initial:{scale:1},animate:{scale:"reject"===c?[1,1.2,1]:1},transition:{duration:.3}},e.createElement(t.ThumbsDown,{className:"h-4 w-4"})))),e.createElement(M,null,e.createElement("p",null,u.negativeAnswerText||"Not helpful"))))),i&&i.length>0&&e.createElement("div",{className:"mt-6 rounded-lg overflow-hidden",style:{backgroundColor:n.surface,borderWidth:"1px",borderStyle:"solid",borderColor:n.border}},e.createElement("button",{onClick:()=>b(!w),className:"w-full flex items-center justify-between p-3 transition-all duration-200 hover:bg-opacity-50",style:{color:n.text,borderBottom:w?`1px solid ${n.surfaceBorder}`:"none"}},e.createElement("div",{className:"flex items-center gap-2"},e.createElement(t.FileText,{className:"h-4 w-4 flex-shrink-0",style:{color:n.primary}}),e.createElement("span",{className:"font-medium truncate"},`Related Sources (${i.length})`)),e.createElement(t.ChevronDown,{className:"h-4 w-4 flex-shrink-0 transition-transform duration-200 "+(w?"rotate-180":""),style:{color:n.text}})),e.createElement("div",{className:"overflow-hidden transition-all duration-200 ease-in-out",style:{maxHeight:w?48*i.length+"px":"0",opacity:w?1:0,transform:`translateY(${w?"0":"-10px"})`}},e.createElement("div",{className:"divide-y divide-gray-200"},i.map((r=>e.createElement("a",{key:r.id,href:r.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 transition-colors duration-200 hover:bg-gray-50",style:{color:n.text,backgroundColor:n.surface}},e.createElement("span",{className:"flex-grow truncate"},r.title),e.createElement(t.ExternalLink,{className:"h-4 w-4 flex-shrink-0",style:{color:`${n.text}60`}}))))))))}function le({questions:a,onQuestionClick:o,theme:n}){return a.length?e.createElement(r.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"w-full"},e.createElement("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:n.surface,borderWidth:"1px",borderStyle:"solid",borderColor:n.border}},e.createElement("div",{className:"p-3 border-b",style:{borderColor:n.surfaceBorder}},e.createElement("div",{className:"flex items-center gap-2"},e.createElement(t.HelpCircle,{className:"h-4 w-4 flex-shrink-0",style:{color:n.primary}}),e.createElement("span",{className:"font-medium"},"Follow-up Questions"))),e.createElement("div",{className:"divide-y divide-gray-200"},a.map(((a,i)=>e.createElement(r.motion.button,{key:i,initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:.1*i},onClick:()=>o(a),className:"w-full flex items-center gap-2 p-3 transition-colors duration-200 hover:bg-gray-50 text-left",style:{color:n.text,backgroundColor:n.surface}},e.createElement("span",{className:"flex-grow"},a),e.createElement(t.ChevronRight,{className:"h-4 w-4 flex-shrink-0",style:{color:`${n.text}60`}}))))))):null}function ce({questions:a,activeIndex:o,onNavigate:n,theme:i,offset:s}){const[l,c]=e.useState(o);e.useEffect((()=>{c(o)}),[o]);const d=a.length,m=(()=>{const e=[];let t=null;const r=r=>{null!==t&&r-t>1&&e.push("ellipsis"),e.push(r),t=r};r(0);for(let e=Math.max(1,o-2);e<=Math.min(d-2,o+2);e++)r(e);return d>1&&r(d-1),e})();return e.createElement("nav",{"aria-label":"Question timeline navigation",className:"fixed left-4 top-1/2 -translate-y-1/2 z-40 flex flex-col gap-3",style:Object.assign({},s?{left:`${s}px`}:{})},e.createElement(r.motion.div,{className:"flex flex-col items-center space-y-3",role:"list",initial:!1,animate:{y:0},transition:{type:"spring",stiffness:300,damping:30}},e.createElement(r.AnimatePresence,null,m.map(((s,c)=>{if("ellipsis"===s)return e.createElement(r.motion.div,{key:`ellipsis-${c}`,className:"h-8 flex items-center justify-center","aria-hidden":"true",initial:{opacity:0,y:l>o?-20:20},animate:{opacity:1,y:0},exit:{opacity:0,y:l>o?20:-20},transition:{duration:.2}},e.createElement(t.MoreVertical,{className:"w-4 h-4",style:{color:i.text}}));const d=s,m=a[d];return e.createElement(r.motion.div,{key:d,className:"relative group isolate",role:"listitem",initial:{opacity:0,y:l>o?-20:20},animate:{opacity:1,y:0},exit:{opacity:0,y:l>o?20:-20},transition:{duration:.2},layout:!0},e.createElement(F,null,e.createElement(_,null,e.createElement(Q,{asChild:!0},e.createElement("button",{onClick:()=>n(d),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||n(d)},className:"flex items-center justify-center w-8 h-8 rounded-full transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 hover:opacity-90",style:{backgroundColor:d===o?i.primary:"#ccc",color:d===o?i.background:"#333",cursor:"pointer","--tw-ring-color":i.primary},"aria-label":`Navigate to question ${d+1}: ${m}`,"aria-current":d===o?"step":void 0},d+1)),e.createElement(M,{side:"right",sideOffset:8},e.createElement("p",{className:"max-w-[200px] break-words"},m)))))})))))}function de({onClick:r,theme:a}){return e.createElement(T,{className:"fixed bottom-20 right-4 rounded-full p-2 transition-opacity duration-300",style:{backgroundColor:a.background,borderColor:a.border,borderWidth:"1px",borderStyle:"solid",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"},onClick:r},e.createElement(t.ArrowDown,{className:"h-5 w-5",style:{color:a.text}}))}const me={maxRetries:3,baseDelay:1e3,shouldRetry:e=>{if(e instanceof TypeError)return!0;const t=e;return!!t.status&&t.status>=500}};let ue=Object.assign({},me),pe=Object.assign({},{emptyResponse:"I apologize, but I couldn't generate an answer at this time. Please try again.",errorResponse:"I encountered an error while processing your request. Please try again."});function ge(e){return k(this,void 0,void 0,(function*(){return new Promise((t=>setTimeout(t,e)))}))}function he(e,t={}){return k(this,void 0,void 0,(function*(){const{retry:r={},headers:a={},body:o,isStream:n=!1,fallback:i={}}=t,s=x(t,["retry","headers","body","isStream","fallback"]),l=Object.assign(Object.assign({},ue),r),c=Object.assign(Object.assign({},pe),i);let d=1;for(;;)try{const t=yield fetch(e,Object.assign(Object.assign({},s),{headers:Object.assign({"Content-Type":"application/json"},a),body:o?JSON.stringify(o):void 0}));if(t.ok){if(n){const e=t.clone();if(!(yield e.text()).trim()){const e=new Error(c.emptyResponse);throw e.name="EmptyResponseError",e}return t}const e=yield t.json();if(!e||"object"==typeof e&&0===Object.keys(e).length){const e=new Error(c.emptyResponse);throw e.name="EmptyResponseError",e}return e}const r=new Error(c.errorResponse);throw r.status=t.status,r.data=yield t.json().catch((()=>{})),r}catch(e){const t=yield Promise.resolve(l.shouldRetry(e,d));if(d>=l.maxRetries||!t){if(e instanceof Error&&"EmptyResponseError"===e.name)return{message:e.message};throw e}console.warn(`Request failed, attempt ${d} of ${l.maxRetries}. Retrying...`);const r=.3*Math.random()+.85;yield ge(l.baseDelay*Math.pow(2,d-1)*r),d++}}))}const fe={maxRetries:3,baseDelay:300,shouldRetry:e=>{if(e instanceof TypeError)return!0;const t=e;return!!t.status&&(t.status>=500||429===t.status)}},we={maxRetries:3,baseDelay:500,shouldRetry:e=>{if(e instanceof TypeError)return!0;const t=e;return!!t.status&&t.status>=500}};function be({endpoint:e,query:t,collectionId:r,headers:a,conversationId:o}){var n;return k(this,void 0,void 0,(function*(){const i=yield he(e,{method:"POST",headers:a,retry:fe,body:Object.assign(Object.assign({query:t,limit:5},r&&"all"!==r&&{collectionId:r}),o&&{conversationId:o})});return{results:null==i?void 0:i.data,searchQueryId:null===(n=null==i?void 0:i.searchQuery)||void 0===n?void 0:n.id}}))}function ye({endpoint:e,searchQueryId:t,headers:r,conversationId:a}){return k(this,void 0,void 0,(function*(){return he(e,{method:"POST",headers:r,retry:we,isStream:!0,fallback:{emptyResponse:"I apologize, but I couldn't generate an answer for your query. Please try rephrasing your question.",errorResponse:"I encountered an issue while generating the answer. Please try again in a moment."},body:Object.assign({searchQueryId:t},a&&{conversationId:a})})}))}function ve(){return`bf-conversation-${Date.now()}-${"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}`}function xe({endpoint:e,conversationId:t,headers:r}){return k(this,void 0,void 0,(function*(){return{data:(yield he(e,{method:"POST",headers:r,body:{conversationId:t}})).data.map((e=>Object.assign(Object.assign({},e),{feedback:e.feedback?"positive"===e.feedback?"accept":"reject":void 0})))}}))}const ke={primary:"#A3E635",accent:"#f9fafb",background:"white",text:"#171717",border:"#171717",hover:"#171717",surface:"#F9FAFB",surfaceBorder:"#E5E7EB",surfaceHover:"#F3F4F6",cardBackground:"white"},Ee={headerText:"How can we help you today?",searchPlaceholder:"Ask a question or type a search term here ...",attachImageText:"Attach image",allDocumentsText:"All documents",loadingSearchText:"Searching for relevant content...",loadingAnswerText:"Crafting a response...",errorText:"Sorry, there was an error generating the answer.",followUpPlaceholder:"Ask follow-up",positiveAnswerText:"Helpful",negativeAnswerText:"Not helpful",uncertaintyFallbackText:{en:"Sorry, I can't find a clear answer to your question. Please try rephrasing or check the related sources below.",es:"Lo siento, no puedo encontrar una respuesta clara. Intente reformular la pregunta o consulte las fuentes relacionadas.",fr:"Désolé, je ne trouve pas de réponse claire. Essayez de reformuler ou consultez les sources connexes.",de:"Entschuldigung, ich finde keine klare Antwort. Versuchen Sie es anders zu formulieren oder sehen Sie sich die verwandten Quellen an.",it:"Mi dispiace, non trovo una risposta chiara. Prova a riformulare o consulta le fonti correlate.",pt:"Desculpe, não encontro uma resposta clara. Tente reformular ou consulte as fontes relacionadas.",nl:"Sorry, ik kan geen duidelijk antwoord vinden. Probeer het anders te formuleren of bekijk de gerelateerde bronnen.",pl:"Przepraszam, nie znajduję jasnej odpowiedzi. Spróbuj przeformułować pytanie lub sprawdź powiązane źródła.",ru:"Извините, я не могу найти четкого ответа. Попробуйте переформулировать или ознакомьтесь со связанными источниками.",ja:"申し訳ありませんが、明確な回答が見つかりません。質問の言い換えや、関連ソースをご確認ください。",ko:"죄송합니다. 명확한 답변을 찾을 수 없습니다. 질문을 다시 작성하거나 관련 소스를 확인해 주세요.",zh:"抱歉,找不到明确的答案。请尝试重新表述或查看相关来源。","zh-TW":"抱歉,找不到明確的答案。請嘗試重新表述或查看相關來源。"}},Ne=e.forwardRef((({suggestions:a,theme:o={},collections:n=[],selectedCollectionId:i,onCollectionChange:s,searchEndpoint:l,answerEndpoint:c,feedbackEndpoint:d,loadConversationEndpoint:m,disableFollowUpQuestions:u=!1,disableImageAttachment:p=!1,disableFeedback:g=!1,siblingNode:h,offset:f=0,headers:w,textConfig:b={},followUpQuestionsEndpoint:y},v)=>{var x;const E=Object.assign(Object.assign({},ke),o),N=Object.assign(Object.assign({},Ee),b),[C,j]=e.useState(""),[z,S]=e.useState(""),[O,R]=e.useState(!1),[L,F]=e.useState(!1),[_,Q]=e.useState([]),[M,D]=e.useState(!1),[B,W]=e.useState(0),[Z,H]=e.useState([]),[Y,V]=e.useState(i),[X,J]=e.useState(!0),[K,G]=e.useState(""),[ee,te]=e.useState(!1),[re,ae]=e.useState(),oe=e.useRef(null),ne=e.useRef(null),ie=e.useRef([]),me=e.useRef(null),ue=e.useRef(null),pe=e.useRef([]);e.useEffect((()=>{const e=new URLSearchParams(window.location.search).get("conversation");if(e&&m)te(!0),F(!0),xe({endpoint:m,conversationId:e,headers:w}).then((t=>{Q(t.data),G(e),F(!0)})).catch((e=>{console.error("Error loading conversation:",e),ae(N.errorText||"An error occurred"),F(!1),Q([]);const t=ve();G(t);const r=new URL(window.location.href);r.searchParams.delete("conversation"),window.history.replaceState({},"",r.toString())})).finally((()=>{te(!1)}));else{const e=ve();G(e)}}),[m]),e.useEffect((()=>{if(K&&_.length>0){const e=new URL(window.location.href);e.searchParams.set("conversation",K),window.history.replaceState({},"",e.toString())}}),[K,_.length]),e.useEffect((()=>{const e={showResults:L,answers:_,isLoading:ee,error:re};pe.current.forEach((t=>t(e)))}),[L,_,ee,re]),e.useImperativeHandle(v,(()=>({createNewThread:()=>{j(""),S(""),F(!1),Q([]),W(0),H([]);const e=ve();G(e);const t=new URL(window.location.href);t.searchParams.delete("conversation"),window.history.replaceState({},"",t.toString()),oe.current&&(oe.current.style.height="auto")},showFollowUpThread:e=>{J(e)},subscribeToStateChanges:e=>(pe.current.push(e),e({showResults:L,answers:_,isLoading:!1,error:void 0}),()=>{pe.current=pe.current.filter((t=>t!==e))})}))),e.useEffect((()=>{V(i)}),[i]);const ge=()=>{requestAnimationFrame((()=>{const e=ie.current[ie.current.length-1];if(e){const t=e.getBoundingClientRect(),r=window.pageYOffset||document.documentElement.scrollTop,a=t.top+r-80;window.scrollTo({top:a,behavior:"smooth"})}}))},fe=e=>k(void 0,void 0,void 0,(function*(){var t;const r=null===(t=e.body)||void 0===t?void 0:t.getReader();if(!r)return;Q((e=>{const t=[...e],r=t[t.length-1];return r&&(r.isLoading=!1,r.isStreaming=!0,r.searchResults=r.searchResults||[]),t}));let a="";try{let e,t;for(;({done:e,value:t}=yield r.read()),!e;){const e=(new TextDecoder).decode(t);a+=e;const{uncertain:r,language:o}=I(a);Q((e=>{var t;const n=[...e],i=n[n.length-1];return i&&(i.answer=a,i.isLoading=!1,i.isStreaming=!0,i.searchResults=i.searchResults||[],i.isUncertain=r,i.uncertaintyLanguage=o,r&&o&&(null===(t=N.uncertaintyFallbackText)||void 0===t?void 0:t[o])&&(i.uncertaintyFallbackText=N.uncertaintyFallbackText[o])),n}))}}catch(e){console.error("Error streaming answer:",e)}finally{Q((e=>{const t=[...e],r=t[t.length-1];return r&&(r.isStreaming=!1,r.isLoading=!1,y&&!u&&r.searchQueryId&&k(void 0,void 0,void 0,(function*(){try{const e=yield function({endpoint:e,searchQueryId:t,headers:r,conversationId:a}){return k(this,void 0,void 0,(function*(){return(yield he(e,{method:"POST",headers:r,body:Object.assign({searchQueryId:t},a&&{conversationId:a})})).questions}))}({endpoint:y,searchQueryId:r.searchQueryId,headers:w,conversationId:K});Q((t=>{const r=[...t],a=r[r.length-1];return a&&(a.followUpQuestions=e),r}))}catch(e){console.error("Error fetching follow-up questions:",e)}}))),t})),r.releaseLock()}})),we=(e,t,r)=>k(void 0,void 0,void 0,(function*(){if(d){Q((t=>{const a=[...t];return a[r]&&(a[r]=Object.assign(Object.assign({},a[r]),{feedback:e})),a}));try{yield function({endpoint:e,searchQueryId:t,response:r,headers:a,conversationId:o}){return k(this,void 0,void 0,(function*(){yield he(e,{method:"POST",headers:a,body:Object.assign({searchQueryId:t,response:r},o&&{conversationId:o})})}))}({endpoint:d,searchQueryId:t,response:e,headers:w,conversationId:K})}catch(e){console.error("Error sending feedback:",e),Q((e=>{const t=[...e];return t[r]&&(t[r]=Object.assign(Object.assign({},t[r]),{feedback:void 0})),t}))}}})),Ne=(e=C.trim())=>k(void 0,void 0,void 0,(function*(){if(e){R(!0),F(!0);const t=K||ve();K||G(t);const r={question:e,answer:"",isLoading:!0,isSearchLoading:!0,searchResults:[],searchQueryId:void 0,isStreaming:!1};Q((e=>[...e,r]));const a=_.length;W(a),ge(),yield Promise.resolve();try{const r=yield be({endpoint:l,query:e,collectionId:Y,headers:w,conversationId:t});Q((e=>{const t=[...e];return t[t.length-1]&&(t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{searchResults:r.results,searchQueryId:r.searchQueryId,isSearchLoading:!1})),t}));const a=yield ye({endpoint:c,searchQueryId:r.searchQueryId,headers:w,conversationId:t});yield fe(a)}catch(e){console.error("Error generating answer:",e),Q((e=>{const t=[...e];return t[t.length-1]&&(t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{answer:N.errorText||"An error occurred",isLoading:!1,isSearchLoading:!1,isStreaming:!1})),t}))}finally{R(!1)}}})),Ce=()=>k(void 0,void 0,void 0,(function*(){if(z.trim()){const e=z;j(e),S(""),ne.current&&(ne.current.style.height="auto"),yield Ne(e)}}));e.useEffect((()=>{const e=()=>{const e=window.innerHeight+window.pageYOffset>=document.documentElement.scrollHeight-100;D(!e)};return window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)}),[]),e.useEffect((()=>()=>{Z.forEach((e=>URL.revokeObjectURL(e.preview)))}),[Z]);e.useEffect((()=>{const e=()=>{new URLSearchParams(window.location.search).get("conversation")||(j(""),S(""),F(!1),Q([]),W(0),H([]),oe.current&&(oe.current.style.height="auto"))};return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)}),[]);const je=e=>{Ne(e)};return e.createElement("div",{className:"relative min-h-screen"},e.createElement("div",{ref:me,className:"w-full max-w-3xl mx-auto flex flex-col items-center space-y-8 px-4 py-20",style:{"--surface-border":E.surfaceBorder,"--surface-hover":E.surfaceHover}},e.createElement(r.AnimatePresence,null,ee?e.createElement(r.motion.div,{key:"loading",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"w-full flex items-center justify-center py-20"},e.createElement("div",{className:"flex flex-col items-center gap-4"},e.createElement("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-t-transparent",style:{borderColor:E.primary}}),e.createElement("p",{className:"text-sm",style:{color:E.text}},"Loading conversation..."))):L?e.createElement(r.motion.div,{key:"results",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.5},className:"w-full space-y-4 py-4 mb-20"},_.map(((t,a)=>e.createElement(r.motion.div,{key:a,ref:e=>ie.current[a]=e,initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.1*a}},e.createElement(se,{answer:t.answer,question:t.question,theme:E,searchResults:t.searchResults,isStreaming:t.isStreaming,searchQueryId:t.searchQueryId,feedback:t.feedback,onFeedback:g||!d?void 0:e=>we(e,t.searchQueryId,a),disableFeedback:g||!d,textConfig:N,isLoading:t.isLoading,isSearchLoading:t.isSearchLoading}),a===_.length-1&&!u&&t.followUpQuestions&&!t.isStreaming&&e.createElement("div",{className:"mt-4"},e.createElement(le,{questions:t.followUpQuestions,onQuestionClick:je,theme:E})))))):e.createElement(r.motion.div,{key:"search",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.5},className:"w-full space-y-8"},e.createElement("div",{className:"w-full text-center space-y-4"},e.createElement(r.motion.h1,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.3},className:"text-5xl font-bold",style:{color:E.text}},N.headerText)),e.createElement(r.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.4}},e.createElement("div",{className:"relative w-full rounded-md overflow-hidden",style:{backgroundColor:E.background,borderColor:E.border,borderWidth:"1px",borderStyle:"solid"}},e.createElement("div",{className:"p-3 flex items-center"},e.createElement(t.Search,{className:"h-5 w-5 text-gray-400 mr-2"}),e.createElement("textarea",{ref:oe,placeholder:N.searchPlaceholder,value:C,onChange:e=>{var t;j(e.target.value),(t=e.target).style.height="auto",t.style.height=`${t.scrollHeight}px`},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),Ne())},className:"w-full resize-none outline-none text-lg py-1 font-light min-h-[36px] overflow-hidden placeholder:text-gray-400 border-none bg-transparent",style:{color:E.text,outline:"none",boxShadow:"none",fontSize:"16px"},rows:1})),!p&&Z.length>0&&e.createElement("div",{className:"flex gap-2 mt-3 overflow-x-auto pb-1 px-3"},Z.map(((r,a)=>e.createElement("div",{key:a,className:"relative group rounded-lg overflow-hidden flex-shrink-0",style:{width:"80px",height:"80px"}},e.createElement("img",{src:r.preview,alt:`Attached ${a+1}`,className:"w-full h-full object-cover"}),e.createElement("button",{onClick:()=>(e=>{H((t=>(URL.revokeObjectURL(t[e].preview),t.filter(((t,r)=>r!==e)))))})(a),className:"absolute top-1 right-1 bg-black bg-opacity-50 rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200"},e.createElement(t.X,{className:"h-3 w-3 text-white"})))))),e.createElement("div",{className:"flex items-center justify-between px-3 py-2 bg-gray-100 border-t border-gray-200"},e.createElement("div",{className:"flex gap-2"},n.length>0&&e.createElement($,null,e.createElement(A,{asChild:!0},e.createElement(T,{variant:"ghost",size:"sm",className:"hover:bg-gray-200 transition-all duration-200 rounded-md h-8 flex items-center gap-2 text-gray-700"},Y&&"all"!==Y?e.createElement(t.CheckCircle2,{className:"h-5 w-5 text-green-500"}):e.createElement(t.Circle,{className:"h-5 w-5 text-gray-400"}),(null===(x=n.find((e=>e.id===Y)))||void 0===x?void 0:x.name)||N.allDocumentsText,e.createElement(t.ChevronDown,{className:"h-4 w-4 opacity-50"}))),e.createElement(q,null,n.map((r=>e.createElement(P,{key:r.id,onClick:()=>{return e=r.id,V(e),void(null==s||s(e));var e},className:r.id===Y?"bg-gray-100":""},r.id===Y?e.createElement(t.CheckCircle2,{className:"h-4 w-4 mr-2 text-green-500"}):e.createElement(t.Circle,{className:"h-4 w-4 mr-2 text-gray-400"}),r.name))))),!p&&e.createElement(e.Fragment,null,e.createElement("input",{type:"file",ref:ue,accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{const t=e.target.files;if(t){const e=Array.from(t).map((e=>({file:e,preview:URL.createObjectURL(e)})));H((t=>[...t,...e]))}ue.current&&(ue.current.value="")}}),e.createElement(T,{variant:"ghost",size:"sm",className:"hover:bg-gray-200 rounded-md h-8 text-gray-700",onClick:()=>{var e;return null===(e=ue.current)||void 0===e?void 0:e.click()}},e.createElement(t.Image,{className:"h-4 w-4 mr-1.5"}),N.attachImageText))),e.createElement("div",{className:"flex items-center"},e.createElement(T,{size:"sm",disabled:!C||O,className:"rounded-md h-8 w-8 bg-[#86efac] hover:bg-[#86efac]/90 disabled:opacity-50",onClick:()=>{Ne()}},O?e.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-2 border-t-transparent",style:{borderColor:"white"}}):e.createElement(t.ArrowRight,{className:"h-4 w-4 text-gray-700"})))))),e.createElement(U,{suggestions:a||[],onQuestionClick:e=>{if(e.conversationId&&m)return te(!0),F(!0),void xe({endpoint:m,conversationId:e.conversationId,headers:w}).then((t=>{Q(t.data),G(e.conversationId),F(!0)})).catch((e=>{console.error("Error loading conversation:",e),ae(N.errorText||"An error occurred"),F(!1),Q([]);const t=ve();G(t);const r=new URL(window.location.href);r.searchParams.delete("conversation"),window.history.replaceState({},"",r.toString())})).finally((()=>{te(!1)}));if(F(!0),R(!0),!K){const e=ve();G(e)}Q((t=>[...t,{question:e.question,answer:"",isLoading:!0,isSearchLoading:!0}])),k(void 0,void 0,void 0,(function*(){try{const t=yield be({endpoint:l,query:e.question,collectionId:Y,headers:w,conversationId:K}),r=t.results;Q((e=>{const a=[...e];return a[a.length-1]=Object.assign(Object.assign({},a[a.length-1]),{searchResults:r,searchQueryId:t.searchQueryId,isSearchLoading:!1}),a}));const a=yield ye({endpoint:c,searchQueryId:t.searchQueryId,headers:w,conversationId:K});yield fe(a)}catch(e){console.error("Error generating answer:",e),Q((e=>{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{answer:N.errorText||"An error occurred",isLoading:!1,isSearchLoading:!1}),t}))}finally{R(!1),ge()}}))},borderColor:E.border,title:N.suggestionsTitle}),h)),L&&_.length>1&&e.createElement("div",{className:"hidden sm:block"},e.createElement(ce,{questions:_.map((e=>e.question)),activeIndex:B,onNavigate:e=>{W(e),(e=>{requestAnimationFrame((()=>{const t=ie.current[e];if(t){const e=t.getBoundingClientRect(),r=window.pageYOffset||document.documentElement.scrollTop,a=e.top+r-80;window.scrollTo({top:a,behavior:"smooth"})}}))})(e)},theme:E,offset:f})),L&&X&&e.createElement(r.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},className:"fixed bottom-4 left-4 right-4 max-w-3xl mx-auto z-10",style:{left:`${f}px`}},e.createElement("div",{className:"rounded-full h-[44px] sm:h-[52px] flex items-center justify-between",style:{backgroundColor:E.background,borderColor:E.border,borderWidth:"1px",borderStyle:"solid",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",padding:"0 15px"}},e.createElement("div",{className:"flex items-center gap-2 sm:gap-3 flex-grow overflow-hidden h-full"},e.createElement(t.Search,{className:"h-4 w-4 sm:h-5 sm:w-5 flex-shrink-0",style:{color:E.primary}}),e.createElement("div",{className:"flex-grow",style:{paddingTop:"15px",paddingBottom:"10px"}},e.createElement("textarea",{ref:ne,placeholder:N.followUpPlaceholder,value:z,onChange:e=>{S(e.target.value);e.target.style.height="auto",e.target.style.height=`${Math.min(e.target.scrollHeight,100)}px`,e.target.scrollHeight>100?e.target.style.overflowY="auto":e.target.style.overflowY="hidden"},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),Ce())},disabled:O,className:"w-full bg-transparent outline-none text-sm sm:text-base resize-none overflow-hidden disabled:opacity-50 border-none min-h-[24px] max-h-[100px] placeholder:text-sm sm:placeholder:text-base",style:{color:E.text,outline:"none",boxShadow:"none",fontSize:"16px",lineHeight:"24px"},rows:1}))),e.createElement("div",{className:"flex items-center gap-2 sm:gap-3 ml-2 sm:ml-3 flex-shrink-0"},e.createElement(T,{size:"icon",variant:"ghost",disabled:O||!z.trim(),className:"rounded-full transition-colors duration-200 disabled:opacity-50 h-8 w-8 sm:h-9 sm:w-9 flex items-center justify-center",style:{color:E.text,backgroundColor:"transparent"},onClick:()=>{Ce()}},O?e.createElement("div",{className:"animate-spin rounded-full h-4 w-4 sm:h-5 sm:w-5 border-2",style:{borderColor:`${E.text}40`,borderTopColor:E.text}}):e.createElement(t.ArrowUp,{className:"h-4 w-4 sm:h-5 sm:w-5"}))))),M&&L&&e.createElement(de,{onClick:ge,theme:E})))}));Ne.displayName="ChatSearch",exports.ChatSearch=Ne;
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- import*as e from"react";import t,{memo as r,useState as a,useEffect as o,useRef as n,forwardRef as i,useImperativeHandle as s}from"react";import{CheckCircle as l,Clipboard as c,Download as d,Check as m,Copy as p,ThumbsUp as u,ThumbsDown as g,FileText as h,ChevronDown as f,ExternalLink as w,HelpCircle as b,ChevronRight as y,MoreVertical as v,ArrowDown as x,Search as k,X as E,CheckCircle2 as N,Circle as j,Image as z,ArrowRight as C,ArrowUp as S}from"lucide-react";import{motion as O,AnimatePresence as I}from"framer-motion";import{jsx as R,Fragment as L}from"react/jsx-runtime";import{cva as T}from"class-variance-authority";import{clsx as $}from"clsx";import{twMerge as A}from"tailwind-merge";import*as F from"@radix-ui/react-dropdown-menu";import{ChevronRightIcon as P,CheckIcon as Q,DotFilledIcon as _}from"@radix-ui/react-icons";import*as M from"@radix-ui/react-tooltip";import U from"rehype-raw";import q from"remark-gfm";import{Prism as B}from"react-syntax-highlighter";import{a11yDark as W}from"react-syntax-highlighter/dist/cjs/styles/prism";import Z from"react-markdown";import D from"mermaid";function H(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&a.firstChild?a.insertBefore(o,a.firstChild):a.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}function Y(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(r[a[o]]=e[a[o]])}return r}function V(e,t,r,a){return new(r||(r=Promise))((function(o,n){function i(e){try{l(a.next(e))}catch(e){n(e)}}function s(e){try{l(a.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}l((a=a.apply(e,t||[])).next())}))}function X(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function J(...e){return t=>{let r=!1;const a=e.map((e=>{const a=X(e,t);return r||"function"!=typeof a||(r=!0),a}));if(r)return()=>{for(let t=0;t<a.length;t++){const r=a[t];"function"==typeof r?r():X(e[t],null)}}}}H('/*! tailwindcss v3.3.5 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}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,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;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{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-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,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}:root{--background:0 0% 100%;--foreground:0 0% 3.9%;--card:0 0% 100%;--card-foreground:0 0% 3.9%;--popover:0 0% 100%;--popover-foreground:0 0% 3.9%;--primary:0 0% 9%;--primary-foreground:0 0% 98%;--secondary:0 0% 96.1%;--secondary-foreground:0 0% 9%;--muted:0 0% 96.1%;--muted-foreground:0 0% 45.1%;--accent:0 0% 96.1%;--accent-foreground:0 0% 9%;--destructive:0 84.2% 60.2%;--destructive-foreground:0 0% 98%;--border:0 0% 89.8%;--input:0 0% 89.8%;--ring:0 0% 3.9%;--radius:0.5rem}.dark{--background:0 0% 3.9%;--foreground:0 0% 98%;--card:0 0% 3.9%;--card-foreground:0 0% 98%;--popover:0 0% 3.9%;--popover-foreground:0 0% 98%;--primary:0 0% 98%;--primary-foreground:0 0% 9%;--secondary:0 0% 14.9%;--secondary-foreground:0 0% 98%;--muted:0 0% 14.9%;--muted-foreground:0 0% 63.9%;--accent:0 0% 14.9%;--accent-foreground:0 0% 98%;--destructive:0 62.8% 30.6%;--destructive-foreground:0 0% 98%;--border:0 0% 14.9%;--input:0 0% 14.9%;--ring:0 0% 83.1%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}*,:after,:before{--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:rgba(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: }::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:rgba(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: }.container{margin-left:auto;margin-right:auto;padding-left:2rem;padding-right:2rem;width:100%}@media (min-width:1400px){.container{max-width:1400px}}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.bottom-20{bottom:5rem}.bottom-4{bottom:1rem}.left-2{left:.5rem}.left-4{left:1rem}.right-1{right:.25rem}.right-4{right:1rem}.top-1{top:.25rem}.top-1\\/2{top:50%}.isolate{isolation:isolate}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-bottom:.25rem;margin-top:.25rem}.my-2{margin-bottom:.5rem;margin-top:.5rem}.my-4{margin-bottom:1rem;margin-top:1rem}.mb-2{margin-bottom:.5rem}.mb-20{margin-bottom:5rem}.mb-4{margin-bottom:1rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-\\[-5px\\]{margin-top:-5px}.block{display:block}.inline-block{display:inline-block}.\\!inline{display:inline!important}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.hidden{display:none}.h-10{height:2.5rem}.h-2{height:.5rem}.h-3{height:.75rem}.h-3\\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\\[44px\\]{height:44px}.h-full{height:100%}.h-px{height:1px}.max-h-\\[100px\\]{max-height:100px}.min-h-\\[24px\\]{min-height:24px}.min-h-\\[36px\\]{min-height:36px}.min-h-screen{min-height:100vh}.w-1\\/4{width:25%}.w-2{width:.5rem}.w-3{width:.75rem}.w-3\\.5{width:.875rem}.w-3\\/4{width:75%}.w-32{width:8rem}.w-4{width:1rem}.w-40{width:10rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-5\\/6{width:83.333333%}.w-8{width:2rem}.w-9{width:2.25rem}.w-full{width:100%}.min-w-\\[20px\\]{min-width:20px}.min-w-\\[8rem\\]{min-width:8rem}.max-w-3xl{max-width:48rem}.max-w-\\[200px\\]{max-width:200px}.max-w-none{max-width:none}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.border-collapse{border-collapse:collapse}.-translate-y-1\\/2{--tw-translate-y:-50%}.-translate-y-1\\/2,.rotate-180{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate:180deg}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.list-outside{list-style-position:outside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(2rem*var(--tw-space-y-reverse));margin-top:calc(2rem*(1 - var(--tw-space-y-reverse)))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.divide-gray-200>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(229 231 235/var(--tw-divide-opacity))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.truncate{overflow:hidden;text-overflow:ellipsis}.truncate,.whitespace-nowrap{white-space:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-b-lg{border-bottom-left-radius:var(--radius);border-bottom-right-radius:var(--radius)}.rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-none{border-style:none}.border-black{--tw-border-opacity:1;border-color:rgb(0 0 0/var(--tw-border-opacity))}.border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}.border-input{border-color:hsl(var(--input))}.border-slate-300{--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}.border-transparent{border-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\\[\\#86efac\\]{--tw-bg-opacity:1;background-color:rgb(134 239 172/var(--tw-bg-opacity))}.bg-background{background-color:hsl(var(--background))}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity))}.bg-green-100{--tw-bg-opacity:1;background-color:rgb(220 252 231/var(--tw-bg-opacity))}.bg-muted{background-color:hsl(var(--muted))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity))}.bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-slate-200{--tw-bg-opacity:1;background-color:rgb(226 232 240/var(--tw-bg-opacity))}.bg-transparent{background-color:transparent}.bg-zinc-800\\/80{background-color:rgba(39,39,42,.8)}.bg-opacity-50{--tw-bg-opacity:0.5}.fill-current{fill:currentColor}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\\.5{padding:.125rem}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0{padding-bottom:0;padding-top:0}.py-0\\.5{padding-bottom:.125rem;padding-top:.125rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.py-20{padding-bottom:5rem;padding-top:5rem}.py-4{padding-bottom:1rem;padding-top:1rem}.pb-1{padding-bottom:.25rem}.pl-8{padding-left:2rem}.pr-2{padding-right:.5rem}.text-left{text-align:left}.text-center{text-align:center}.font-sans{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-5xl{font-size:3rem;line-height:1}.text-base{font-size:1rem;line-height:1.5rem}.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}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-light{font-weight:300}.font-medium{font-weight:500}.font-semibold{font-weight:600}.lowercase{text-transform:lowercase}.leading-normal{line-height:1.5}.tracking-widest{letter-spacing:.1em}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity))}.text-green-600{--tw-text-opacity:1;color:rgb(22 163 74/var(--tw-text-opacity))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity))}.text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity))}.text-red-600{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity))}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.shadow,.shadow-lg{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 rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.shadow-md,.shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--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(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)}.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{--tw-backdrop-blur:blur(8px);-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-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-transform{transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.animate-in{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-duration:.15s;animation-name:enter}.fade-in-0{--tw-enter-opacity:0}.zoom-in-95{--tw-enter-scale:.95}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.placeholder\\:text-sm::-moz-placeholder{font-size:.875rem;line-height:1.25rem}.placeholder\\:text-sm::placeholder{font-size:.875rem;line-height:1.25rem}.placeholder\\:text-gray-400::-moz-placeholder{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.placeholder\\:text-gray-400::placeholder{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.hover\\:scale-105:hover{--tw-scale-x:1.05;--tw-scale-y:1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:bg-\\[\\#86efac\\]\\/90:hover{background-color:rgba(134,239,172,.9)}.hover\\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\\:bg-destructive\\/90:hover{background-color:hsl(var(--destructive)/.9)}.hover\\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.hover\\:bg-gray-200:hover{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.hover\\:bg-gray-50:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity))}.hover\\:bg-green-200:hover{--tw-bg-opacity:1;background-color:rgb(187 247 208/var(--tw-bg-opacity))}.hover\\:bg-primary\\/90:hover{background-color:hsl(var(--primary)/.9)}.hover\\:bg-red-200:hover{--tw-bg-opacity:1;background-color:rgb(254 202 202/var(--tw-bg-opacity))}.hover\\:bg-secondary\\/80:hover{background-color:hsl(var(--secondary)/.8)}.hover\\:bg-zinc-700\\/50:hover{background-color:rgba(63,63,70,.5)}.hover\\:bg-opacity-50:hover{--tw-bg-opacity:0.5}.hover\\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\\:text-zinc-100:hover{--tw-text-opacity:1;color:rgb(244 244 245/var(--tw-text-opacity))}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:opacity-90:hover{opacity:.9}.focus\\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.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\\:ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:ring-1: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(1px + 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-ring:focus-visible{--tw-ring-color:hsl(var(--ring))}.focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.focus-visible\\:ring-offset-background:focus-visible{--tw-ring-offset-color:hsl(var(--background))}.active\\:scale-95:active{--tw-scale-x:.95;--tw-scale-y:.95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\\:pointer-events-none:disabled{pointer-events:none}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\\:opacity-100{opacity:1}.data-\\[disabled\\]\\:pointer-events-none[data-disabled]{pointer-events:none}.data-\\[state\\=checked\\]\\:translate-x-4[data-state=checked]{--tw-translate-x:1rem}.data-\\[state\\=checked\\]\\:translate-x-4[data-state=checked],.data-\\[state\\=unchecked\\]\\:translate-x-0[data-state=unchecked]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[state\\=unchecked\\]\\:translate-x-0[data-state=unchecked]{--tw-translate-x:0px}.data-\\[state\\=checked\\]\\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\\[state\\=open\\]\\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\\[state\\=unchecked\\]\\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\\[disabled\\]\\:opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=open\\]\\:animate-in[data-state=open]{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-duration:.15s;animation-name:enter}.data-\\[state\\=closed\\]\\:animate-out[data-state=closed]{--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial;animation-duration:.15s;animation-name:exit}.data-\\[state\\=closed\\]\\:fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}:is([data-mode=dark] .dark\\:border-white){--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity))}@media (min-width:640px){.sm\\:ml-3{margin-left:.75rem}.sm\\:block{display:block}.sm\\:h-5{height:1.25rem}.sm\\:h-9{height:2.25rem}.sm\\:h-\\[52px\\]{height:52px}.sm\\:w-5{width:1.25rem}.sm\\:w-9{width:2.25rem}.sm\\:gap-3{gap:.75rem}.sm\\:text-base{font-size:1rem;line-height:1.5rem}.sm\\:placeholder\\:text-base::-moz-placeholder{font-size:1rem;line-height:1.5rem}.sm\\:placeholder\\:text-base::placeholder{font-size:1rem;line-height:1.5rem}}.\\[\\&\\>svg\\]\\:shrink-0>svg{flex-shrink:0}.\\[\\&_svg\\]\\:pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:shrink-0 svg{flex-shrink:0}'),"function"==typeof SuppressedError&&SuppressedError;var K=e.forwardRef(((t,r)=>{const{children:a,...o}=t,n=e.Children.toArray(a),i=n.find(te);if(i){const t=i.props.children,a=n.map((r=>r===i?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:r));return R(G,{...o,ref:r,children:e.isValidElement(t)?e.cloneElement(t,void 0,a):null})}return R(G,{...o,ref:r,children:a})}));K.displayName="Slot";var G=e.forwardRef(((t,r)=>{const{children:a,...o}=t;if(e.isValidElement(a)){const t=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(a);return e.cloneElement(a,{...re(o,a.props),ref:r?J(r,t):t})}return e.Children.count(a)>1?e.Children.only(null):null}));G.displayName="SlotClone";var ee=({children:e})=>R(L,{children:e});function te(t){return e.isValidElement(t)&&t.type===ee}function re(e,t){const r={...t};for(const a in t){const o=e[a],n=t[a];/^on[A-Z]/.test(a)?o&&n?r[a]=(...e)=>{n(...e),o(...e)}:o&&(r[a]=o):"style"===a?r[a]={...o,...n}:"className"===a&&(r[a]=[o,n].filter(Boolean).join(" "))}return{...e,...r}}function ae(...e){return A($(e))}function oe(e){const t={en:[/i(?:\s|['\u2018\u2019])?m(?:\s+really)?\s+not\s+sure/i,/i(?:\s+am)?(?:\s+really)?\s+not\s+sure/i,/i\s+don(?:['\u2018\u2019])?t\s+know/i,/it(?:['\u2018\u2019]s| is) unclear/i,/cannot determine/i,/hard to say/i,/difficult to determine/i,/need more information/i],es:[/no (?:lo )?sé/i,/no estoy seguro/i,/no es claro/i,/desconocido/i],fr:[/je ne sais pas/i,/je ne suis pas sûr/i,/ce n'est pas clair/i,/inconnu/i],de:[/ich weiß nicht/i,/ich bin nicht sicher/i,/es ist unklar/i,/unbekannt/i],it:[/non lo so/i,/non sono sicuro/i,/non è chiaro/i,/sconosciuto/i],pt:[/não sei/i,/não tenho certeza/i,/não está claro/i,/desconhecido/i],nl:[/ik weet het niet/i,/ik weet niet zeker/i,/het is onduidelijk/i,/onbekend/i],pl:[/nie wiem/i,/nie jestem pewien/i,/to nie jest jasne/i,/nieznany/i],ru:[/я не знаю/i,/я не уверен/i,/это не ясно/i,/неизвестно/i],ja:[/知りません/i,/よくわからない/i,/不明です/i,/未知/i],ko:[/모릅니다/i,/잘 모르겠습니다/i,/불확실합니다/i,/알 수 없음/i],zh:[/我不知道/i,/我不确定/i,/不清楚/i,/未知/i],"zh-TW":[/我不知道/i,/我不確定/i,/不清楚/i,/未知/i]};let r=null;for(const[a,o]of Object.entries(t))for(const t of o){const o=e.match(t);o&&(null===r||o.index<r.index)&&(r={index:o.index,language:a})}return r?{uncertain:!0,language:r.language}:{uncertain:!1,language:null}}const ne=T("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ie=e.forwardRef(((t,r)=>{var{className:a,variant:o,size:n,asChild:i=!1}=t,s=Y(t,["className","variant","size","asChild"]);const l=i?K:"button";return e.createElement(l,Object.assign({className:ae(ne({variant:o,size:n,className:a})),ref:r},s))}));ie.displayName="Button";const se=F.Root,le=F.Trigger;e.forwardRef(((t,r)=>{var{className:a,inset:o,children:n}=t,i=Y(t,["className","inset","children"]);return e.createElement(F.SubTrigger,Object.assign({ref:r,className:ae("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",o&&"pl-8",a)},i),n,e.createElement(P,{className:"ml-auto"}))})).displayName=F.SubTrigger.displayName;e.forwardRef(((t,r)=>{var{className:a}=t,o=Y(t,["className"]);return e.createElement(F.SubContent,Object.assign({ref:r,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a)},o))})).displayName=F.SubContent.displayName;const ce=e.forwardRef(((t,r)=>{var{className:a,sideOffset:o=4}=t,n=Y(t,["className","sideOffset"]);return e.createElement(F.Portal,null,e.createElement(F.Content,Object.assign({ref:r,sideOffset:o,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a)},n)))}));ce.displayName=F.Content.displayName;const de=e.forwardRef(((t,r)=>{var{className:a,inset:o}=t,n=Y(t,["className","inset"]);return e.createElement(F.Item,Object.assign({ref:r,className:ae("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",o&&"pl-8",a)},n))}));de.displayName=F.Item.displayName;e.forwardRef(((t,r)=>{var{className:a,children:o,checked:n}=t,i=Y(t,["className","children","checked"]);return e.createElement(F.CheckboxItem,Object.assign({ref:r,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),checked:n},i),e.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},e.createElement(F.ItemIndicator,null,e.createElement(Q,{className:"h-4 w-4"}))),o)})).displayName=F.CheckboxItem.displayName;e.forwardRef(((t,r)=>{var{className:a,children:o}=t,n=Y(t,["className","children"]);return e.createElement(F.RadioItem,Object.assign({ref:r,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a)},n),e.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},e.createElement(F.ItemIndicator,null,e.createElement(_,{className:"h-2 w-2 fill-current"}))),o)})).displayName=F.RadioItem.displayName;e.forwardRef(((t,r)=>{var{className:a,inset:o}=t,n=Y(t,["className","inset"]);return e.createElement(F.Label,Object.assign({ref:r,className:ae("px-2 py-1.5 text-sm font-semibold",o&&"pl-8",a)},n))})).displayName=F.Label.displayName;e.forwardRef(((t,r)=>{var{className:a}=t,o=Y(t,["className"]);return e.createElement(F.Separator,Object.assign({ref:r,className:ae("-mx-1 my-1 h-px bg-muted",a)},o))})).displayName=F.Separator.displayName;const me=M.Provider,pe=M.Root,ue=M.Trigger,ge=e.forwardRef(((t,r)=>{var{className:a,sideOffset:o=4}=t,n=Y(t,["className","sideOffset"]);return e.createElement(M.Portal,null,e.createElement(M.Content,Object.assign({ref:r,sideOffset:o,className:ae("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a)},n)))}));function he({suggestions:e,onQuestionClick:r,borderColor:a,title:o="Suggested questions"}){return e&&0!==e.length?t.createElement("div",{className:"w-full"},t.createElement("h3",{className:"text-base font-medium mb-4 text-gray-900"},o),t.createElement("div",{className:"flex flex-wrap gap-2"},e.map((e=>t.createElement("button",{key:e.id,onClick:()=>r(e),className:"px-4 py-2 rounded-lg border border-gray-300 text-gray-700 hover:bg-gray-50 transition-colors duration-200 text-sm flex items-center gap-2",style:{borderColor:a}},void 0!==e.messageCount&&t.createElement(me,null,t.createElement(pe,null,t.createElement(ue,{asChild:!0},t.createElement("span",{className:"bg-gray-100 text-gray-600 px-2 py-0.5 rounded-full text-xs min-w-[20px] border flex items-center justify-center",style:{borderColor:a}},e.messageCount)),t.createElement(ge,null,t.createElement("p",null,e.messageCount," messages in this conversation")))),t.createElement("span",null,e.question)))))):null}ge.displayName=M.Content.displayName;const fe={javascript:".js",python:".py",java:".java",c:".c",cpp:".cpp","c++":".cpp","c#":".cs",ruby:".rb",php:".php",swift:".swift","objective-c":".m",kotlin:".kt",typescript:".ts",go:".go",perl:".pl",rust:".rs",scala:".scala",haskell:".hs",lua:".lua",shell:".sh",sql:".sql",html:".html",css:".css"},we=B,be=r((({language:e,value:r})=>{const[o,n]=a(!1);return t.createElement("div",{className:"relative font-sans text-sm mt-1"},t.createElement("div",{className:"relative rounded-t-lg bg-zinc-800/80 font-sans text-sm backdrop-blur"},t.createElement("div",{className:"flex h-8 items-center justify-between px-3"},t.createElement("span",{className:"text-xs font-medium text-zinc-400"},e),t.createElement("div",{className:"flex gap-1"},t.createElement(ie,{variant:"ghost",size:"icon",className:"size-5 text-zinc-400 hover:bg-zinc-700/50 hover:text-zinc-100",onClick:()=>{V(void 0,void 0,void 0,(function*(){if(navigator.clipboard&&navigator.clipboard.writeText)try{yield navigator.clipboard.writeText(r),n(!0),setTimeout((()=>{n(!1)}),2e3)}catch(e){console.error("Failed to copy:",e)}}))}},o?t.createElement(l,{size:18}):t.createElement(c,{size:18})),t.createElement(ie,{variant:"ghost",size:"icon",className:"size-5 text-zinc-400 hover:bg-zinc-700/50 hover:text-zinc-100",onClick:()=>{const t=fe[e]||".file",a=`file-${((e,t=!1)=>{const r="ABCDEFGHJKLMNPQRSTUVWXY3456789";let a="";for(let t=0;t<e;t+=1)a+=r.charAt(Math.floor(30*Math.random()));return t?a.toLowerCase():a})(3,!0)}${t}`,o=new Blob([r],{type:"text/plain"}),n=URL.createObjectURL(o),i=document.createElement("a");i.download=a,i.href=n,i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(n)}},t.createElement(d,{size:18}))))),t.createElement("div",{className:"rounded-b-lg"},t.createElement(we,{language:e,style:W,PreTag:"div",wrapLongLines:!0,customStyle:{margin:0,borderTopLeftRadius:0,borderTopRightRadius:0}},r)))}));be.displayName="CodeBlock";const ye=e.forwardRef((({src:t,border:r,width:a="100%",height:o="400px",title:n},i)=>{const[s,l]=e.useState(!1);return e.useEffect((()=>{let e=!0;return setTimeout((()=>{e&&l(!0)}),0),()=>{e=!1}}),[]),e.createElement("div",{className:"overflow-hidden rounded-lg mt-4 "+(r?"border":""),style:{width:a,height:o}},s&&e.createElement(e.Fragment,null,e.createElement("iframe",{ref:i,src:t,sandbox:"allow-same-origin allow-scripts allow-popups allow-forms allow-downloads",width:a,height:o,frameBorder:"0",title:"embed",loading:"lazy",allowFullScreen:!0,className:"block rounded-lg"}),n&&e.createElement("span",{className:"block text-center text-sm font-medium"},n)))}));function ve(t){const r=t.attrs.href.replace("share","embed");return e.createElement(ye,Object.assign({},t,{src:r,title:"Loom Embed"}))}function xe(t){return e.createElement(ye,Object.assign({},t,{src:t.attrs.href,title:"Supademo Embed"}))}function ke(t){return e.createElement(ye,Object.assign({},t,{src:t.attrs.href,title:"Typeform Embed"}))}function Ee(t){const r=t.attrs.href.match(/(http|https)?:\/\/(www\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|)(\d+)(?:\/|\?)?([\d\w]+)?/);if(!r)return null;const a=r[4],o=r[5],n=`https://player.vimeo.com/video/${a}?byline=0${o?`&h=${o}`:""}`;return e.createElement(ye,Object.assign({},t,{src:n,title:`Vimeo Embed (${a})`,height:"412px",border:!1}))}function Ne(t){const r=(e=>{const t=[/^https?:\/\/([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)\/?$/,/^https?:\/\/fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)\/?$/,/^fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)\/?$/,/^([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)\/?$/];for(const r of t){const t=e.match(r);if(t)return t}return null})(t.attrs.href);if(!r)return null;const a=r[1],o=r[2]||r[1],n=a?`https://${a}.wistia.com/embed/iframe/${o}?seo=true&videoFoam=false`:`https://fast.wistia.com/embed/iframe/${o}`;return e.createElement(ye,Object.assign({},t,{src:n,border:!0,title:`Wistia Embed (${o})`}))}function je(t){const r=(e=>{const t=e.match(/(?:https?:\/\/)?(?:www\.)?youtu\.?be(?:\.com)?\/?.*(?:watch|embed)?(?:.*v=|v\/|\/)([a-zA-Z0-9_-]{11})$/i);return t?t[1]:null})(t.attrs.href);return r?e.createElement(ye,Object.assign({},t,{src:`https://www.youtube.com/embed/${r}?modestbranding=1`,title:`YouTube Embed (${r})`})):null}ve.isMatch=e=>/^https:\/\/(www\.)?(use)?loom\.com\/(embed|share)\/(.*)$/.test(e),xe.isMatch=e=>/^https:\/\/app\.supademo\.com\/embed\/(.*)$/.test(e),ke.isMatch=e=>/^https:\/\/([A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)\.typeform\.com\/to\/(.*)$/.test(e),Ee.isMatch=e=>/^(https?):\/\/(www\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|)?(\d+)(\/)?(?:\?.*|#.*)?$/i.test(e),Ne.isMatch=e=>[/^https?:\/\/([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i,/^https?:\/\/fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i,/^fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i,/^([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i].some((t=>t.test(e))),je.isMatch=e=>/^(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|embed\/|v\/|shorts\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})(?:\/|[?&].*)?$/i.test(e);const ze=[ve,xe,ke,je,Ne,Ee],Ce=t=>{const{href:r}=t.attrs,[n,i]=a(null);if(o((()=>{let e=!0;return(()=>{try{const a=ze.find((e=>e.isMatch(r)));a&&e&&i({Component:a,props:t})}catch(e){console.error("Error finding embed match:",e)}})(),()=>{e=!1}}),[r,t]),n){const{Component:t,props:r}=n;return e.createElement(t,Object.assign({},r))}return null},Se=r(Z,((e,t)=>e.children===t.children)),Oe={startOnLoad:!1,theme:"default",securityLevel:"loose",fontFamily:"inherit"},Ie=({content:e})=>{const[r,i]=a(""),[s,l]=a(null),c=n(null),[d,m]=a(!1);return o((()=>{(()=>{try{D.initialize(Oe),m(!0)}catch(e){console.error("Error initializing mermaid:",e),l("Failed to initialize diagram renderer")}})()}),[]),o((()=>{if(!d)return;V(void 0,void 0,void 0,(function*(){try{const t=`mermaid-${Math.random().toString(36).substr(2,9)}`,r=yield D.render(t,e);i(r.svg),l(null)}catch(e){console.error("Error rendering mermaid diagram:",e),l("Failed to render diagram")}}))}),[e,d]),s?t.createElement("div",{className:"text-red-500 bg-red-50 p-4 rounded-md"},s,t.createElement("pre",{className:"mt-2 text-sm"},e)):t.createElement("div",{ref:c,className:"my-4 overflow-auto",dangerouslySetInnerHTML:{__html:r}})},Re=r((({message:e,isStreaming:r})=>{const[n,i]=a(e.content);o((()=>{var t;const r=oe(e.content);console.log("Content:",e.content),console.log("Uncertainty check result:",r),r.uncertain&&r.language&&(null===(t=e.uncertaintyFallbackText)||void 0===t?void 0:t[r.language])?i(e.uncertaintyFallbackText[r.language]):i(e.content)}),[e.content,e.uncertaintyFallbackText,r]);const s=n.replace(/^\n+|(\n+|\\)+$/g,"");return t.createElement(Se,{className:"dark:prose-invert prose flex-1",remarkPlugins:[q],rehypePlugins:[U],components:{code:e=>{var{inline:r,className:a,children:o}=e,n=Y(e,["inline","className","children"]);const i=/language-(\w+)/.exec(a||""),s=i&&i[1];return r||"mermaid"!==s&&"mermaidjs"!==s?!r&&s?t.createElement(be,Object.assign({key:Math.random(),language:s,value:String(o).replace(/\n$/,"")},n)):t.createElement("code",Object.assign({className:`text-red-400 bg-slate-200 border-slate-300 border rounded p-0.5 ${a}`.trim()},n),o):t.createElement(Ie,{content:String(o).replace(/\n$/,"")})},marker:({children:e})=>t.createElement("div",{className:"my-2"},t.createElement("span",{className:"highlight"},e)),table:({children:e})=>t.createElement("table",{className:"border-collapse border border-black px-3 py-1 dark:border-white"},e),th:({children:e})=>t.createElement("th",{className:"break-words border border-black bg-gray-500 px-3 py-1 text-white dark:border-white"},e),td:({children:e})=>t.createElement("td",{className:"break-words border border-black px-3 py-1 dark:border-white"},e),a(e){var{children:r}=e,a=Y(e,["children"]);if(a.href){const e=Ce({attrs:{href:a.href}});if(t.isValidElement(e))return e}return t.createElement("a",Object.assign({className:"link",target:"_blank",rel:"noopener noreferrer"},a),r)},pre:({children:e})=>t.createElement(t.Fragment,null,e),img({src:e,alt:r}){const a=Ce({attrs:{href:null!=e?e:""}});return t.isValidElement(a)?a:t.createElement("img",{src:e,alt:r,className:"w-full"})},li:e=>{var{children:r}=e,a=Y(e,["children"]);return t.createElement("li",Object.assign({className:"py-1"},a),r)},ul:({children:e})=>t.createElement("ul",{className:"ml-4 list-outside list-disc"},e),ol:({children:e})=>t.createElement("ol",{className:"ml-4 list-outside list-decimal"},e),strong:e=>{var{children:r}=e,a=Y(e,["children"]);return t.createElement("span",Object.assign({className:"font-semibold"},a),r)},h1:e=>{var{children:r}=e,a=Y(e,["children"]);return t.createElement("h1",Object.assign({className:"mb-2 mt-6 text-3xl font-semibold"},a),r)},h2:e=>{var{children:r}=e,a=Y(e,["children"]);return t.createElement("h2",Object.assign({className:"mb-2 mt-6 text-2xl font-semibold"},a),r)},h3:e=>{var{children:r}=e,a=Y(e,["children"]);return t.createElement("h3",Object.assign({className:"mb-2 mt-6 text-xl font-semibold"},a),r)},h4:e=>{var{children:r}=e,a=Y(e,["children"]);return t.createElement("h4",Object.assign({className:"mb-2 mt-6 text-lg font-semibold"},a),r)},h5:e=>{var{children:r}=e,a=Y(e,["children"]);return t.createElement("h5",Object.assign({className:"mb-2 mt-6 text-base font-semibold"},a),r)},h6:e=>{var{children:r}=e,a=Y(e,["children"]);return t.createElement("h6",Object.assign({className:"mb-2 mt-6 text-sm font-semibold"},a),r)}}},s)}));Re.displayName="FormattedMessage";var Le="generating-star-module_animate-spin__AJjwz";H(".generating-star-module_animate-spin__AJjwz{animation:generating-star-module_rotate__ChndJ 2s linear infinite;transform:none;transform-box:fill-box;transform-origin:center}@keyframes generating-star-module_rotate__ChndJ{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}");const Te=({loading:e,color:r="#000"})=>t.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:"mt-[-5px] inline-block flex-shrink-0",style:{minWidth:"24px",minHeight:"24px"}},t.createElement("path",{className:e?Le:"",d:"M7.54672 16.0031L2.66234 14.2031C2.51881 14.1498 2.39502 14.0539 2.3076 13.9282C2.22019 13.8025 2.17333 13.6531 2.17333 13.5C2.17333 13.3469 2.22019 13.1975 2.3076 13.0718C2.39502 12.9461 2.51881 12.8501 2.66234 12.7969L7.54672 10.9969C7.64981 10.9589 7.74344 10.899 7.82113 10.8213C7.89882 10.7436 7.95873 10.65 7.99672 10.5469L9.79672 5.66249C9.84999 5.51896 9.94592 5.39517 10.0716 5.30775C10.1973 5.22033 10.3467 5.17348 10.4998 5.17348C10.6529 5.17348 10.8024 5.22033 10.9281 5.30775C11.0538 5.39517 11.1497 5.51896 11.203 5.66249L13.003 10.5469C13.041 10.65 13.1009 10.7436 13.1786 10.8213C13.2562 10.899 13.3499 10.9589 13.453 10.9969L18.3373 12.7969C18.4809 12.8501 18.6047 12.9461 18.6921 13.0718C18.7795 13.1975 18.8264 13.3469 18.8264 13.5C18.8264 13.6531 18.7795 13.8025 18.6921 13.9282C18.6047 14.0539 18.4809 14.1498 18.3373 14.2031L13.453 16.0031C13.3499 16.0411 13.2562 16.101 13.1786 16.1787C13.1009 16.2564 13.041 16.35 13.003 16.4531L11.203 21.3375C11.1497 21.481 11.0538 21.6048 10.9281 21.6922C10.8024 21.7796 10.6529 21.8265 10.4998 21.8265C10.3467 21.8265 10.1973 21.7796 10.0716 21.6922C9.94592 21.6048 9.84999 21.481 9.79672 21.3375L7.99672 16.4531C7.95873 16.35 7.89882 16.2564 7.82113 16.1787C7.74344 16.101 7.64981 16.0411 7.54672 16.0031Z",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",fill:e?r:"none",strokeLinejoin:"round"}),t.createElement("path",{d:"M18.7497 3.75L14.2497 3.75",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),t.createElement("path",{d:"M16.4999 6V1.5",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),t.createElement("path",{d:"M22.4999 8.25001H19.4999",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),t.createElement("path",{d:"M20.9998 9.75002V6.75002",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}));function $e({answer:e,question:r,theme:o,searchResults:n,isStreaming:i=!1,searchQueryId:s,feedback:l,onFeedback:c,disableFeedback:d=!1,textConfig:b={},isLoading:y=!1,isSearchLoading:v=!1}){const[x,k]=a(!1),[E,N]=a(!1),j=()=>V(this,void 0,void 0,(function*(){try{yield navigator.clipboard.writeText(e),k(!0),setTimeout((()=>k(!1)),2e3)}catch(e){console.error("Failed to copy text:",e)}})),z=e=>{c&&s&&c(e)};return t.createElement("div",{className:"rounded-lg p-6 relative",style:{backgroundColor:o.cardBackground,borderColor:o.border,borderWidth:"1px",borderStyle:"solid"}},t.createElement("div",{className:"flex items-start justify-between"},t.createElement("div",{className:"flex items-center gap-2 mb-4"},t.createElement("div",{className:"mt-1"},t.createElement(Te,{loading:y||i,color:o.primary})),t.createElement("h2",{className:"text-xl leading-normal",style:{color:o.text}},r)),e&&t.createElement(me,null,t.createElement(pe,null,t.createElement(ue,{asChild:!0},t.createElement("button",{onClick:()=>{j()},className:"flex items-center justify-center w-8 h-8 rounded-md hover:bg-gray-100 transition-colors duration-200"},x?t.createElement(m,{className:"h-4 w-4 text-green-500"}):t.createElement(p,{className:"h-4 w-4 text-gray-500"}))),t.createElement(ge,null,t.createElement("p",null,x?"Copied!":"Copy"))))),y?t.createElement("div",{className:"space-y-4"},t.createElement("div",{className:"flex items-center gap-2"},t.createElement("div",{className:"animate-pulse h-5 rounded-full w-5",style:{backgroundColor:`${o.primary}30`}}),t.createElement("div",{className:"flex items-center gap-2 text-sm",style:{color:o.text}},v?b.loadingSearchText:b.loadingAnswerText)),t.createElement("div",{className:"space-y-3"},t.createElement("div",{className:"animate-pulse h-4 bg-gray-200 rounded w-3/4",style:{backgroundColor:`${o.border}40`}}),t.createElement("div",{className:"animate-pulse h-4 bg-gray-200 rounded w-full",style:{backgroundColor:`${o.border}40`}}),t.createElement("div",{className:"animate-pulse h-4 bg-gray-200 rounded w-5/6",style:{backgroundColor:`${o.border}40`}})),t.createElement("div",{className:"mt-6 space-y-3"},t.createElement("div",{className:"animate-pulse h-4 bg-gray-200 rounded w-1/4",style:{backgroundColor:`${o.border}40`}}),t.createElement("div",{className:"flex gap-2"},t.createElement("div",{className:"animate-pulse h-8 bg-gray-200 rounded w-32",style:{backgroundColor:`${o.border}40`}}),t.createElement("div",{className:"animate-pulse h-8 bg-gray-200 rounded w-40",style:{backgroundColor:`${o.border}40`}})))):e&&t.createElement("div",{className:"prose prose-sm max-w-none",style:{color:o.text}},t.createElement(Re,{message:{content:e,theme:{primary:o.primary,text:o.text},uncertaintyFallbackText:b.uncertaintyFallbackText},isStreaming:i})),e&&!i&&!d&&t.createElement("div",{className:"mt-2 flex justify-end gap-2"},t.createElement(me,null,t.createElement(pe,null,t.createElement(ue,{asChild:!0},t.createElement(ie,{variant:"ghost",size:"sm",className:"rounded-md h-8 w-8 flex items-center justify-center transition-all duration-200 transform hover:scale-105 active:scale-95 "+("accept"===l?"bg-green-100 text-green-600 hover:bg-green-200":""),onClick:()=>z("accept"),disabled:Boolean(l)},t.createElement(O.div,{initial:{scale:1},animate:{scale:"accept"===l?[1,1.2,1]:1},transition:{duration:.3}},t.createElement(u,{className:"h-4 w-4"})))),t.createElement(ge,null,t.createElement("p",null,b.positiveAnswerText||"Helpful")))),t.createElement(me,null,t.createElement(pe,null,t.createElement(ue,{asChild:!0},t.createElement(ie,{variant:"ghost",size:"sm",className:"rounded-md h-8 w-8 flex items-center justify-center transition-all duration-200 transform hover:scale-105 active:scale-95 "+("reject"===l?"bg-red-100 text-red-600 hover:bg-red-200":""),onClick:()=>z("reject"),disabled:Boolean(l)},t.createElement(O.div,{initial:{scale:1},animate:{scale:"reject"===l?[1,1.2,1]:1},transition:{duration:.3}},t.createElement(g,{className:"h-4 w-4"})))),t.createElement(ge,null,t.createElement("p",null,b.negativeAnswerText||"Not helpful"))))),n&&n.length>0&&t.createElement("div",{className:"mt-6 rounded-lg overflow-hidden",style:{backgroundColor:o.surface,borderWidth:"1px",borderStyle:"solid",borderColor:o.border}},t.createElement("button",{onClick:()=>N(!E),className:"w-full flex items-center justify-between p-3 transition-all duration-200 hover:bg-opacity-50",style:{color:o.text,borderBottom:E?`1px solid ${o.surfaceBorder}`:"none"}},t.createElement("div",{className:"flex items-center gap-2"},t.createElement(h,{className:"h-4 w-4 flex-shrink-0",style:{color:o.primary}}),t.createElement("span",{className:"font-medium truncate"},`Related Sources (${n.length})`)),t.createElement(f,{className:"h-4 w-4 flex-shrink-0 transition-transform duration-200 "+(E?"rotate-180":""),style:{color:o.text}})),t.createElement("div",{className:"overflow-hidden transition-all duration-200 ease-in-out",style:{maxHeight:E?48*n.length+"px":"0",opacity:E?1:0,transform:`translateY(${E?"0":"-10px"})`}},t.createElement("div",{className:"divide-y divide-gray-200"},n.map((e=>t.createElement("a",{key:e.id,href:e.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 transition-colors duration-200 hover:bg-gray-50",style:{color:o.text,backgroundColor:o.surface}},t.createElement("span",{className:"flex-grow truncate"},e.title),t.createElement(w,{className:"h-4 w-4 flex-shrink-0",style:{color:`${o.text}60`}}))))))))}function Ae({questions:e,onQuestionClick:r,theme:a}){return e.length?t.createElement(O.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"w-full"},t.createElement("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:a.surface,borderWidth:"1px",borderStyle:"solid",borderColor:a.border}},t.createElement("div",{className:"p-3 border-b",style:{borderColor:a.surfaceBorder}},t.createElement("div",{className:"flex items-center gap-2"},t.createElement(b,{className:"h-4 w-4 flex-shrink-0",style:{color:a.primary}}),t.createElement("span",{className:"font-medium"},"Follow-up Questions"))),t.createElement("div",{className:"divide-y divide-gray-200"},e.map(((e,o)=>t.createElement(O.button,{key:o,initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:.1*o},onClick:()=>r(e),className:"w-full flex items-center gap-2 p-3 transition-colors duration-200 hover:bg-gray-50 text-left",style:{color:a.text,backgroundColor:a.surface}},t.createElement("span",{className:"flex-grow"},e),t.createElement(y,{className:"h-4 w-4 flex-shrink-0",style:{color:`${a.text}60`}}))))))):null}function Fe({questions:e,activeIndex:r,onNavigate:n,theme:i,offset:s}){const[l,c]=a(r);o((()=>{c(r)}),[r]);const d=e.length,m=(()=>{const e=[];let t=null;const a=r=>{null!==t&&r-t>1&&e.push("ellipsis"),e.push(r),t=r};a(0);for(let e=Math.max(1,r-2);e<=Math.min(d-2,r+2);e++)a(e);return d>1&&a(d-1),e})();return t.createElement("nav",{"aria-label":"Question timeline navigation",className:"fixed left-4 top-1/2 -translate-y-1/2 z-40 flex flex-col gap-3",style:Object.assign({},s?{left:`${s}px`}:{})},t.createElement(O.div,{className:"flex flex-col items-center space-y-3",role:"list",initial:!1,animate:{y:0},transition:{type:"spring",stiffness:300,damping:30}},t.createElement(I,{mode:"wait"},m.map(((a,o)=>{if("ellipsis"===a)return t.createElement(O.div,{key:`ellipsis-${o}`,className:"h-8 flex items-center justify-center","aria-hidden":"true",initial:{opacity:0,y:l>r?-20:20},animate:{opacity:1,y:0},exit:{opacity:0,y:l>r?20:-20},transition:{duration:.2}},t.createElement(v,{className:"w-4 h-4",style:{color:i.text}}));const s=a,c=e[s];return t.createElement(O.div,{key:s,className:"relative group isolate",role:"listitem",initial:{opacity:0,y:l>r?-20:20},animate:{opacity:1,y:0},exit:{opacity:0,y:l>r?20:-20},transition:{duration:.2},layout:!0},t.createElement(me,null,t.createElement(pe,null,t.createElement(ue,{asChild:!0},t.createElement("button",{onClick:()=>n(s),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||n(s)},className:"flex items-center justify-center w-8 h-8 rounded-full transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 hover:opacity-90",style:{backgroundColor:s===r?i.primary:"#ccc",color:s===r?i.background:"#333",cursor:"pointer","--tw-ring-color":i.primary},"aria-label":`Navigate to question ${s+1}: ${c}`,"aria-current":s===r?"step":void 0},s+1)),t.createElement(ge,{side:"right",sideOffset:8},t.createElement("p",{className:"max-w-[200px] break-words"},c)))))})))))}function Pe({onClick:e,theme:r}){return t.createElement(ie,{className:"fixed bottom-20 right-4 rounded-full p-2 transition-opacity duration-300",style:{backgroundColor:r.background,borderColor:r.border,borderWidth:"1px",borderStyle:"solid",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"},onClick:e},t.createElement(x,{className:"h-5 w-5",style:{color:r.text}}))}const Qe={maxRetries:3,baseDelay:1e3,shouldRetry:e=>{if(e instanceof TypeError)return!0;const t=e;return!!t.status&&t.status>=500}};let _e=Object.assign({},Qe),Me=Object.assign({},{emptyResponse:"I apologize, but I couldn't generate an answer at this time. Please try again.",errorResponse:"I encountered an error while processing your request. Please try again."});function Ue(e){return V(this,void 0,void 0,(function*(){return new Promise((t=>setTimeout(t,e)))}))}function qe(e,t={}){return V(this,void 0,void 0,(function*(){const{retry:r={},headers:a={},body:o,isStream:n=!1,fallback:i={}}=t,s=Y(t,["retry","headers","body","isStream","fallback"]),l=Object.assign(Object.assign({},_e),r),c=Object.assign(Object.assign({},Me),i);let d=1;for(;;)try{const t=yield fetch(e,Object.assign(Object.assign({},s),{headers:Object.assign({"Content-Type":"application/json"},a),body:o?JSON.stringify(o):void 0}));if(t.ok){if(n){const e=t.clone();if(!(yield e.text()).trim()){const e=new Error(c.emptyResponse);throw e.name="EmptyResponseError",e}return t}const e=yield t.json();if(!e||"object"==typeof e&&0===Object.keys(e).length){const e=new Error(c.emptyResponse);throw e.name="EmptyResponseError",e}return e}const r=new Error(c.errorResponse);throw r.status=t.status,r.data=yield t.json().catch((()=>{})),r}catch(e){const t=yield Promise.resolve(l.shouldRetry(e,d));if(d>=l.maxRetries||!t){if(e instanceof Error&&"EmptyResponseError"===e.name)return{message:e.message};throw e}console.warn(`Request failed, attempt ${d} of ${l.maxRetries}. Retrying...`);const r=.3*Math.random()+.85;yield Ue(l.baseDelay*Math.pow(2,d-1)*r),d++}}))}const Be={maxRetries:3,baseDelay:300,shouldRetry:e=>{if(e instanceof TypeError)return!0;const t=e;return!!t.status&&(t.status>=500||429===t.status)}},We={maxRetries:3,baseDelay:500,shouldRetry:e=>{if(e instanceof TypeError)return!0;const t=e;return!!t.status&&t.status>=500}};function Ze({endpoint:e,query:t,collectionId:r,headers:a,conversationId:o}){var n;return V(this,void 0,void 0,(function*(){const i=yield qe(e,{method:"POST",headers:a,retry:Be,body:Object.assign(Object.assign({query:t,limit:5},r&&"all"!==r&&{collectionId:r}),o&&{conversationId:o})});return{results:null==i?void 0:i.data,searchQueryId:null===(n=null==i?void 0:i.searchQuery)||void 0===n?void 0:n.id}}))}function De({endpoint:e,searchQueryId:t,headers:r,conversationId:a}){return V(this,void 0,void 0,(function*(){return qe(e,{method:"POST",headers:r,retry:We,isStream:!0,fallback:{emptyResponse:"I apologize, but I couldn't generate an answer for your query. Please try rephrasing your question.",errorResponse:"I encountered an issue while generating the answer. Please try again in a moment."},body:Object.assign({searchQueryId:t},a&&{conversationId:a})})}))}function He(){return`bf-conversation-${Date.now()}-${"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}`}function Ye({endpoint:e,conversationId:t,headers:r}){return V(this,void 0,void 0,(function*(){return{data:(yield qe(e,{method:"POST",headers:r,body:{conversationId:t}})).data.map((e=>Object.assign(Object.assign({},e),{feedback:e.feedback?"positive"===e.feedback?"accept":"reject":void 0})))}}))}const Ve={primary:"#A3E635",accent:"#f9fafb",background:"white",text:"#171717",border:"#171717",hover:"#171717",surface:"#F9FAFB",surfaceBorder:"#E5E7EB",surfaceHover:"#F3F4F6",cardBackground:"white"},Xe={headerText:"How can we help you today?",searchPlaceholder:"Ask a question or type a search term here ...",attachImageText:"Attach image",allDocumentsText:"All documents",loadingSearchText:"Searching for relevant content...",loadingAnswerText:"Crafting a response...",errorText:"Sorry, there was an error generating the answer.",followUpPlaceholder:"Ask follow-up",positiveAnswerText:"Helpful",negativeAnswerText:"Not helpful",uncertaintyFallbackText:{en:"Sorry, I can't find a clear answer to your question. Please try rephrasing or check the related sources below.",es:"Lo siento, no puedo encontrar una respuesta clara. Intente reformular la pregunta o consulte las fuentes relacionadas.",fr:"Désolé, je ne trouve pas de réponse claire. Essayez de reformuler ou consultez les sources connexes.",de:"Entschuldigung, ich finde keine klare Antwort. Versuchen Sie es anders zu formulieren oder sehen Sie sich die verwandten Quellen an.",it:"Mi dispiace, non trovo una risposta chiara. Prova a riformulare o consulta le fonti correlate.",pt:"Desculpe, não encontro uma resposta clara. Tente reformular ou consulte as fontes relacionadas.",nl:"Sorry, ik kan geen duidelijk antwoord vinden. Probeer het anders te formuleren of bekijk de gerelateerde bronnen.",pl:"Przepraszam, nie znajduję jasnej odpowiedzi. Spróbuj przeformułować pytanie lub sprawdź powiązane źródła.",ru:"Извините, я не могу найти четкого ответа. Попробуйте переформулировать или ознакомьтесь со связанными источниками.",ja:"申し訳ありませんが、明確な回答が見つかりません。質問の言い換えや、関連ソースをご確認ください。",ko:"죄송합니다. 명확한 답변을 찾을 수 없습니다. 질문을 다시 작성하거나 관련 소스를 확인해 주세요.",zh:"抱歉,找不到明确的答案。请尝试重新表述或查看相关来源。","zh-TW":"抱歉,找不到明確的答案。請嘗試重新表述或查看相關來源。"}},Je=i((({suggestions:e,theme:r={},collections:i=[],selectedCollectionId:l,onCollectionChange:c,searchEndpoint:d,answerEndpoint:m,feedbackEndpoint:p,loadConversationEndpoint:u,disableFollowUpQuestions:g=!1,disableImageAttachment:h=!1,disableFeedback:w=!1,siblingNode:b,offset:y=0,headers:v,textConfig:x={},followUpQuestionsEndpoint:R},L)=>{var T;const $=Object.assign(Object.assign({},Ve),r),A=Object.assign(Object.assign({},Xe),x),[F,P]=a(""),[Q,_]=a(""),[M,U]=a(!1),[q,B]=a(!1),[W,Z]=a([]),[D,H]=a(!1),[Y,X]=a(0),[J,K]=a([]),[G,ee]=a(l),[te,re]=a(!0),[ae,ne]=a(""),[me,pe]=a(!1),[ue,ge]=a(),fe=n(null),we=n(null),be=n([]),ye=n(null),ve=n(null),xe=n([]);o((()=>{const e=new URLSearchParams(window.location.search).get("conversation");if(e&&u)pe(!0),B(!0),Ye({endpoint:u,conversationId:e,headers:v}).then((t=>{Z(t.data),ne(e),B(!0)})).catch((e=>{console.error("Error loading conversation:",e),ge(A.errorText||"An error occurred"),B(!1),Z([]);const t=He();ne(t);const r=new URL(window.location.href);r.searchParams.delete("conversation"),window.history.replaceState({},"",r.toString())})).finally((()=>{pe(!1)}));else{const e=He();ne(e)}}),[u]),o((()=>{if(ae&&W.length>0){const e=new URL(window.location.href);e.searchParams.set("conversation",ae),window.history.replaceState({},"",e.toString())}}),[ae,W.length]),o((()=>{const e={showResults:q,answers:W,isLoading:me,error:ue};xe.current.forEach((t=>t(e)))}),[q,W,me,ue]),s(L,(()=>({createNewThread:()=>{P(""),_(""),B(!1),Z([]),X(0),K([]);const e=He();ne(e);const t=new URL(window.location.href);t.searchParams.delete("conversation"),window.history.replaceState({},"",t.toString()),fe.current&&(fe.current.style.height="auto")},showFollowUpThread:e=>{re(e)},subscribeToStateChanges:e=>(xe.current.push(e),e({showResults:q,answers:W,isLoading:!1,error:void 0}),()=>{xe.current=xe.current.filter((t=>t!==e))})}))),o((()=>{ee(l)}),[l]);const ke=()=>{requestAnimationFrame((()=>{const e=be.current[be.current.length-1];if(e){const t=e.getBoundingClientRect(),r=window.pageYOffset||document.documentElement.scrollTop,a=t.top+r-80;window.scrollTo({top:a,behavior:"smooth"})}}))},Ee=e=>V(void 0,void 0,void 0,(function*(){var t;const r=null===(t=e.body)||void 0===t?void 0:t.getReader();if(!r)return;Z((e=>{const t=[...e],r=t[t.length-1];return r&&(r.isLoading=!1,r.isStreaming=!0,r.searchResults=r.searchResults||[]),t}));let a="";try{let e,t;for(;({done:e,value:t}=yield r.read()),!e;){const e=(new TextDecoder).decode(t);a+=e;const{uncertain:r,language:o}=oe(a);Z((e=>{var t;const n=[...e],i=n[n.length-1];return i&&(i.answer=a,i.isLoading=!1,i.isStreaming=!0,i.searchResults=i.searchResults||[],i.isUncertain=r,i.uncertaintyLanguage=o,r&&o&&(null===(t=A.uncertaintyFallbackText)||void 0===t?void 0:t[o])&&(i.uncertaintyFallbackText=A.uncertaintyFallbackText[o])),n}))}}catch(e){console.error("Error streaming answer:",e)}finally{Z((e=>{const t=[...e],r=t[t.length-1];return r&&(r.isStreaming=!1,r.isLoading=!1,R&&!g&&r.searchQueryId&&V(void 0,void 0,void 0,(function*(){try{const e=yield function({endpoint:e,searchQueryId:t,headers:r,conversationId:a}){return V(this,void 0,void 0,(function*(){return(yield qe(e,{method:"POST",headers:r,body:Object.assign({searchQueryId:t},a&&{conversationId:a})})).questions}))}({endpoint:R,searchQueryId:r.searchQueryId,headers:v,conversationId:ae});Z((t=>{const r=[...t],a=r[r.length-1];return a&&(a.followUpQuestions=e),r}))}catch(e){console.error("Error fetching follow-up questions:",e)}}))),t})),r.releaseLock()}})),Ne=(e,t,r)=>V(void 0,void 0,void 0,(function*(){if(p){Z((t=>{const a=[...t];return a[r]&&(a[r]=Object.assign(Object.assign({},a[r]),{feedback:e})),a}));try{yield function({endpoint:e,searchQueryId:t,response:r,headers:a,conversationId:o}){return V(this,void 0,void 0,(function*(){yield qe(e,{method:"POST",headers:a,body:Object.assign({searchQueryId:t,response:r},o&&{conversationId:o})})}))}({endpoint:p,searchQueryId:t,response:e,headers:v,conversationId:ae})}catch(e){console.error("Error sending feedback:",e),Z((e=>{const t=[...e];return t[r]&&(t[r]=Object.assign(Object.assign({},t[r]),{feedback:void 0})),t}))}}})),je=(e=F.trim())=>V(void 0,void 0,void 0,(function*(){if(e){U(!0),B(!0);const t=ae||He();ae||ne(t);const r={question:e,answer:"",isLoading:!0,isSearchLoading:!0,searchResults:[],searchQueryId:void 0,isStreaming:!1};Z((e=>[...e,r]));const a=W.length;X(a),ke(),yield Promise.resolve();try{const r=yield Ze({endpoint:d,query:e,collectionId:G,headers:v,conversationId:t});Z((e=>{const t=[...e];return t[t.length-1]&&(t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{searchResults:r.results,searchQueryId:r.searchQueryId,isSearchLoading:!1})),t}));const a=yield De({endpoint:m,searchQueryId:r.searchQueryId,headers:v,conversationId:t});yield Ee(a)}catch(e){console.error("Error generating answer:",e),Z((e=>{const t=[...e];return t[t.length-1]&&(t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{answer:A.errorText||"An error occurred",isLoading:!1,isSearchLoading:!1,isStreaming:!1})),t}))}finally{U(!1)}}})),ze=()=>V(void 0,void 0,void 0,(function*(){if(Q.trim()){const e=Q;P(e),_(""),we.current&&(we.current.style.height="auto"),yield je(e)}}));o((()=>{const e=()=>{const e=window.innerHeight+window.pageYOffset>=document.documentElement.scrollHeight-100;H(!e)};return window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)}),[]),o((()=>()=>{J.forEach((e=>URL.revokeObjectURL(e.preview)))}),[J]);o((()=>{const e=()=>{new URLSearchParams(window.location.search).get("conversation")||(P(""),_(""),B(!1),Z([]),X(0),K([]),fe.current&&(fe.current.style.height="auto"))};return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)}),[]);const Ce=e=>{je(e)};return t.createElement("div",{className:"relative min-h-screen"},t.createElement("div",{ref:ye,className:"w-full max-w-3xl mx-auto flex flex-col items-center space-y-8 px-4 py-20",style:{"--surface-border":$.surfaceBorder,"--surface-hover":$.surfaceHover}},t.createElement(I,null,me?t.createElement(O.div,{key:"loading",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"w-full flex items-center justify-center py-20"},t.createElement("div",{className:"flex flex-col items-center gap-4"},t.createElement("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-t-transparent",style:{borderColor:$.primary}}),t.createElement("p",{className:"text-sm",style:{color:$.text}},"Loading conversation..."))):q?t.createElement(O.div,{key:"results",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.5},className:"w-full space-y-4 py-4 mb-20"},W.map(((e,r)=>t.createElement(O.div,{key:r,ref:e=>be.current[r]=e,initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.1*r}},t.createElement($e,{answer:e.answer,question:e.question,theme:$,searchResults:e.searchResults,isStreaming:e.isStreaming,searchQueryId:e.searchQueryId,feedback:e.feedback,onFeedback:w||!p?void 0:t=>Ne(t,e.searchQueryId,r),disableFeedback:w||!p,textConfig:A,isLoading:e.isLoading,isSearchLoading:e.isSearchLoading}),r===W.length-1&&!g&&e.followUpQuestions&&!e.isStreaming&&t.createElement("div",{className:"mt-4"},t.createElement(Ae,{questions:e.followUpQuestions,onQuestionClick:Ce,theme:$})))))):t.createElement(O.div,{key:"search",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.5},className:"w-full space-y-8"},t.createElement("div",{className:"w-full text-center space-y-4"},t.createElement(O.h1,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.3},className:"text-5xl font-bold",style:{color:$.text}},A.headerText)),t.createElement(O.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.4}},t.createElement("div",{className:"relative w-full rounded-md overflow-hidden",style:{backgroundColor:$.background,borderColor:$.border,borderWidth:"1px",borderStyle:"solid"}},t.createElement("div",{className:"p-3 flex items-center"},t.createElement(k,{className:"h-5 w-5 text-gray-400 mr-2"}),t.createElement("textarea",{ref:fe,placeholder:A.searchPlaceholder,value:F,onChange:e=>{var t;P(e.target.value),(t=e.target).style.height="auto",t.style.height=`${t.scrollHeight}px`},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),je())},className:"w-full resize-none outline-none text-lg py-1 font-light min-h-[36px] overflow-hidden placeholder:text-gray-400 border-none bg-transparent",style:{color:$.text,outline:"none",boxShadow:"none",fontSize:"16px"},rows:1})),!h&&J.length>0&&t.createElement("div",{className:"flex gap-2 mt-3 overflow-x-auto pb-1 px-3"},J.map(((e,r)=>t.createElement("div",{key:r,className:"relative group rounded-lg overflow-hidden flex-shrink-0",style:{width:"80px",height:"80px"}},t.createElement("img",{src:e.preview,alt:`Attached ${r+1}`,className:"w-full h-full object-cover"}),t.createElement("button",{onClick:()=>(e=>{K((t=>(URL.revokeObjectURL(t[e].preview),t.filter(((t,r)=>r!==e)))))})(r),className:"absolute top-1 right-1 bg-black bg-opacity-50 rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200"},t.createElement(E,{className:"h-3 w-3 text-white"})))))),t.createElement("div",{className:"flex items-center justify-between px-3 py-2 bg-gray-100 border-t border-gray-200"},t.createElement("div",{className:"flex gap-2"},i.length>0&&t.createElement(se,null,t.createElement(le,{asChild:!0},t.createElement(ie,{variant:"ghost",size:"sm",className:"hover:bg-gray-200 transition-all duration-200 rounded-md h-8 flex items-center gap-2 text-gray-700"},G&&"all"!==G?t.createElement(N,{className:"h-5 w-5 text-green-500"}):t.createElement(j,{className:"h-5 w-5 text-gray-400"}),(null===(T=i.find((e=>e.id===G)))||void 0===T?void 0:T.name)||A.allDocumentsText,t.createElement(f,{className:"h-4 w-4 opacity-50"}))),t.createElement(ce,null,i.map((e=>t.createElement(de,{key:e.id,onClick:()=>{return t=e.id,ee(t),void(null==c||c(t));var t},className:e.id===G?"bg-gray-100":""},e.id===G?t.createElement(N,{className:"h-4 w-4 mr-2 text-green-500"}):t.createElement(j,{className:"h-4 w-4 mr-2 text-gray-400"}),e.name))))),!h&&t.createElement(t.Fragment,null,t.createElement("input",{type:"file",ref:ve,accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{const t=e.target.files;if(t){const e=Array.from(t).map((e=>({file:e,preview:URL.createObjectURL(e)})));K((t=>[...t,...e]))}ve.current&&(ve.current.value="")}}),t.createElement(ie,{variant:"ghost",size:"sm",className:"hover:bg-gray-200 rounded-md h-8 text-gray-700",onClick:()=>{var e;return null===(e=ve.current)||void 0===e?void 0:e.click()}},t.createElement(z,{className:"h-4 w-4 mr-1.5"}),A.attachImageText))),t.createElement("div",{className:"flex items-center"},t.createElement(ie,{size:"sm",disabled:!F||M,className:"rounded-md h-8 w-8 bg-[#86efac] hover:bg-[#86efac]/90 disabled:opacity-50",onClick:()=>{je()}},M?t.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-2 border-t-transparent",style:{borderColor:"white"}}):t.createElement(C,{className:"h-4 w-4 text-gray-700"})))))),t.createElement(he,{suggestions:e||[],onQuestionClick:e=>{if(e.conversationId&&u)return pe(!0),B(!0),void Ye({endpoint:u,conversationId:e.conversationId,headers:v}).then((t=>{Z(t.data),ne(e.conversationId),B(!0)})).catch((e=>{console.error("Error loading conversation:",e),ge(A.errorText||"An error occurred"),B(!1),Z([]);const t=He();ne(t);const r=new URL(window.location.href);r.searchParams.delete("conversation"),window.history.replaceState({},"",r.toString())})).finally((()=>{pe(!1)}));if(B(!0),U(!0),!ae){const e=He();ne(e)}Z((t=>[...t,{question:e.question,answer:"",isLoading:!0,isSearchLoading:!0}])),V(void 0,void 0,void 0,(function*(){try{const t=yield Ze({endpoint:d,query:e.question,collectionId:G,headers:v,conversationId:ae}),r=t.results;Z((e=>{const a=[...e];return a[a.length-1]=Object.assign(Object.assign({},a[a.length-1]),{searchResults:r,searchQueryId:t.searchQueryId,isSearchLoading:!1}),a}));const a=yield De({endpoint:m,searchQueryId:t.searchQueryId,headers:v,conversationId:ae});yield Ee(a)}catch(e){console.error("Error generating answer:",e),Z((e=>{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{answer:A.errorText||"An error occurred",isLoading:!1,isSearchLoading:!1}),t}))}finally{U(!1),ke()}}))},borderColor:$.border,title:A.suggestionsTitle}),b)),q&&W.length>1&&t.createElement("div",{className:"hidden sm:block"},t.createElement(Fe,{questions:W.map((e=>e.question)),currentIndex:M?W.length-1:Y,activeIndex:Y,onNavigate:e=>{X(e),(e=>{requestAnimationFrame((()=>{const t=be.current[e];if(t){const e=t.getBoundingClientRect(),r=window.pageYOffset||document.documentElement.scrollTop,a=e.top+r-80;window.scrollTo({top:a,behavior:"smooth"})}}))})(e)},theme:$,offset:y})),q&&te&&t.createElement(O.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},className:"fixed bottom-4 left-4 right-4 max-w-3xl mx-auto z-10",style:{left:`${y}px`}},t.createElement("div",{className:"rounded-full h-[44px] sm:h-[52px] flex items-center justify-between",style:{backgroundColor:$.background,borderColor:$.border,borderWidth:"1px",borderStyle:"solid",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",padding:"0 15px"}},t.createElement("div",{className:"flex items-center gap-2 sm:gap-3 flex-grow overflow-hidden h-full"},t.createElement(k,{className:"h-4 w-4 sm:h-5 sm:w-5 flex-shrink-0",style:{color:$.primary}}),t.createElement("div",{className:"flex-grow",style:{paddingTop:"15px",paddingBottom:"10px"}},t.createElement("textarea",{ref:we,placeholder:A.followUpPlaceholder,value:Q,onChange:e=>{_(e.target.value);e.target.style.height="auto",e.target.style.height=`${Math.min(e.target.scrollHeight,100)}px`,e.target.scrollHeight>100?e.target.style.overflowY="auto":e.target.style.overflowY="hidden"},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),ze())},disabled:M,className:"w-full bg-transparent outline-none text-sm sm:text-base resize-none overflow-hidden disabled:opacity-50 border-none min-h-[24px] max-h-[100px] placeholder:text-sm sm:placeholder:text-base",style:{color:$.text,outline:"none",boxShadow:"none",fontSize:"16px",lineHeight:"24px"},rows:1}))),t.createElement("div",{className:"flex items-center gap-2 sm:gap-3 ml-2 sm:ml-3 flex-shrink-0"},t.createElement(ie,{size:"icon",variant:"ghost",disabled:M||!Q.trim(),className:"rounded-full transition-colors duration-200 disabled:opacity-50 h-8 w-8 sm:h-9 sm:w-9 flex items-center justify-center",style:{color:$.text,backgroundColor:"transparent"},onClick:()=>{ze()}},M?t.createElement("div",{className:"animate-spin rounded-full h-4 w-4 sm:h-5 sm:w-5 border-2",style:{borderColor:`${$.text}40`,borderTopColor:$.text}}):t.createElement(S,{className:"h-4 w-4 sm:h-5 sm:w-5"}))))),D&&q&&t.createElement(Pe,{onClick:ke,theme:$})))}));Je.displayName="ChatSearch";export{Je as ChatSearch};
1
+ import*as e from"react";import t,{memo as r,useState as a,useEffect as o,useRef as n,forwardRef as i,useImperativeHandle as s}from"react";import{CheckCircle as l,Clipboard as c,Download as d,Check as m,Copy as p,ThumbsUp as u,ThumbsDown as g,FileText as h,ChevronDown as f,ExternalLink as w,HelpCircle as b,ChevronRight as y,MoreVertical as v,ArrowDown as x,Search as k,X as E,CheckCircle2 as N,Circle as z,Image as j,ArrowRight as C,ArrowUp as O}from"lucide-react";import{motion as S,AnimatePresence as I}from"framer-motion";import{jsx as R,Fragment as L}from"react/jsx-runtime";import{cva as T}from"class-variance-authority";import{clsx as $}from"clsx";import{twMerge as A}from"tailwind-merge";import*as P from"@radix-ui/react-dropdown-menu";import{ChevronRightIcon as _,CheckIcon as F,DotFilledIcon as Q}from"@radix-ui/react-icons";import*as q from"@radix-ui/react-tooltip";import M from"rehype-raw";import U from"remark-gfm";import{Prism as B}from"react-syntax-highlighter";import{a11yDark as W}from"react-syntax-highlighter/dist/cjs/styles/prism";import Z from"react-markdown";import D from"mermaid";function Y(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&a.firstChild?a.insertBefore(o,a.firstChild):a.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}function H(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(r[a[o]]=e[a[o]])}return r}function V(e,t,r,a){return new(r||(r=Promise))((function(o,n){function i(e){try{l(a.next(e))}catch(e){n(e)}}function s(e){try{l(a.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}l((a=a.apply(e,t||[])).next())}))}function X(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function J(...e){return t=>{let r=!1;const a=e.map((e=>{const a=X(e,t);return r||"function"!=typeof a||(r=!0),a}));if(r)return()=>{for(let t=0;t<a.length;t++){const r=a[t];"function"==typeof r?r():X(e[t],null)}}}}Y('*,:after,:before{--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:rgba(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:rgba(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: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}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,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height: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,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background:0 0% 100%;--foreground:0 0% 3.9%;--card:0 0% 100%;--card-foreground:0 0% 3.9%;--popover:0 0% 100%;--popover-foreground:0 0% 3.9%;--primary:0 0% 9%;--primary-foreground:0 0% 98%;--secondary:0 0% 96.1%;--secondary-foreground:0 0% 9%;--muted:0 0% 96.1%;--muted-foreground:0 0% 45.1%;--accent:0 0% 96.1%;--accent-foreground:0 0% 9%;--destructive:0 84.2% 60.2%;--destructive-foreground:0 0% 98%;--border:0 0% 89.8%;--input:0 0% 89.8%;--ring:0 0% 3.9%;--radius:0.5rem}.dark{--background:0 0% 3.9%;--foreground:0 0% 98%;--card:0 0% 3.9%;--card-foreground:0 0% 98%;--popover:0 0% 3.9%;--popover-foreground:0 0% 98%;--primary:0 0% 98%;--primary-foreground:0 0% 9%;--secondary:0 0% 14.9%;--secondary-foreground:0 0% 98%;--muted:0 0% 14.9%;--muted-foreground:0 0% 63.9%;--accent:0 0% 14.9%;--accent-foreground:0 0% 98%;--destructive:0 62.8% 30.6%;--destructive-foreground:0 0% 98%;--border:0 0% 14.9%;--input:0 0% 14.9%;--ring:0 0% 83.1%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}.container{margin-left:auto;margin-right:auto;padding-left:2rem;padding-right:2rem;width:100%}@media (min-width:1400px){.container{max-width:1400px}}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.bottom-20{bottom:5rem}.bottom-4{bottom:1rem}.left-2{left:.5rem}.left-4{left:1rem}.right-1{right:.25rem}.right-4{right:1rem}.top-1{top:.25rem}.top-1\\/2{top:50%}.isolate{isolation:isolate}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-bottom:.25rem;margin-top:.25rem}.my-2{margin-bottom:.5rem;margin-top:.5rem}.my-4{margin-bottom:1rem;margin-top:1rem}.mb-2{margin-bottom:.5rem}.mb-20{margin-bottom:5rem}.mb-4{margin-bottom:1rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-auto{margin-left:auto}.mr-1\\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-\\[-5px\\]{margin-top:-5px}.block{display:block}.inline-block{display:inline-block}.\\!inline{display:inline!important}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.hidden{display:none}.size-5{height:1.25rem;width:1.25rem}.h-10{height:2.5rem}.h-2{height:.5rem}.h-3{height:.75rem}.h-3\\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\\[44px\\]{height:44px}.h-full{height:100%}.h-px{height:1px}.max-h-\\[100px\\]{max-height:100px}.min-h-\\[24px\\]{min-height:24px}.min-h-\\[36px\\]{min-height:36px}.min-h-screen{min-height:100vh}.w-1\\/4{width:25%}.w-2{width:.5rem}.w-3{width:.75rem}.w-3\\.5{width:.875rem}.w-3\\/4{width:75%}.w-32{width:8rem}.w-4{width:1rem}.w-40{width:10rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-5\\/6{width:83.333333%}.w-8{width:2rem}.w-9{width:2.25rem}.w-full{width:100%}.min-w-\\[20px\\]{min-width:20px}.min-w-\\[8rem\\]{min-width:8rem}.max-w-3xl{max-width:48rem}.max-w-\\[200px\\]{max-width:200px}.max-w-none{max-width:none}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.border-collapse{border-collapse:collapse}.-translate-y-1\\/2{--tw-translate-y:-50%}.-translate-y-1\\/2,.rotate-180{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate:180deg}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.list-outside{list-style-position:outside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(2rem*var(--tw-space-y-reverse));margin-top:calc(2rem*(1 - var(--tw-space-y-reverse)))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.divide-gray-200>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(229 231 235/var(--tw-divide-opacity,1))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.truncate{overflow:hidden;text-overflow:ellipsis}.truncate,.whitespace-nowrap{white-space:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-b-lg{border-bottom-left-radius:var(--radius);border-bottom-right-radius:var(--radius)}.rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-none{border-style:none}.border-black{--tw-border-opacity:1;border-color:rgb(0 0 0/var(--tw-border-opacity,1))}.border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}.border-input{border-color:hsl(var(--input))}.border-slate-300{--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity,1))}.border-transparent{border-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\\[\\#86efac\\]{--tw-bg-opacity:1;background-color:rgb(134 239 172/var(--tw-bg-opacity,1))}.bg-background{background-color:hsl(var(--background))}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}.bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.bg-green-100{--tw-bg-opacity:1;background-color:rgb(220 252 231/var(--tw-bg-opacity,1))}.bg-muted{background-color:hsl(var(--muted))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity,1))}.bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity,1))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-slate-200{--tw-bg-opacity:1;background-color:rgb(226 232 240/var(--tw-bg-opacity,1))}.bg-transparent{background-color:transparent}.bg-zinc-800\\/80{background-color:rgba(39,39,42,.8)}.bg-opacity-50{--tw-bg-opacity:0.5}.fill-current{fill:currentColor}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0\\.5{padding:.125rem}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\\.5{padding-bottom:.125rem;padding-top:.125rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.py-20{padding-bottom:5rem;padding-top:5rem}.py-4{padding-bottom:1rem;padding-top:1rem}.pb-1{padding-bottom:.25rem}.pl-8{padding-left:2rem}.pr-2{padding-right:.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-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-5xl{font-size:3rem;line-height:1}.text-base{font-size:1rem;line-height:1.5rem}.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}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-light{font-weight:300}.font-medium{font-weight:500}.font-semibold{font-weight:600}.lowercase{text-transform:lowercase}.leading-normal{line-height:1.5}.tracking-widest{letter-spacing:.1em}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.text-green-600{--tw-text-opacity:1;color:rgb(22 163 74/var(--tw-text-opacity,1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.text-red-600{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity,1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.shadow,.shadow-lg{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 rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.shadow-md,.shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--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(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)}.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{--tw-backdrop-blur:blur(8px);-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-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-transform{transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.animate-in{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-duration:.15s;animation-name:enter}.fade-in-0{--tw-enter-opacity:0}.zoom-in-95{--tw-enter-scale:.95}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.placeholder\\:text-sm::-moz-placeholder{font-size:.875rem;line-height:1.25rem}.placeholder\\:text-sm::placeholder{font-size:.875rem;line-height:1.25rem}.placeholder\\:text-gray-400::-moz-placeholder{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.placeholder\\:text-gray-400::placeholder{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.hover\\:scale-105:hover{--tw-scale-x:1.05;--tw-scale-y:1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:bg-\\[\\#86efac\\]\\/90:hover{background-color:rgba(134,239,172,.9)}.hover\\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\\:bg-destructive\\/90:hover{background-color:hsl(var(--destructive)/.9)}.hover\\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.hover\\:bg-gray-200:hover{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}.hover\\:bg-gray-50:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}.hover\\:bg-green-200:hover{--tw-bg-opacity:1;background-color:rgb(187 247 208/var(--tw-bg-opacity,1))}.hover\\:bg-primary\\/90:hover{background-color:hsl(var(--primary)/.9)}.hover\\:bg-red-200:hover{--tw-bg-opacity:1;background-color:rgb(254 202 202/var(--tw-bg-opacity,1))}.hover\\:bg-secondary\\/80:hover{background-color:hsl(var(--secondary)/.8)}.hover\\:bg-zinc-700\\/50:hover{background-color:rgba(63,63,70,.5)}.hover\\:bg-opacity-50:hover{--tw-bg-opacity:0.5}.hover\\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\\:text-zinc-100:hover{--tw-text-opacity:1;color:rgb(244 244 245/var(--tw-text-opacity,1))}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:opacity-90:hover{opacity:.9}.focus\\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.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\\:ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:ring-1: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(1px + 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-ring:focus-visible{--tw-ring-color:hsl(var(--ring))}.focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.focus-visible\\:ring-offset-background:focus-visible{--tw-ring-offset-color:hsl(var(--background))}.active\\:scale-95:active{--tw-scale-x:.95;--tw-scale-y:.95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\\:pointer-events-none:disabled{pointer-events:none}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\\:opacity-100{opacity:1}.data-\\[disabled\\]\\:pointer-events-none[data-disabled]{pointer-events:none}.data-\\[state\\=checked\\]\\:translate-x-4[data-state=checked]{--tw-translate-x:1rem}.data-\\[state\\=checked\\]\\:translate-x-4[data-state=checked],.data-\\[state\\=unchecked\\]\\:translate-x-0[data-state=unchecked]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[state\\=unchecked\\]\\:translate-x-0[data-state=unchecked]{--tw-translate-x:0px}.data-\\[state\\=checked\\]\\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\\[state\\=open\\]\\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\\[state\\=unchecked\\]\\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\\[disabled\\]\\:opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=open\\]\\:animate-in[data-state=open]{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-duration:.15s;animation-name:enter}.data-\\[state\\=closed\\]\\:animate-out[data-state=closed]{--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial;animation-duration:.15s;animation-name:exit}.data-\\[state\\=closed\\]\\:fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}.dark\\:border-white:is([data-mode=dark] *){--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity,1))}@media (min-width:640px){.sm\\:ml-3{margin-left:.75rem}.sm\\:block{display:block}.sm\\:h-5{height:1.25rem}.sm\\:h-9{height:2.25rem}.sm\\:h-\\[52px\\]{height:52px}.sm\\:w-5{width:1.25rem}.sm\\:w-9{width:2.25rem}.sm\\:gap-3{gap:.75rem}.sm\\:text-base{font-size:1rem;line-height:1.5rem}.sm\\:placeholder\\:text-base::-moz-placeholder{font-size:1rem;line-height:1.5rem}.sm\\:placeholder\\:text-base::placeholder{font-size:1rem;line-height:1.5rem}}.\\[\\&\\>svg\\]\\:size-4>svg{height:1rem;width:1rem}.\\[\\&\\>svg\\]\\:shrink-0>svg{flex-shrink:0}.\\[\\&_svg\\]\\:pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:size-4 svg{height:1rem;width:1rem}.\\[\\&_svg\\]\\:shrink-0 svg{flex-shrink:0}'),"function"==typeof SuppressedError&&SuppressedError;var K=e.forwardRef(((t,r)=>{const{children:a,...o}=t,n=e.Children.toArray(a),i=n.find(te);if(i){const t=i.props.children,a=n.map((r=>r===i?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:r));return R(G,{...o,ref:r,children:e.isValidElement(t)?e.cloneElement(t,void 0,a):null})}return R(G,{...o,ref:r,children:a})}));K.displayName="Slot";var G=e.forwardRef(((t,r)=>{const{children:a,...o}=t;if(e.isValidElement(a)){const t=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(a);return e.cloneElement(a,{...re(o,a.props),ref:r?J(r,t):t})}return e.Children.count(a)>1?e.Children.only(null):null}));G.displayName="SlotClone";var ee=({children:e})=>R(L,{children:e});function te(t){return e.isValidElement(t)&&t.type===ee}function re(e,t){const r={...t};for(const a in t){const o=e[a],n=t[a];/^on[A-Z]/.test(a)?o&&n?r[a]=(...e)=>{n(...e),o(...e)}:o&&(r[a]=o):"style"===a?r[a]={...o,...n}:"className"===a&&(r[a]=[o,n].filter(Boolean).join(" "))}return{...e,...r}}function ae(...e){return A($(e))}function oe(e){const t={en:[/i(?:\s|['\u2018\u2019])?m(?:\s+really)?\s+not\s+sure/i,/i(?:\s+am)?(?:\s+really)?\s+not\s+sure/i,/i\s+don(?:['\u2018\u2019])?t\s+know/i,/it(?:['\u2018\u2019]s| is) unclear/i,/cannot determine/i,/hard to say/i,/difficult to determine/i,/need more information/i],es:[/no (?:lo )?sé/i,/no estoy seguro/i,/no es claro/i,/desconocido/i],fr:[/je ne sais pas/i,/je ne suis pas sûr/i,/ce n'est pas clair/i,/inconnu/i],de:[/ich weiß nicht/i,/ich bin nicht sicher/i,/es ist unklar/i,/unbekannt/i],it:[/non lo so/i,/non sono sicuro/i,/non è chiaro/i,/sconosciuto/i],pt:[/não sei/i,/não tenho certeza/i,/não está claro/i,/desconhecido/i],nl:[/ik weet het niet/i,/ik weet niet zeker/i,/het is onduidelijk/i,/onbekend/i],pl:[/nie wiem/i,/nie jestem pewien/i,/to nie jest jasne/i,/nieznany/i],ru:[/я не знаю/i,/я не уверен/i,/это не ясно/i,/неизвестно/i],ja:[/知りません/i,/よくわからない/i,/不明です/i,/未知/i],ko:[/모릅니다/i,/잘 모르겠습니다/i,/불확실합니다/i,/알 수 없음/i],zh:[/我不知道/i,/我不确定/i,/不清楚/i,/未知/i],"zh-TW":[/我不知道/i,/我不確定/i,/不清楚/i,/未知/i]};let r=null;for(const[a,o]of Object.entries(t))for(const t of o){const o=e.match(t);o&&(null===r||o.index<r.index)&&(r={index:o.index,language:a})}return r?{uncertain:!0,language:r.language}:{uncertain:!1,language:null}}const ne=T("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ie=e.forwardRef(((t,r)=>{var{className:a,variant:o,size:n,asChild:i=!1}=t,s=H(t,["className","variant","size","asChild"]);const l=i?K:"button";return e.createElement(l,Object.assign({className:ae(ne({variant:o,size:n,className:a})),ref:r},s))}));ie.displayName="Button";const se=P.Root,le=P.Trigger;e.forwardRef(((t,r)=>{var{className:a,inset:o,children:n}=t,i=H(t,["className","inset","children"]);return e.createElement(P.SubTrigger,Object.assign({ref:r,className:ae("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",o&&"pl-8",a)},i),n,e.createElement(_,{className:"ml-auto"}))})).displayName=P.SubTrigger.displayName;e.forwardRef(((t,r)=>{var{className:a}=t,o=H(t,["className"]);return e.createElement(P.SubContent,Object.assign({ref:r,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a)},o))})).displayName=P.SubContent.displayName;const ce=e.forwardRef(((t,r)=>{var{className:a,sideOffset:o=4}=t,n=H(t,["className","sideOffset"]);return e.createElement(P.Portal,null,e.createElement(P.Content,Object.assign({ref:r,sideOffset:o,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a)},n)))}));ce.displayName=P.Content.displayName;const de=e.forwardRef(((t,r)=>{var{className:a,inset:o}=t,n=H(t,["className","inset"]);return e.createElement(P.Item,Object.assign({ref:r,className:ae("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",o&&"pl-8",a)},n))}));de.displayName=P.Item.displayName;e.forwardRef(((t,r)=>{var{className:a,children:o,checked:n}=t,i=H(t,["className","children","checked"]);return e.createElement(P.CheckboxItem,Object.assign({ref:r,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),checked:n},i),e.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},e.createElement(P.ItemIndicator,null,e.createElement(F,{className:"h-4 w-4"}))),o)})).displayName=P.CheckboxItem.displayName;e.forwardRef(((t,r)=>{var{className:a,children:o}=t,n=H(t,["className","children"]);return e.createElement(P.RadioItem,Object.assign({ref:r,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a)},n),e.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},e.createElement(P.ItemIndicator,null,e.createElement(Q,{className:"h-2 w-2 fill-current"}))),o)})).displayName=P.RadioItem.displayName;e.forwardRef(((t,r)=>{var{className:a,inset:o}=t,n=H(t,["className","inset"]);return e.createElement(P.Label,Object.assign({ref:r,className:ae("px-2 py-1.5 text-sm font-semibold",o&&"pl-8",a)},n))})).displayName=P.Label.displayName;e.forwardRef(((t,r)=>{var{className:a}=t,o=H(t,["className"]);return e.createElement(P.Separator,Object.assign({ref:r,className:ae("-mx-1 my-1 h-px bg-muted",a)},o))})).displayName=P.Separator.displayName;const me=q.Provider,pe=q.Root,ue=q.Trigger,ge=e.forwardRef(((t,r)=>{var{className:a,sideOffset:o=4}=t,n=H(t,["className","sideOffset"]);return e.createElement(q.Portal,null,e.createElement(q.Content,Object.assign({ref:r,sideOffset:o,className:ae("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a)},n)))}));function he({suggestions:e,onQuestionClick:r,borderColor:a,title:o="Suggested questions"}){return e&&0!==e.length?t.createElement("div",{className:"w-full"},t.createElement("h3",{className:"text-base font-medium mb-4 text-gray-900"},o),t.createElement("div",{className:"flex flex-wrap gap-2"},e.map((e=>t.createElement("button",{key:e.id,onClick:()=>r(e),className:"px-4 py-2 rounded-lg border border-gray-300 text-gray-700 hover:bg-gray-50 transition-colors duration-200 text-sm flex items-center gap-2",style:{borderColor:a}},void 0!==e.messageCount&&t.createElement(me,null,t.createElement(pe,null,t.createElement(ue,{asChild:!0},t.createElement("span",{className:"bg-gray-100 text-gray-600 px-2 py-0.5 rounded-full text-xs min-w-[20px] border flex items-center justify-center",style:{borderColor:a}},e.messageCount)),t.createElement(ge,null,t.createElement("p",null,e.messageCount," messages in this conversation")))),t.createElement("span",null,e.question)))))):null}ge.displayName=q.Content.displayName;const fe={javascript:".js",python:".py",java:".java",c:".c",cpp:".cpp","c++":".cpp","c#":".cs",ruby:".rb",php:".php",swift:".swift","objective-c":".m",kotlin:".kt",typescript:".ts",go:".go",perl:".pl",rust:".rs",scala:".scala",haskell:".hs",lua:".lua",shell:".sh",sql:".sql",html:".html",css:".css"},we=B,be=r((({language:e,value:r})=>{const[o,n]=a(!1);return t.createElement("div",{className:"relative font-sans text-sm mt-1"},t.createElement("div",{className:"relative rounded-t-lg bg-zinc-800/80 font-sans text-sm backdrop-blur"},t.createElement("div",{className:"flex h-8 items-center justify-between px-3"},t.createElement("span",{className:"text-xs font-medium text-zinc-400"},e),t.createElement("div",{className:"flex gap-1"},t.createElement(ie,{variant:"ghost",size:"icon",className:"size-5 text-zinc-400 hover:bg-zinc-700/50 hover:text-zinc-100",onClick:()=>{V(void 0,void 0,void 0,(function*(){if(navigator.clipboard&&navigator.clipboard.writeText)try{yield navigator.clipboard.writeText(r),n(!0),setTimeout((()=>{n(!1)}),2e3)}catch(e){console.error("Failed to copy:",e)}}))}},o?t.createElement(l,{size:18}):t.createElement(c,{size:18})),t.createElement(ie,{variant:"ghost",size:"icon",className:"size-5 text-zinc-400 hover:bg-zinc-700/50 hover:text-zinc-100",onClick:()=>{const t=fe[e]||".file",a=`file-${((e,t=!1)=>{const r="ABCDEFGHJKLMNPQRSTUVWXY3456789";let a="";for(let t=0;t<e;t+=1)a+=r.charAt(Math.floor(30*Math.random()));return t?a.toLowerCase():a})(3,!0)}${t}`,o=new Blob([r],{type:"text/plain"}),n=URL.createObjectURL(o),i=document.createElement("a");i.download=a,i.href=n,i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(n)}},t.createElement(d,{size:18}))))),t.createElement("div",{className:"rounded-b-lg"},t.createElement(we,{language:e,style:W,PreTag:"div",wrapLongLines:!0,customStyle:{margin:0,borderTopLeftRadius:0,borderTopRightRadius:0}},r)))}));be.displayName="CodeBlock";const ye=e.forwardRef((({src:t,border:r,width:a="100%",height:o="400px",title:n},i)=>{const[s,l]=e.useState(!1);return e.useEffect((()=>{let e=!0;return setTimeout((()=>{e&&l(!0)}),0),()=>{e=!1}}),[]),e.createElement("div",{className:"overflow-hidden rounded-lg mt-4 "+(r?"border":""),style:{width:a,height:o}},s&&e.createElement(e.Fragment,null,e.createElement("iframe",{ref:i,src:t,sandbox:"allow-same-origin allow-scripts allow-popups allow-forms allow-downloads",width:a,height:o,frameBorder:"0",title:"embed",loading:"lazy",allowFullScreen:!0,className:"block rounded-lg"}),n&&e.createElement("span",{className:"block text-center text-sm font-medium"},n)))}));function ve(t){const r=t.attrs.href.replace("share","embed");return e.createElement(ye,Object.assign({},t,{src:r,title:"Loom Embed"}))}function xe(t){return e.createElement(ye,Object.assign({},t,{src:t.attrs.href,title:"Supademo Embed"}))}function ke(t){return e.createElement(ye,Object.assign({},t,{src:t.attrs.href,title:"Typeform Embed"}))}function Ee(t){const r=t.attrs.href.match(/(http|https)?:\/\/(www\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|)(\d+)(?:\/|\?)?([\d\w]+)?/);if(!r)return null;const a=r[4],o=r[5],n=`https://player.vimeo.com/video/${a}?byline=0${o?`&h=${o}`:""}`;return e.createElement(ye,Object.assign({},t,{src:n,title:`Vimeo Embed (${a})`,height:"412px",border:!1}))}function Ne(t){const r=(e=>{const t=[/^https?:\/\/([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)\/?$/,/^https?:\/\/fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)\/?$/,/^fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)\/?$/,/^([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)\/?$/];for(const r of t){const t=e.match(r);if(t)return t}return null})(t.attrs.href);if(!r)return null;const a=r[1],o=r[2]||r[1],n=a?`https://${a}.wistia.com/embed/iframe/${o}?seo=true&videoFoam=false`:`https://fast.wistia.com/embed/iframe/${o}`;return e.createElement(ye,Object.assign({},t,{src:n,border:!0,title:`Wistia Embed (${o})`}))}function ze(t){const r=(e=>{const t=e.match(/(?:https?:\/\/)?(?:www\.)?youtu\.?be(?:\.com)?\/?.*(?:watch|embed)?(?:.*v=|v\/|\/)([a-zA-Z0-9_-]{11})$/i);return t?t[1]:null})(t.attrs.href);return r?e.createElement(ye,Object.assign({},t,{src:`https://www.youtube.com/embed/${r}?modestbranding=1`,title:`YouTube Embed (${r})`})):null}ve.isMatch=e=>/^https:\/\/(www\.)?(use)?loom\.com\/(embed|share)\/(.*)$/.test(e),xe.isMatch=e=>/^https:\/\/app\.supademo\.com\/embed\/(.*)$/.test(e),ke.isMatch=e=>/^https:\/\/([A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)\.typeform\.com\/to\/(.*)$/.test(e),Ee.isMatch=e=>/^(https?):\/\/(www\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|)?(\d+)(\/)?(?:\?.*|#.*)?$/i.test(e),Ne.isMatch=e=>[/^https?:\/\/([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i,/^https?:\/\/fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i,/^fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i,/^([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i].some((t=>t.test(e))),ze.isMatch=e=>/^(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|embed\/|v\/|shorts\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})(?:\/|[?&].*)?$/i.test(e);const je=[ve,xe,ke,ze,Ne,Ee],Ce=t=>{const{href:r}=t.attrs,[n,i]=a(null);if(o((()=>{let e=!0;return(()=>{try{const a=je.find((e=>e.isMatch(r)));a&&e&&i({Component:a,props:t})}catch(e){console.error("Error finding embed match:",e)}})(),()=>{e=!1}}),[r,t]),n){const{Component:t,props:r}=n;return e.createElement(t,Object.assign({},r))}return null},Oe=r(Z,((e,t)=>e.children===t.children)),Se={startOnLoad:!1,theme:"default",securityLevel:"loose",fontFamily:"inherit"},Ie=({content:e})=>{const[r,i]=a(""),[s,l]=a(null),c=n(null),[d,m]=a(!1);return o((()=>{(()=>{try{D.initialize(Se),m(!0)}catch(e){console.error("Error initializing mermaid:",e),l("Failed to initialize diagram renderer")}})()}),[]),o((()=>{if(!d)return;V(void 0,void 0,void 0,(function*(){try{const t=`mermaid-${Math.random().toString(36).substr(2,9)}`,r=yield D.render(t,e);i(r.svg),l(null)}catch(e){console.error("Error rendering mermaid diagram:",e),l("Failed to render diagram")}}))}),[e,d]),s?t.createElement("div",{className:"text-red-500 bg-red-50 p-4 rounded-md"},s,t.createElement("pre",{className:"mt-2 text-sm"},e)):t.createElement("div",{ref:c,className:"my-4 overflow-auto",dangerouslySetInnerHTML:{__html:r}})},Re=r((({message:e,isStreaming:r})=>{const[n,i]=a(e.content);o((()=>{var t;const r=oe(e.content);r.uncertain&&r.language&&(null===(t=e.uncertaintyFallbackText)||void 0===t?void 0:t[r.language])?i(e.uncertaintyFallbackText[r.language]):i(e.content)}),[e.content,e.uncertaintyFallbackText,r]);const s=n.replace(/^\n+|(\n+|\\)+$/g,"");return t.createElement(Oe,{className:"dark:prose-invert prose flex-1",remarkPlugins:[U],rehypePlugins:[M],components:{code:e=>{var{inline:r,className:a,children:o}=e,n=H(e,["inline","className","children"]);const i=/language-(\w+)/.exec(a||""),s=i&&i[1];return r||"mermaid"!==s&&"mermaidjs"!==s?!r&&s?t.createElement(be,Object.assign({key:Math.random(),language:s,value:String(o).replace(/\n$/,"")},n)):t.createElement("code",Object.assign({className:`text-red-400 bg-slate-200 border-slate-300 border rounded p-0.5 ${a}`.trim()},n),o):t.createElement(Ie,{content:String(o).replace(/\n$/,"")})},marker:({children:e})=>t.createElement("div",{className:"my-2"},t.createElement("span",{className:"highlight"},e)),table:({children:e})=>t.createElement("table",{className:"border-collapse border border-black px-3 py-1 dark:border-white"},e),th:({children:e})=>t.createElement("th",{className:"break-words border border-black bg-gray-500 px-3 py-1 text-white dark:border-white"},e),td:({children:e})=>t.createElement("td",{className:"break-words border border-black px-3 py-1 dark:border-white"},e),a(e){var{children:r}=e,a=H(e,["children"]);if(a.href){const e=Ce({attrs:{href:a.href}});if(t.isValidElement(e))return e}return t.createElement("a",Object.assign({className:"link",target:"_blank",rel:"noopener noreferrer"},a),r)},pre:({children:e})=>t.createElement(t.Fragment,null,e),img({src:e,alt:r}){const a=Ce({attrs:{href:null!=e?e:""}});return t.isValidElement(a)?a:t.createElement("img",{src:e,alt:r,className:"w-full"})},li:e=>{var{children:r}=e,a=H(e,["children"]);return t.createElement("li",Object.assign({className:"py-1"},a),r)},ul:({children:e})=>t.createElement("ul",{className:"ml-4 list-outside list-disc"},e),ol:({children:e})=>t.createElement("ol",{className:"ml-4 list-outside list-decimal"},e),strong:e=>{var{children:r}=e,a=H(e,["children"]);return t.createElement("span",Object.assign({className:"font-semibold"},a),r)},h1:e=>{var{children:r}=e,a=H(e,["children"]);return t.createElement("h1",Object.assign({className:"mb-2 mt-6 text-3xl font-semibold"},a),r)},h2:e=>{var{children:r}=e,a=H(e,["children"]);return t.createElement("h2",Object.assign({className:"mb-2 mt-6 text-2xl font-semibold"},a),r)},h3:e=>{var{children:r}=e,a=H(e,["children"]);return t.createElement("h3",Object.assign({className:"mb-2 mt-6 text-xl font-semibold"},a),r)},h4:e=>{var{children:r}=e,a=H(e,["children"]);return t.createElement("h4",Object.assign({className:"mb-2 mt-6 text-lg font-semibold"},a),r)},h5:e=>{var{children:r}=e,a=H(e,["children"]);return t.createElement("h5",Object.assign({className:"mb-2 mt-6 text-base font-semibold"},a),r)},h6:e=>{var{children:r}=e,a=H(e,["children"]);return t.createElement("h6",Object.assign({className:"mb-2 mt-6 text-sm font-semibold"},a),r)}}},s)}));Re.displayName="FormattedMessage";var Le="generating-star-module_animate-spin__AJjwz";Y(".generating-star-module_animate-spin__AJjwz{animation:generating-star-module_rotate__ChndJ 2s linear infinite;transform:none;transform-box:fill-box;transform-origin:center}@keyframes generating-star-module_rotate__ChndJ{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}");const Te=({loading:e,color:r="#000"})=>t.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:"mt-[-5px] inline-block flex-shrink-0",style:{minWidth:"24px",minHeight:"24px"}},t.createElement("path",{className:e?Le:"",d:"M7.54672 16.0031L2.66234 14.2031C2.51881 14.1498 2.39502 14.0539 2.3076 13.9282C2.22019 13.8025 2.17333 13.6531 2.17333 13.5C2.17333 13.3469 2.22019 13.1975 2.3076 13.0718C2.39502 12.9461 2.51881 12.8501 2.66234 12.7969L7.54672 10.9969C7.64981 10.9589 7.74344 10.899 7.82113 10.8213C7.89882 10.7436 7.95873 10.65 7.99672 10.5469L9.79672 5.66249C9.84999 5.51896 9.94592 5.39517 10.0716 5.30775C10.1973 5.22033 10.3467 5.17348 10.4998 5.17348C10.6529 5.17348 10.8024 5.22033 10.9281 5.30775C11.0538 5.39517 11.1497 5.51896 11.203 5.66249L13.003 10.5469C13.041 10.65 13.1009 10.7436 13.1786 10.8213C13.2562 10.899 13.3499 10.9589 13.453 10.9969L18.3373 12.7969C18.4809 12.8501 18.6047 12.9461 18.6921 13.0718C18.7795 13.1975 18.8264 13.3469 18.8264 13.5C18.8264 13.6531 18.7795 13.8025 18.6921 13.9282C18.6047 14.0539 18.4809 14.1498 18.3373 14.2031L13.453 16.0031C13.3499 16.0411 13.2562 16.101 13.1786 16.1787C13.1009 16.2564 13.041 16.35 13.003 16.4531L11.203 21.3375C11.1497 21.481 11.0538 21.6048 10.9281 21.6922C10.8024 21.7796 10.6529 21.8265 10.4998 21.8265C10.3467 21.8265 10.1973 21.7796 10.0716 21.6922C9.94592 21.6048 9.84999 21.481 9.79672 21.3375L7.99672 16.4531C7.95873 16.35 7.89882 16.2564 7.82113 16.1787C7.74344 16.101 7.64981 16.0411 7.54672 16.0031Z",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",fill:e?r:"none",strokeLinejoin:"round"}),t.createElement("path",{d:"M18.7497 3.75L14.2497 3.75",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),t.createElement("path",{d:"M16.4999 6V1.5",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),t.createElement("path",{d:"M22.4999 8.25001H19.4999",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),t.createElement("path",{d:"M20.9998 9.75002V6.75002",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}));function $e({answer:e,question:r,theme:o,searchResults:n,isStreaming:i=!1,searchQueryId:s,feedback:l,onFeedback:c,disableFeedback:d=!1,textConfig:b={},isLoading:y=!1,isSearchLoading:v=!1}){const[x,k]=a(!1),[E,N]=a(!1),z=()=>V(this,void 0,void 0,(function*(){try{yield navigator.clipboard.writeText(e),k(!0),setTimeout((()=>k(!1)),2e3)}catch(e){console.error("Failed to copy text:",e)}})),j=e=>{c&&s&&c(e)};return t.createElement("div",{className:"rounded-lg p-6 relative",style:{backgroundColor:o.cardBackground,borderColor:o.border,borderWidth:"1px",borderStyle:"solid"}},t.createElement("div",{className:"flex items-start justify-between"},t.createElement("div",{className:"flex items-center gap-2 mb-4"},t.createElement("div",{className:"mt-1"},t.createElement(Te,{loading:y||i,color:o.primary})),t.createElement("h2",{className:"text-xl leading-normal font-semibold",style:{color:o.text}},r)),e&&t.createElement(me,null,t.createElement(pe,null,t.createElement(ue,{asChild:!0},t.createElement("button",{onClick:()=>{z()},className:"flex items-center justify-center w-8 h-8 rounded-md hover:bg-gray-100 transition-colors duration-200"},x?t.createElement(m,{className:"h-4 w-4 text-green-500"}):t.createElement(p,{className:"h-4 w-4 text-gray-500"}))),t.createElement(ge,null,t.createElement("p",null,x?"Copied!":"Copy"))))),y?t.createElement("div",{className:"space-y-4"},t.createElement("div",{className:"flex items-center gap-2"},t.createElement("div",{className:"animate-pulse h-5 rounded-full w-5",style:{backgroundColor:`${o.primary}30`}}),t.createElement("div",{className:"flex items-center gap-2 text-sm",style:{color:o.text}},v?b.loadingSearchText:b.loadingAnswerText)),t.createElement("div",{className:"space-y-3"},t.createElement("div",{className:"animate-pulse h-4 bg-gray-200 rounded w-3/4",style:{backgroundColor:`${o.border}40`}}),t.createElement("div",{className:"animate-pulse h-4 bg-gray-200 rounded w-full",style:{backgroundColor:`${o.border}40`}}),t.createElement("div",{className:"animate-pulse h-4 bg-gray-200 rounded w-5/6",style:{backgroundColor:`${o.border}40`}})),t.createElement("div",{className:"mt-6 space-y-3"},t.createElement("div",{className:"animate-pulse h-4 bg-gray-200 rounded w-1/4",style:{backgroundColor:`${o.border}40`}}),t.createElement("div",{className:"flex gap-2"},t.createElement("div",{className:"animate-pulse h-8 bg-gray-200 rounded w-32",style:{backgroundColor:`${o.border}40`}}),t.createElement("div",{className:"animate-pulse h-8 bg-gray-200 rounded w-40",style:{backgroundColor:`${o.border}40`}})))):e?t.createElement("div",{className:"prose prose-sm max-w-none",style:{color:o.text}},t.createElement(Re,{message:{content:e,theme:{primary:o.primary,text:o.text},uncertaintyFallbackText:b.uncertaintyFallbackText},isStreaming:i})):t.createElement("div",{className:"prose prose-sm max-w-none",style:{color:o.text}},t.createElement(Re,{message:{content:"Sorry, there was an error generating the answer. Please try again.",theme:{primary:o.primary,text:o.text}},isStreaming:i})),e&&!i&&!d&&t.createElement("div",{className:"mt-2 flex justify-end gap-2"},t.createElement(me,null,t.createElement(pe,null,t.createElement(ue,{asChild:!0},t.createElement(ie,{variant:"ghost",size:"sm",className:"rounded-md h-8 w-8 flex items-center justify-center transition-all duration-200 transform hover:scale-105 active:scale-95 "+("accept"===l?"bg-green-100 text-green-600 hover:bg-green-200":""),onClick:()=>j("accept"),disabled:Boolean(l)},t.createElement(S.div,{initial:{scale:1},animate:{scale:"accept"===l?[1,1.2,1]:1},transition:{duration:.3}},t.createElement(u,{className:"h-4 w-4"})))),t.createElement(ge,null,t.createElement("p",null,b.positiveAnswerText||"Helpful")))),t.createElement(me,null,t.createElement(pe,null,t.createElement(ue,{asChild:!0},t.createElement(ie,{variant:"ghost",size:"sm",className:"rounded-md h-8 w-8 flex items-center justify-center transition-all duration-200 transform hover:scale-105 active:scale-95 "+("reject"===l?"bg-red-100 text-red-600 hover:bg-red-200":""),onClick:()=>j("reject"),disabled:Boolean(l)},t.createElement(S.div,{initial:{scale:1},animate:{scale:"reject"===l?[1,1.2,1]:1},transition:{duration:.3}},t.createElement(g,{className:"h-4 w-4"})))),t.createElement(ge,null,t.createElement("p",null,b.negativeAnswerText||"Not helpful"))))),n&&n.length>0&&t.createElement("div",{className:"mt-6 rounded-lg overflow-hidden",style:{backgroundColor:o.surface,borderWidth:"1px",borderStyle:"solid",borderColor:o.border}},t.createElement("button",{onClick:()=>N(!E),className:"w-full flex items-center justify-between p-3 transition-all duration-200 hover:bg-opacity-50",style:{color:o.text,borderBottom:E?`1px solid ${o.surfaceBorder}`:"none"}},t.createElement("div",{className:"flex items-center gap-2"},t.createElement(h,{className:"h-4 w-4 flex-shrink-0",style:{color:o.primary}}),t.createElement("span",{className:"font-medium truncate"},`Related Sources (${n.length})`)),t.createElement(f,{className:"h-4 w-4 flex-shrink-0 transition-transform duration-200 "+(E?"rotate-180":""),style:{color:o.text}})),t.createElement("div",{className:"overflow-hidden transition-all duration-200 ease-in-out",style:{maxHeight:E?48*n.length+"px":"0",opacity:E?1:0,transform:`translateY(${E?"0":"-10px"})`}},t.createElement("div",{className:"divide-y divide-gray-200"},n.map((e=>t.createElement("a",{key:e.id,href:e.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 transition-colors duration-200 hover:bg-gray-50",style:{color:o.text,backgroundColor:o.surface}},t.createElement("span",{className:"flex-grow truncate"},e.title),t.createElement(w,{className:"h-4 w-4 flex-shrink-0",style:{color:`${o.text}60`}}))))))))}function Ae({questions:e,onQuestionClick:r,theme:a}){return e.length?t.createElement(S.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"w-full"},t.createElement("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:a.surface,borderWidth:"1px",borderStyle:"solid",borderColor:a.border}},t.createElement("div",{className:"p-3 border-b",style:{borderColor:a.surfaceBorder}},t.createElement("div",{className:"flex items-center gap-2"},t.createElement(b,{className:"h-4 w-4 flex-shrink-0",style:{color:a.primary}}),t.createElement("span",{className:"font-medium"},"Follow-up Questions"))),t.createElement("div",{className:"divide-y divide-gray-200"},e.map(((e,o)=>t.createElement(S.button,{key:o,initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:.1*o},onClick:()=>r(e),className:"w-full flex items-center gap-2 p-3 transition-colors duration-200 hover:bg-gray-50 text-left",style:{color:a.text,backgroundColor:a.surface}},t.createElement("span",{className:"flex-grow"},e),t.createElement(y,{className:"h-4 w-4 flex-shrink-0",style:{color:`${a.text}60`}}))))))):null}function Pe({questions:e,activeIndex:r,onNavigate:n,theme:i,offset:s}){const[l,c]=a(r);o((()=>{c(r)}),[r]);const d=e.length,m=(()=>{const e=[];let t=null;const a=r=>{null!==t&&r-t>1&&e.push("ellipsis"),e.push(r),t=r};a(0);for(let e=Math.max(1,r-2);e<=Math.min(d-2,r+2);e++)a(e);return d>1&&a(d-1),e})();return t.createElement("nav",{"aria-label":"Question timeline navigation",className:"fixed left-4 top-1/2 -translate-y-1/2 z-40 flex flex-col gap-3",style:Object.assign({},s?{left:`${s}px`}:{})},t.createElement(S.div,{className:"flex flex-col items-center space-y-3",role:"list",initial:!1,animate:{y:0},transition:{type:"spring",stiffness:300,damping:30}},t.createElement(I,null,m.map(((a,o)=>{if("ellipsis"===a)return t.createElement(S.div,{key:`ellipsis-${o}`,className:"h-8 flex items-center justify-center","aria-hidden":"true",initial:{opacity:0,y:l>r?-20:20},animate:{opacity:1,y:0},exit:{opacity:0,y:l>r?20:-20},transition:{duration:.2}},t.createElement(v,{className:"w-4 h-4",style:{color:i.text}}));const s=a,c=e[s];return t.createElement(S.div,{key:s,className:"relative group isolate",role:"listitem",initial:{opacity:0,y:l>r?-20:20},animate:{opacity:1,y:0},exit:{opacity:0,y:l>r?20:-20},transition:{duration:.2},layout:!0},t.createElement(me,null,t.createElement(pe,null,t.createElement(ue,{asChild:!0},t.createElement("button",{onClick:()=>n(s),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||n(s)},className:"flex items-center justify-center w-8 h-8 rounded-full transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 hover:opacity-90",style:{backgroundColor:s===r?i.primary:"#ccc",color:s===r?i.background:"#333",cursor:"pointer","--tw-ring-color":i.primary},"aria-label":`Navigate to question ${s+1}: ${c}`,"aria-current":s===r?"step":void 0},s+1)),t.createElement(ge,{side:"right",sideOffset:8},t.createElement("p",{className:"max-w-[200px] break-words"},c)))))})))))}function _e({onClick:e,theme:r}){return t.createElement(ie,{className:"fixed bottom-20 right-4 rounded-full p-2 transition-opacity duration-300",style:{backgroundColor:r.background,borderColor:r.border,borderWidth:"1px",borderStyle:"solid",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"},onClick:e},t.createElement(x,{className:"h-5 w-5",style:{color:r.text}}))}const Fe={maxRetries:3,baseDelay:1e3,shouldRetry:e=>{if(e instanceof TypeError)return!0;const t=e;return!!t.status&&t.status>=500}};let Qe=Object.assign({},Fe),qe=Object.assign({},{emptyResponse:"I apologize, but I couldn't generate an answer at this time. Please try again.",errorResponse:"I encountered an error while processing your request. Please try again."});function Me(e){return V(this,void 0,void 0,(function*(){return new Promise((t=>setTimeout(t,e)))}))}function Ue(e,t={}){return V(this,void 0,void 0,(function*(){const{retry:r={},headers:a={},body:o,isStream:n=!1,fallback:i={}}=t,s=H(t,["retry","headers","body","isStream","fallback"]),l=Object.assign(Object.assign({},Qe),r),c=Object.assign(Object.assign({},qe),i);let d=1;for(;;)try{const t=yield fetch(e,Object.assign(Object.assign({},s),{headers:Object.assign({"Content-Type":"application/json"},a),body:o?JSON.stringify(o):void 0}));if(t.ok){if(n){const e=t.clone();if(!(yield e.text()).trim()){const e=new Error(c.emptyResponse);throw e.name="EmptyResponseError",e}return t}const e=yield t.json();if(!e||"object"==typeof e&&0===Object.keys(e).length){const e=new Error(c.emptyResponse);throw e.name="EmptyResponseError",e}return e}const r=new Error(c.errorResponse);throw r.status=t.status,r.data=yield t.json().catch((()=>{})),r}catch(e){const t=yield Promise.resolve(l.shouldRetry(e,d));if(d>=l.maxRetries||!t){if(e instanceof Error&&"EmptyResponseError"===e.name)return{message:e.message};throw e}console.warn(`Request failed, attempt ${d} of ${l.maxRetries}. Retrying...`);const r=.3*Math.random()+.85;yield Me(l.baseDelay*Math.pow(2,d-1)*r),d++}}))}const Be={maxRetries:3,baseDelay:300,shouldRetry:e=>{if(e instanceof TypeError)return!0;const t=e;return!!t.status&&(t.status>=500||429===t.status)}},We={maxRetries:3,baseDelay:500,shouldRetry:e=>{if(e instanceof TypeError)return!0;const t=e;return!!t.status&&t.status>=500}};function Ze({endpoint:e,query:t,collectionId:r,headers:a,conversationId:o}){var n;return V(this,void 0,void 0,(function*(){const i=yield Ue(e,{method:"POST",headers:a,retry:Be,body:Object.assign(Object.assign({query:t,limit:5},r&&"all"!==r&&{collectionId:r}),o&&{conversationId:o})});return{results:null==i?void 0:i.data,searchQueryId:null===(n=null==i?void 0:i.searchQuery)||void 0===n?void 0:n.id}}))}function De({endpoint:e,searchQueryId:t,headers:r,conversationId:a}){return V(this,void 0,void 0,(function*(){return Ue(e,{method:"POST",headers:r,retry:We,isStream:!0,fallback:{emptyResponse:"I apologize, but I couldn't generate an answer for your query. Please try rephrasing your question.",errorResponse:"I encountered an issue while generating the answer. Please try again in a moment."},body:Object.assign({searchQueryId:t},a&&{conversationId:a})})}))}function Ye(){return`bf-conversation-${Date.now()}-${"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}`}function He({endpoint:e,conversationId:t,headers:r}){return V(this,void 0,void 0,(function*(){return{data:(yield Ue(e,{method:"POST",headers:r,body:{conversationId:t}})).data.map((e=>Object.assign(Object.assign({},e),{feedback:e.feedback?"positive"===e.feedback?"accept":"reject":void 0})))}}))}const Ve={primary:"#A3E635",accent:"#f9fafb",background:"white",text:"#171717",border:"#171717",hover:"#171717",surface:"#F9FAFB",surfaceBorder:"#E5E7EB",surfaceHover:"#F3F4F6",cardBackground:"white"},Xe={headerText:"How can we help you today?",searchPlaceholder:"Ask a question or type a search term here ...",attachImageText:"Attach image",allDocumentsText:"All documents",loadingSearchText:"Searching for relevant content...",loadingAnswerText:"Crafting a response...",errorText:"Sorry, there was an error generating the answer.",followUpPlaceholder:"Ask follow-up",positiveAnswerText:"Helpful",negativeAnswerText:"Not helpful",uncertaintyFallbackText:{en:"Sorry, I can't find a clear answer to your question. Please try rephrasing or check the related sources below.",es:"Lo siento, no puedo encontrar una respuesta clara. Intente reformular la pregunta o consulte las fuentes relacionadas.",fr:"Désolé, je ne trouve pas de réponse claire. Essayez de reformuler ou consultez les sources connexes.",de:"Entschuldigung, ich finde keine klare Antwort. Versuchen Sie es anders zu formulieren oder sehen Sie sich die verwandten Quellen an.",it:"Mi dispiace, non trovo una risposta chiara. Prova a riformulare o consulta le fonti correlate.",pt:"Desculpe, não encontro uma resposta clara. Tente reformular ou consulte as fontes relacionadas.",nl:"Sorry, ik kan geen duidelijk antwoord vinden. Probeer het anders te formuleren of bekijk de gerelateerde bronnen.",pl:"Przepraszam, nie znajduję jasnej odpowiedzi. Spróbuj przeformułować pytanie lub sprawdź powiązane źródła.",ru:"Извините, я не могу найти четкого ответа. Попробуйте переформулировать или ознакомьтесь со связанными источниками.",ja:"申し訳ありませんが、明確な回答が見つかりません。質問の言い換えや、関連ソースをご確認ください。",ko:"죄송합니다. 명확한 답변을 찾을 수 없습니다. 질문을 다시 작성하거나 관련 소스를 확인해 주세요.",zh:"抱歉,找不到明确的答案。请尝试重新表述或查看相关来源。","zh-TW":"抱歉,找不到明確的答案。請嘗試重新表述或查看相關來源。"}},Je=i((({suggestions:e,theme:r={},collections:i=[],selectedCollectionId:l,onCollectionChange:c,searchEndpoint:d,answerEndpoint:m,feedbackEndpoint:p,loadConversationEndpoint:u,disableFollowUpQuestions:g=!1,disableImageAttachment:h=!1,disableFeedback:w=!1,siblingNode:b,offset:y=0,headers:v,textConfig:x={},followUpQuestionsEndpoint:R},L)=>{var T;const $=Object.assign(Object.assign({},Ve),r),A=Object.assign(Object.assign({},Xe),x),[P,_]=a(""),[F,Q]=a(""),[q,M]=a(!1),[U,B]=a(!1),[W,Z]=a([]),[D,Y]=a(!1),[H,X]=a(0),[J,K]=a([]),[G,ee]=a(l),[te,re]=a(!0),[ae,ne]=a(""),[me,pe]=a(!1),[ue,ge]=a(),fe=n(null),we=n(null),be=n([]),ye=n(null),ve=n(null),xe=n([]);o((()=>{const e=new URLSearchParams(window.location.search).get("conversation");if(e&&u)pe(!0),B(!0),He({endpoint:u,conversationId:e,headers:v}).then((t=>{Z(t.data),ne(e),B(!0)})).catch((e=>{console.error("Error loading conversation:",e),ge(A.errorText||"An error occurred"),B(!1),Z([]);const t=Ye();ne(t);const r=new URL(window.location.href);r.searchParams.delete("conversation"),window.history.replaceState({},"",r.toString())})).finally((()=>{pe(!1)}));else{const e=Ye();ne(e)}}),[u]),o((()=>{if(ae&&W.length>0){const e=new URL(window.location.href);e.searchParams.set("conversation",ae),window.history.replaceState({},"",e.toString())}}),[ae,W.length]),o((()=>{const e={showResults:U,answers:W,isLoading:me,error:ue};xe.current.forEach((t=>t(e)))}),[U,W,me,ue]),s(L,(()=>({createNewThread:()=>{_(""),Q(""),B(!1),Z([]),X(0),K([]);const e=Ye();ne(e);const t=new URL(window.location.href);t.searchParams.delete("conversation"),window.history.replaceState({},"",t.toString()),fe.current&&(fe.current.style.height="auto")},showFollowUpThread:e=>{re(e)},subscribeToStateChanges:e=>(xe.current.push(e),e({showResults:U,answers:W,isLoading:!1,error:void 0}),()=>{xe.current=xe.current.filter((t=>t!==e))})}))),o((()=>{ee(l)}),[l]);const ke=()=>{requestAnimationFrame((()=>{const e=be.current[be.current.length-1];if(e){const t=e.getBoundingClientRect(),r=window.pageYOffset||document.documentElement.scrollTop,a=t.top+r-80;window.scrollTo({top:a,behavior:"smooth"})}}))},Ee=e=>V(void 0,void 0,void 0,(function*(){var t;const r=null===(t=e.body)||void 0===t?void 0:t.getReader();if(!r)return;Z((e=>{const t=[...e],r=t[t.length-1];return r&&(r.isLoading=!1,r.isStreaming=!0,r.searchResults=r.searchResults||[]),t}));let a="";try{let e,t;for(;({done:e,value:t}=yield r.read()),!e;){const e=(new TextDecoder).decode(t);a+=e;const{uncertain:r,language:o}=oe(a);Z((e=>{var t;const n=[...e],i=n[n.length-1];return i&&(i.answer=a,i.isLoading=!1,i.isStreaming=!0,i.searchResults=i.searchResults||[],i.isUncertain=r,i.uncertaintyLanguage=o,r&&o&&(null===(t=A.uncertaintyFallbackText)||void 0===t?void 0:t[o])&&(i.uncertaintyFallbackText=A.uncertaintyFallbackText[o])),n}))}}catch(e){console.error("Error streaming answer:",e)}finally{Z((e=>{const t=[...e],r=t[t.length-1];return r&&(r.isStreaming=!1,r.isLoading=!1,R&&!g&&r.searchQueryId&&V(void 0,void 0,void 0,(function*(){try{const e=yield function({endpoint:e,searchQueryId:t,headers:r,conversationId:a}){return V(this,void 0,void 0,(function*(){return(yield Ue(e,{method:"POST",headers:r,body:Object.assign({searchQueryId:t},a&&{conversationId:a})})).questions}))}({endpoint:R,searchQueryId:r.searchQueryId,headers:v,conversationId:ae});Z((t=>{const r=[...t],a=r[r.length-1];return a&&(a.followUpQuestions=e),r}))}catch(e){console.error("Error fetching follow-up questions:",e)}}))),t})),r.releaseLock()}})),Ne=(e,t,r)=>V(void 0,void 0,void 0,(function*(){if(p){Z((t=>{const a=[...t];return a[r]&&(a[r]=Object.assign(Object.assign({},a[r]),{feedback:e})),a}));try{yield function({endpoint:e,searchQueryId:t,response:r,headers:a,conversationId:o}){return V(this,void 0,void 0,(function*(){yield Ue(e,{method:"POST",headers:a,body:Object.assign({searchQueryId:t,response:r},o&&{conversationId:o})})}))}({endpoint:p,searchQueryId:t,response:e,headers:v,conversationId:ae})}catch(e){console.error("Error sending feedback:",e),Z((e=>{const t=[...e];return t[r]&&(t[r]=Object.assign(Object.assign({},t[r]),{feedback:void 0})),t}))}}})),ze=(e=P.trim())=>V(void 0,void 0,void 0,(function*(){if(e){M(!0),B(!0);const t=ae||Ye();ae||ne(t);const r={question:e,answer:"",isLoading:!0,isSearchLoading:!0,searchResults:[],searchQueryId:void 0,isStreaming:!1};Z((e=>[...e,r]));const a=W.length;X(a),ke(),yield Promise.resolve();try{const r=yield Ze({endpoint:d,query:e,collectionId:G,headers:v,conversationId:t});Z((e=>{const t=[...e];return t[t.length-1]&&(t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{searchResults:r.results,searchQueryId:r.searchQueryId,isSearchLoading:!1})),t}));const a=yield De({endpoint:m,searchQueryId:r.searchQueryId,headers:v,conversationId:t});yield Ee(a)}catch(e){console.error("Error generating answer:",e),Z((e=>{const t=[...e];return t[t.length-1]&&(t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{answer:A.errorText||"An error occurred",isLoading:!1,isSearchLoading:!1,isStreaming:!1})),t}))}finally{M(!1)}}})),je=()=>V(void 0,void 0,void 0,(function*(){if(F.trim()){const e=F;_(e),Q(""),we.current&&(we.current.style.height="auto"),yield ze(e)}}));o((()=>{const e=()=>{const e=window.innerHeight+window.pageYOffset>=document.documentElement.scrollHeight-100;Y(!e)};return window.addEventListener("scroll",e),()=>window.removeEventListener("scroll",e)}),[]),o((()=>()=>{J.forEach((e=>URL.revokeObjectURL(e.preview)))}),[J]);o((()=>{const e=()=>{new URLSearchParams(window.location.search).get("conversation")||(_(""),Q(""),B(!1),Z([]),X(0),K([]),fe.current&&(fe.current.style.height="auto"))};return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)}),[]);const Ce=e=>{ze(e)};return t.createElement("div",{className:"relative min-h-screen"},t.createElement("div",{ref:ye,className:"w-full max-w-3xl mx-auto flex flex-col items-center space-y-8 px-4 py-20",style:{"--surface-border":$.surfaceBorder,"--surface-hover":$.surfaceHover}},t.createElement(I,null,me?t.createElement(S.div,{key:"loading",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"w-full flex items-center justify-center py-20"},t.createElement("div",{className:"flex flex-col items-center gap-4"},t.createElement("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-t-transparent",style:{borderColor:$.primary}}),t.createElement("p",{className:"text-sm",style:{color:$.text}},"Loading conversation..."))):U?t.createElement(S.div,{key:"results",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.5},className:"w-full space-y-4 py-4 mb-20"},W.map(((e,r)=>t.createElement(S.div,{key:r,ref:e=>be.current[r]=e,initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.1*r}},t.createElement($e,{answer:e.answer,question:e.question,theme:$,searchResults:e.searchResults,isStreaming:e.isStreaming,searchQueryId:e.searchQueryId,feedback:e.feedback,onFeedback:w||!p?void 0:t=>Ne(t,e.searchQueryId,r),disableFeedback:w||!p,textConfig:A,isLoading:e.isLoading,isSearchLoading:e.isSearchLoading}),r===W.length-1&&!g&&e.followUpQuestions&&!e.isStreaming&&t.createElement("div",{className:"mt-4"},t.createElement(Ae,{questions:e.followUpQuestions,onQuestionClick:Ce,theme:$})))))):t.createElement(S.div,{key:"search",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.5},className:"w-full space-y-8"},t.createElement("div",{className:"w-full text-center space-y-4"},t.createElement(S.h1,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.3},className:"text-5xl font-bold",style:{color:$.text}},A.headerText)),t.createElement(S.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.4}},t.createElement("div",{className:"relative w-full rounded-md overflow-hidden",style:{backgroundColor:$.background,borderColor:$.border,borderWidth:"1px",borderStyle:"solid"}},t.createElement("div",{className:"p-3 flex items-center"},t.createElement(k,{className:"h-5 w-5 text-gray-400 mr-2"}),t.createElement("textarea",{ref:fe,placeholder:A.searchPlaceholder,value:P,onChange:e=>{var t;_(e.target.value),(t=e.target).style.height="auto",t.style.height=`${t.scrollHeight}px`},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),ze())},className:"w-full resize-none outline-none text-lg py-1 font-light min-h-[36px] overflow-hidden placeholder:text-gray-400 border-none bg-transparent",style:{color:$.text,outline:"none",boxShadow:"none",fontSize:"16px"},rows:1})),!h&&J.length>0&&t.createElement("div",{className:"flex gap-2 mt-3 overflow-x-auto pb-1 px-3"},J.map(((e,r)=>t.createElement("div",{key:r,className:"relative group rounded-lg overflow-hidden flex-shrink-0",style:{width:"80px",height:"80px"}},t.createElement("img",{src:e.preview,alt:`Attached ${r+1}`,className:"w-full h-full object-cover"}),t.createElement("button",{onClick:()=>(e=>{K((t=>(URL.revokeObjectURL(t[e].preview),t.filter(((t,r)=>r!==e)))))})(r),className:"absolute top-1 right-1 bg-black bg-opacity-50 rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200"},t.createElement(E,{className:"h-3 w-3 text-white"})))))),t.createElement("div",{className:"flex items-center justify-between px-3 py-2 bg-gray-100 border-t border-gray-200"},t.createElement("div",{className:"flex gap-2"},i.length>0&&t.createElement(se,null,t.createElement(le,{asChild:!0},t.createElement(ie,{variant:"ghost",size:"sm",className:"hover:bg-gray-200 transition-all duration-200 rounded-md h-8 flex items-center gap-2 text-gray-700"},G&&"all"!==G?t.createElement(N,{className:"h-5 w-5 text-green-500"}):t.createElement(z,{className:"h-5 w-5 text-gray-400"}),(null===(T=i.find((e=>e.id===G)))||void 0===T?void 0:T.name)||A.allDocumentsText,t.createElement(f,{className:"h-4 w-4 opacity-50"}))),t.createElement(ce,null,i.map((e=>t.createElement(de,{key:e.id,onClick:()=>{return t=e.id,ee(t),void(null==c||c(t));var t},className:e.id===G?"bg-gray-100":""},e.id===G?t.createElement(N,{className:"h-4 w-4 mr-2 text-green-500"}):t.createElement(z,{className:"h-4 w-4 mr-2 text-gray-400"}),e.name))))),!h&&t.createElement(t.Fragment,null,t.createElement("input",{type:"file",ref:ve,accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{const t=e.target.files;if(t){const e=Array.from(t).map((e=>({file:e,preview:URL.createObjectURL(e)})));K((t=>[...t,...e]))}ve.current&&(ve.current.value="")}}),t.createElement(ie,{variant:"ghost",size:"sm",className:"hover:bg-gray-200 rounded-md h-8 text-gray-700",onClick:()=>{var e;return null===(e=ve.current)||void 0===e?void 0:e.click()}},t.createElement(j,{className:"h-4 w-4 mr-1.5"}),A.attachImageText))),t.createElement("div",{className:"flex items-center"},t.createElement(ie,{size:"sm",disabled:!P||q,className:"rounded-md h-8 w-8 bg-[#86efac] hover:bg-[#86efac]/90 disabled:opacity-50",onClick:()=>{ze()}},q?t.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-2 border-t-transparent",style:{borderColor:"white"}}):t.createElement(C,{className:"h-4 w-4 text-gray-700"})))))),t.createElement(he,{suggestions:e||[],onQuestionClick:e=>{if(e.conversationId&&u)return pe(!0),B(!0),void He({endpoint:u,conversationId:e.conversationId,headers:v}).then((t=>{Z(t.data),ne(e.conversationId),B(!0)})).catch((e=>{console.error("Error loading conversation:",e),ge(A.errorText||"An error occurred"),B(!1),Z([]);const t=Ye();ne(t);const r=new URL(window.location.href);r.searchParams.delete("conversation"),window.history.replaceState({},"",r.toString())})).finally((()=>{pe(!1)}));if(B(!0),M(!0),!ae){const e=Ye();ne(e)}Z((t=>[...t,{question:e.question,answer:"",isLoading:!0,isSearchLoading:!0}])),V(void 0,void 0,void 0,(function*(){try{const t=yield Ze({endpoint:d,query:e.question,collectionId:G,headers:v,conversationId:ae}),r=t.results;Z((e=>{const a=[...e];return a[a.length-1]=Object.assign(Object.assign({},a[a.length-1]),{searchResults:r,searchQueryId:t.searchQueryId,isSearchLoading:!1}),a}));const a=yield De({endpoint:m,searchQueryId:t.searchQueryId,headers:v,conversationId:ae});yield Ee(a)}catch(e){console.error("Error generating answer:",e),Z((e=>{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{answer:A.errorText||"An error occurred",isLoading:!1,isSearchLoading:!1}),t}))}finally{M(!1),ke()}}))},borderColor:$.border,title:A.suggestionsTitle}),b)),U&&W.length>1&&t.createElement("div",{className:"hidden sm:block"},t.createElement(Pe,{questions:W.map((e=>e.question)),activeIndex:H,onNavigate:e=>{X(e),(e=>{requestAnimationFrame((()=>{const t=be.current[e];if(t){const e=t.getBoundingClientRect(),r=window.pageYOffset||document.documentElement.scrollTop,a=e.top+r-80;window.scrollTo({top:a,behavior:"smooth"})}}))})(e)},theme:$,offset:y})),U&&te&&t.createElement(S.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},className:"fixed bottom-4 left-4 right-4 max-w-3xl mx-auto z-10",style:{left:`${y}px`}},t.createElement("div",{className:"rounded-full h-[44px] sm:h-[52px] flex items-center justify-between",style:{backgroundColor:$.background,borderColor:$.border,borderWidth:"1px",borderStyle:"solid",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",padding:"0 15px"}},t.createElement("div",{className:"flex items-center gap-2 sm:gap-3 flex-grow overflow-hidden h-full"},t.createElement(k,{className:"h-4 w-4 sm:h-5 sm:w-5 flex-shrink-0",style:{color:$.primary}}),t.createElement("div",{className:"flex-grow",style:{paddingTop:"15px",paddingBottom:"10px"}},t.createElement("textarea",{ref:we,placeholder:A.followUpPlaceholder,value:F,onChange:e=>{Q(e.target.value);e.target.style.height="auto",e.target.style.height=`${Math.min(e.target.scrollHeight,100)}px`,e.target.scrollHeight>100?e.target.style.overflowY="auto":e.target.style.overflowY="hidden"},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),je())},disabled:q,className:"w-full bg-transparent outline-none text-sm sm:text-base resize-none overflow-hidden disabled:opacity-50 border-none min-h-[24px] max-h-[100px] placeholder:text-sm sm:placeholder:text-base",style:{color:$.text,outline:"none",boxShadow:"none",fontSize:"16px",lineHeight:"24px"},rows:1}))),t.createElement("div",{className:"flex items-center gap-2 sm:gap-3 ml-2 sm:ml-3 flex-shrink-0"},t.createElement(ie,{size:"icon",variant:"ghost",disabled:q||!F.trim(),className:"rounded-full transition-colors duration-200 disabled:opacity-50 h-8 w-8 sm:h-9 sm:w-9 flex items-center justify-center",style:{color:$.text,backgroundColor:"transparent"},onClick:()=>{je()}},q?t.createElement("div",{className:"animate-spin rounded-full h-4 w-4 sm:h-5 sm:w-5 border-2",style:{borderColor:`${$.text}40`,borderTopColor:$.text}}):t.createElement(O,{className:"h-4 w-4 sm:h-5 sm:w-5"}))))),D&&U&&t.createElement(_e,{onClick:ke,theme:$})))}));Je.displayName="ChatSearch";export{Je as ChatSearch};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainfish-ai/components",
3
- "version": "0.0.29",
3
+ "version": "0.0.31",
4
4
  "description": "Brainfish Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/cjs/index.js",
@@ -29,8 +29,8 @@
29
29
  "class-variance-authority": "0.7.0",
30
30
  "clsx": "2.x",
31
31
  "lucide-react": "^0.292.0",
32
- "react": "18.2.0",
33
- "react-dom": "18.2.0",
32
+ "react": "^17.0.0",
33
+ "react-dom": "^17.0.0",
34
34
  "tailwind-merge": "^2.0.0",
35
35
  "tailwindcss-animate": "1.0.7"
36
36
  },
@@ -91,7 +91,7 @@
91
91
  "rollup-plugin-terser": "^7.0.2",
92
92
  "storybook": "^7.5.2",
93
93
  "tailwind-merge": "^2.0.0",
94
- "tailwindcss": "^3.3.5",
94
+ "tailwindcss": "^3.4.1",
95
95
  "tailwindcss-animate": "^1.0.7",
96
96
  "tslib": "^2.6.2",
97
97
  "typescript": "5.2.2",