1import { g as spread_props, i as if_block, r as rest_props, b as set_class, a as set_attribute, t as remove_input_defaults } from './i18n-CGlVUOvE.js'; 2import { M as push, ab as state, ac as proxy, ad as user_effect, Z as get, $ as set, N as first_child, t as template_effect, a as append, U as event, S as sibling, O as pop, Q as child, R as from_html, I as tick, X as set_text, a2 as user_derived, a5 as next, T as reset } from './index-Bq2njFOY.js'; 3import { b as bind_value } from './input-CXpCw23l.js'; 4import { G as Gradio } from './utils.svelte-Bi9ASwv9.js'; 5import { B as Block } from './Block-DNK-JdLJ.js'; 6import { B as BlockTitle } from './BlockTitle-Bcj082QO.js'; 7import './ScrollFade.svelte_svelte_type_style_lang-D0JPkGar.js'; 8import './MarkdownCode.svelte_svelte_type_style_lang-B29zDiob.js'; 9import { I as IconButtonWrapper } from './IconButtonWrapper-DAsvkfJg.js'; 10import { S as Static } from './index-1GCmrSlD.js'; 11import './StreamingBar.svelte_svelte_type_style_lang-DWGn5tT_.js'; 12import './Info-CfqzbVCN.js'; 13import './MarkdownCode-BYKuypS7.js'; 14import './html-Bwif0JPw.js'; 15import './snippet-BG7qkY_1.js'; 16import './prism-python-NrKIQnfs.js'; 17import './Clear-C8Tfa7QP.js'; 18 19var root_4 = from_html(`<div class="validation-error svelte-16ty2ow"> </div>`); 20var root_3 = from_html(` <!>`, 1); 21var root_1 = from_html(`<!> <label><!> <!> <input type="number"/></label>`, 1); 22 23function Index($$anchor, $$props) { 24 push($$props, true); 25 26 const props = rest_props($$props, ['$$slots', '$$events', '$$legacy']); 27 const gradio = new Gradio(props); 28 29 gradio.props.value ??= 0; 30 31 let old_value = state(proxy(gradio.props.value)); 32 33 user_effect(() => { 34 if (get(old_value) != gradio.props.value) { 35 //@ts-ignore 36 set(old_value, gradio.props.value, true); 37 38 gradio.dispatch("change"); 39 } 40 }); 41 42 async function handle_keypress(e) { 43 await tick(); 44 45 if (e.key === "Enter") { 46 e.preventDefault(); 47 gradio.dispatch("submit"); 48 } 49 } 50 51 const disabled = user_derived(() => !gradio.shared.interactive); 52 53 Block($$anchor, { 54 get visible() { 55 return gradio.shared.visible; 56 }, 57 58 get elem_id() { 59 return gradio.shared.elem_id; 60 }, 61 62 get elem_classes() { 63 return gradio.shared.elem_classes; 64 }, 65 66 get padding() { 67 return gradio.shared.container; 68 }, 69 allow_overflow: false, 70 get scale() { 71 return gradio.shared.scale; 72 }, 73 74 get min_width() { 75 return gradio.shared.min_width; 76 }, 77 78 children: ($$anchor, $$slotProps) => { 79 var fragment_1 = root_1(); 80 var node = first_child(fragment_1); 81 82 Static(node, spread_props( 83 { 84 get autoscroll() { 85 return gradio.shared.autoscroll; 86 }, 87 88 get i18n() { 89 return gradio.i18n; 90 } 91 }, 92 () => gradio.shared.loading_status, 93 { 94 show_validation_error: false, 95 on_clear_status: () => { 96 gradio.dispatch("clear_status", gradio.shared.loading_status); 97 } 98 } 99 )); 100 101 var label = sibling(node, 2); 102 let classes; 103 var node_1 = child(label); 104 105 { 106 var consequent = ($$anchor) => { 107 IconButtonWrapper($$anchor, { 108 get buttons() { 109 return gradio.props.buttons; 110 }, 111 112 on_custom_button_click: (id) => { 113 gradio.dispatch("custom_button_click", { id }); 114 } 115 }); 116 }; 117 118 if_block(node_1, ($$render) => { 119 if (gradio.shared.show_label && gradio.props.buttons && gradio.props.buttons.length > 0) $$render(consequent); 120 }); 121 } 122 123 var node_2 = sibling(node_1, 2); 124 125 BlockTitle(node_2, { 126 get show_label() { 127 return gradio.shared.show_label; 128 }, 129 130 get info() { 131 return gradio.props.info; 132 }, 133 134 children: ($$anchor, $$slotProps) => { 135 next(); 136 137 var fragment_3 = root_3(); 138 var text = first_child(fragment_3); 139 var node_3 = sibling(text); 140 141 { 142 var consequent_1 = ($$anchor) => { 143 var div = root_4(); 144 var text_1 = child(div, true); 145 146 reset(div); 147 template_effect(() => set_text(text_1, gradio.shared.loading_status?.validation_error)); 148 append($$anchor, div); 149 }; 150 151 if_block(node_3, ($$render) => { 152 if (gradio.shared.loading_status?.validation_error) $$render(consequent_1); 153 }); 154 } 155 156 template_effect(() => set_text(text, `${(gradio.shared.label || "Number") ?? ''} `)); 157 append($$anchor, fragment_3); 158 }, 159 $$slots: { default: true } 160 }); 161 162 var input = sibling(node_2, 2); 163 164 remove_input_defaults(input); 165 166 let classes_1; 167 168 reset(label); 169 170 template_effect(() => { 171 classes = set_class(label, 1, 'block svelte-16ty2ow', null, classes, { container: gradio.shared.container }); 172 set_attribute(input, 'aria-label', gradio.shared.label || "Number"); 173 set_attribute(input, 'min', gradio.props.minimum); 174 set_attribute(input, 'max', gradio.props.maximum); 175 set_attribute(input, 'step', gradio.props.step); 176 set_attribute(input, 'placeholder', gradio.props.placeholder); 177 input.disabled = get(disabled); 178 179 classes_1 = set_class(input, 1, 'svelte-16ty2ow', null, classes_1, { 180 'validation-error': gradio.shared.loading_status?.validation_error 181 }); 182 }); 183 184 bind_value(input, () => gradio.props.value, ($$value) => gradio.props.value = $$value); 185 event('keypress', input, handle_keypress); 186 event('input', input, () => gradio.dispatch("input")); 187 event('blur', input, () => gradio.dispatch("blur")); 188 event('focus', input, () => gradio.dispatch("focus")); 189 append($$anchor, fragment_1); 190 }, 191 $$slots: { default: true } 192 }); 193 194 pop(); 195} 196 197export { Index as default }; 198//# sourceMappingURL=Index-D5QhI0w9.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.