PageSourceSearch

https://parimalanath-bean-lab-qa.hf.space/assets/Index-D4zlyuz4.js

js parimalanath-bean-lab-qa.hf.space collected 2026-10-03 17:13:36 UTC 8,356 bytes, 293 lines download raw bytes

1import { g as spread_props, i as if_block, k as each, r as rest_props, u as index, v as set_checked, b as set_class, a as set_attribute, t as remove_input_defaults } from './i18n-dpAHICcw.js';
2import { R as push, y as user_effect, S as first_child, a6 as comment, a as append, w as get, X as sibling, a5 as user_derived, T as pop, W as from_html, t as template_effect, a0 as set_text, Z as event, V as child, a7 as text, au as to_array, Y as reset } from './index-CDZuCcOm.js';
3import { s as snapshot } from './clone-dZfS06Ds.js';
4import { G as Gradio } from './utils.svelte-CyWLYi-B.js';
5import { B as Block } from './Block-DntE23uJ.js';
6import { B as BlockTitle } from './BlockTitle-Xgz-MKYS.js';
7import './ScrollFade.svelte_svelte_type_style_lang-DUvCSfRk.js';
8import './MarkdownCode.svelte_svelte_type_style_lang-GeNUGzep.js';
9import { I as IconButtonWrapper } from './IconButtonWrapper-KjCt2Pl8.js';
10import { S as Static } from './index-DyDpuTN9.js';
11import './StreamingBar.svelte_svelte_type_style_lang-BxBb9ZZb.js';
12import { d as dequal } from './index-DnoGeqVF.js';
13import './Info-CLoErKII.js';
14import './MarkdownCode-Q694H4-C.js';
15import './html-h_YSgefI.js';
16import './snippet-DVkMfmSq.js';
17import './prism-python-C_fanlsZ.js';
18import './Clear-tvJMRS4J.js';
19
20var root_4 = from_html(`<div class="select-all-container svelte-yb2gcx"><label class="select-all-label svelte-yb2gcx"><input class="select-all-checkbox svelte-yb2gcx" type="checkbox" title="Select/Deselect All"/></label> <button type="button" class="label-text svelte-yb2gcx"> </button></div>`);
21var root_7 = from_html(`<label><input type="checkbox" class="svelte-yb2gcx"/> <span class="ml-2 svelte-yb2gcx"> </span></label>`);
22var root_1 = from_html(`<!> <!> <!> <div class="wrap svelte-yb2gcx" data-testid="checkbox-group"></div>`, 1);
23
24function Index($$anchor, $$props) {
25	push($$props, true);
26
27	let props = rest_props($$props, ['$$slots', '$$events', '$$legacy']);
28	let gradio = new Gradio(props);
29
30	function toggle_choice(choice) {
31		if (gradio.props.value.includes(choice)) {
32			gradio.props.value = gradio.props.value.filter((v) => v !== choice);
33		} else {
34			gradio.props.value = [...gradio.props.value, choice];
35		}
36
37		gradio.dispatch("input");
38	}
39
40	function toggle_select_all() {
41		const all_values = gradio.props.choices.map(([, internal_value]) => internal_value);
42
43		if (gradio.props.value.length === all_values.length) {
44			gradio.props.value = [];
45		} else {
46			gradio.props.value = all_values.slice();
47		}
48
49		gradio.dispatch("input");
50	}
51
52	let select_all_state = user_derived(() => {
53		const all_values = gradio.props.choices.map(([, internal_value]) => internal_value);
54
55		if (gradio.props.value.length === 0) return "unchecked";
56		if (gradio.props.value.length === all_values.length) return "checked";
57
58		return "indeterminate";
59	});
60
61	let disabled = user_derived(() => !gradio.shared.interactive);
62	let old_value = gradio.props.value;
63
64	user_effect(() => {
65		gradio.props.value;
66
67		if (dequal(old_value, gradio.props.value)) {
68			return;
69		}
70
71		old_value = gradio.props.value;
72		gradio.dispatch("change", snapshot(gradio.props.value));
73	});
74
75	Block($$anchor, {
76		get visible() {
77			return gradio.shared.visible;
78		},
79
80		get elem_id() {
81			return gradio.shared.elem_id;
82		},
83
84		get elem_classes() {
85			return gradio.shared.elem_classes;
86		},
87		type: 'fieldset',
88		get container() {
89			return gradio.shared.container;
90		},
91
92		get scale() {
93			return gradio.shared.scale;
94		},
95
96		get min_width() {
97			return gradio.shared.min_width;
98		},
99
100		children: ($$anchor, $$slotProps) => {
101			var fragment_1 = root_1();
102			var node = first_child(fragment_1);
103
104			Static(node, spread_props(
105				{
106					get autoscroll() {
107						return gradio.shared.autoscroll;
108					},
109
110					get i18n() {
111						return gradio.i18n;
112					}
113				},
114				() => gradio.shared.loading_status,
115				{
116					on_clear_status: () => gradio.dispatch("clear_status", gradio.shared.loading_status)
117				}
118			));
119
120			var node_1 = sibling(node, 2);
121
122			{
123				var consequent = ($$anchor) => {
124					IconButtonWrapper($$anchor, {
125						get buttons() {
126							return gradio.props.buttons;
127						},
128
129						on_custom_button_click: (id) => {
130							gradio.dispatch("custom_button_click", { id });
131						}
132					});
133				};
134
135				if_block(node_1, ($$render) => {
136					if (gradio.shared.show_label && gradio.props.buttons && gradio.props.buttons.length > 0) $$render(consequent);
137				});
138			}
139
140			var node_2 = sibling(node_1, 2);
141
142			{
143				let $0 = user_derived(() => gradio.shared.show_label || gradio.props.show_select_all && gradio.shared.interactive);
144
145				BlockTitle(node_2, {
146					get show_label() {
147						return get($0);
148					},
149
150					get info() {
151						return gradio.props.info;
152					},
153
154					children: ($$anchor, $$slotProps) => {
155						var fragment_3 = comment();
156						var node_3 = first_child(fragment_3);
157
158						{
159							var consequent_1 = ($$anchor) => {
160								var div = root_4();
161								var label = child(div);
162								var input = child(label);
163
164								remove_input_defaults(input);
165								reset(label);
166
167								var button = sibling(label, 2);
168								var text = child(button, true);
169
170								reset(button);
171								reset(div);
172
173								template_effect(() => {
174									set_checked(input, get(select_all_state) === "checked");
175									input.indeterminate = get(select_all_state) === "indeterminate";
176									set_text(text, gradio.shared.show_label ? gradio.shared.label : "Select All");
177								});
178
179								event('change', input, toggle_select_all);
180								event('click', button, toggle_select_all);
181								append($$anchor, div);
182							};
183
184							var alternate = ($$anchor) => {
185								var fragment_4 = comment();
186								var node_4 = first_child(fragment_4);
187
188								{
189									var consequent_2 = ($$anchor) => {
190										var text_1 = text();
191
192										template_effect(($0) => set_text(text_1, $0), [
193											() => gradio.shared.label || gradio.i18n("checkbox.checkbox_group")
194										]);
195
196										append($$anchor, text_1);
197									};
198
199									if_block(
200										node_4,
201										($$render) => {
202											if (gradio.shared.show_label) $$render(consequent_2);
203										},
204										true
205									);
206								}
207
208								append($$anchor, fragment_4);
209							};
210
211							if_block(node_3, ($$render) => {
212								if (gradio.props.show_select_all && gradio.shared.interactive) $$render(consequent_1); else $$render(alternate, false);
213							});
214						}
215
216						append($$anchor, fragment_3);
217					},
218					$$slots: { default: true }
219				});
220			}
221
222			var div_1 = sibling(node_2, 2);
223
224			each(div_1, 21, () => gradio.props.choices, index, ($$anchor, $$item, i) => {
225				var $$array = user_derived(() => to_array(get($$item), 2));
226				let display_value = () => get($$array)[0];
227				let internal_value = () => get($$array)[1];
228				var label_1 = root_7();
229				let classes;
230				var input_1 = child(label_1);
231
232				remove_input_defaults(input_1);
233
234				var span = sibling(input_1, 2);
235				var text_2 = child(span, true);
236
237				reset(span);
238				reset(label_1);
239
240				template_effect(
241					($0, $1, $2, $3) => {
242						classes = set_class(label_1, 1, 'svelte-yb2gcx', null, classes, $0);
243						input_1.disabled = get(disabled);
244						set_checked(input_1, $1);
245						set_attribute(input_1, 'name', $2);
246						set_attribute(input_1, 'title', $3);
247						set_text(text_2, display_value());
248					},
249					[
250						() => ({
251							disabled: get(disabled),
252							selected: gradio.props.value.includes(internal_value())
253						}),
254						() => gradio.props.value.includes(internal_value()),
255						() => internal_value()?.toString(),
256						() => internal_value()?.toString()
257					]
258				);
259
260				event('change', input_1, () => toggle_choice(internal_value()));
261
262				event('input', input_1, (evt) => gradio.dispatch("select", {
263					index: i,
264					value: internal_value(),
265					selected: evt.currentTarget.checked
266				}));
267
268				event('keydown', input_1, (event) => {
269					if (event.key === "Enter") {
270						toggle_choice(internal_value());
271
272						gradio.dispatch("select", {
273							index: i,
274							value: internal_value(),
275							selected: !gradio.props.value.includes(internal_value())
276						});
277					}
278				});
279
280				append($$anchor, label_1);
281			});
282
283			reset(div_1);
284			append($$anchor, fragment_1);
285		},
286		$$slots: { default: true }
287	});
288
289	pop();
290}
291
292export { Index as default };
293//# sourceMappingURL=Index-D4zlyuz4.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.