Team Ai
Datasetpublic

Brunobkr/llama.cpp_AlgMor24_github

ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes3.1kdownloads
render.js335 linesDownload Raw Back to client
1/** @import { ComponentContext, Effect, EffectNodes, TemplateNode } from '#client' */2/** @import { Component, ComponentType, SvelteComponent, MountOptions } from '../../index.js' */3import { DEV } from 'esm-env';4import {5	clear_text_content,6	create_text,7	get_first_child,8	get_next_sibling,9	init_operations10} from './dom/operations.js';11import { HYDRATION_END, HYDRATION_ERROR, HYDRATION_START } from '../../constants.js';12import { active_effect } from './runtime.js';13import { push, pop, component_context } from './context.js';14import { component_root } from './reactivity/effects.js';15import { hydrate_node, hydrating, set_hydrate_node, set_hydrating } from './dom/hydration.js';16import { array_from } from '../shared/utils.js';17import {18	all_registered_events,19	handle_event_propagation,20	root_event_handles21} from './dom/elements/events.js';22import * as w from './warnings.js';23import * as e from './errors.js';24import { assign_nodes } from './dom/template.js';25import { is_passive_event } from '../../utils.js';26import { COMMENT_NODE, STATE_SYMBOL, TEXT_CACHE } from './constants.js';27import { boundary } from './dom/blocks/boundary.js';28 29/**30 * This is normally true — block effects should run their intro transitions —31 * but is false during hydration (unless `options.intro` is `true`) and32 * when creating the children of a `<svelte:element>` that just changed tag33 */34export let should_intro = true;35 36/** @param {boolean} value */37export function set_should_intro(value) {38	should_intro = value;39}40 41/**42 * @param {Element} text43 * @param {string} value44 * @returns {void}45 */46export function set_text(text, value) {47	// For objects, we apply string coercion (which might make things like $state array references in the template reactive) before diffing48	var str = value == null ? '' : typeof value === 'object' ? `${value}` : value;49	// prettier-ignore50	if (str !== (/** @type {any} */ (text)[TEXT_CACHE] ??= text.nodeValue)) {51		/** @type {any} */ (text)[TEXT_CACHE] = str;52		text.nodeValue = `${str}`;53	}54}55 56/**57 * Mounts a component to the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component.58 * Transitions will play during the initial render unless the `intro` option is set to `false`.59 *60 * @template {Record<string, any>} Props61 * @template {Record<string, any>} Exports62 * @param {ComponentType<SvelteComponent<Props>> | Component<Props, Exports, any>} component63 * @param {MountOptions<Props>} options64 * @returns {Exports}65 */66export function mount(component, options) {67	return _mount(component, options);68}69 70/**71 * Hydrates a component on the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component72 *73 * @template {Record<string, any>} Props74 * @template {Record<string, any>} Exports75 * @param {ComponentType<SvelteComponent<Props>> | Component<Props, Exports, any>} component76 * @param {{} extends Props ? {77 * 		target: Document | Element | ShadowRoot;78 * 		props?: Props;79 * 		events?: Record<string, (e: any) => any>;80 *  	context?: Map<any, any>;81 * 		intro?: boolean;82 * 		recover?: boolean;83 *		transformError?: (error: unknown) => unknown;84 * 	} : {85 * 		target: Document | Element | ShadowRoot;86 * 		props: Props;87 * 		events?: Record<string, (e: any) => any>;88 *  	context?: Map<any, any>;89 * 		intro?: boolean;90 * 		recover?: boolean;91 *		transformError?: (error: unknown) => unknown;92 * 	}} options93 * @returns {Exports}94 */95export function hydrate(component, options) {96	init_operations();97	options.intro = options.intro ?? false;98	const target = options.target;99	const was_hydrating = hydrating;100	const previous_hydrate_node = hydrate_node;101 102	try {103		var anchor = get_first_child(target);104 105		while (106			anchor &&107			(anchor.nodeType !== COMMENT_NODE || /** @type {Comment} */ (anchor).data !== HYDRATION_START)108		) {109			anchor = get_next_sibling(anchor);110		}111 112		if (!anchor) {113			throw HYDRATION_ERROR;114		}115 116		set_hydrating(true);117		set_hydrate_node(/** @type {Comment} */ (anchor));118 119		const instance = _mount(component, { ...options, anchor });120 121		set_hydrating(false);122 123		return /**  @type {Exports} */ (instance);124	} catch (error) {125		// re-throw Svelte errors - they are certainly not related to hydration126		if (127			error instanceof Error &&128			error.message.split('\n').some((line) => line.startsWith('https://svelte.dev/e/'))129		) {130			throw error;131		}132		if (error !== HYDRATION_ERROR) {133			// eslint-disable-next-line no-console134			console.warn('Failed to hydrate: ', error);135		}136 137		if (options.recover === false) {138			e.hydration_failed();139		}140 141		// If an error occurred above, the operations might not yet have been initialised.142		init_operations();143		clear_text_content(target);144 145		set_hydrating(false);146		return mount(component, options);147	} finally {148		set_hydrating(was_hydrating);149		set_hydrate_node(previous_hydrate_node);150	}151}152 153/** @type {Map<EventTarget, Map<string, number>>} */154const listeners = new Map();155 156/**157 * @template {Record<string, any>} Exports158 * @param {ComponentType<SvelteComponent<any>> | Component<any>} Component159 * @param {MountOptions} options160 * @returns {Exports}161 */162function _mount(163	Component,164	{ target, anchor, props = {}, events, context, intro = true, transformError }165) {166	init_operations();167 168	/** @type {Exports} */169	// @ts-expect-error will be defined because the render effect runs synchronously170	var component = undefined;171 172	var unmount = component_root(() => {173		var anchor_node = anchor ?? target.appendChild(create_text());174 175		boundary(176			/** @type {TemplateNode} */ (anchor_node),177			{178				pending: () => {}179			},180			(anchor_node) => {181				push({});182				var ctx = /** @type {ComponentContext} */ (component_context);183				if (context) ctx.c = context;184 185				if (events) {186					// We can't spread the object or else we'd lose the state proxy stuff, if it is one187					/** @type {any} */ (props).$$events = events;188				}189 190				if (hydrating) {191					assign_nodes(/** @type {TemplateNode} */ (anchor_node), null);192				}193 194				should_intro = intro;195				// @ts-expect-error the public typings are not what the actual function looks like196				component = Component(anchor_node, props) || {};197				should_intro = true;198 199				if (hydrating) {200					/** @type {Effect & { nodes: EffectNodes }} */ (active_effect).nodes.end = hydrate_node;201 202					if (203						hydrate_node === null ||204						hydrate_node.nodeType !== COMMENT_NODE ||205						/** @type {Comment} */ (hydrate_node).data !== HYDRATION_END206					) {207						w.hydration_mismatch();208						throw HYDRATION_ERROR;209					}210				}211 212				pop();213			},214			transformError215		);216 217		// Setup event delegation _after_ component is mounted - if an error would happen during mount, it would otherwise not be cleaned up218		/** @type {Set<string>} */219		var registered_events = new Set();220 221		/** @param {Array<string>} events */222		var event_handle = (events) => {223			for (var i = 0; i < events.length; i++) {224				var event_name = events[i];225 226				if (registered_events.has(event_name)) continue;227				registered_events.add(event_name);228 229				var passive = is_passive_event(event_name);230 231				// Add the event listener to both the container and the document.232				// The container listener ensures we catch events from within in case233				// the outer content stops propagation of the event.234				//235				// The document listener ensures we catch events that originate from elements that were236				// manually moved outside of the container (e.g. via manual portals).237				for (const node of [target, document]) {238					var counts = listeners.get(node);239 240					if (counts === undefined) {241						counts = new Map();242						listeners.set(node, counts);243					}244 245					var count = counts.get(event_name);246 247					if (count === undefined) {248						node.addEventListener(event_name, handle_event_propagation, { passive });249						counts.set(event_name, 1);250					} else {251						counts.set(event_name, count + 1);252					}253				}254			}255		};256 257		event_handle(array_from(all_registered_events));258		root_event_handles.add(event_handle);259 260		return () => {261			for (var event_name of registered_events) {262				for (const node of [target, document]) {263					var counts = /** @type {Map<string, number>} */ (listeners.get(node));264					var count = /** @type {number} */ (counts.get(event_name));265 266					if (--count == 0) {267						node.removeEventListener(event_name, handle_event_propagation);268						counts.delete(event_name);269 270						if (counts.size === 0) {271							listeners.delete(node);272						}273					} else {274						counts.set(event_name, count);275					}276				}277			}278 279			root_event_handles.delete(event_handle);280 281			if (anchor_node !== anchor) {282				anchor_node.parentNode?.removeChild(anchor_node);283			}284		};285	});286 287	mounted_components.set(component, unmount);288	return component;289}290 291/**292 * References of the components that were mounted or hydrated.293 * Uses a `WeakMap` to avoid memory leaks.294 */295let mounted_components = new WeakMap();296 297/**298 * Unmounts a component that was previously mounted using `mount` or `hydrate`.299 *300 * Since 5.13.0, if `options.outro` is `true`, [transitions](https://svelte.dev/docs/svelte/transition) will play before the component is removed from the DOM.301 *302 * Returns a `Promise` that resolves after transitions have completed if `options.outro` is true, or immediately otherwise (prior to 5.13.0, returns `void`).303 *304 * ```js305 * import { mount, unmount } from 'svelte';306 * import App from './App.svelte';307 *308 * const app = mount(App, { target: document.body });309 *310 * // later...311 * unmount(app, { outro: true });312 * ```313 * @param {Record<string, any>} component314 * @param {{ outro?: boolean }} [options]315 * @returns {Promise<void>}316 */317export function unmount(component, options) {318	const fn = mounted_components.get(component);319 320	if (fn) {321		mounted_components.delete(component);322		return fn(options);323	}324 325	if (DEV) {326		if (STATE_SYMBOL in component) {327			w.state_proxy_unmount();328		} else {329			w.lifecycle_double_unmount();330		}331	}332 333	return Promise.resolve();334}335 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai