{"version":3,"file":"Chatbot.BdbCWiC8.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/nbgHIrU5nAxTVWkMtkP8/pjmkBaOKoZU0DqJY9HCw/Chatbot.js"],"sourcesContent":["// Chatbot component using Vercel API with OpenAI integration\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function Chatbot(props){const{systemPrompt,placeholder,loadingText,errorText,backgroundColor,inputBackgroundColor,textColor,buttonColor,buttonTextColor,borderColor,font,buttonFont,borderRadius,padding,placeholderTextColor,placeholderPadding,buttonPadding}=props;const[input,setInput]=useState(\"\");const[response,setResponse]=useState(\"\");const[isLoading,setLoading]=useState(false);const[error,setError]=useState(\"\");const handleSubmit=async e=>{e.preventDefault();if(!input.trim())return;setLoading(true);setError(\"\");setResponse(\"\");try{const res=await fetch(\"https://v0-deep-adalja-chatbot-main-18.vercel.app/api/assistant\",{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({userPrompt:input})});const data=await res.json();setResponse(data.reply);if(!res.ok||!data.reply){throw new Error(data?.error||\"Invalid response\");}startTransition(()=>{setResponse(data.reply);setInput(\"\");});}catch(err){setError(errorText||\"Something went wrong.\");}finally{setLoading(false);}};const isFixedWidth=props?.style&&props.style.width===\"100%\";const isFixedHeight=props?.style&&props.style.height===\"100%\";return /*#__PURE__*/_jsxs(\"div\",{style:{...props.style,position:\"relative\",backgroundColor,borderRadius,padding,display:\"flex\",flexDirection:\"column\",gap:16,...isFixedWidth?{}:{minWidth:\"max-content\",width:400},...isFixedHeight?{}:{minHeight:\"max-content\"},...font,color:textColor},children:[/*#__PURE__*/_jsxs(\"form\",{onSubmit:handleSubmit,style:{display:\"flex\",gap:8,alignItems:\"center\"},children:[/*#__PURE__*/_jsx(\"input\",{type:\"text\",value:input,onChange:e=>setInput(e.target.value),placeholder:placeholder,disabled:isLoading,style:{flex:1,height:40,padding:`0 ${placeholderPadding}px`,backgroundColor:inputBackgroundColor,border:`1px solid ${borderColor}`,borderRadius:borderRadius,color:textColor,outline:\"none\",...font,\"::placeholder\":{color:placeholderTextColor}}}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",disabled:isLoading||!input.trim(),style:{height:40,width:40,padding:`${buttonPadding}px`,backgroundColor:buttonColor,color:buttonTextColor,border:\"none\",borderRadius:borderRadius,cursor:isLoading||!input.trim()?\"not-allowed\":\"pointer\",opacity:isLoading||!input.trim()?.6:1,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",fontSize:\"16px\",...buttonFont},children:isLoading?\"...\":\"→\"})]}),(response||error||isLoading)&&/*#__PURE__*/_jsxs(\"div\",{style:{padding:16,backgroundColor:inputBackgroundColor,borderRadius:borderRadius,border:`1px solid ${borderColor}`,minHeight:60,display:\"flex\",alignItems:isLoading?\"center\":\"flex-start\",justifyContent:isLoading?\"center\":\"flex-start\"},children:[isLoading&&/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",gap:8},children:[/*#__PURE__*/_jsx(\"div\",{style:{width:16,height:16,border:`2px solid ${borderColor}`,borderTop:`2px solid ${buttonColor}`,borderRadius:\"50%\",animation:\"spin 1s linear infinite\"}}),/*#__PURE__*/_jsx(\"span\",{style:{opacity:.7},children:loadingText})]}),error&&/*#__PURE__*/_jsx(\"div\",{style:{color:\"#FF5588\",...font},children:error}),response&&!isLoading&&/*#__PURE__*/_jsx(\"div\",{style:{whiteSpace:\"pre-wrap\",lineHeight:1.5,...font},children:response})]}),/*#__PURE__*/_jsx(\"style\",{children:`\n                    @keyframes spin {\n                        0% { transform: rotate(0deg); }\n                        100% { transform: rotate(360deg); }\n                    }\n                `})]});}addPropertyControls(Chatbot,{apiKey:{type:ControlType.String,title:\"OpenAI API Key\",defaultValue:\"\",placeholder:\"sk-...\",obscured:true},systemPrompt:{type:ControlType.String,title:\"System Prompt\",defaultValue:\"You are a helpful assistant. Provide clear and concise answers.\",displayTextArea:true},placeholder:{type:ControlType.String,title:\"Input Placeholder\",defaultValue:\"Ask me anything about Deep Adalja...\"},submitLabel:{type:ControlType.String,title:\"Submit Button Text\",defaultValue:\"Send\"},loadingText:{type:ControlType.String,title:\"Loading Text\",defaultValue:\"Thinking...\"},errorText:{type:ControlType.String,title:\"Error Message\",defaultValue:\"Sorry, something went wrong. Please try again.\"},backgroundColor:{type:ControlType.Color,title:\"Background Color\",defaultValue:\"#FFFFFF\"},inputBackgroundColor:{type:ControlType.Color,title:\"Input Background\",defaultValue:\"#F5F5F5\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},buttonColor:{type:ControlType.Color,title:\"Button Color\",defaultValue:\"#000000\"},buttonTextColor:{type:ControlType.Color,title:\"Button Text Color\",defaultValue:\"#FFFFFF\"},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"#EEEEEE\"},placeholderTextColor:{type:ControlType.Color,title:\"Placeholder Text Color\",defaultValue:\"#CCCCCC\"},placeholderPadding:{type:ControlType.Number,title:\"Input Padding\",defaultValue:12,min:0,max:32,step:1,unit:\"px\"},buttonPadding:{type:ControlType.Number,title:\"Button Padding\",defaultValue:8,min:0,max:24,step:1,unit:\"px\"},font:{type:ControlType.Font,title:\"Text Font\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},buttonFont:{type:ControlType.Font,title:\"Button Font\",defaultValue:{fontSize:\"14px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:32,step:1,unit:\"px\"},padding:{type:ControlType.Number,title:\"Padding\",defaultValue:16,min:0,max:64,step:1,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Chatbot\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Chatbot.map"],"mappings":"gRAIG,SAAwB,EAAQ,EAAM,CAAC,GAAK,CAAC,eAAa,cAAY,cAAY,YAAU,kBAAgB,uBAAqB,YAAU,cAAY,kBAAgB,cAAY,OAAK,aAAW,eAAa,UAAQ,uBAAqB,qBAAmB,iBAAe,EAAW,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAM,CAAC,EAAS,GAAaA,EAAS,GAAG,CAAM,CAAC,EAAU,GAAYA,EAAS,GAAM,CAAM,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAO,EAAa,KAAM,IAAG,CAAC,KAAE,gBAAgB,CAAK,EAAM,MAAM,CAAsC,CAA9B,EAAW,GAAK,CAAC,EAAS,GAAG,CAAC,EAAY,GAAG,CAAC,GAAG,CAAC,IAAM,EAAI,MAAM,MAAM,kEAAkE,CAAC,OAAO,OAAO,QAAQ,CAAC,eAAe,mBAAmB,CAAC,KAAK,KAAK,UAAU,CAAC,WAAW,EAAM,CAAC,CAAC,CAAC,CAAO,EAAK,MAAM,EAAI,MAAM,CAAyB,GAAxB,EAAY,EAAK,MAAM,CAAI,CAAC,EAAI,IAAI,CAAC,EAAK,MAAO,MAAU,MAAM,GAAM,OAAO,mBAAmB,CAAE,MAAoB,CAAC,EAAY,EAAK,MAAM,CAAC,EAAS,GAAG,EAAG,MAAY,CAAC,EAAS,GAAW,wBAAwB,QAAS,CAAC,EAAW,GAAM,IAAU,EAAa,GAAO,OAAO,EAAM,MAAM,QAAQ,OAAa,EAAc,GAAO,OAAO,EAAM,MAAM,SAAS,OAAO,OAAoB,EAAM,MAAM,CAAC,MAAM,CAAC,GAAG,EAAM,MAAM,SAAS,WAAW,kB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