PageSourceSearch

https://vikhyatk-moondream1.hf.space/assets/Index-4b19822d.js

js vikhyatk-moondream1.hf.space collected 2026-10-03 10:25:17 UTC 15,414 bytes, 642 lines download raw bytes

1import { P as Prism$1 } from './prism-python-2f196ac7.js';
2import './Index-911d1d3f.js';
3import './index-457a826a.js';
4import './svelte/svelte.js';
5
6const prism = '';
7
8(function (Prism) {
9
10	Prism.languages.typescript = Prism.languages.extend('javascript', {
11		'class-name': {
12			pattern: /(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,
13			lookbehind: true,
14			greedy: true,
15			inside: null // see below
16		},
17		'builtin': /\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/,
18	});
19
20	// The keywords TypeScript adds to JavaScript
21	Prism.languages.typescript.keyword.push(
22		/\b(?:abstract|declare|is|keyof|readonly|require)\b/,
23		// keywords that have to be followed by an identifier
24		/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,
25		// This is for `import type *, {}`
26		/\btype\b(?=\s*(?:[\{*]|$))/
27	);
28
29	// doesn't work with TS because TS is too complex
30	delete Prism.languages.typescript['parameter'];
31	delete Prism.languages.typescript['literal-property'];
32
33	// a version of typescript specifically for highlighting types
34	var typeInside = Prism.languages.extend('typescript', {});
35	delete typeInside['class-name'];
36
37	Prism.languages.typescript['class-name'].inside = typeInside;
38
39	Prism.languages.insertBefore('typescript', 'function', {
40		'decorator': {
41			pattern: /@[$\w\xA0-\uFFFF]+/,
42			inside: {
43				'at': {
44					pattern: /^@/,
45					alias: 'operator'
46				},
47				'function': /^[\s\S]+/
48			}
49		},
50		'generic-function': {
51			// e.g. foo<T extends "bar" | "baz">( ...
52			pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,
53			greedy: true,
54			inside: {
55				'function': /^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,
56				'generic': {
57					pattern: /<[\s\S]+/, // everything after the first <
58					alias: 'class-name',
59					inside: typeInside
60				}
61			}
62		}
63	});
64
65	Prism.languages.ts = Prism.languages.typescript;
66
67}(Prism));
68
69const ParamViewer_svelte_svelte_type_style_lang = '';
70
71/* home/runner/work/gradio/gradio/js/paramviewer/ParamViewer.svelte generated by Svelte v4.2.2 */
72const {
73	HtmlTag,
74	SvelteComponent: SvelteComponent$1,
75	append,
76	attr,
77	binding_callbacks,
78	destroy_block,
79	detach,
80	element,
81	empty,
82	ensure_array_like,
83	init: init$1,
84	insert,
85	listen,
86	noop,
87	safe_not_equal: safe_not_equal$1,
88	set_data,
89	set_style,
90	space,
91	text,
92	toggle_class,
93	update_keyed_each
94} = window.__gradio__svelte__internal;
95function get_each_context(ctx, list, i) {
96	const child_ctx = ctx.slice();
97	child_ctx[10] = list[i].type;
98	child_ctx[11] = list[i].description;
99	child_ctx[12] = list[i].default;
100	child_ctx[13] = list[i].name;
101	child_ctx[14] = list;
102	child_ctx[15] = i;
103	return child_ctx;
104}
105
106// (37:1) {#if _docs}
107function create_if_block(ctx) {
108	let each_blocks = [];
109	let each_1_lookup = new Map();
110	let each_1_anchor;
111	let each_value = ensure_array_like(/*_docs*/ ctx[1]);
112	const get_key = ctx => /*name*/ ctx[13];
113
114	for (let i = 0; i < each_value.length; i += 1) {
115		let child_ctx = get_each_context(ctx, each_value, i);
116		let key = get_key(child_ctx);
117		each_1_lookup.set(key, each_blocks[i] = create_each_block(key, child_ctx));
118	}
119
120	return {
121		c() {
122			for (let i = 0; i < each_blocks.length; i += 1) {
123				each_blocks[i].c();
124			}
125
126			each_1_anchor = empty();
127		},
128		m(target, anchor) {
129			for (let i = 0; i < each_blocks.length; i += 1) {
130				if (each_blocks[i]) {
131					each_blocks[i].m(target, anchor);
132				}
133			}
134
135			insert(target, each_1_anchor, anchor);
136		},
137		p(ctx, dirty) {
138			if (dirty & /*show_desc, _docs, lang, el*/ 15) {
139				each_value = ensure_array_like(/*_docs*/ ctx[1]);
140				each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, each_1_anchor.parentNode, destroy_block, create_each_block, each_1_anchor, get_each_context);
141			}
142		},
143		d(detaching) {
144			if (detaching) {
145				detach(each_1_anchor);
146			}
147
148			for (let i = 0; i < each_blocks.length; i += 1) {
149				each_blocks[i].d(detaching);
150			}
151		}
152	};
153}
154
155// (42:14) {#if type}
156function create_if_block_4(ctx) {
157	let t;
158	let html_tag;
159	let raw_value = /*type*/ ctx[10] + "";
160	let html_anchor;
161
162	return {
163		c() {
164			t = text(": ");
165			html_tag = new HtmlTag(false);
166			html_anchor = empty();
167			html_tag.a = html_anchor;
168		},
169		m(target, anchor) {
170			insert(target, t, anchor);
171			html_tag.m(raw_value, target, anchor);
172			insert(target, html_anchor, anchor);
173		},
174		p(ctx, dirty) {
175			if (dirty & /*_docs*/ 2 && raw_value !== (raw_value = /*type*/ ctx[10] + "")) html_tag.p(raw_value);
176		},
177		d(detaching) {
178			if (detaching) {
179				detach(t);
180				detach(html_anchor);
181				html_tag.d();
182			}
183		}
184	};
185}
186
187// (50:4) {#if show_desc[i]}
188function create_if_block_1(ctx) {
189	let t;
190	let if_block1_anchor;
191	let if_block0 = /*_default*/ ctx[12] && create_if_block_3(ctx);
192	let if_block1 = /*description*/ ctx[11] && create_if_block_2(ctx);
193
194	return {
195		c() {
196			if (if_block0) if_block0.c();
197			t = space();
198			if (if_block1) if_block1.c();
199			if_block1_anchor = empty();
200		},
201		m(target, anchor) {
202			if (if_block0) if_block0.m(target, anchor);
203			insert(target, t, anchor);
204			if (if_block1) if_block1.m(target, anchor);
205			insert(target, if_block1_anchor, anchor);
206		},
207		p(ctx, dirty) {
208			if (/*_default*/ ctx[12]) {
209				if (if_block0) {
210					if_block0.p(ctx, dirty);
211				} else {
212					if_block0 = create_if_block_3(ctx);
213					if_block0.c();
214					if_block0.m(t.parentNode, t);
215				}
216			} else if (if_block0) {
217				if_block0.d(1);
218				if_block0 = null;
219			}
220
221			if (/*description*/ ctx[11]) {
222				if (if_block1) {
223					if_block1.p(ctx, dirty);
224				} else {
225					if_block1 = create_if_block_2(ctx);
226					if_block1.c();
227					if_block1.m(if_block1_anchor.parentNode, if_block1_anchor);
228				}
229			} else if (if_block1) {
230				if_block1.d(1);
231				if_block1 = null;
232			}
233		},
234		d(detaching) {
235			if (detaching) {
236				detach(t);
237				detach(if_block1_anchor);
238			}
239
240			if (if_block0) if_block0.d(detaching);
241			if (if_block1) if_block1.d(detaching);
242		}
243	};
244}
245
246// (51:5) {#if _default}
247function create_if_block_3(ctx) {
248	let div;
249	let span;
250	let t1;
251	let code;
252	let t2;
253	let html_tag;
254	let raw_value = /*_default*/ ctx[12] + "";
255
256	return {
257		c() {
258			div = element("div");
259			span = element("span");
260			span.textContent = "default";
261			t1 = space();
262			code = element("code");
263			t2 = text("= ");
264			html_tag = new HtmlTag(false);
265			attr(span, "class", "svelte-o0cc7h");
266			set_style(span, "padding-right", "4px");
267			html_tag.a = null;
268			attr(code, "class", "svelte-o0cc7h");
269			attr(div, "class", "default svelte-o0cc7h");
270			toggle_class(div, "last", !/*description*/ ctx[11]);
271		},
272		m(target, anchor) {
273			insert(target, div, anchor);
274			append(div, span);
275			append(div, t1);
276			append(div, code);
277			append(code, t2);
278			html_tag.m(raw_value, code);
279		},
280		p(ctx, dirty) {
281			if (dirty & /*_docs*/ 2 && raw_value !== (raw_value = /*_default*/ ctx[12] + "")) html_tag.p(raw_value);
282
283			if (dirty & /*_docs*/ 2) {
284				toggle_class(div, "last", !/*description*/ ctx[11]);
285			}
286		},
287		d(detaching) {
288			if (detaching) {
289				detach(div);
290			}
291		}
292	};
293}
294
295// (57:5) {#if description}
296function create_if_block_2(ctx) {
297	let div;
298	let p;
299	let t_value = /*description*/ ctx[11] + "";
300	let t;
301
302	return {
303		c() {
304			div = element("div");
305			p = element("p");
306			t = text(t_value);
307			attr(div, "class", "description svelte-o0cc7h");
308		},
309		m(target, anchor) {
310			insert(target, div, anchor);
311			append(div, p);
312			append(p, t);
313		},
314		p(ctx, dirty) {
315			if (dirty & /*_docs*/ 2 && t_value !== (t_value = /*description*/ ctx[11] + "")) set_data(t, t_value);
316		},
317		d(detaching) {
318			if (detaching) {
319				detach(div);
320			}
321		}
322	};
323}
324
325// (38:2) {#each _docs as { type, description, default: _default, name }
326function create_each_block(key_1, ctx) {
327	let div1;
328	let div0;
329	let pre;
330	let code;
331	let t0_value = /*name*/ ctx[13] + "";
332	let t0;
333	let i = /*i*/ ctx[15];
334	let pre_class_value;
335	let t1;
336	let button;
337	let t3;
338	let t4;
339	let mounted;
340	let dispose;
341	let if_block0 = /*type*/ ctx[10] && create_if_block_4(ctx);
342	const assign_code = () => /*code_binding*/ ctx[6](code, i);
343	const unassign_code = () => /*code_binding*/ ctx[6](null, i);
344
345	function click_handler() {
346		return /*click_handler*/ ctx[7](/*i*/ ctx[15]);
347	}
348
349	let if_block1 = /*show_desc*/ ctx[3][/*i*/ ctx[15]] && create_if_block_1(ctx);
350
351	return {
352		key: key_1,
353		first: null,
354		c() {
355			div1 = element("div");
356			div0 = element("div");
357			pre = element("pre");
358			code = element("code");
359			t0 = text(t0_value);
360			if (if_block0) if_block0.c();
361			t1 = space();
362			button = element("button");
363			button.textContent = "▲";
364			t3 = space();
365			if (if_block1) if_block1.c();
366			t4 = space();
367			attr(code, "class", "svelte-o0cc7h");
368			attr(pre, "class", pre_class_value = "language-" + /*lang*/ ctx[0] + " svelte-o0cc7h");
369			attr(button, "class", "arrow svelte-o0cc7h");
370			toggle_class(button, "hidden", !/*show_desc*/ ctx[3][/*i*/ ctx[15]]);
371			attr(div0, "class", "type svelte-o0cc7h");
372			attr(div1, "class", "param md svelte-o0cc7h");
373			toggle_class(div1, "open", /*show_desc*/ ctx[3][/*i*/ ctx[15]]);
374			this.first = div1;
375		},
376		m(target, anchor) {
377			insert(target, div1, anchor);
378			append(div1, div0);
379			append(div0, pre);
380			append(pre, code);
381			append(code, t0);
382			if (if_block0) if_block0.m(code, null);
383			assign_code();
384			append(div0, t1);
385			append(div0, button);
386			append(div1, t3);
387			if (if_block1) if_block1.m(div1, null);
388			append(div1, t4);
389
390			if (!mounted) {
391				dispose = listen(button, "click", click_handler);
392				mounted = true;
393			}
394		},
395		p(new_ctx, dirty) {
396			ctx = new_ctx;
397			if (dirty & /*_docs*/ 2 && t0_value !== (t0_value = /*name*/ ctx[13] + "")) set_data(t0, t0_value);
398
399			if (/*type*/ ctx[10]) {
400				if (if_block0) {
401					if_block0.p(ctx, dirty);
402				} else {
403					if_block0 = create_if_block_4(ctx);
404					if_block0.c();
405					if_block0.m(code, null);
406				}
407			} else if (if_block0) {
408				if_block0.d(1);
409				if_block0 = null;
410			}
411
412			if (i !== /*i*/ ctx[15]) {
413				unassign_code();
414				i = /*i*/ ctx[15];
415				assign_code();
416			}
417
418			if (dirty & /*lang*/ 1 && pre_class_value !== (pre_class_value = "language-" + /*lang*/ ctx[0] + " svelte-o0cc7h")) {
419				attr(pre, "class", pre_class_value);
420			}
421
422			if (dirty & /*show_desc, _docs*/ 10) {
423				toggle_class(button, "hidden", !/*show_desc*/ ctx[3][/*i*/ ctx[15]]);
424			}
425
426			if (/*show_desc*/ ctx[3][/*i*/ ctx[15]]) {
427				if (if_block1) {
428					if_block1.p(ctx, dirty);
429				} else {
430					if_block1 = create_if_block_1(ctx);
431					if_block1.c();
432					if_block1.m(div1, t4);
433				}
434			} else if (if_block1) {
435				if_block1.d(1);
436				if_block1 = null;
437			}
438
439			if (dirty & /*show_desc, _docs*/ 10) {
440				toggle_class(div1, "open", /*show_desc*/ ctx[3][/*i*/ ctx[15]]);
441			}
442		},
443		d(detaching) {
444			if (detaching) {
445				detach(div1);
446			}
447
448			if (if_block0) if_block0.d();
449			unassign_code();
450			if (if_block1) if_block1.d();
451			mounted = false;
452			dispose();
453		}
454	};
455}
456
457function create_fragment$1(ctx) {
458	let div;
459	let if_block = /*_docs*/ ctx[1] && create_if_block(ctx);
460
461	return {
462		c() {
463			div = element("div");
464			if (if_block) if_block.c();
465			attr(div, "class", "wrap svelte-o0cc7h");
466		},
467		m(target, anchor) {
468			insert(target, div, anchor);
469			if (if_block) if_block.m(div, null);
470		},
471		p(ctx, [dirty]) {
472			if (/*_docs*/ ctx[1]) {
473				if (if_block) {
474					if_block.p(ctx, dirty);
475				} else {
476					if_block = create_if_block(ctx);
477					if_block.c();
478					if_block.m(div, null);
479				}
480			} else if (if_block) {
481				if_block.d(1);
482				if_block = null;
483			}
484		},
485		i: noop,
486		o: noop,
487		d(detaching) {
488			if (detaching) {
489				detach(div);
490			}
491
492			if (if_block) if_block.d();
493		}
494	};
495}
496
497function instance$1($$self, $$props, $$invalidate) {
498	let show_desc;
499	let { docs } = $$props;
500	let { lang = "python" } = $$props;
501	let { linkify = [] } = $$props;
502	let _docs;
503
504	function highlight(code, lang) {
505		let highlighted = Prism$1.highlight(code, Prism$1.languages[lang], lang);
506
507		for (const link of linkify) {
508			highlighted = highlighted.replace(new RegExp(link, "g"), `<a href="#h-${link.toLocaleLowerCase()}">${link}</a>`);
509		}
510
511		return highlighted;
512	}
513
514	function highlight_code(_docs, lang) {
515		return Object.entries(_docs).map(([name, { type, description, default: _default }]) => {
516			let highlighted_type = type ? highlight(type, lang) : null;
517
518			return {
519				name,
520				type: highlighted_type,
521				description,
522				default: _default ? highlight(_default, lang) : null
523			};
524		});
525	}
526
527	let el = [];
528
529	function code_binding($$value, i) {
530		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
531			el[i] = $$value;
532			$$invalidate(2, el);
533		});
534	}
535
536	const click_handler = i =>
536 $$invalidate(3, show_desc[i] = !show_desc[i], show_desc);
537
538	$$self.$$set = $$props => {
539		if ('docs' in $$props) $$invalidate(4, docs = $$props.docs);
540		if ('lang' in $$props) $$invalidate(0, lang = $$props.lang);
541		if ('linkify' in $$props) $$invalidate(5, linkify = $$props.linkify);
542	};
543
544	$$self.$$.update = () => {
545		if ($$self.$$.dirty & /*docs, lang*/ 17) {
546			{
547				setTimeout(
548					() => {
549						$$invalidate(1, _docs = highlight_code(docs, lang));
550					},
551					0
552				);
553			}
554		}
555
556		if ($$self.$$.dirty & /*_docs*/ 2) {
557			$$invalidate(3, show_desc = _docs && _docs.map(x => false));
558		}
559	};
560
561	return [lang, _docs, el, show_desc, docs, linkify, code_binding, click_handler];
562}
563
564class ParamViewer extends SvelteComponent$1 {
565	constructor(options) {
566		super();
567		init$1(this, options, instance$1, create_fragment$1, safe_not_equal$1, { docs: 4, lang: 0, linkify: 5 });
568	}
569}
570
571/* home/runner/work/gradio/gradio/js/paramviewer/Index.svelte generated by Svelte v4.2.2 */
572const {
573	SvelteComponent,
574	create_component,
575	destroy_component,
576	init,
577	mount_component,
578	safe_not_equal,
579	transition_in,
580	transition_out
581} = window.__gradio__svelte__internal;
582function create_fragment(ctx) {
583	let paramviewer;
584	let current;
585
586	paramviewer = new ParamViewer({
587			props: {
588				docs: /*value*/ ctx[0],
589				linkify: /*linkify*/ ctx[1]
590			}
591		});
592
593	return {
594		c() {
595			create_component(paramviewer.$$.fragment);
596		},
597		m(target, anchor) {
598			mount_component(paramviewer, target, anchor);
599			current = true;
600		},
601		p(ctx, [dirty]) {
602			const paramviewer_changes = {};
603			if (dirty & /*value*/ 1) paramviewer_changes.docs = /*value*/ ctx[0];
604			if (dirty & /*linkify*/ 2) paramviewer_changes.linkify = /*linkify*/ ctx[1];
605			paramviewer.$set(paramviewer_changes);
606		},
607		i(local) {
608			if (current) return;
609			transition_in(paramviewer.$$.fragment, local);
610			current = true;
611		},
612		o(local) {
613			transition_out(paramviewer.$$.fragment, local);
614			current = false;
615		},
616		d(detaching) {
617			destroy_component(paramviewer, detaching);
618		}
619	};
620}
621
622function instance($$self, $$props, $$invalidate) {
623	let { value } = $$props;
624	let { linkify = [] } = $$props;
625
626	$$self.$$set = $$props => {
627		if ('value' in $$props) $$invalidate(0, value = $$props.value);
628		if ('linkify' in $$props) $$invalidate(1, linkify = $$props.linkify);
629	};
630
631	return [value, linkify];
632}
633
634class Index extends SvelteComponent {
635	constructor(options) {
636		super();
637		init(this, options, instance, create_fragment, safe_not_equal, { value: 0, linkify: 1 });
638	}
639}
640
641export { Index as default };
642//# sourceMappingURL=Index-4b19822d.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.