import { f as fallback } from './async-D55cHugf.js';
import { d as bind_props, f as attr_class, j as clsx, e as ensure_array_like, i as stringify, g as attr_style, a as attr, c as spread_props } from './index-u8mz_F03.js';
import './2-BLdXJizP.js';
import { $, c, b } from './utils.svelte-B2py64Fz.js';
import { c as c$1 } from './Image-CuPo5pWT.js';
import { c as createEventDispatcher, o as onDestroy } from './index-server-CQz6EZl_.js';
import { w } from './IconButton-BRnu7KaR.js';
import { e } from './Check-C7_ZsXgh.js';
import { h } from './Copy-B8YOhH7c.js';
import { o } from './Clear-D7Yjckqz.js';
import { l } from './Download-DcU5dONL.js';
import { r as r$2 } from './Edit-DWZSi_T0.js';
import { r as r$1 } from './Undo-Ce01x-M5.js';
import { u as u$1 } from './DownloadLink-nj1p0krE.js';
import { u, y as y$1 } from './ShareButton-7VTs9dOO.js';
import { y } from './IconButtonWrapper-CjFRPb3y.js';
import { i } from './File-DQh5d1OO.js';
import { Q as Qt$1 } from './MarkdownCode-DLHRxFlS.js';
import { r } from './Trash-DLGOAhrN.js';
import { t } from './Music-B6sg6ISZ.js';
import { G } from './Block-DZmzQwnI.js';
import { k } from './BlockLabel-bKYWnOzQ.js';
import { W } from './index3-Df92vI-L.js';
import { e as escape_html } from './escaping-CBnpiEl5.js';
import './context-CBkBucIx.js';
import './index5-BoOEKc6P.js';
import './dev-fallback-Bc5Ork7Y.js';
import './index-Cg-Pg6j3.js';
import './clone-Yk88IHKV.js';
import './prism-python--2v-p3P4.js';
import './index50-G3WrDDFf.js';
import 'path';
import 'url';
import 'fs';
import './html-CfyvkLET.js';

function Yt(e){e.push('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--carbon" width="100%" height="100%" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path fill="currentColor" d="M17.74 30L16 29l4-7h6a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h9v2H6a4 4 0 0 1-4-4V8a4 4 0 0 1 4-4h20a4 4 0 0 1 4 4v12a4 4 0 0 1-4 4h-4.84Z"></path><path fill="currentColor" d="M8 10h16v2H8zm0 6h10v2H8z"></path></svg>');}function Kt(e){e.push('<svg class="dropdown-arrow svelte-1w1fnc7" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 18 18"><circle cx="9" cy="9" r="8" class="circle svelte-1w1fnc7"></circle><path d="M5 8l4 4 4-4z"></path></svg>');}function Qt(e){e.push('<svg width="100%" height="100%" stroke-width="1.5" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" color="currentColor"><path d="M19.1679 9C18.0247 6.46819 15.3006 4.5 11.9999 4.5C8.31459 4.5 5.05104 7.44668 4.54932 11" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M16 9H19.4C19.7314 9 20 8.73137 20 8.4V5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M4.88146 15C5.92458 17.5318 8.64874 19.5 12.0494 19.5C15.7347 19.5 18.9983 16.5533 19.5 13" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M8.04932 15H4.64932C4.31795 15 4.04932 15.2686 4.04932 15.6V19" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg>');}const Xt=async(e,l=1800)=>{let t=[...e],o=await ht(t);if(o.length>l&&t.length>2){const u=t[0],n=t[t.length-1];t=[u,n],o=await ht(t);}return o.length>l&&t.length>0&&(t=t.map(n=>{if(n.type==="text"){const s=Math.floor(l/t.length)-20;if(n.content.length>s)return {...n,content:n.content.substring(0,s)+"..."}}return n}),o=await ht(t)),o},ht=async e=>(await Promise.all(e.map(async t=>{if(t.role==="system")return "";let o=t.role==="user"?"😃":"🤖",u="";if(t.type==="text"){const n={audio:/<audio.*?src="(\/file=.*?)"/g,video:/<video.*?src="(\/file=.*?)"/g,image:/<img.*?src="(\/file=.*?)".*?\/>|!\[.*?\]\((\/file=.*?)\)/g};u=t.content;for(let[s,h]of Object.entries(n)){let c;for(;(c=h.exec(t.content))!==null;){const i=c[1]||c[2],p=await b(i);u=u.replace(i,p);}}}else {if(!t.content.value)return "";const n=t.content.component==="video"?t.content.value?.video.path:t.content.value,s=await b(n);t.content.component==="audio"?u=`<audio controls src="${s}"></audio>`:t.content.component==="video"?u=s:t.content.component==="image"&&(u=`<img src="${s}" />`);}return `${o}: ${u}`}))).filter(t=>t!=="").join(`
`),$t=(e,l)=>e.replace('src="/file',`src="${l}file`);function tl(e,l){if(!e){const t=l?.path;if(t){const o=t.toLowerCase();if(o.endsWith(".glb")||o.endsWith(".gltf")||o.endsWith(".obj")||o.endsWith(".stl")||o.endsWith(".splat")||o.endsWith(".ply"))return "model3d"}return "file"}return e.includes("audio")?"audio":e.includes("video")?"video":e.includes("image")?"image":e.includes("model")?"model3d":"file"}function ll(e){const l=Array.isArray(e.file)?e.file[0]:e.file,t=tl(l?.mime_type,l);return {component:t,value:t==="file"?Array.isArray(e.file)?e.file:[e.file]:e.file,alt_text:e.alt_text,constructor_args:{},props:{}}}function al(e,l,t,o){let u;return l.type==="text"?u={role:e.role,metadata:e.metadata,content:$t(l.text,t),type:"text",index:o,options:e.options}:l.type==="file"?u={role:e.role,metadata:e.metadata,content:ll(l),type:"component",index:o,options:e.options}:u={role:e.role,metadata:e.metadata,content:l,type:"component",index:o,options:e.options},u}function el(e,l){if(e===null)return e;const t=new Map;return e.flatMap((o,u)=>{const n=o.content.map(s=>al(o,s,l,u));for(const s of n){const{id:h,title:c,parent_id:i}=o.metadata||{};if(i){const p=t.get(String(i));if(p){const _={...s,children:[]};return p.children.push(_),h&&c&&t.set(String(h),_),null}}if(h&&c){const p={...s,children:[]};return t.set(String(h),p),p}}return n}).filter(o=>o!==null)}function sl(e){return e.type==="component"}function kt(e,l){const t=e[e.length-1].role==="assistant",o=e[e.length-1].index;return JSON.stringify(o)===JSON.stringify(l[l.length-1].index)&&t}function ol(e,l=true){const t=[];let o=[],u=null;for(const n of e)if(n.role==="assistant"||n.role==="user"){if(!l){t.push([n]);continue}n.role===u?o.push(n):(o.length>0&&t.push(o),o=[n],u=n.role);}return o.length>0&&t.push(o),t}async function il(e,l,t){for(const o of e){if(l[o]||o==="file")continue;const u=o==="dataframe"?"component":"base",{component:n}=t(o,u),s=await n;l[o]=s.default;}return l}function xt(e){if(!e)return [];let l=new Set;return e.forEach(t=>{t.type==="component"&&l.add(t.content.component);}),Array.from(l)}function ft(e,l=0){let t="";const o="  ".repeat(l);e.metadata?.title&&(t+=`${o}${l>0?"- ":""}${e.metadata.title}
`),typeof e.content=="string"&&(t+=`${o}  ${e.content}
`);const u=e;return u.children?.length>0&&(t+=u.children.map(n=>ft(n,l+1)).join("")),t}function nl(e){return Array.isArray(e)?e.map(l=>l.metadata?.title?ft(l):l.content).join(`
`):e.metadata?.title?ft(e):e.content}function rt(e){return Array.isArray(e)&&e.every(l=>typeof l.content=="string")||!Array.isArray(e)&&typeof e.content=="string"}function ul(e){e.push('<svg width="100%" height="100%" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M11.25 6.61523H9.375V1.36523H11.25V6.61523ZM3.375 1.36523H8.625V6.91636L7.48425 8.62748L7.16737 10.8464C7.14108 11.0248 7.05166 11.1879 6.91535 11.3061C6.77904 11.4242 6.60488 11.4896 6.4245 11.4902H6.375C6.07672 11.4899 5.79075 11.3713 5.57983 11.1604C5.36892 10.9495 5.2503 10.6635 5.25 10.3652V8.11523H2.25C1.85233 8.11474 1.47109 7.95654 1.18989 7.67535C0.908691 7.39415 0.750496 7.01291 0.75 6.61523V3.99023C0.750992 3.29435 1.02787 2.62724 1.51994 2.13517C2.01201 1.64311 2.67911 1.36623 3.375 1.36523Z" fill="currentColor"></path></svg>');}function cl(e){e.push('<svg width="100%" height="100%" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2.25 8.11523H4.5V10.3652C4.5003 10.6635 4.61892 10.9495 4.82983 11.1604C5.04075 11.3713 5.32672 11.4899 5.625 11.4902H6.42488C6.60519 11.4895 6.77926 11.4241 6.91549 11.3059C7.05172 11.1878 7.14109 11.0248 7.16737 10.8464L7.48425 8.62748L8.82562 6.61523H11.25V1.36523H3.375C2.67911 1.36623 2.01201 1.64311 1.51994 2.13517C1.02787 2.62724 0.750992 3.29435 0.75 3.99023V6.61523C0.750496 7.01291 0.908691 7.39415 1.18989 7.67535C1.47109 7.95654 1.85233 8.11474 2.25 8.11523ZM9 2.11523H10.5V5.86523H9V2.11523ZM1.5 3.99023C1.5006 3.49314 1.69833 3.01657 2.04983 2.66507C2.40133 2.31356 2.8779 2.11583 3.375 2.11523H8.25V6.12661L6.76575 8.35298L6.4245 10.7402H5.625C5.52554 10.7402 5.43016 10.7007 5.35983 10.6304C5.28951 10.5601 5.25 10.4647 5.25 10.3652V7.36523H2.25C2.05118 7.36494 1.86059 7.28582 1.72 7.14524C1.57941 7.00465 1.5003 6.81406 1.5 6.61523V3.99023Z" fill="currentColor"></path></svg>');}function hl(e){e.push('<svg width="100%" height="100%" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0.75 6.24023H2.625V11.4902H0.75V6.24023ZM8.625 11.4902H3.375V5.93911L4.51575 4.22798L4.83263 2.00911C4.85892 1.83065 4.94834 1.66754 5.08465 1.5494C5.22096 1.43125 5.39512 1.36591 5.5755 1.36523H5.625C5.92328 1.36553 6.20925 1.48415 6.42017 1.69507C6.63108 1.90598 6.7497 2.19196 6.75 2.49023V4.74023H9.75C10.1477 4.74073 10.5289 4.89893 10.8101 5.18012C11.0913 5.46132 11.2495 5.84256 11.25 6.24023V8.86523C11.249 9.56112 10.9721 10.2282 10.4801 10.7203C9.98799 11.2124 9.32089 11.4892 8.625 11.4902Z" fill="currentColor"></path></svg>');}function pl(e){e.push('<svg width="100%" height="100%" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9.75 4.74023H7.5V2.49023C7.4997 2.19196 7.38108 1.90598 7.17017 1.69507C6.95925 1.48415 6.67328 1.36553 6.375 1.36523H5.57512C5.39481 1.366 5.22074 1.43138 5.08451 1.54952C4.94828 1.66766 4.85891 1.83072 4.83262 2.00911L4.51575 4.22798L3.17438 6.24023H0.75V11.4902H8.625C9.32089 11.4892 9.98799 11.2124 10.4801 10.7203C10.9721 10.2282 11.249 9.56112 11.25 8.86523V6.24023C11.2495 5.84256 11.0913 5.46132 10.8101 5.18012C10.5289 4.89893 10.1477 4.74073 9.75 4.74023ZM3 10.7402H1.5V6.99023H3V10.7402ZM10.5 8.86523C10.4994 9.36233 10.3017 9.8389 9.95017 10.1904C9.59867 10.5419 9.1221 10.7396 8.625 10.7402H3.75V6.72886L5.23425 4.50248L5.5755 2.11523H6.375C6.47446 2.11523 6.56984 2.15474 6.64017 2.22507C6.71049 2.2954 6.75 2.39078 6.75 2.49023V5.49023H9.75C9.94882 5.49053 10.1394 5.56965 10.28 5.71023C10.4206 5.85082 10.4997 6.04141 10.5 6.24023V8.86523Z" fill="currentColor"></path></svg>');}function _l(e){e.push('<svg id="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="none"><path fill="currentColor" d="M6,30H4V2H28l-5.8,9L28,20H6ZM6,18H24.33L19.8,11l4.53-7H6Z"></path></svg>');}function fl(e){e.push('<svg id="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="none"><path fill="currentColor" d="M4,2H28l-5.8,9L28,20H6v10H4V2z"></path></svg>');}function ml(e,l){e.component(t=>{let o,u=l.i18n,n=l.handle_action,s=l.feedback_options,h=fallback(l.selected,null);function c(i){h=h===i?null:i,n(h);}if(o=s.filter(i=>i!=="Like"&&i!=="Dislike"),s.includes("Like")||s.includes("Dislike")?(t.push("<!--[-->"),s.includes("Dislike")?(t.push("<!--[-->"),w(t,{Icon:h==="Dislike"?ul:cl,label:h==="Dislike"?"Disliked":u("chatbot.dislike"),color:h==="Dislike"?"var(--color-accent)":"var(--block-label-text-color)",onclick:()=>c("Dislike")})):t.push("<!--[!-->"),t.push("<!--]--> "),s.includes("Like")?(t.push("<!--[-->"),w(t,{Icon:h==="Like"?hl:pl,label:h==="Like"?"Liked":u("chatbot.like"),color:h==="Like"?"var(--color-accent)":"var(--block-label-text-color)",onclick:()=>c("Like")})):t.push("<!--[!-->"),t.push("<!--]-->")):t.push("<!--[!-->"),t.push("<!--]--> "),o.length>0){t.push("<!--[-->"),t.push('<div class="extra-feedback no-border svelte-fvat56">'),w(t,{Icon:h&&o.includes(h)?fl:_l,label:"Feedback",color:h&&o.includes(h)?"var(--color-accent)":"var(--block-label-text-color)"}),t.push('<!----> <div class="extra-feedback-options svelte-fvat56"><!--[-->');const i=ensure_array_like(o);for(let p=0,_=i.length;p<_;p++){let v=i[p];t.push(`<button class="extra-feedback-option svelte-fvat56"${attr_style("",{"font-weight":h===v?"bold":"normal"})}>${escape_html(v)}</button>`);}t.push("<!--]--></div></div>");}else t.push("<!--[!-->");t.push("<!--]-->"),bind_props(l,{i18n:u,handle_action:n,feedback_options:s,selected:h});});}function dl(e$1,l){e$1.component(t=>{let u=false,n=l.value,s=fallback(l.watermark,null),h$1=l.i18n,c;function i(){u=true,c&&clearTimeout(c),c=setTimeout(()=>{u=false;},2e3);}async function p(){if("clipboard"in navigator){const _=s?`${n}

${s}`:n;await navigator.clipboard.writeText(_),i();}else {const _=document.createElement("textarea"),v=s?`${n}

${s}`:n;_.value=v,_.style.position="absolute",_.style.left="-999999px",document.body.prepend(_),_.select();try{document.execCommand("copy"),i();}catch(y){console.error(y);}finally{_.remove();}}}onDestroy(()=>{c&&clearTimeout(c);}),w(t,{onclick:p,label:h$1(u?"chatbot.copied_message":"chatbot.copy_message"),Icon:u?e:h}),bind_props(l,{value:n,watermark:s,i18n:h$1});});}function Ct(e$1,l$1){e$1.component(t=>{let o$1,u,n=l$1.i18n,s=l$1.likeable,h=l$1.feedback_options,c=l$1.show_retry,i=l$1.show_undo,p=l$1.show_edit,_=l$1.in_edit_mode,v=l$1.show_copy_button,y$2=fallback(l$1.watermark,null),r=l$1.message,L=l$1.position,z=l$1.avatar,M=l$1.generating,k=l$1.current_feedback,x=fallback(l$1.file,null),V=fallback(l$1.show_download_button,false),B=fallback(l$1.show_share_button,false),A=l$1.handle_action,j=l$1.layout,U=l$1.dispatch;o$1=rt(r)?nl(r):"",u=v&&r&&rt(r),u||c||i||p||s||V&&x?.url||B&&x?(t.push("<!--[-->"),t.push(`<div${attr_class(`message-buttons-${stringify(L)} ${stringify(j)} message-buttons ${stringify(z!==null&&"with-avatar")}`,"svelte-704d7y")}>`),y(t,{top_panel:false,children:f=>{_?(f.push("<!--[-->"),w(f,{label:n("chatbot.submit"),Icon:e,onclick:()=>A("edit_submit"),disabled:M}),f.push("<!----> "),w(f,{label:n("chatbot.cancel"),Icon:o,onclick:()=>A("edit_cancel"),disabled:M}),f.push("<!---->")):(f.push("<!--[!-->"),u?(f.push("<!--[-->"),dl(f,{value:o$1,watermark:y$2,i18n:n})):f.push("<!--[!-->"),f.push("<!--]--> "),V&&x?.url?(f.push("<!--[-->"),u$1(f,{href:x.is_stream?x.url?.replace("playlist.m3u8","playlist-file"):x.url,download:x.orig_name||x.path||"file",children:S=>{w(S,{Icon:l,label:n("common.download")});},$$slots:{default:true}})):f.push("<!--[!-->"),f.push("<!--]--> "),B&&x?(f.push("<!--[-->"),y$1(f,{i18n:n,formatter:async S=>{if(!S)return "";let W=await b(S.url);const T=S.mime_type||"";return T.startsWith("audio/")?`<audio controls src="${W}"></audio>`:T.startsWith("video/")?`<video controls src="${W}"></video>`:T.startsWith("image/")?`<img src="${W}" />`:""},value:x})):f.push("<!--[!-->"),f.push("<!--]--> "),c?(f.push("<!--[-->"),w(f,{Icon:Qt,label:n("chatbot.retry"),onclick:()=>A("retry"),disabled:M})):f.push("<!--[!-->"),f.push("<!--]--> "),i?(f.push("<!--[-->"),w(f,{label:n("chatbot.undo"),Icon:r$1,onclick:()=>A("undo"),disabled:M})):f.push("<!--[!-->"),f.push("<!--]--> "),p?(f.push("<!--[-->"),w(f,{label:n("chatbot.edit"),Icon:r$2,onclick:()=>A("edit"),disabled:M})):f.push("<!--[!-->"),f.push("<!--]--> "),s?(f.push("<!--[-->"),ml(f,{handle_action:A,feedback_options:h,selected:k,i18n:n})):f.push("<!--[!-->"),f.push("<!--]-->")),f.push("<!--]-->");}}),t.push("<!----></div>")):t.push("<!--[!-->"),t.push("<!--]-->"),bind_props(l$1,{i18n:n,likeable:s,feedback_options:h,show_retry:c,show_undo:i,show_edit:p,in_edit_mode:_,show_copy_button:v,watermark:y$2,message:r,position:L,avatar:z,generating:M,current_feedback:k,file:x,show_download_button:V,show_share_button:B,handle_action:A,layout:j,dispatch:U});});}function vl(e,l){e.component(t=>{let o=l.type,u=l.components,n=l.value,s=l.target,h=l.theme_mode,c=l.props,i=l.i18n,p=l.upload,_=l._fetch,v=l.allow_file_downloads,y=fallback(l.display_icon_button_wrapper_top_corner,false);o==="gallery"?(t.push("<!--[-->"),t.push("<!---->"),u[o]?.(t,spread_props([c,{value:n,display_icon_button_wrapper_top_corner:false,show_label:!!c.label,i18n:i,_fetch:_,allow_preview:false,interactive:false,mode:"minimal",fixed_height:1}])),t.push("<!---->")):(t.push("<!--[!-->"),o==="dataframe"?(t.push("<!--[-->"),t.push("<!---->"),u[o]?.(t,spread_props([c,{value:n,show_label:!!c.label,i18n:i,interactive:false,line_breaks:c.line_breaks,wrap:true,root:"",gradio:{dispatch:()=>{},i18n:i},datatype:c.datatype,latex_delimiters:c.latex_delimiters,col_count:c.col_count,row_count:c.row_count}])),t.push("<!---->")):(t.push("<!--[!-->"),o==="plot"?(t.push("<!--[-->"),t.push("<!---->"),u[o]?.(t,spread_props([c,{value:n,target:s,theme_mode:h,on_change:()=>{},bokeh_version:c.bokeh_version,caption:c.caption||"",show_actions_button:true}])),t.push("<!---->")):(t.push("<!--[!-->"),o==="audio"?(t.push("<!--[-->"),t.push("<!---->"),u[o]?.(t,spread_props([c,{value:n,show_label:!!c.label,show_share_button:false,i18n:i,waveform_settings:{...c.waveform_settings,autoplay:c.autoplay},show_download_button:false,display_icon_button_wrapper_top_corner:false,minimal:true}])),t.push("<!---->")):(t.push("<!--[!-->"),o==="video"?(t.push("<!--[-->"),t.push("<!---->"),u[o]?.(t,spread_props([c,{autoplay:c.autoplay,value:n.video||n,show_label:!!c.label,show_share_button:false,i18n:i,upload:p,display_icon_button_wrapper_top_corner:false,show_download_button:false,children:L=>{L.push('<track kind="captions"/>');},$$slots:{default:true}}])),t.push("<!---->")):(t.push("<!--[!-->"),o==="image"?(t.push("<!--[-->"),t.push("<div><!---->"),u[o]?.(t,spread_props([c,{value:n,show_label:!!c.label,display_icon_button_wrapper_top_corner:false,buttons:["fullscreen"],fullscreen:false,show_button_background:false,i18n:i}])),t.push("<!----></div>")):(t.push("<!--[!-->"),o==="html"?(t.push("<!--[-->"),t.push("<!---->"),u[o]?.(t,spread_props([c,{props:{value:n}}])),t.push("<!---->")):(t.push("<!--[!-->"),o==="model3d"?(t.push("<!--[-->"),t.push("<!---->"),u[o]?.(t,spread_props([c,{value:n,clear_color:c.clear_color,display_mode:c.display_mode,zoom_speed:c.zoom_speed,pan_speed:c.pan_speed},c.camera_position!==void 0&&{camera_position:c.camera_position},{has_change_history:true,show_label:!!c.label,root:"",interactive:false,show_share_button:false,gradio:{dispatch:()=>{},i18n:i},i18n:i}])),t.push("<!---->")):t.push("<!--[!-->"),t.push("<!--]-->")),t.push("<!--]-->")),t.push("<!--]-->")),t.push("<!--]-->")),t.push("<!--]-->")),t.push("<!--]-->")),t.push("<!--]-->")),t.push("<!--]-->"),bind_props(l,{type:o,components:u,value:n,target:s,theme_mode:h,props:c,i18n:i,upload:p,_fetch:_,allow_file_downloads:v,display_icon_button_wrapper_top_corner:y});});}function gl(e,l){e.component(t=>{let o=l.latex_delimiters,u=l.sanitize_html,n=l._fetch,s=l.i18n,h=l.line_breaks,c=l.upload,i$1=l.target,p=l.theme_mode,_=l._components,v=l.render_markdown,y=l.scroll,r=l.allow_file_downloads,L=l.display_consecutive_in_same_bubble,z=l.thought_index,M=fallback(l.allow_tags,false),k=l.message;if(k.type==="text")t.push("<!--[-->"),t.push('<div class="message-content">'),Qt$1(t,{message:k.content,latex_delimiters:o,sanitize_html:u,render_markdown:v,line_breaks:h,allow_tags:M,theme_mode:p}),t.push("<!----></div>");else {if(t.push("<!--[!-->"),k.type==="component"&&k.content.component in _)t.push("<!--[-->"),vl(t,{target:i$1,theme_mode:p,props:k.content.props,type:k.content.component,components:_,value:k.content.value,display_icon_button_wrapper_top_corner:z>0&&L,i18n:s,upload:c,_fetch:n,allow_file_downloads:r});else {if(t.push("<!--[!-->"),k.type==="component"&&k.content.component==="file"){t.push("<!--[-->"),t.push("<!--[-->");const x=ensure_array_like(k.content.value);for(let V=0,B=x.length;V<B;V++){const j=x[V];t.push('<div class="file-container svelte-e5gd5s"><div class="file-icon svelte-e5gd5s">'),i(t),t.push(`<!----></div> <div class="file-info svelte-e5gd5s"><a data-testid="chatbot-file" class="file-link svelte-e5gd5s"${attr("href",j.url)} target="_blank"${attr("download",window.__is_colab__?null:j?.orig_name||j?.path.split("/").pop()||"file")}><span class="file-name svelte-e5gd5s">${escape_html(j?.orig_name||j?.path.split("/").pop()||"file")}</span></a> <span class="file-type svelte-e5gd5s">${escape_html((j.orig_name||j.path||"").split(".").pop().toUpperCase())}</span></div></div>`);}t.push("<!--]-->");}else t.push("<!--[!-->");t.push("<!--]-->");}t.push("<!--]-->");}t.push("<!--]-->"),bind_props(l,{latex_delimiters:o,sanitize_html:u,_fetch:n,i18n:s,line_breaks:h,upload:c,target:i$1,theme_mode:p,_components:_,render_markdown:v,scroll:y,allow_file_downloads:r,display_consecutive_in_same_bubble:L,thought_index:z,allow_tags:M,message:k});});}function bl(e,l){e.component(t=>{let{thought:o,sanitize_html:u,latex_delimiters:n,render_markdown:s,allow_tags:h}=l;function c(_){return "children"in _}let i={...o,children:c(o)?o.children:[]};t.push(`<div class="thought-group svelte-18cn3o3"><div${attr_class("title svelte-18cn3o3",void 0,{expanded:false})}${attr("aria-busy",i.content===""||i.content===null)} role="button" tabindex="0"><span class="arrow svelte-18cn3o3"${attr_style("",{transform:"rotate(0deg)"})}>`),w(t,{Icon:Kt}),t.push("<!----></span> "),Qt$1(t,{message:i.metadata?.title||"",render_markdown:s,latex_delimiters:n,sanitize_html:u,allow_tags:h||false}),t.push("<!----> "),i.metadata?.status==="pending"?(t.push("<!--[-->"),t.push('<span class="loading-spinner svelte-18cn3o3"></span>')):t.push("<!--[!-->"),t.push("<!--]--> "),i?.metadata?.log||i?.metadata?.duration?(t.push("<!--[-->"),t.push('<span class="duration svelte-18cn3o3">'),i.metadata.log?(t.push("<!--[-->"),t.push(`${escape_html(i.metadata.log)}`)):t.push("<!--[!-->"),t.push("<!--]--> "),i.metadata.duration!==void 0?(t.push("<!--[-->"),t.push("("),Number.isInteger(i.metadata.duration)?(t.push("<!--[-->"),t.push(`${escape_html(i.metadata.duration)}s`)):(t.push("<!--[!-->"),i.metadata.duration>=.1?(t.push("<!--[-->"),t.push(`${escape_html(i.metadata.duration.toFixed(1))}s`)):(t.push("<!--[!-->"),t.push(`${escape_html((i.metadata.duration*1e3).toFixed(1))}ms`)),t.push("<!--]-->")),t.push("<!--]-->)")):t.push("<!--[!-->"),t.push("<!--]--></span>")):t.push("<!--[!-->"),t.push("<!--]--></div> "),t.push("<!--[!-->"),t.push("<!--]--></div>");});}function wl(e,l){e.component(t=>{let o=l.value,u=l.avatar_img,n=fallback(l.opposite_avatar_img,null),s=fallback(l.role,"user"),h=fallback(l.messages,()=>[],true),c=l.layout,i=l.render_markdown,p=l.latex_delimiters,_=l.sanitize_html,v=l.selectable,y=l._fetch,r=l.rtl,L=l.dispatch,z=l.i18n,M=l.line_breaks,k=l.upload,x=l.target,V=l.theme_mode,B=l._components,A=l.i,j=l.show_copy_button,U=l.generating,f=l.feedback_options,S=l.show_like,W=l.show_edit,T=l.show_retry,K=l.show_undo,Q=l.handle_action,X=l.scroll,G=l.allow_file_downloads,O=l.in_edit_mode,N=l.edit_messages,E=l.display_consecutive_in_same_bubble,q=fallback(l.current_feedback,null),J=fallback(l.allow_tags,false),Y=fallback(l.watermark,null),P=[],$=Array(h.length).fill(160),tt=Array(h.length).fill(0);function ot(d){return d.type==="text"?d.content:d.type==="component"&&d.content.component==="file"?Array.isArray(d.content.value)?`file of extension type: ${d.content.value[0].orig_name?.split(".").pop()}`:`file of extension type: ${d.content.value?.orig_name?.split(".").pop()}`+(d.content.value?.orig_name??""):`a component of type ${d.content.component??"unknown"}`}function lt(d){for(const b of d)if(b.type==="component"&&(b.content.component==="audio"||b.content.component==="video"||b.content.component==="image"||b.content.component==="file")&&b.content.value)return b.content.value;return null}let R;if(O){const d=P.length-h.length;for(let b=d;b<P.length;b++)b>=0&&($[b-d]=P[b]?.clientWidth,tt[b-d]=P[b]?.clientHeight);}R={handle_action:Q,likeable:S,feedback_options:f,show_retry:T,show_undo:K,show_edit:W,in_edit_mode:O,generating:U,show_copy_button:j,message:h,position:s==="user"?"right":"left",avatar:u,layout:c,dispatch:L,current_feedback:q,watermark:Y,file:lt(h),show_download_button:G,show_share_button:true},t.push(`<div${attr_class(`message-row ${stringify(c)} ${stringify(s)}-row`,"svelte-1nr59td",{with_avatar:u!==null,with_opposite_avatar:n!==null})}>`),u!==null?(t.push("<!--[-->"),t.push('<div class="avatar-container svelte-1nr59td">'),c$1(t,{src:u?.url}),t.push("<!----></div>")):t.push("<!--[!-->"),t.push(`<!--]--> <div${attr_class("flex-wrap svelte-1nr59td",void 0,{role:s,"component-wrap":h[0].type==="component"})}><div${attr_class(clsx(E?s:""),"svelte-1nr59td",{message:E})}><!--[-->`);const at=ensure_array_like(h);for(let d=0,b=at.length;d<b;d++){let C=at[d];if(t.push(`<div${attr_class(`message ${stringify(E?"":s)}`,"svelte-1nr59td",{"panel-full-width":true,"message-markdown-disabled":!i,component:C.type==="component",html:sl(C)&&C.content.component==="html",thought:d>0})}>`),O&&C.type==="text"){t.push("<!--[-->"),t.push(`<textarea class="edit-textarea svelte-1nr59td" autofocus${attr_style("",{width:`max(${$[d]}px, 160px)`,"min-height":`${tt[d]}px`})}>`);const et=escape_html(N[d]);et&&t.push(`${et}`),t.push("</textarea>");}else t.push("<!--[!-->"),t.push(`<div${attr("data-testid",s)}${attr("dir",r?"rtl":"ltr")}${attr("aria-label",s+"'s message: "+ot(C))}${attr_class("svelte-1nr59td",void 0,{latest:A===o.length-1,"message-markdown-disabled":!i,selectable:v})}${attr_style("",{"user-select":"text",cursor:v?"pointer":"auto","text-align":r?"right":"left"})}>`),C?.metadata?.title?(t.push("<!--[-->"),bl(t,{thought:C,sanitize_html:_,allow_tags:J,latex_delimiters:p,render_markdown:i})):(t.push("<!--[!-->"),gl(t,{message:C,sanitize_html:_,allow_tags:J,latex_delimiters:p,render_markdown:i,_components:B,upload:k,thought_index:d,target:x,theme_mode:V,_fetch:y,scroll:X,allow_file_downloads:G,display_consecutive_in_same_bubble:E,i18n:z,line_breaks:M})),t.push("<!--]--></div>");t.push("<!--]--></div> "),c==="panel"?(t.push("<!--[-->"),Ct(t,spread_props([R,{current_feedback:q,watermark:Y,i18n:z}]))):t.push("<!--[!-->"),t.push("<!--]-->");}t.push("<!--]--></div></div></div> "),c==="bubble"?(t.push("<!--[-->"),Ct(t,spread_props([R,{i18n:z}]))):t.push("<!--[!-->"),t.push("<!--]-->"),bind_props(l,{value:o,avatar_img:u,opposite_avatar_img:n,role:s,messages:h,layout:c,render_markdown:i,latex_delimiters:p,sanitize_html:_,selectable:v,_fetch:y,rtl:r,dispatch:L,i18n:z,line_breaks:M,upload:k,target:x,theme_mode:V,_components:B,i:A,show_copy_button:j,generating:U,feedback_options:f,show_like:S,show_edit:W,show_retry:T,show_undo:K,handle_action:Q,scroll:X,allow_file_downloads:G,in_edit_mode:O,edit_messages:N,display_consecutive_in_same_bubble:E,current_feedback:q,allow_tags:J,watermark:Y});});}var Ht=Object.prototype.hasOwnProperty;function mt(e,l){var t,o;if(e===l)return  true;if(e&&l&&(t=e.constructor)===l.constructor){if(t===Date)return e.getTime()===l.getTime();if(t===RegExp)return e.toString()===l.toString();if(t===Array){if((o=e.length)===l.length)for(;o--&&mt(e[o],l[o]););return o===-1}if(!t||typeof e=="object"){o=0;for(t in e)if(Ht.call(e,t)&&++o&&!Ht.call(l,t)||!(t in l)||!mt(e[t],l[t]))return  false;return Object.keys(l).length===o}}return e!==e&&l!==l}function jt(e,l){e.component(t=>{let o=fallback(l.layout,"bubble"),u=fallback(l.avatar_images,()=>[null,null],true);t.push('<div class="container svelte-stpvyx">'),u[1]!==null?(t.push("<!--[-->"),t.push('<div class="avatar-container svelte-stpvyx">'),c$1(t,{src:u[1].url}),t.push("<!----></div>")):t.push("<!--[!-->"),t.push(`<!--]--> <div${attr_class(`message bot pending ${stringify(o)}`,"svelte-stpvyx",{with_avatar:u[1]!==null,with_opposite_avatar:u[0]!==null})} role="status" aria-label="Loading response" aria-live="polite"><div class="message-content svelte-stpvyx"><span class="sr-only svelte-stpvyx">Loading content</span> <div class="dots svelte-stpvyx"><div class="dot svelte-stpvyx"></div> <div class="dot svelte-stpvyx"></div> <div class="dot svelte-stpvyx"></div></div></div></div></div>`),bind_props(l,{layout:o,avatar_images:u});});}function yl(e,l){e.component(t$1=>{let o=fallback(l.examples,null),u=fallback(l.placeholder,null),n=l.latex_delimiters;if(t$1.push('<div class="placeholder-content svelte-1rn3hyj" role="complementary">'),u!==null?(t$1.push("<!--[-->"),t$1.push('<div class="placeholder svelte-1rn3hyj">'),Qt$1(t$1,{message:u,latex_delimiters:n}),t$1.push("<!----></div>")):t$1.push("<!--[!-->"),t$1.push("<!--]--> "),o!==null){t$1.push("<!--[-->"),t$1.push('<div class="examples svelte-1rn3hyj" role="list"><!--[-->');const s=ensure_array_like(o);for(let h=0,c=s.length;h<c;h++){let i$1=s[h];if(t$1.push(`<button class="example svelte-1rn3hyj"${attr("aria-label",`Select example ${h+1}: ${i$1.display_text||i$1.text}`)}><div class="example-content svelte-1rn3hyj">`),i$1?.icon?.url)t$1.push("<!--[-->"),t$1.push('<div class="example-image-container svelte-1rn3hyj">'),c$1(t$1,{src:i$1.icon.url}),t$1.push("<!----></div>");else {if(t$1.push("<!--[!-->"),i$1?.icon?.mime_type==="text")t$1.push("<!--[-->"),t$1.push('<div class="example-icon svelte-1rn3hyj" aria-hidden="true"><span class="text-icon-aa svelte-1rn3hyj">Aa</span></div>');else {if(t$1.push("<!--[!-->"),i$1.files!==void 0&&i$1.files.length>0){if(t$1.push("<!--[-->"),i$1.files.length>1){t$1.push("<!--[-->"),t$1.push('<div class="example-icons-grid svelte-1rn3hyj" role="group" aria-label="Example attachments"><!--[-->');const p=ensure_array_like(i$1.files.slice(0,4));for(let _=0,v=p.length;_<v;_++){let y=p[_];y.mime_type?.includes("image")?(t$1.push("<!--[-->"),t$1.push('<div class="example-image-container svelte-1rn3hyj">'),c$1(t$1,{src:y.url,alt:y.orig_name||`Example image ${_+1}`}),t$1.push("<!----> "),_===3&&i$1.files.length>4?(t$1.push("<!--[-->"),t$1.push(`<div class="image-overlay svelte-1rn3hyj" role="status"${attr("aria-label",`${i$1.files.length-4} more files`)}>+${escape_html(i$1.files.length-4)}</div>`)):t$1.push("<!--[!-->"),t$1.push("<!--]--></div>")):(t$1.push("<!--[!-->"),y.mime_type?.includes("video")?(t$1.push("<!--[-->"),t$1.push(`<div class="example-image-container svelte-1rn3hyj"><video class="example-image"${attr("src",y.url)} aria-hidden="true"></video> `),_===3&&i$1.files.length>4?(t$1.push("<!--[-->"),t$1.push(`<div class="image-overlay svelte-1rn3hyj" role="status"${attr("aria-label",`${i$1.files.length-4} more files`)}>+${escape_html(i$1.files.length-4)}</div>`)):t$1.push("<!--[!-->"),t$1.push("<!--]--></div>")):(t$1.push("<!--[!-->"),t$1.push(`<div class="example-icon svelte-1rn3hyj"${attr("aria-label",`File: ${y.orig_name}`)}>`),y.mime_type?.includes("audio")?(t$1.push("<!--[-->"),t(t$1)):(t$1.push("<!--[!-->"),i(t$1)),t$1.push("<!--]--></div>")),t$1.push("<!--]-->")),t$1.push("<!--]-->");}t$1.push("<!--]--> "),i$1.files.length>4?(t$1.push("<!--[-->"),t$1.push(`<div class="example-icon svelte-1rn3hyj"><div class="file-overlay svelte-1rn3hyj" role="status"${attr("aria-label",`${i$1.files.length-4} more files`)}>+${escape_html(i$1.files.length-4)}</div></div>`)):t$1.push("<!--[!-->"),t$1.push("<!--]--></div>");}else t$1.push("<!--[!-->"),i$1.files[0].mime_type?.includes("image")?(t$1.push("<!--[-->"),t$1.push('<div class="example-image-container svelte-1rn3hyj">'),c$1(t$1,{src:i$1.files[0].url,alt:i$1.files[0].orig_name||"Example image"}),t$1.push("<!----></div>")):(t$1.push("<!--[!-->"),i$1.files[0].mime_type?.includes("video")?(t$1.push("<!--[-->"),t$1.push(`<div class="example-image-container svelte-1rn3hyj"><video class="example-image"${attr("src",i$1.files[0].url)} aria-hidden="true"></video></div>`)):(t$1.push("<!--[!-->"),i$1.files[0].mime_type?.includes("audio")?(t$1.push("<!--[-->"),t$1.push(`<div class="example-icon svelte-1rn3hyj"${attr("aria-label",`File: ${i$1.files[0].orig_name}`)}>`),t(t$1),t$1.push("<!----></div>")):(t$1.push("<!--[!-->"),t$1.push(`<div class="example-icon svelte-1rn3hyj"${attr("aria-label",`File: ${i$1.files[0].orig_name}`)}>`),i(t$1),t$1.push("<!----></div>")),t$1.push("<!--]-->")),t$1.push("<!--]-->")),t$1.push("<!--]-->");t$1.push("<!--]-->");}else t$1.push("<!--[!-->");t$1.push("<!--]-->");}t$1.push("<!--]-->");}t$1.push(`<!--]--> <div class="example-text-content svelte-1rn3hyj"><span class="example-text svelte-1rn3hyj">${escape_html(i$1.display_text||i$1.text)}</span></div></div></button>`);}t$1.push("<!--]--></div>");}else t$1.push("<!--[!-->");t$1.push("<!--]--></div>"),bind_props(l,{examples:o,placeholder:u,latex_delimiters:n});});}function kl(e$1,l){e$1.component(t=>{let o=false,u=l.value,n=fallback(l.watermark,null),s;function h$1(){o=true,s&&clearTimeout(s),s=setTimeout(()=>{o=false;},1e3);}const c=()=>{if(u){const p=u.map(v=>v.type==="text"?`${v.role}: ${v.content}`:`${v.role}: ${v.content.value.url}`).join(`

`),_=n?`${p}

${n}`:p;navigator.clipboard.writeText(_).catch(v=>{console.error("Failed to copy conversation: ",v);});}};async function i(){"clipboard"in navigator&&(c(),h$1());}onDestroy(()=>{s&&clearTimeout(s);}),w(t,{Icon:o?e:h,onclick:i,label:o?"Copied conversation":"Copy conversation"}),bind_props(l,{value:u,watermark:n});});}function xl(e,l){e.component(t=>{let o,u$1,n=fallback(l.value,()=>[],true),s=null,h=l._fetch,c$1=l.load_component,i=l.allow_file_downloads,p=l.display_consecutive_in_same_bubble,_={};const v=typeof window<"u";async function y$1(){_=await il(xt(n),_,c$1);}let r$1=l.latex_delimiters,L=fallback(l.pending_message,false),z=fallback(l.generating,false),M=fallback(l.selectable,false),k=fallback(l.likeable,false),x=l.feedback_options,V=fallback(l.feedback_value,null),B=fallback(l.editable,null),A=fallback(l.show_share_button,false),j=fallback(l.show_copy_all_button,false),U=fallback(l.rtl,false),f=fallback(l.show_copy_button,false),S=fallback(l.buttons,null),W=fallback(l.on_custom_button_click,null),T=fallback(l.avatar_images,()=>[null,null],true),K=fallback(l.sanitize_html,true),Q=fallback(l.render_markdown,true),X=fallback(l.line_breaks,true),G=fallback(l.autoscroll,true),O=l.theme_mode,N=l.i18n,E=fallback(l.layout,"bubble"),q=fallback(l.placeholder,null),J=l.upload,Y=fallback(l.examples,null),P=fallback(l._retryable,false),$=fallback(l._undoable,false),tt=fallback(l.like_user_message,false),ot=fallback(l.allow_tags,false),lt=fallback(l.watermark,null),R=fallback(l.show_progress,"full"),at=null,d=null,b=[];const C=createEventDispatcher();async function et(){}function bt(m,H,g){if(g==="undo"||g==="retry"){const I=n;let w=I.length-1;for(;I[w].role==="assistant";)w--;C(g,{index:I[w].index,value:I[w].content});}else if(g=="edit")d=m,b.push(H.content);else if(g=="edit_cancel")d=null;else if(g=="edit_submit")d=null,C("edit",{index:H.index,_dispatch_value:[{type:"text",text:b[m].slice()}],value:b[m].slice(),previous_value:H.content});else {let I=g==="Like"?true:g==="Dislike"?false:g||"";if(!o)return;const w=o[m],[Z]=[w[0],w[w.length-1]];C("like",{index:Z.index,value:w.map(ut=>ut.content),liked:I});}}function zt(){if(!n||!o||o.length===0)return;const m=o[o.length-1];if(m[0].role==="assistant")return m[m.length-1].options}xt(n).sort().join(", "),y$1(),(n||L||_)&&et(),mt(n,s)||(s=n,C("change")),o=n&&ol(n,p),u$1=n&&zt();let it=true,nt;function At(m){if(n!==null&&n.length>0?(m.push("<!--[-->"),y(m,{buttons:S,on_custom_button_click:W,children:H=>{A?(H.push("<!--[-->"),w(H,{Icon:u,onclick:async()=>{try{const g=await Xt(n);C("share",{description:g});}catch(g){console.error(g);g instanceof c?g.message:"Share failed.";}}})):H.push("<!--[!-->"),H.push("<!--]--> "),w(H,{Icon:r,onclick:()=>C("clear"),label:N("chatbot.clear")}),H.push("<!----> "),j?(H.push("<!--[-->"),kl(H,{value:n,watermark:lt})):H.push("<!--[!-->"),H.push("<!--]-->");}})):m.push("<!--[!-->"),m.push(`<!--]--> <div${attr_class(clsx(E==="bubble"?"bubble-wrap":"panel-wrap"),"svelte-kpz1")} role="log" aria-label="chatbot conversation" aria-live="polite">`),n!==null&&n.length>0&&o!==null){m.push("<!--[-->"),m.push('<div class="message-wrap svelte-kpz1"><!--[-->');const H=ensure_array_like(o);for(let g=0,I=H.length;g<I;g++){let w=H[g];const Z=w[0].role==="user"?"user":"bot",ut=T[Z==="user"?0:1],It=T[Z==="user"?0:1],wt=o.slice(0,g).filter(F=>F[0].role==="assistant").length,Dt=Z==="bot"&&V&&V[wt]?V[wt]:null;wl(m,{messages:w,display_consecutive_in_same_bubble:p,opposite_avatar_img:It,avatar_img:ut,role:Z,layout:E,dispatch:C,i18n:N,_fetch:h,line_breaks:X,theme_mode:O,target:at,upload:J,selectable:M,sanitize_html:K,render_markdown:Q,rtl:U,i:g,value:n,latex_delimiters:r$1,_components:_,generating:z,feedback_options:x,current_feedback:Dt,allow_tags:ot,watermark:lt,show_like:Z==="user"?k&&tt:k,show_retry:P&&kt(w,n),show_undo:$&&kt(w,n),show_edit:B==="all"||B=="user"&&Z==="user"&&w.length>0&&w[w.length-1].type=="text",in_edit_mode:d===g,show_copy_button:f,handle_action:F=>{F=="edit"&&b.splice(0,b.length),F==="edit"||F==="edit_submit"?w.forEach((Bt,Tt)=>{bt(F==="edit"?g:Tt,Bt,F);}):bt(g,w[0],F);},scroll:v?scroll:()=>{},allow_file_downloads:i,get edit_messages(){return b},set edit_messages(F){b=F,it=false;}}),m.push("<!----> "),R!=="hidden"&&z&&w[w.length-1].role==="assistant"&&w[w.length-1].metadata?.status==="done"?(m.push("<!--[-->"),jt(m,{layout:E,avatar_images:T})):m.push("<!--[!-->"),m.push("<!--]-->");}if(m.push("<!--]--> "),R!=="hidden"&&L)m.push("<!--[-->"),jt(m,{layout:E,avatar_images:T});else {if(m.push("<!--[!-->"),u$1){m.push("<!--[-->"),m.push('<div class="options svelte-kpz1"><!--[-->');const g=ensure_array_like(u$1);for(let I=0,w=g.length;I<w;I++){let Z=g[I];m.push(`<button class="option svelte-kpz1">${escape_html(Z.label||Z.value)}</button>`);}m.push("<!--]--></div>");}else m.push("<!--[!-->");m.push("<!--]-->");}m.push("<!--]--></div>");}else m.push("<!--[!-->"),yl(m,{examples:Y,placeholder:q,latex_delimiters:r$1});m.push("<!--]--></div> "),m.push("<!--[!-->"),m.push("<!--]-->");}do it=true,nt=t.copy(),At(nt);while(!it);t.subsume(nt),bind_props(l,{value:n,_fetch:h,load_component:c$1,allow_file_downloads:i,display_consecutive_in_same_bubble:p,latex_delimiters:r$1,pending_message:L,generating:z,selectable:M,likeable:k,feedback_options:x,feedback_value:V,editable:B,show_share_button:A,show_copy_all_button:j,rtl:U,show_copy_button:f,buttons:S,on_custom_button_click:W,avatar_images:T,sanitize_html:K,render_markdown:Q,line_breaks:X,autoscroll:G,theme_mode:O,i18n:N,layout:E,placeholder:q,upload:J,examples:Y,_retryable:P,_undoable:$,like_user_message:tt,allow_tags:ot,watermark:lt,show_progress:R});});}function Kl(e,l){e.component(t=>{let{$$slots:o,$$events:u,...n}=l;const s=new $(n);let h=el(s.props.value,s.shared.root),c=s.shared.loading_status.status==="error"?"full":s.shared.loading_status.show_progress==="hidden"?"hidden":"minimal";G(t,{elem_id:s.shared.elem_id,elem_classes:s.shared.elem_classes,visible:s.shared.visible,padding:false,scale:s.shared.scale,min_width:s.shared.min_width,height:s.props.height,resizable:s.props.resizable,min_height:s.props.min_height,max_height:s.props.max_height,allow_overflow:true,flex:true,overflow_behavior:"auto",rtl:s.props.rtl,children:i=>{s.shared.loading_status?(i.push("<!--[-->"),W(i,spread_props([{autoscroll:s.shared.autoscroll,i18n:s.i18n},s.shared.loading_status,{show_progress:c,on_clear_status:()=>s.dispatch("clear_status",s.shared.loading_status)}]))):i.push("<!--[!-->"),i.push('<!--]--> <div class="wrapper svelte-1wizwbi">'),s.shared.show_label?(i.push("<!--[-->"),k(i,{show_label:s.shared.show_label,Icon:Yt,float:true,label:s.shared.label||"Chatbot"})):i.push("<!--[!-->"),i.push("<!--]--> "),xl(i,{i18n:s.i18n,selectable:s.props._selectable,likeable:s.props.likeable,feedback_options:s.props.feedback_options,feedback_value:s.props.feedback_value,show_share_button:(s.props.buttons??["share"]).some(p=>typeof p=="string"&&p==="share"),show_copy_all_button:(s.props.buttons??["copy_all"]).some(p=>typeof p=="string"&&p==="copy_all"),value:h,latex_delimiters:s.props.latex_delimiters,display_consecutive_in_same_bubble:s.props.group_consecutive_messages,render_markdown:s.props.render_markdown,theme_mode:s.shared.theme_mode,editable:s.props.editable,pending_message:s.shared.loading_status?.status==="pending",generating:s.shared.loading_status?.status==="generating",rtl:s.props.rtl,show_copy_button:(s.props.buttons??["copy"]).some(p=>typeof p=="string"&&p==="copy"),buttons:s.props.buttons,on_custom_button_click:p=>{s.dispatch("custom_button_click",{id:p});},like_user_message:s.props.like_user_message,show_progress:s.shared.loading_status?.show_progress||"full",avatar_images:s.props.avatar_images,sanitize_html:s.props.sanitize_html,line_breaks:s.props.line_breaks,autoscroll:s.props.autoscroll,layout:s.props.layout,placeholder:s.props.placeholder,examples:s.props.examples,_retryable:s.props._retryable,_undoable:s.props._undoable,upload:(...p)=>s.shared.client.upload(...p),_fetch:(...p)=>s.shared.client.fetch(...p),load_component:s.shared.load_component,allow_file_downloads:s.props.allow_file_downloads,allow_tags:s.props.allow_tags,watermark:s.props.watermark}),i.push("<!----></div>");},$$slots:{default:true}});});}

export { xl as BaseChatBot, Kl as default };
//# sourceMappingURL=Index54-CG_RFEl_.js.map
