import './async-D55cHugf.js';
import { d as bind_props, f as attr_class, a as attr, e as ensure_array_like, g as attr_style, c as spread_props } from './index-u8mz_F03.js';
import './2-BLdXJizP.js';
import { $, w } from './utils.svelte-B2py64Fz.js';
import { o as onDestroy, t as tick } from './index-server-CQz6EZl_.js';
import { c } from './BlockTitle-BnJIYf6a.js';
import { e as e$1 } from './Check-C7_ZsXgh.js';
import { o } from './Clear-D7Yjckqz.js';
import { i } from './File-DQh5d1OO.js';
import { i as i$1 } from './Microphone-BMM9-23W.js';
import { t } from './Music-B6sg6ISZ.js';
import { s } from './Square-CDuLMWYC.js';
import { r } from './Video-FfbWmOVG.js';
import { u } from './ScrollFade-Yfqlww91.js';
import { e as ee } from './Upload2-uTutz1dY.js';
import { c as c$1 } from './Image-CuPo5pWT.js';
import { Z } from './MinimalAudioPlayer-CtXDbTgQ.js';
import { G } from './Block-DZmzQwnI.js';
import { W } from './index3-Df92vI-L.js';
export { default as BaseExample } from './Example23-DV0Mqr6K.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 './Info-DU6zbiUl.js';
import './html-CfyvkLET.js';
import './IconButton-BRnu7KaR.js';
import './Video2-BN5I0jvO.js';

function e(o){o.push('<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="19" x2="12" y2="5"></line><polyline points="5 12 12 5 19 12"></polyline></svg>');}

function K(f){f.push('<svg fill="currentColor" width="100%" height="100%" viewBox="0 0 1920 1920" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><path d="M1752.768 221.109C1532.646.986 1174.283.986 954.161 221.109l-838.588 838.588c-154.052 154.165-154.052 404.894 0 558.946 149.534 149.421 409.976 149.308 559.059 0l758.738-758.626c87.982-88.094 87.982-231.417 0-319.51-88.32-88.208-231.642-87.982-319.51 0l-638.796 638.908 79.85 79.849 638.795-638.908c43.934-43.821 115.539-43.934 159.812 0 43.934 44.047 43.934 115.877 0 159.812l-758.739 758.625c-110.23 110.118-289.355 110.005-399.36 0-110.118-110.117-110.005-289.242 0-399.247l838.588-838.588c175.963-175.962 462.382-176.188 638.909 0 176.075 176.188 176.075 462.833 0 638.908l-798.607 798.72 79.849 79.85 798.607-798.72c220.01-220.123 220.01-578.485 0-798.607" fill-rule="evenodd"></path></g></svg>');}function kt(f,v){f.component(a=>{let {label:l,waveform_settings:G={},recording:I=void 0,upload:W,root:P,max_file_size:s$1=null,upload_promise:m=void 0,onchange:M,onstoprecording:b,onclear:g}=v,r=0,_;onDestroy(()=>{clearInterval(_);}),a.push(`<div class="minimal-audio-recorder svelte-doy9oc"${attr("aria-label",l||"Audio Recorder")} data-testid="minimal-audio-recorder">`),(a.push("<!--[!-->"),a.push(`<div class="waveform-wrapper svelte-doy9oc"></div> <div class="timestamp svelte-doy9oc">${escape_html(w(r))}</div> <button class="stop-button svelte-doy9oc" aria-label="Stop recording">`),s(a,{}),a.push("<!----></button>")),a.push("<!--]--></div>"),bind_props(v,{recording:I,upload_promise:m});});}function St(f,v){f.component(a=>{let{value:l=void 0,value_is_output:G=false,lines:I=1,i18n:W,placeholder:P="",disabled:s$1=false,label:m,info:M=void 0,show_label:b=true,max_lines:g,submit_btn:r$1=null,stop_btn:_=null,rtl:c$2=false,autofocus:A=false,text_align:w=void 0,autoscroll:R=true,root:d,file_types_string:e$2=null,max_file_size:h=null,upload:q,stream_handler:p,file_count:n="multiple",max_plain_text_length:i$2=1e3,waveform_settings:Q,waveform_options:Mt={show_recording_waveform:true},sources_string:X="upload",active_source:F=void 0,html_attributes:x=null,upload_promise:z=void 0,dragging:U=void 0,onchange:H,onsubmit:At,onstop:Rt,onblur:zt,onselect:Bt,oninput:Y,onfocus:Gt,ondrag:It,onupload:Z$1,onclear:$,onload:Pt,onerror:tt,onstop_recording:st}=v,ot=false,C=false;l?.text;let T=false,B=null,k=X.split(",").map(t=>t.trim()).filter(t=>t==="upload"||t==="microphone"),lt=e$2?e$2.split(",").map(t=>t.trim()):null,j=k&&k.includes("upload")&&!(n==="single"&&l?.files?.length>0);async function at(){H?.(l),G||Y?.();}async function it(t){if(at(),Array.isArray(t)){for(let V of t)l.files.push(V);l=l;}else l.files.push(t),l=l;await tick(),H?.(l),Z$1?.(t);}let S=true,E;function et(t$1){if(t$1.push(`<div${attr_class("full-container svelte-1qn0337",void 0,{dragging:U})} role="group" aria-label="Multimedia input field">`),c(t$1,{show_label:b,info:M,rtl:c$2,children:u=>{u.push(`<!---->${escape_html(m)}`);},$$slots:{default:true}}),t$1.push('<!----> <div class="input-container svelte-1qn0337">'),k&&k.includes("microphone")&&F==="microphone"?(t$1.push("<!--[-->"),t$1.push(`<div${attr_class("recording-overlay svelte-1qn0337",void 0,{"has-audio":B!==null})}>`),B?(t$1.push("<!--[!-->"),t$1.push('<div class="recording-content svelte-1qn0337">'),Z(t$1,{value:B,label:m||"Audio",loop:false}),t$1.push('<!----> <div class="action-buttons svelte-1qn0337"><button class="confirm-button svelte-1qn0337" aria-label="Attach audio">'),e$1(t$1),t$1.push('<!----></button> <button class="cancel-button svelte-1qn0337" aria-label="Clear audio">'),o(t$1),t$1.push("<!----></button></div></div>")):(t$1.push("<!--[-->"),t$1.push('<div class="recording-content svelte-1qn0337">'),kt(t$1,{label:m||"Audio",waveform_settings:Q,recording:T,upload:q,root:d,max_file_size:h,onchange:u=>{B=u;},onstoprecording:()=>{T=false,st?.();},onclear:()=>{F=null,T=false,B=null,$?.();},get upload_promise(){return z},set upload_promise(u){z=u,S=false;}}),t$1.push("<!----></div>")),t$1.push("<!--]--></div>")):t$1.push("<!--[!-->"),t$1.push("<!--]--> "),j?(t$1.push("<!--[-->"),ee(t$1,{onload:it,file_count:n,filetype:lt,root:d,max_file_size:h,show_progress:false,disable_click:true,onerror:tt,hidden:true,upload:q,stream_handler:p,get upload_promise(){return z},set upload_promise(u){z=u,S=false;},get dragging(){return U},set dragging(u){U=u,S=false;},get uploading(){return C},set uploading(u){C=u,S=false;}})):t$1.push("<!--[!-->"),t$1.push(`<!--]--> <div${attr_class("input-wrapper svelte-1qn0337",void 0,{"has-files":(l?.files?.length??0)>0||C})}>`),(l?.files?.length??0)>0||C){t$1.push("<!--[-->"),t$1.push('<div class="thumbnails svelte-1qn0337" aria-label="Uploaded files" data-testid="container_el">'),j?(t$1.push("<!--[-->"),t$1.push(`<button data-testid="upload-button" class="upload-button thumbnail-add svelte-1qn0337"${attr("disabled",s$1,true)} aria-label="Upload a file">`),K(t$1),t$1.push("<!----></button>")):t$1.push("<!--[!-->"),t$1.push("<!--]--> <!--[-->");const u=ensure_array_like(l?.files??[]);for(let D=0,ut=u.length;D<ut;D++){let y=u[D];t$1.push('<span class="thumbnail-wrapper svelte-1qn0337" role="listitem" aria-label="File thumbnail"><div class="thumbnail-item thumbnail-small svelte-1qn0337">'),y.mime_type&&y.mime_type.includes("image")?(t$1.push("<!--[-->"),c$1(t$1,{src:y.url,restProps:{title:null,alt:"",loading:"lazy",class:"thumbnail-image"}})):(t$1.push("<!--[!-->"),y.mime_type&&y.mime_type.includes("audio")?(t$1.push("<!--[-->"),t(t$1)):(t$1.push("<!--[!-->"),y.mime_type&&y.mime_type.includes("video")?(t$1.push("<!--[-->"),r(t$1)):(t$1.push("<!--[!-->"),i(t$1)),t$1.push("<!--]-->")),t$1.push("<!--]-->")),t$1.push('<!--]--> <button class="delete-button svelte-1qn0337" aria-label="Remove file">'),o(t$1),t$1.push("<!----></button></div></span>");}t$1.push("<!--]--> "),C?(t$1.push("<!--[-->"),t$1.push('<div class="loader svelte-1qn0337" role="status" aria-label="Uploading"></div>')):t$1.push("<!--[!-->"),t$1.push("<!--]--></div>");}else t$1.push("<!--[!-->");t$1.push('<!--]--> <div class="input-row svelte-1qn0337">'),j&&(l?.files?.length??0)===0&&!C?(t$1.push("<!--[-->"),t$1.push(`<button data-testid="upload-button" class="upload-button icon-button svelte-1qn0337"${attr("disabled",s$1,true)} aria-label="Upload a file">`),K(t$1),t$1.push("<!----></button>")):t$1.push("<!--[!-->"),t$1.push(`<!--]--> <div class="textarea-wrapper svelte-1qn0337"><textarea data-testid="textbox"${attr("dir",c$2?"rtl":"ltr")}${attr("placeholder",P)}${attr("rows",I)}${attr("disabled",s$1,true)}${attr_style(w?"text-align: "+w:"")}${attr("autocapitalize",x?.autocapitalize)}${attr("autocorrect",x?.autocorrect)}${attr("spellcheck",x?.spellcheck)}${attr("autocomplete",x?.autocomplete)}${attr("tabindex",x?.tabindex)}${attr("enterkeyhint",x?.enterkeyhint)}${attr("lang",x?.lang)}${attr_class("svelte-1qn0337",void 0,{"no-label":!b})}>`);const V=escape_html(l.text);V&&t$1.push(`${V}`),t$1.push("</textarea> "),u(t$1,{visible:ot,position:"absolute"}),t$1.push("<!----></div> "),k&&k.includes("microphone")?(t$1.push("<!--[-->"),t$1.push(`<button data-testid="microphone-button"${attr_class("microphone-button svelte-1qn0337",void 0,{recording:T})}${attr("disabled",s$1,true)} aria-label="Record audio">`),i$1(t$1),t$1.push("<!----></button>")):t$1.push("<!--[!-->"),t$1.push("<!--]--> "),r$1?(t$1.push("<!--[-->"),t$1.push(`<button${attr_class("submit-button svelte-1qn0337",void 0,{"padded-button":r$1!==true})} data-testid="submit-button"${attr("disabled",s$1,true)} aria-label="Submit">`),r$1===true?(t$1.push("<!--[-->"),e(t$1)):(t$1.push("<!--[!-->"),t$1.push(`${escape_html(r$1)}`)),t$1.push("<!--]--></button>")):t$1.push("<!--[!-->"),t$1.push("<!--]--> "),_?(t$1.push("<!--[-->"),t$1.push(`<button${attr_class("stop-button svelte-1qn0337",void 0,{"padded-button":_!==true})} aria-label="Stop">`),_===true?(t$1.push("<!--[-->"),s(t$1,{fill:"none",stroke_width:2.5})):(t$1.push("<!--[!-->"),t$1.push(`${escape_html(_)}`)),t$1.push("<!--]--></button>")):t$1.push("<!--[!-->"),t$1.push("<!--]--></div></div></div></div>");}do S=true,E=a.copy(),et(E);while(!S);a.subsume(E),bind_props(v,{value:l,active_source:F,upload_promise:z,dragging:U});});}function us(f,v){f.component(a=>{let l=null;let G$1 = class G extends ${async get_data(){return l&&(await l,await tick()),await super.get_data()}};let{$$slots:I,$$events:W$1,...P}=v;const s=new G$1(P);s.props.value=s.props.value??{text:"",files:[]};let m=false,M=null;const g={height:50,barWidth:2,barGap:3,cursorWidth:2,cursorColor:"#ddd5e9",autoplay:false,barRadius:10,dragToSeek:true,normalize:true,minPxPerSec:20,waveColor:"",progressColor:"",mediaControls:false,sampleRate:44100};({color:s.props?.waveform_options?.trim_region_color});const c=(...p)=>s.shared.client.upload(...p),A=p=>s.i18n(p),w=(...p)=>s.shared.client.stream(...p);let R=s.props.sources.join(","),d=(s.props.file_types||[]).join(",")||null,e=true,h;function q(p){G(p,{visible:s.shared.visible,elem_id:s.shared.elem_id,elem_classes:[...s.shared.elem_classes||[],"multimodal-textbox"],scale:s.shared.scale,min_width:s.shared.min_width,allow_overflow:false,padding:false,border_mode:m?"focus":"base",rtl:s.props.rtl,children:n=>{s.shared.loading_status?(n.push("<!--[-->"),W(n,spread_props([{autoscroll:s.shared.autoscroll,i18n:s.i18n},s.shared.loading_status,{on_clear_status:()=>s.dispatch("clear_status",s.shared.loading_status)}]))):n.push("<!--[!-->"),n.push("<!--]--> "),St(n,{value_is_output:true,file_types_string:d,root:s.shared.root,label:s.shared.label||"MultimodalTextbox",info:s.props.info,show_label:s.shared.show_label,lines:s.props.lines,rtl:s.props.rtl,text_align:s.props.text_align,waveform_settings:g,i18n:A,max_lines:s.props.max_lines?s.props.max_lines:s.props.lines+1,placeholder:s.props.placeholder,submit_btn:s.props.submit_btn,stop_btn:s.props.stop_btn,autofocus:s.props.autofocus,autoscroll:s.shared.autoscroll,file_count:s.props.file_count,sources_string:R,max_file_size:s.shared.max_file_size,onchange:i=>{s.props.value=i,s.dispatch("change",s.props.value);},oninput:()=>s.dispatch("input"),onsubmit:()=>s.dispatch("submit"),onstop:()=>s.dispatch("stop"),onblur:()=>s.dispatch("blur"),onselect:i=>s.dispatch("select",i),onfocus:()=>s.dispatch("focus"),onerror:i=>{s.dispatch("error",i);},onstop_recording:()=>s.dispatch("stop_recording"),onupload:i=>s.dispatch("upload",i),onclear:()=>s.dispatch("clear"),disabled:!s.shared.interactive,upload:c,stream_handler:w,max_plain_text_length:s.props.max_plain_text_length,html_attributes:s.props.html_attributes,get upload_promise(){return l},set upload_promise(i){l=i,e=false;},get value(){return s.props.value},set value(i){s.props.value=i,e=false;},get dragging(){return m},set dragging(i){m=i,e=false;},get active_source(){return M},set active_source(i){M=i,e=false;}}),n.push("<!---->");},$$slots:{default:true}});}do e=true,h=a.copy(),q(h);while(!e);a.subsume(h);});}

export { St as BaseMultimodalTextbox, us as default };
//# sourceMappingURL=Index47-VQ9pruXD.js.map
