1import { i as if_block, r as rest_props, g as spread_props } from './i18n-dpAHICcw.js'; 2import { R as push, u as state, v as proxy, y as user_effect, S as first_child, w as get, a as append, X as sibling, a5 as user_derived, T as pop, x as set, N as tick, W as from_html } from './index-CDZuCcOm.js'; 3import { s as snapshot } from './clone-dZfS06Ds.js'; 4import { T as Textbox } from './Textbox-D1wbJ-Bi.js'; 5import { S as Static } from './index-DyDpuTN9.js'; 6import './StreamingBar.svelte_svelte_type_style_lang-BxBb9ZZb.js'; 7import { B as Block } from './Block-DntE23uJ.js'; 8import './MarkdownCode.svelte_svelte_type_style_lang-GeNUGzep.js'; 9import './ScrollFade.svelte_svelte_type_style_lang-DUvCSfRk.js'; 10import { G as Gradio } from './utils.svelte-CyWLYi-B.js'; 11export { default as BaseExample } from './Example-BF3XR3cU.js'; 12import './actions-BTh6ZJJ8.js'; 13import './input-UUW65DyE.js'; 14import './BlockTitle-Xgz-MKYS.js'; 15import './Info-CLoErKII.js'; 16import './MarkdownCode-Q694H4-C.js'; 17import './html-h_YSgefI.js'; 18import './Check-4kogBHUX.js'; 19import './Copy-C8W4pNlO.js'; 20import './Send-DHvsoBjG.js'; 21import './Square-Bg2evxzG.js'; 22import './IconButtonWrapper-KjCt2Pl8.js'; 23import './snippet-DVkMfmSq.js'; 24import './Clear-tvJMRS4J.js'; 25import './prism-python-C_fanlsZ.js'; 26import './size-CuuZBRle.js'; 27/* empty css */ 28 29var root_1 = from_html(`<!> <!>`, 1); 30 31function Index($$anchor, $$props) { 32 push($$props, true); 33 34 let _props = rest_props($$props, ['$$slots', '$$events', '$$legacy']); 35 const gradio = new Gradio(_props); 36 let label = user_derived(() => gradio.shared.label || "Textbox"); 37 38 // Need to set the value to "" otherwise a change event gets 39 // dispatched when the child sets it to "" 40 gradio.props.value = gradio.props.value ?? ""; 41 42 let old_value = state(proxy(gradio.props.value)); 43 44 async function dispatch_change() { 45 if (get(old_value) !== gradio.props.value) { 46 set(old_value, gradio.props.value, true); 47 await tick(); 48 gradio.dispatch("change", snapshot(gradio.props.value)); 49 } 50 } 51 52 async function handle_input(value) { 53 if (!gradio.shared || !gradio.props) return; 54 55 gradio.props.validation_error = null; 56 gradio.props.value = value; 57 await tick(); 58 gradio.dispatch("input"); 59 } 60 61 user_effect(() => { 62 dispatch_change(); 63 }); 64 65 function handle_change(value) { 66 if (!gradio.shared || !gradio.props) return; 67 68 gradio.props.validation_error = null; 69 gradio.props.value = value; 70 } 71 72 Block($$anchor, { 73 get visible() { 74 return gradio.shared.visible; 75 }, 76 77 get elem_id() { 78 return gradio.shared.elem_id; 79 }, 80 81 get elem_classes() { 82 return gradio.shared.elem_classes; 83 }, 84 85 get scale() { 86 return gradio.shared.scale; 87 }, 88 89 get min_width() { 90 return gradio.shared.min_width; 91 }, 92 allow_overflow: false, 93 get padding() { 94 return gradio.shared.container; 95 }, 96 97 get rtl() { 98 return gradio.props.rtl; 99 }, 100 101 children: ($$anchor, $$slotProps) => { 102 var fragment_1 = root_1(); 103 var node = first_child(fragment_1); 104 105 { 106 var consequent = ($$anchor) => { 107 Static($$anchor, spread_props( 108 { 109 get autoscroll() { 110 return gradio.shared.autoscroll; 111 }, 112 113 get i18n() { 114 return gradio.i18n; 115 } 116 }, 117 () => gradio.shared.loading_status, 118 { 119 show_validation_error: false, 120 on_clear_status: () => gradio.dispatch("clear_status", gradio.shared.loading_status) 121 } 122 )); 123 }; 124 125 if_block(node, ($$render) => { 126 if (gradio.shared.loading_status) $$render(consequent); 127 }); 128 } 129 130 var node_1 = sibling(node, 2); 131 132 { 133 let $0 = user_derived(() => gradio.shared?.loading_status?.validation_error || gradio.shared?.validation_error); 134 let $1 = user_derived(() => !gradio.shared.interactive); 135 136 Textbox(node_1, { 137 get label() { 138 return get(label); 139 }, 140 141 get info() { 142 return gradio.props.info; 143 }, 144 145 get show_label() { 146 return gradio.shared.show_label; 147 }, 148 149 get lines() { 150 return gradio.props.lines; 151 }, 152 153 get type() { 154 return gradio.props.type; 155 }, 156 157 get rtl() { 158 return gradio.props.rtl; 159 }, 160 161 get text_align() { 162 return gradio.props.text_align; 163 }, 164 165 get max_lines() { 166 return gradio.props.max_lines; 167 }, 168 169 get placeholder() { 170 return gradio.props.placeholder; 171 }, 172 173 get submit_btn() { 174 return gradio.props.submit_btn; 175 }, 176 177 get stop_btn() { 178 return gradio.props.stop_btn; 179 }, 180 181 get buttons() { 182 return gradio.props.buttons; 183 }, 184 185 get autofocus() { 186 return gradio.props.autofocus; 187 }, 188 189 get container() { 190 return gradio.shared.container; 191 }, 192 193 get autoscroll() { 194 return gradio.shared.autoscroll; 195 }, 196 197 get max_length() { 198 return gradio.props.max_length; 199 }, 200 201 get html_attributes() { 202 return gradio.props.html_attributes; 203 }, 204 205 get validation_error() { 206 return get($0); 207 }, 208 onchange: handle_change, 209 oninput: handle_input, 210 onsubmit: () => { 211 gradio.shared.validation_error = null; 212 gradio.dispatch("submit"); 213 }, 214 onblur: () => gradio.dispatch("blur"), 215 onselect: (data) => gradio.dispatch("select", data), 216 onfocus: () => gradio.dispatch("focus"), 217 onstop: () => gradio.dispatch("stop"), 218 oncopy: (data) => gradio.dispatch("copy", data), 219 oncustombuttonclick: (id) => { 220 gradio.dispatch("custom_button_click", { id }); 221 }, 222 223 get disabled() { 224 return get($1); 225 }, 226 227 get value() { 228 return gradio.props.value; 229 }, 230 231 set value($$value) { 232 gradio.props.value = $$value; 233 } 234 }); 235 } 236 237 append($$anchor, fragment_1); 238 }, 239 $$slots: { default: true } 240 }); 241 242 pop(); 243} 244 245export { Textbox as BaseTextbox, Index as default }; 246//# sourceMappingURL=Index-A247jCMc.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.