PageSourceSearch

https://pavanchow-vibe-security-test.hf.space/assets/Index-Dtsvb4cq.js

js pavanchow-vibe-security-test.hf.space collected 2026-10-03 17:14:42 UTC 10,608 bytes, 387 lines download raw bytes

1import { p as prop, i as if_block, d as bind_this, f as set_style, a as set_attribute, k as each, b as set_class, r as rest_props } from './i18n-CMo5lpzy.js';
2import { R as push, aa as onMount, t as template_effect, w as get, a0 as set_text, Z as event, a as append, T as pop, u as state, X as sibling, V as child, W as from_html, x as set, a5 as user_derived, Y as reset, S as first_child } from './index-BvBk1Iap.js';
3import { G as Gradio } from './utils.svelte-CYLB_jIA.js';
4import { h as html } from './html-CdUEtR5E.js';
5import { P as Prism$1 } from './prism-python-CbXMXbdR.js';
6import './clone-DaB-S2nH.js';
7
8var prismTypescript = {};
9
10var hasRequiredPrismTypescript;
11
12function requirePrismTypescript () {
13	if (hasRequiredPrismTypescript) return prismTypescript;
14	hasRequiredPrismTypescript = 1;
15	(function (Prism) {
16
17		Prism.languages.typescript = Prism.languages.extend('javascript', {
18			'class-name': {
19				pattern: /(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,
20				lookbehind: true,
21				greedy: true,
22				inside: null // see below
23			},
24			'builtin': /\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/,
25		});
26
27		// The keywords TypeScript adds to JavaScript
28		Prism.languages.typescript.keyword.push(
29			/\b(?:abstract|declare|is|keyof|readonly|require)\b/,
30			// keywords that have to be followed by an identifier
31			/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,
32			// This is for `import type *, {}`
33			/\btype\b(?=\s*(?:[\{*]|$))/
34		);
35
36		// doesn't work with TS because TS is too complex
37		delete Prism.languages.typescript['parameter'];
38		delete Prism.languages.typescript['literal-property'];
39
40		// a version of typescript specifically for highlighting types
41		var typeInside = Prism.languages.extend('typescript', {});
42		delete typeInside['class-name'];
43
44		Prism.languages.typescript['class-name'].inside = typeInside;
45
46		Prism.languages.insertBefore('typescript', 'function', {
47			'decorator': {
48				pattern: /@[$\w\xA0-\uFFFF]+/,
49				inside: {
50					'at': {
51						pattern: /^@/,
52						alias: 'operator'
53					},
54					'function': /^[\s\S]+/
55				}
56			},
57			'generic-function': {
58				// e.g. foo<T extends "bar" | "baz">( ...
59				pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,
60				greedy: true,
61				inside: {
62					'function': /^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,
63					'generic': {
64						pattern: /<[\s\S]+/, // everything after the first <
65						alias: 'class-name',
66						inside: typeInside
67					}
68				}
69			}
70		});
71
72		Prism.languages.ts = Prism.languages.typescript;
73
74	}(Prism));
75	return prismTypescript;
76}
77
78requirePrismTypescript();
79
80var root_1 = from_html(`<span class="title svelte-1kuiw39"> </span>`);
81var root_4 = from_html(`<a class="param-link svelte-1kuiw39"><span class="link-icon svelte-1kuiw39">🔗</span></a>`);
82var root_5 = from_html(`: <!>`, 1);
83var root_6 = from_html(`<div><span class="svelte-1kuiw39">default</span> <code class="svelte-1kuiw39">= <!></code></div>`);
84var root_7 = from_html(`<div class="description svelte-1kuiw39"><p><!></p></div>`);
85var root_3 = from_html(`<details class="param md svelte-1kuiw39"><summary class="type svelte-1kuiw39"><!> <pre><code class="svelte-1kuiw39"> <!></code></pre></summary> <!> <!></details>`);
86var root_2 = from_html(`<div class="param-content svelte-1kuiw39"></div>`);
87var root = from_html(`<div class="wrap svelte-1kuiw39"><div class="header svelte-1kuiw39"><!> <button class="toggle-all svelte-1kuiw39"> </button></div> <!></div>`);
88
89function ParamViewer($$anchor, $$props) {
90	push($$props, true);
91
92	let linkify = prop($$props, 'linkify', 19, () => []);
93	let component_root;
94	let all_open = state(false);
95	let lang = "python";
96	let _docs = user_derived(() => highlight_code($$props.docs, lang));
97
98	function create_slug(name, anchor_links) {
99		let prefix = "param-";
100
101		if (typeof anchor_links === "string") {
102			prefix += anchor_links + "-";
103		}
104
105		return prefix + name.toLowerCase().replace(/[^a-z0-9]+/g, "-");
106	}
107
108	function highlight(code, lang) {
109		let highlighted = Prism$1.highlight(code, Prism$1.languages[lang], lang);
110
111		for (const link of linkify()) {
112			highlighted = highlighted.replace(new RegExp(link, "g"), `<a href="#h-${link.toLocaleLowerCase()}">${link}</a>`);
113		}
114
115		return highlighted;
116	}
117
118	function highlight_code(_docs, lang) {
119		if (!_docs) {
120			return [];
121		}
122
123		return Object.entries(_docs).map(([name, { type, description, default: _default }]) => {
124			let highlighted_type = type ? highlight(type, lang) : null;
125
126			return {
127				name,
128				type: highlighted_type,
129				description,
130				default: _default ? highlight(_default, lang) : null
131			};
132		});
133	}
134
135	function toggle_all() {
136		set(all_open, !get(all_open));
137
138		const details = component_root.querySelectorAll(".param");
139
140		details.forEach((detail) => {
141			if (detail instanceof HTMLDetailsElement) {
142				detail.open = get(all_open);
143			}
144		});
145	}
146
147	function render_links(description) {
148		const escaped = description.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
149		const markdown_links = escaped.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2" target="_blank">$1</a>');
150
151		return markdown_links;
152	}
153
154	onMount(() => {
155		if (window.location.hash) {
156			open_parameter_from_hash(window.location.hash);
157		}
158
159		window.addEventListener("hashchange", (e) => {
160			open_parameter_from_hash(window.location.hash);
161		});
162	});
163
164	function open_parameter_from_hash(hash) {
165		if (!component_root) return;
166
167		const id = hash.slice(1);
168		const detail = component_root.querySelector(`#${id}`);
169
170		if (detail instanceof HTMLDetailsElement) {
171			detail.open = true;
172			detail.scrollIntoView({ behavior: "smooth" });
173		}
174	}
175
176	const get_dimension = (dimension_value) => {
177		if (dimension_value === undefined) {
178			return undefined;
179		}
180
181		if (typeof dimension_value === "number") {
182			return dimension_value + "px";
183		} else if (typeof dimension_value === "string") {
184			return dimension_value;
185		}
186	};
187
188	var div = root();
189	let styles;
190	var div_1 = child(div);
191	var node = child(div_1);
192
193	{
194		var consequent = ($$anchor) => {
195			var span = root_1();
196			var text = child(span, true);
197
198			reset(span);
199			template_effect(() => set_text(text, $$props.header));
200			append($$anchor, span);
201		};
202
203		if_block(node, ($$render) => {
204			if ($$props.header !== null) $$render(consequent);
205		});
206	}
207
208	var button = sibling(node, 2);
209	var text_1 = child(button, true);
210
211	reset(button);
212	reset(div_1);
213
214	var node_1 = sibling(div_1, 2);
215
216	{
217		var consequent_5 = ($$anchor) => {
218			var div_2 = root_2();
219
220			each(div_2, 21, () => get(_docs), ({ type, description, default: _default, name }) => name, ($$anchor, $$item) => {
221				let type = () => get($$item).type;
222				let description = () => get($$item).description;
223				let _default = () => get($$item).default;
224				let name = () => get($$item).name;
225				var details_1 = root_3();
226				var summary = child(details_1);
227				var node_2 = child(summary);
228
229				{
230					var consequent_1 = ($$anchor) => {
231						var a = root_4();
232
233						template_effect(($0) => set_attribute(a, 'href', `#${$0 ?? ''}`), [() => create_slug(name() || '', $$props.anchor_links)]);
234						append($$anchor, a);
235					};
236
237					if_block(node_2, ($$render) => {
238						if ($$props.anchor_links) $$render(consequent_1);
239					});
240				}
241
242				var pre = sibling(node_2, 2);
243
244				set_class(pre, 1, 'language-python svelte-1kuiw39');
245
246				var code_1 = child(pre);
247				var text_2 = child(code_1, true);
248				var node_3 = sibling(text_2);
249
250				{
251					var consequent_2 = ($$anchor) => {
252						var fragment = root_5();
253						var node_4 = sibling(first_child(fragment));
254
255						html(node_4, type);
256						append($$anchor, fragment);
257					};
258
259					if_block(node_3, ($$render) => {
260						if (type()) $$render(consequent_2);
261					});
262				}
263
264				reset(code_1);
265				reset(pre);
266				reset(summary);
267
268				var node_5 = sibling(summary, 2);
269
270				{
271					var consequent_3 = ($$anchor) => {
272						var div_3 = root_6();
273						let classes;
274						var span_1 = child(div_3);
275
276						set_style(span_1, '', {}, { 'padding-right': "4px" });
277
278						var code_2 = sibling(span_1, 2);
279						var node_6 = sibling(child(code_2));
280
281						html(node_6, _default);
282						reset(code_2);
283						reset(div_3);
284						template_effect(() => classes = set_class(div_3, 1, 'default svelte-1kuiw39', null, classes, { last: !description() }));
285						append($$anchor, div_3);
286					};
287
288					if_block(node_5, ($$render) => {
289						if (_default()) $$render(consequent_3);
290					});
291				}
292
293				var node_7 = sibling(node_5, 2);
294
295				{
296					var consequent_4 = ($$anchor) => {
297						var div_4 = root_7();
298						var p = child(div_4);
299						var node_8 = child(p);
300
301						html(node_8, () => render_links(description()));
302						reset(p);
303						reset(div_4);
304						append($$anchor, div_4);
305					};
306
307					if_block(node_7, ($$render) => {
308						if (description()) $$render(consequent_4);
309					});
310				}
311
312				reset(details_1);
313
314				template_effect(
315					($0) => {
316						set_attribute(details_1, 'id', $0);
317						set_text(text_2, name());
318					},
319					[
320						() => $$props.anchor_links
321							? create_slug(name() || "", $$props.anchor_links)
322							: undefined
323					]
324				);
325
326				append($$anchor, details_1);
327			});
328
329			reset(div_2);
330			append($$anchor, div_2);
331		};
332
333		if_block(node_1, ($$render) => {
334			if (get(_docs)) $$render(consequent_5);
335		});
336	}
337
338	reset(div);
339	bind_this(div, ($$value) => component_root = $$value, () => component_root);
340
341	template_effect(
342		($0) => {
343			styles = set_style(div, '', styles, $0);
344			set_attribute(button, 'title', get(all_open) ? "Close All" : "Open All");
345			set_text(text_1, get(all_open) ? "▲" : "▼");
346		},
347		[() => ({ 'max-height': get_dimension($$props.max_height) })]
348	);
349
350	event('click', button, toggle_all);
351	append($$anchor, div);
352	pop();
353}
354
355function Index($$anchor, $$props) {
356	push($$props, true);
357
358	const props = rest_props($$props, ['$$slots', '$$events', '$$legacy']);
359	const gradio = new Gradio(props);
360
361	ParamViewer($$anchor, {
362		get docs() {
363			return gradio.props.value;
364		},
365
366		get linkify() {
367			return gradio.props.linkify;
368		},
369
370		get header() {
371			return gradio.props.header;
372		},
373
374		get anchor_links() {
375			return gradio.props.anchor_links;
376		},
377
378		get max_height() {
379			return gradio.props.max_height;
380		}
381	});
382
383	pop();
384}
385
386export { Index as default };
387//# sourceMappingURL=Index-Dtsvb4cq.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.