1import { i as if_block, g as spread_props, b as set_class, f as set_style, r as rest_props } from './i18n-CMo5lpzy.js'; 2import { R as push, u as state, v as proxy, y as user_effect, w as get, x as set, S as first_child, t as template_effect, a as append, X as sibling, V as child, T as pop, a5 as user_derived, au as prepare_files, W as from_html, Y as reset } from './index-BvBk1Iap.js'; 3import { G as Gradio, c as css_units } from './utils.svelte-CYLB_jIA.js'; 4import HTML from './HTML-Cns4Rn3B.js'; 5import { S as Static } from './index-Lz7fsHFt.js'; 6import './StreamingBar.svelte_svelte_type_style_lang-CdFIGsJa.js'; 7import { B as Block } from './Block-Bx3BikCN.js'; 8import './ScrollFade.svelte_svelte_type_style_lang-Xm-PLg9E.js'; 9import { B as BlockLabel } from './BlockLabel-oGSqUii_.js'; 10import { C as Code } from './Code-DMRxApdQ.js'; 11import { I as IconButtonWrapper } from './IconButtonWrapper-Ba0GidgU.js'; 12export { default as BaseExample } from './Example-BEiY6GLN.js'; 13import './clone-DaB-S2nH.js'; 14import './snippet-Bl5YVoCg.js'; 15import './Clear-Dgs5UhTO.js'; 16import './html-CdUEtR5E.js'; 17import './index-C7e-J7CF.js'; 18 19var root_1 = from_html(`<!> <!> <!> <div><!></div>`, 1); 20 21function Index($$anchor, $$props) { 22 push($$props, true); 23 24 let props = rest_props($$props, ['$$slots', '$$events', '$$legacy']); 25 let children = $$props.children; 26 const gradio = new Gradio(props); 27 28 let _props = user_derived(() => ({ 29 value: gradio.props.value ?? "", 30 label: gradio.shared.label, 31 visible: gradio.shared.visible, 32 ...gradio.props.props 33 })); 34 35 let old_value = state(proxy(gradio.props.value)); 36 37 user_effect(() => { 38 if (JSON.stringify(get(old_value)) !== JSON.stringify(gradio.props.value)) { 39 set(old_value, gradio.props.value, true); 40 gradio.dispatch("change"); 41 } 42 }); 43 44 let watch_entries = []; 45 46 function watch(propOrProps, callback) { 47 const prop_list = Array.isArray(propOrProps) ? propOrProps : [propOrProps]; 48 49 watch_entries.push({ props: prop_list, callback }); 50 } 51 52 function fire_watchers(changed_keys) { 53 const seen = new Set(); 54 55 for (const entry of watch_entries) { 56 if (entry.props.some((k) => changed_keys.includes(k))) { 57 seen.add(entry); 58 } 59 } 60 61 for (const entry of seen) { 62 try { 63 entry.callback(); 64 } catch(e) { 65 console.error("Error in watch callback:", e); 66 } 67 } 68 } 69 70 async function upload(file) { 71 try { 72 const file_data = await prepare_files([file]); 73 const result = await gradio.shared.client.upload(file_data, gradio.shared.root, undefined, gradio.shared.max_file_size ?? undefined); 74 75 if (result && result[0]) { 76 return { path: result[0].path, url: result[0].url }; 77 } 78 79 throw new Error("Upload failed"); 80 } catch(e) { 81 gradio.dispatch("error", e instanceof Error ? e.message : String(e)); 82 83 throw e; 84 } 85 } 86 87 { 88 let $0 = user_derived(() => gradio.props.padding !== false); 89 90 Block($$anchor, { 91 get visible() { 92 return gradio.shared.visible; 93 }, 94 95 get elem_id() { 96 return gradio.shared.elem_id; 97 }, 98 99 get elem_classes() { 100 return gradio.shared.elem_classes; 101 }, 102 103 get container() { 104 return gradio.shared.container; 105 }, 106 107 get padding() { 108 return get($0); 109 }, 110 overflow_behavior: 'visible', 111 children: ($$anchor, $$slotProps) => { 112 var fragment_1 = root_1(); 113 var node = first_child(fragment_1); 114 115 { 116 var consequent = ($$anchor) => { 117 IconButtonWrapper($$anchor, { 118 get buttons() { 119 return gradio.props.buttons; 120 }, 121 122 on_custom_button_click: (id) => { 123 gradio.dispatch("custom_button_click", { id }); 124 } 125 }); 126 }; 127 128 if_block(node, ($$render) => { 129 if (gradio.shared.show_label && gradio.props.buttons && gradio.props.buttons.length > 0) $$render(consequent); 130 }); 131 } 132
133 var node_1 = sibling(node, 2); 134 135 { 136 var consequent_1 = ($$anchor) => { 137 BlockLabel($$anchor, { 138 get Icon() { 139 return Code; 140 }, 141 142 get show_label() { 143 return gradio.shared.show_label; 144 }, 145 146 get label() { 147 return gradio.shared.label; 148 }, 149 float: true 150 }); 151 }; 152 153 if_block(node_1, ($$render) => { 154 if (gradio.shared.show_label) $$render(consequent_1); 155 }); 156 } 157 158 var node_2 = sibling(node_1, 2); 159 160 Static(node_2, spread_props( 161 { 162 get autoscroll() { 163 return gradio.shared.autoscroll; 164 }, 165 166 get i18n() { 167 return gradio.i18n; 168 } 169 }, 170 () => gradio.shared.loading_status, 171 { 172 variant: 'center', 173 on_clear_status: () => gradio.dispatch("clear_status", gradio.shared.loading_status) 174 } 175 )); 176 177 var div = sibling(node_2, 2); 178 let classes; 179 let styles; 180 var node_3 = child(div); 181 182 HTML(node_3, { 183 get props() { 184 return get(_props); 185 }, 186 187 get html_template() { 188 return gradio.props.html_template; 189 }, 190 191 get css_template() { 192 return gradio.props.css_template; 193 }, 194 195 get js_on_load() { 196 return gradio.props.js_on_load; 197 }, 198 199 get elem_classes() { 200 return gradio.shared.elem_classes; 201 }, 202 203 get visible() { 204 return gradio.shared.visible; 205 }, 206 207 get autoscroll() { 208 return gradio.shared.autoscroll; 209 }, 210 211 get apply_default_css() { 212 return gradio.props.apply_default_css; 213 }, 214 215 get head() { 216 return gradio.props.head; 217 }, 218 219 get component_class_name() { 220 return gradio.props.component_class_name; 221 }, 222 upload, 223 get server() { 224 return gradio.shared.server; 225 }, 226 watch_fn: watch, 227 fire_watchers, 228 $$events: { 229 event: (e) => { 230 gradio.dispatch(e.detail.type, e.detail.data); 231 }, 232 233 update_value: (e) => { 234 if (e.detail.property === "value") { 235 gradio.props.value = e.detail.data; 236 } else if (e.detail.property === "label") { 237 gradio.shared.label = e.detail.data; 238 } else if (e.detail.property === "visible") { 239 gradio.shared.visible = e.detail.data; 240 } 241 } 242 }, 243 244 children: ($$anchor, $$slotProps) => { 245 children?.($$anchor); 246 }, 247 $$slots: { default: true } 248 }); 249 250 reset(div); 251 252 template_effect( 253 ($0) => { 254 classes = set_class(div, 1, 'html-container svelte-1jts93g', null, classes, { 255 pending: gradio.shared.loading_status?.status === "pending" && gradio.shared.loading_status?.show_progress !== "hidden", 256 'label-padding': gradio.shared.show_label ?? undefined 257 }); 258 259 styles = set_style(div, '', styles, $0); 260 }, 261 [ 262 () => ({ 263 'min-height': gradio.props.min_height && gradio.shared.loading_status?.status !== "pending" ? css_units(gradio.props.min_height) : undefined, 264 'max-height': gradio.props.max_height ? css_units(gradio.props.max_height) : undefined, 265 'overflow-y': gradio.props.max_height ? "auto" : undefined 266 }) 267 ] 268 ); 269 270 append($$anchor, fragment_1); 271 }, 272 $$slots: { default: true } 273 }); 274 } 275 276 pop(); 277} 278 279export { HTML as BaseHTML, Index as default }; 280//# sourceMappingURL=Index-DKemNWiC.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.