DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.
var ScrollFollow = class ScrollFollow {
following;
threshold;
static owners = new WeakMap();
target = null;
sampledTop;
constructor(following, threshold) {
this.following = following;
this.threshold = threshold;
}
static forElement(element) {
return this.owners.get(element);
}
bind(element) {
ScrollFollow.owners.set(element, this);
return () => {
if (ScrollFollow.owners.get(element) === this) ScrollFollow.owners.delete(element);
};
}
get active() {
return this.following;
}
get animating() {
return this.target !== null;
}
nearBottom(metrics) {
return Math.abs(metrics.floor - metrics.top) <= this.threshold;
}
setFollowing(active) {
this.following = active;
if (!active) this.target = null;
}
reset() {
this.setFollowing(false);
this.sampledTop = void 0;
}
sample(metrics, movedByReader = this.sampledTop === void 0 || Math.abs(metrics.top - this.sampledTop) > .5) {
this.sampledTop = metrics.top;
if (!this.animating && movedByReader) this.following = this.nearBottom(metrics);
return this.active;
}
settle(metrics) {
const target = this.target;
this.target = null;
return this.sample(metrics, target === null ? void 0 : Math.abs(metrics.top - Math.min(target, metrics.floor)) > this.threshold);
}
jump(element, metrics, top) {
const animated = this.animating;
this.target = null;
const target = Math.max(0, Math.min(metrics.floor, top));
if (animated) element.scrollTo({
top: target,
behavior: "instant"
});
else if (target !== metrics.top) element.scrollTop = target;
const landed = {
...metrics,
top: element.scrollTop
};
this.sampledTop = landed.top;
this.following = this.nearBottom(landed);
return landed;
}
toBottom(element, metrics, behavior) {
this.following = true;
if (metrics.top === metrics.floor) return this.jump(element, metrics, metrics.floor);
if (behavior === "instant" && this.animating) {
if (this.target !== metrics.floor) {
this.target = metrics.floor;
element.scrollTo({
top: metrics.floor,
behavior: "smooth"
});
}
return metrics;
}
if (behavior === "instant" || !this.animating && this.nearBottom(metrics)) return this.jump(element, metrics, metrics.floor);
if (typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches) return this.jump(element, metrics, metrics.floor);
if (this.target === null) {
this.target = metrics.floor;
element.scrollTo({
top: metrics.floor,
behavior: "smooth"
});
}
return metrics;
}
interrupt(element, metrics) {
if (!this.animating) return;
this.target = null;
this.sampledTop = metrics.top;
element.scrollTo({
top: metrics.top,
behavior: "instant"
});
}
};