1import { p as prop, i as if_block, a as set_attribute, r as rest_props } from './i18n-CMo5lpzy.js'; 2import { R as push, S as first_child, a as append, T as pop, X as sibling, W as from_html, t as template_effect, a6 as comment, a7 as text, w as get, a5 as user_derived, a0 as set_text, a8 as next } from './index-BvBk1Iap.js'; 3import { G as Gradio } from './utils.svelte-CYLB_jIA.js'; 4import { s as snippet } from './snippet-Bl5YVoCg.js'; 5import { B as Button } from './Button-CH2w4_A4.js'; 6import './clone-DaB-S2nH.js'; 7import './Image-CDw5qb5O.js'; 8import './misc-ByVveAau.js'; 9/* empty css */ 10import './ScrollFade.svelte_svelte_type_style_lang-Xm-PLg9E.js'; 11/* empty css */ 12 13var root_2 = from_html(`<img class="button-icon svelte-4ac0fl"/>`); 14var root_1 = from_html(`<!> <!>`, 1); 15 16function DownloadButton($$anchor, $$props) { 17 push($$props, true); 18 19 let elem_id = prop($$props, 'elem_id', 3, ""), 20 elem_classes = prop($$props, 'elem_classes', 19, () => []), 21 visible = prop($$props, 'visible', 3, true), 22 variant = prop($$props, 'variant', 3, "secondary"), 23 size = prop($$props, 'size', 3, "lg"), 24 disabled = prop($$props, 'disabled', 3, false), 25 scale = prop($$props, 'scale', 3, null), 26 min_width = prop($$props, 'min_width', 3, undefined); 27 28 function download_file() { 29 $$props.on_click?.(); 30 31 if (!$$props.value?.url) { 32 return; 33 } 34 35 let file_name; 36 37 if (!$$props.value.orig_name && $$props.value.url) { 38 const parts = $$props.value.url.split("/"); 39 40 file_name = parts[parts.length - 1]; 41 file_name = file_name.split("?")[0].split("#")[0]; 42 } else { 43 file_name = $$props.value.orig_name; 44 } 45 46 const a = document.createElement("a"); 47 48 a.href = $$props.value.url; 49 a.download = file_name || "file"; 50 document.body.appendChild(a); 51 a.click(); 52 document.body.removeChild(a); 53 } 54 55 Button($$anchor, { 56 get size() { 57 return size(); 58 }, 59 60 get variant() { 61 return variant(); 62 }, 63 64 get elem_id() { 65 return elem_id(); 66 }, 67 68 get elem_classes() { 69 return elem_classes(); 70 }, 71 72 get visible() { 73 return visible(); 74 }, 75 onclick: download_file, 76 get scale() { 77 return scale(); 78 }, 79 80 get min_width() { 81 return min_width(); 82 }, 83 84 get disabled() { 85 return disabled(); 86 }, 87 88 children: ($$anchor, $$slotProps) => { 89 var fragment_1 = root_1(); 90 var node = first_child(fragment_1); 91 92 { 93 var consequent = ($$anchor) => { 94 var img = root_2(); 95 96 template_effect(() => { 97 set_attribute(img, 'src', $$props.icon.url); 98 set_attribute(img, 'alt', `${$$props.value} icon`); 99 }); 100 101 append($$anchor, img); 102 }; 103 104 if_block(node, ($$render) => { 105 if ($$props.icon) $$render(consequent); 106 }); 107 } 108 109 var node_1 = sibling(node, 2); 110 111 { 112 var consequent_1 = ($$anchor) => { 113 var fragment_2 = comment(); 114 var node_2 = first_child(fragment_2); 115 116 snippet(node_2, () => $$props.children); 117 append($$anchor, fragment_2); 118 }; 119 120 if_block(node_1, ($$render) => { 121 if ($$props.children) $$render(consequent_1); 122 }); 123 } 124 125 append($$anchor, fragment_1); 126 }, 127 $$slots: { default: true } 128 }); 129 130 pop(); 131} 132 133function Index($$anchor, $$props) { 134 push($$props, true); 135 136 const props = rest_props($$props, ['$$slots', '$$events', '$$legacy']); 137 const gradio = new Gradio(props); 138 139 { 140 let $0 = user_derived(() => !gradio.shared.interactive); 141 142 DownloadButton($$anchor, { 143 get value() { 144 return gradio.props.value; 145 }, 146 147 get variant() { 148 return gradio.props.variant; 149 }, 150 151 get elem_id() { 152 return gradio.shared.elem_id; 153 }, 154 155 get elem_classes() { 156 return gradio.shared.elem_classes; 157 }, 158 159 get size() { 160 return gradio.props.size; 161 }, 162 163 get scale() { 164 return gradio.shared.scale; 165 }, 166 167 get icon() { 168 return gradio.props.icon; 169 }, 170 171 get min_width() { 172 return gradio.shared.min_width; 173 }, 174 175 get visible() { 176 return gradio.shared.visible; 177 }, 178 179 get disabled() { 180 return get($0); 181 }, 182 on_click: () => gradio.dispatch("click"), 183 children: ($$anchor, $$slotProps) => { 184 next(); 185 186 var text$1 = text(); 187 188 template_effect(() => set_text(text$1, gradio.shared.label ?? "")); 189 append($$anchor, text$1); 190 }, 191 $$slots: { default: true } 192 }); 193 } 194 195 pop(); 196} 197 198export { DownloadButton as BaseButton, Index as default }; 199//# sourceMappingURL=Index-CBNBXH2C.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.