PageSourceSearch

https://lookatme.app/assets/gsap/TextPlugin-48bab6de.js

js lookatme.app collected 2026-10-09 22:33:52 UTC 4,002 bytes, 121 lines download raw bytes

1/*!
2 * TextPlugin 3.12.7
3 * https://gsap.com
4 *
5 * @license Copyright 2008-2025, GreenSock. All rights reserved.
6 * Subject to the terms at https://gsap.com/standard-license or for
7 * Club GSAP members, the agreement issued with that membership.
8 * @author: Jack Doyle, [email protected]
9*/
10/* eslint-disable */
11
12import { emojiSafeSplit, getText, splitInnerHTML } from "gsap/Strings";
13
14let gsap, _tempDiv,
15	_getGSAP = () => gsap || (typeof(window) !== "undefined" && (gsap = window.gsap) && gsap.registerPlugin && gsap);
16
17
18export const TextPlugin = {
19	version:"3.12.7",
20	name:"text",
21	init(target, value, tween) {
22		typeof(value) !== "object" && (value = {value:value});
23		let i = target.nodeName.toUpperCase(),
24			data = this,
25			{ newClass, oldClass, preserveSpaces, rtl } = value,
26			delimiter = data.delimiter = value.delimiter || "",
27			fillChar = data.fillChar = value.fillChar || (value.padSpace ? " " : ""),
28			short, text, original, j, condensedText, condensedOriginal, aggregate, s;
29		data.svg = (target.getBBox && (i === "TEXT" || i === "TSPAN"));
30		if (!("innerHTML" in target) && !data.svg) {
31			return false;
32		}
33		data.target = target;
34		if (!("value" in value)) {
35			data.text = data.original = [""];
36			return;
37		}
38		original = splitInnerHTML(target, delimiter, false, preserveSpaces, data.svg);
39		_tempDiv || (_tempDiv = document.createElement("div"));
40		_tempDiv.innerHTML = value.value;
41		text = splitInnerHTML(_tempDiv, delimiter, false, preserveSpaces, data.svg);
42		data.from = tween._from;
43		if ((data.from || rtl) && !(rtl && data.from)) { // right-to-left or "from()" tweens should invert things (but if it's BOTH .from() and rtl, inverting twice equals not inverting at all :)
44			i = original;
45			original = text;
46			text = i;
47		}
48		data.hasClass = !!(newClass || oldClass);
49		data.newClass = rtl ? oldClass : newClass;
50		data.oldClass = rtl ? newClass : oldClass;
51		i = original.length - text.length;
52		short = i < 0 ? original : text;
53		if (i < 0) {
54			i = -i;
55		}
56		while (--i > -1) {
57			short.push(fillChar);
58		}
59		if (value.type === "diff") {
60			j = 0;
61			condensedText = [];
62			condensedOriginal = [];
63			aggregate = "";
64			for (i = 0; i < text.length; i++) {
65				s = text[i];
66				if (s === original[i]) {
67					aggregate += s;
68				} else {
69					condensedText[j] = aggregate + s;
70					condensedOriginal[j++] = aggregate + original[i];
71					aggregate = "";
72				}
73			}
74			text = condensedText;
75			original = condensedOriginal;
76			if (aggregate) {
77				text.push(aggregate);
78				original.push(aggregate);
79			}
80		}
81		value.speed && tween.duration(Math.min(0.05 / value.speed * short.length, value.maxDuration || 9999));
82		data.rtl = rtl;
83		data.original = original;
84		data.text = text;
85		data._props.push("text");
86	},
87	render(ratio, data) {
88		if (ratio > 1) {
89			ratio = 1;
90		} else if (ratio < 0) {
91			ratio = 0;
92		}
93		if (data.from) {
94			ratio = 1 - ratio;
95		}
96		let { text, hasClass, newClass, oldClass, delimiter, target, fillChar, original, rtl } = data,
97			l = text.length,
98			i = ((rtl ? 1 - ratio : ratio) * l + 0.5) | 0,
99			applyNew, applyOld, str;
100		if (hasClass && ratio) {
101			applyNew = (newClass && i);
102			applyOld = (oldClass && i !== l);
103			str = (applyNew ? "<span class='" + newClass + "'>" : "") + text.slice(0, i).join(delimiter) + (applyNew ? "</span>" : "") + (applyOld ? "<span class='" + oldClass + "'>" : "") + delimiter + original.slice(i).join(delimiter) + (applyOld ? "</span>" : "");
104		} else {
105			str = text.slice(0, i).join(delimiter) + delimiter + original.slice(i).join(delimiter);
106		}
107		if (data.svg) { //SVG text elements don't have an "innerHTML" in Microsoft browsers.
108			target.textContent = str;
109		} else {
110			target.innerHTML = (fillChar === "&nbsp;" && ~str.indexOf("  ")) ? str.split("  ").join("&nbsp;&nbsp;") : str;
111		}
112	}
113};
114
115TextPlugin.splitInnerHTML = splitInnerHTML;
116TextPlugin.emojiSafeSplit = emojiSafeSplit;
117TextPlugin.getText = getText;
118
119_getGSAP() && gsap.registerPlugin(TextPlugin);
120
121export { TextPlugin as default };

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.