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.
03.1k
1import { afterTick, onDestroyEffect } from "svelte-toolbelt";2export class AnimationsComplete {3 #opts;4 #currentFrame = null;5 #observer = null;6 #runId = 0;7 constructor(opts) {8 this.#opts = opts;9 onDestroyEffect(() => this.#cleanup());10 }11 #cleanup() {12 if (this.#currentFrame !== null) {13 window.cancelAnimationFrame(this.#currentFrame);14 this.#currentFrame = null;15 }16 this.#observer?.disconnect();17 this.#observer = null;18 this.#runId++;19 }20 run(fn) {21 this.#cleanup();22 const node = this.#opts.ref.current;23 if (!node)24 return;25 if (typeof node.getAnimations !== "function") {26 this.#executeCallback(fn);27 return;28 }29 const runId = this.#runId;30 const executeIfCurrent = () => {31 if (runId !== this.#runId)32 return;33 this.#executeCallback(fn);34 };35 const waitForAnimations = () => {36 if (runId !== this.#runId)37 return;38 const animations = node.getAnimations();39 if (animations.length === 0) {40 executeIfCurrent();41 return;42 }43 Promise.all(animations.map((animation) => animation.finished))44 .then(() => {45 executeIfCurrent();46 })47 .catch(() => {48 if (runId !== this.#runId)49 return;50 const currentAnimations = node.getAnimations();51 const hasRunningAnimations = currentAnimations.some((animation) => animation.pending || animation.playState !== "finished");52 if (hasRunningAnimations) {53 waitForAnimations();54 return;55 }56 executeIfCurrent();57 });58 };59 const requestWaitForAnimations = () => {60 this.#currentFrame = window.requestAnimationFrame(() => {61 this.#currentFrame = null;62 waitForAnimations();63 });64 };65 if (!this.#opts.afterTick.current) {66 requestWaitForAnimations();67 return;68 }69 this.#currentFrame = window.requestAnimationFrame(() => {70 this.#currentFrame = null;71 const startingStyleAttr = "data-starting-style";72 if (!node.hasAttribute(startingStyleAttr)) {73 requestWaitForAnimations();74 return;75 }76 this.#observer = new MutationObserver(() => {77 if (runId !== this.#runId)78 return;79 if (node.hasAttribute(startingStyleAttr))80 return;81 this.#observer?.disconnect();82 this.#observer = null;83 requestWaitForAnimations();84 });85 this.#observer.observe(node, {86 attributes: true,87 attributeFilter: [startingStyleAttr],88 });89 });90 }91 #executeCallback(fn) {92 const execute = () => {93 fn();94 };95 if (this.#opts.afterTick) {96 afterTick(execute);97 }98 else {99 execute();100 }101 }102}103 