UNPKG

solid-spring

Version:
1,706 lines (1,683 loc) 91.6 kB
import { createEffect, createSignal, createRenderEffect, onCleanup, createMemo, children, createComponent } from 'solid-js'; import { Dynamic } from 'solid-js/web'; const createInterpolator = (range, output, extrapolate) => { if (is.fun(range)) { return range; } if (is.arr(range)) { return createInterpolator({ range, output, extrapolate }); } if (is.str(range.output[0])) { return createStringInterpolator(range); } const config = range; const outputRange = config.output; const inputRange = config.range || [0, 1]; const extrapolateLeft = config.extrapolateLeft || config.extrapolate || "extend"; const extrapolateRight = config.extrapolateRight || config.extrapolate || "extend"; const easing = config.easing || ((t) => t); return (input) => { const range2 = findRange(input, inputRange); return interpolate(input, inputRange[range2], inputRange[range2 + 1], outputRange[range2], outputRange[range2 + 1], easing, extrapolateLeft, extrapolateRight, config.map); }; }; function interpolate(input, inputMin, inputMax, outputMin, outputMax, easing, extrapolateLeft, extrapolateRight, map) { let result = map ? map(input) : input; if (result < inputMin) { if (extrapolateLeft === "identity") return result; else if (extrapolateLeft === "clamp") result = inputMin; } if (result > inputMax) { if (extrapolateRight === "identity") return result; else if (extrapolateRight === "clamp") result = inputMax; } if (outputMin === outputMax) return outputMin; if (inputMin === inputMax) return input <= inputMin ? outputMin : outputMax; if (inputMin === -Infinity) result = -result; else if (inputMax === Infinity) result = result - inputMin; else result = (result - inputMin) / (inputMax - inputMin); result = easing(result); if (outputMin === -Infinity) result = -result; else if (outputMax === Infinity) result = result + outputMin; else result = result * (outputMax - outputMin) + outputMin; return result; } function findRange(input, inputRange) { for (var i = 1; i < inputRange.length - 1; ++i) if (inputRange[i] >= input) break; return i - 1; } const $get = Symbol.for("FluidValue.get"); const $observers = Symbol.for("FluidValue.observers"); const hasFluidValue = (arg) => Boolean(arg && arg[$get]); const setHidden = (target, key, value) => Object.defineProperty(target, key, { value, writable: true, configurable: true }); const setFluidGetter = (target, get) => setHidden(target, $get, get); class FluidValue { constructor(get) { if (!get && !(get = this.get)) { throw Error("Unknown getter"); } setFluidGetter(this, get); } } const getFluidValue = (arg) => arg && arg[$get] ? arg[$get]() : arg; function callFluidObserver(observer, event) { if (observer.eventObserved) { observer.eventObserved(event); } else { observer(event); } } function callFluidObservers(target, event) { let observers = target[$observers]; if (observers) { observers.forEach((observer) => { callFluidObserver(observer, event); }); } } function addFluidObserver(target, observer) { if (target[$get]) { let observers = target[$observers]; if (!observers) { setHidden(target, $observers, observers = /* @__PURE__ */ new Set()); } if (!observers.has(observer)) { observers.add(observer); if (target.observerAdded) { target.observerAdded(observers.size, observer); } } } return observer; } function removeFluidObserver(target, observer) { let observers = target[$observers]; if (observers && observers.has(observer)) { const count = observers.size - 1; if (count) { observers.delete(observer); } else { target[$observers] = null; } if (target.observerRemoved) { target.observerRemoved(count, observer); } } } const getFluidObservers = (target) => target[$observers] || null; const $node = Symbol.for("Animated:node"); const isAnimated = (value) => !!value && value[$node] === value; const getAnimated = (owner) => owner && owner[$node]; const setAnimated = (owner, node) => defineHidden(owner, $node, node); const getPayload = (owner) => owner && owner[$node] && owner[$node].getPayload(); class Animated { constructor() { setAnimated(this, this); } getPayload() { return this.payload || []; } } class AnimatedValue extends Animated { constructor(_value) { super(); this._value = _value; this.done = true; this.durationProgress = 0; if (is.num(this._value)) { this.lastPosition = this._value; } } static create(value) { return new AnimatedValue(value); } getPayload() { return [this]; } getValue() { return this._value; } setValue(value, step) { if (is.num(value)) { this.lastPosition = value; if (step) { value = Math.round(value / step) * step; if (this.done) { this.lastPosition = value; } } } if (this._value === value) { return false; } this._value = value; return true; } reset() { const { done } = this; this.done = false; if (is.num(this._value)) { this.elapsedTime = 0; this.durationProgress = 0; this.lastPosition = this._value; if (done) this.lastVelocity = null; this.v0 = null; } } } let updateQueue = makeQueue(); const raf = (fn) => schedule(fn, updateQueue); let writeQueue = makeQueue(); raf.write = (fn) => schedule(fn, writeQueue); let onStartQueue = makeQueue(); raf.onStart = (fn) => schedule(fn, onStartQueue); let onFrameQueue = makeQueue(); raf.onFrame = (fn) => schedule(fn, onFrameQueue); let onFinishQueue = makeQueue(); raf.onFinish = (fn) => schedule(fn, onFinishQueue); let timeouts = []; raf.setTimeout = (handler, ms) => { let time = raf.now() + ms; let cancel = () => { let i = timeouts.findIndex((t) => t.cancel == cancel); if (~i) timeouts.splice(i, 1); pendingCount -= ~i ? 1 : 0; }; let timeout = { time, handler, cancel }; timeouts.splice(findTimeout(time), 0, timeout); pendingCount += 1; start(); return timeout; }; let findTimeout = (time) => ~(~timeouts.findIndex((t) => t.time > time) || ~timeouts.length); raf.cancel = (fn) => { onStartQueue.delete(fn); onFrameQueue.delete(fn); updateQueue.delete(fn); writeQueue.delete(fn); onFinishQueue.delete(fn); }; raf.sync = (fn) => { sync = true; raf.batchedUpdates(fn); sync = false; }; raf.throttle = (fn) => { let lastArgs; function queuedFn() { try { fn(...lastArgs); } finally { lastArgs = null; } } function throttled(...args) { lastArgs = args; raf.onStart(queuedFn); } throttled.handler = fn; throttled.cancel = () => { onStartQueue.delete(queuedFn); lastArgs = null; }; return throttled; }; let nativeRaf = typeof window != "undefined" ? window.requestAnimationFrame : () => { }; raf.use = (impl) => nativeRaf = impl; raf.now = typeof performance != "undefined" ? () => performance.now() : Date.now; raf.batchedUpdates = (fn) => fn(); raf.catch = console.error; raf.frameLoop = "always"; raf.advance = () => { if (raf.frameLoop !== "demand") { console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"); } else { update(); } }; let ts = -1; let pendingCount = 0; let sync = false; function schedule(fn, queue) { if (sync) { queue.delete(fn); fn(0); } else { queue.add(fn); start(); } } function start() { if (ts < 0) { ts = 0; if (raf.frameLoop !== "demand") { nativeRaf(loop); } } } function stop() { ts = -1; } function loop() { if (~ts) { nativeRaf(loop); raf.batchedUpdates(update); } } function update() { let prevTs = ts; ts = raf.now(); let count = findTimeout(ts); if (count) { eachSafely(timeouts.splice(0, count), (t) => t.handler()); pendingCount -= count; } onStartQueue.flush(); updateQueue.flush(prevTs ? Math.min(64, ts - prevTs) : 16.667); onFrameQueue.flush(); writeQueue.flush(); onFinishQueue.flush(); if (!pendingCount) { stop(); } } function makeQueue() { let next = /* @__PURE__ */ new Set(); let current = next; return { add(fn) { pendingCount += current == next && !next.has(fn) ? 1 : 0; next.add(fn); }, delete(fn) { pendingCount -= current == next && next.has(fn) ? 1 : 0; return next.delete(fn); }, flush(arg) { if (current.size) { next = /* @__PURE__ */ new Set(); pendingCount -= current.size; eachSafely(current, (fn) => fn(arg) && next.add(fn)); pendingCount += next.size; current = next; } } }; } function eachSafely(values, each) { values.forEach((value) => { try { each(value); } catch (e) { raf.catch(e); } }); } const startQueue = /* @__PURE__ */ new Set(); let currentFrame = []; let prevFrame = []; let priority = 0; const frameLoop = { get idle() { return !startQueue.size && !currentFrame.length; }, start(animation) { if (priority > animation.priority) { startQueue.add(animation); raf.onStart(flushStartQueue); } else { startSafely(animation); raf(advance); } }, advance, sort(animation) { if (priority) { raf.onFrame(() => frameLoop.sort(animation)); } else { const prevIndex = currentFrame.indexOf(animation); if (~prevIndex) { currentFrame.splice(prevIndex, 1); startUnsafely(animation); } } }, clear() { currentFrame = []; startQueue.clear(); } }; function flushStartQueue() { startQueue.forEach(startSafely); startQueue.clear(); raf(advance); } function startSafely(animation) { if (!currentFrame.includes(animation)) startUnsafely(animation); } function startUnsafely(animation) { currentFrame.splice(findIndex(currentFrame, (other) => other.priority > animation.priority), 0, animation); } function advance(dt) { const nextFrame = prevFrame; for (let i = 0; i < currentFrame.length; i++) { const animation = currentFrame[i]; priority = animation.priority; if (!animation.idle) { animation.advance(dt); if (!animation.idle) { nextFrame.push(animation); } } } priority = 0; prevFrame = currentFrame; prevFrame.length = 0; currentFrame = nextFrame; return currentFrame.length > 0; } function findIndex(arr, test) { const index = arr.findIndex(test); return index < 0 ? arr.length : index; } const isFrameValue = (value) => value instanceof FrameValue; let nextId$1 = 1; class FrameValue extends FluidValue { constructor() { super(...arguments); this.id = nextId$1++; this._priority = 0; } get priority() { return this._priority; } set priority(priority) { if (this._priority != priority) { this._priority = priority; this._onPriorityChange(priority); } } get() { const node = getAnimated(this); return node && node.getValue(); } to(...args) { return to$1(this, args); } interpolate(...args) { return to$1(this, args); } toJSON() { return this.get(); } observerAdded(count) { if (count == 1) this._attach(); } observerRemoved(count) { if (count == 0) this._detach(); } _attach() { } _detach() { } _onChange(value, idle = false) { callFluidObservers(this, { type: "change", parent: this, value, idle }); } _onPriorityChange(priority) { if (!this.idle) { frameLoop.sort(this); } callFluidObservers(this, { type: "priority", parent: this, priority }); } } class Interpolation extends FrameValue { constructor(source, args) { super(); this.source = source; this.idle = true; this._active = /* @__PURE__ */ new Set(); this.calc = createInterpolator(...args); const value = this._get(); const nodeType = getAnimatedType(value); setAnimated(this, nodeType.create(value)); } advance(_dt) { const value = this._get(); const oldValue = this.get(); if (!isEqual(value, oldValue)) { getAnimated(this).setValue(value); this._onChange(value, this.idle); } if (!this.idle && checkIdle(this._active)) { becomeIdle(this); } } _get() { const inputs = is.arr(this.source) ? this.source.map(getFluidValue) : toArray(getFluidValue(this.source)); return this.calc(...inputs); } _start() { if (this.idle && !checkIdle(this._active)) { this.idle = false; each(getPayload(this), (node) => { node.done = false; }); { frameLoop.start(this); } } } _attach() { let priority = 1; each(toArray(this.source), (source) => { if (hasFluidValue(source)) { addFluidObserver(source, this); } if (isFrameValue(source)) { if (!source.idle) { this._active.add(source); } priority = Math.max(priority, source.priority + 1); } }); this.priority = priority; this._start(); } _detach() { each(toArray(this.source), (source) => { if (hasFluidValue(source)) { removeFluidObserver(source, this); } }); this._active.clear(); becomeIdle(this); } eventObserved(event) { if (event.type == "change") { if (event.idle) { this.advance(); } else { this._active.add(event.parent); this._start(); } } else if (event.type == "idle") { this._active.delete(event.parent); } else if (event.type == "priority") { this.priority = toArray(this.source).reduce((highest, parent) => Math.max(highest, (isFrameValue(parent) ? parent.priority : 0) + 1), 0); } } } function isIdle(source) { return source.idle !== false; } function checkIdle(active) { return !active.size || Array.from(active).every(isIdle); } function becomeIdle(self) { if (!self.idle) { self.idle = true; each(getPayload(self), (node) => { node.done = true; }); callFluidObservers(self, { type: "idle", parent: self }); } } const NUMBER = "[-+]?\\d*\\.?\\d+"; const PERCENTAGE = NUMBER + "%"; function call(...parts) { return "\\(\\s*(" + parts.join(")\\s*,\\s*(") + ")\\s*\\)"; } const rgb = new RegExp("rgb" + call(NUMBER, NUMBER, NUMBER)); const rgba = new RegExp("rgba" + call(NUMBER, NUMBER, NUMBER, NUMBER)); const hsl = new RegExp("hsl" + call(NUMBER, PERCENTAGE, PERCENTAGE)); const hsla = new RegExp("hsla" + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER)); const hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/; const hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/; const hex6 = /^#([0-9a-fA-F]{6})$/; const hex8 = /^#([0-9a-fA-F]{8})$/; function normalizeColor(color) { let match; if (typeof color === "number") { return color >>> 0 === color && color >= 0 && color <= 4294967295 ? color : null; } if (match = hex6.exec(color)) return parseInt(match[1] + "ff", 16) >>> 0; if (colors && colors[color] !== void 0) { return colors[color]; } if (match = rgb.exec(color)) { return (parse255(match[1]) << 24 | parse255(match[2]) << 16 | parse255(match[3]) << 8 | 255) >>> 0; } if (match = rgba.exec(color)) { return (parse255(match[1]) << 24 | parse255(match[2]) << 16 | parse255(match[3]) << 8 | parse1(match[4])) >>> 0; } if (match = hex3.exec(color)) { return parseInt(match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + "ff", 16) >>> 0; } if (match = hex8.exec(color)) return parseInt(match[1], 16) >>> 0; if (match = hex4.exec(color)) { return parseInt(match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + match[4] + match[4], 16) >>> 0; } if (match = hsl.exec(color)) { return (hslToRgb(parse360(match[1]), parsePercentage(match[2]), parsePercentage(match[3])) | 255) >>> 0; } if (match = hsla.exec(color)) { return (hslToRgb(parse360(match[1]), parsePercentage(match[2]), parsePercentage(match[3])) | parse1(match[4])) >>> 0; } return null; } function hue2rgb(p, q, t) { if (t < 0) t += 1; if (t > 1) t -= 1; if (t < 1 / 6) return p + (q - p) * 6 * t; if (t < 1 / 2) return q; if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; return p; } function hslToRgb(h, s, l) { const q = l < 0.5 ? l * (1 + s) : l + s - l * s; const p = 2 * l - q; const r = hue2rgb(p, q, h + 1 / 3); const g = hue2rgb(p, q, h); const b = hue2rgb(p, q, h - 1 / 3); return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8; } function parse255(str) { const int = parseInt(str, 10); if (int < 0) return 0; if (int > 255) return 255; return int; } function parse360(str) { const int = parseFloat(str); return (int % 360 + 360) % 360 / 360; } function parse1(str) { const num = parseFloat(str); if (num < 0) return 0; if (num > 1) return 255; return Math.round(num * 255); } function parsePercentage(str) { const int = parseFloat(str); if (int < 0) return 0; if (int > 100) return 1; return int / 100; } const colors$1 = { transparent: 0, aliceblue: 4042850303, antiquewhite: 4209760255, aqua: 16777215, aquamarine: 2147472639, azure: 4043309055, beige: 4126530815, bisque: 4293182719, black: 255, blanchedalmond: 4293643775, blue: 65535, blueviolet: 2318131967, brown: 2771004159, burlywood: 3736635391, burntsienna: 3934150143, cadetblue: 1604231423, chartreuse: 2147418367, chocolate: 3530104575, coral: 4286533887, cornflowerblue: 1687547391, cornsilk: 4294499583, crimson: 3692313855, cyan: 16777215, darkblue: 35839, darkcyan: 9145343, darkgoldenrod: 3095792639, darkgray: 2846468607, darkgreen: 6553855, darkgrey: 2846468607, darkkhaki: 3182914559, darkmagenta: 2332068863, darkolivegreen: 1433087999, darkorange: 4287365375, darkorchid: 2570243327, darkred: 2332033279, darksalmon: 3918953215, darkseagreen: 2411499519, darkslateblue: 1211993087, darkslategray: 793726975, darkslategrey: 793726975, darkturquoise: 13554175, darkviolet: 2483082239, deeppink: 4279538687, deepskyblue: 12582911, dimgray: 1768516095, dimgrey: 1768516095, dodgerblue: 512819199, firebrick: 2988581631, floralwhite: 4294635775, forestgreen: 579543807, fuchsia: 4278255615, gainsboro: 3705462015, ghostwhite: 4177068031, gold: 4292280575, goldenrod: 3668254975, gray: 2155905279, green: 8388863, greenyellow: 2919182335, grey: 2155905279, honeydew: 4043305215, hotpink: 4285117695, indianred: 3445382399, indigo: 1258324735, ivory: 4294963455, khaki: 4041641215, lavender: 3873897215, lavenderblush: 4293981695, lawngreen: 2096890111, lemonchiffon: 4294626815, lightblue: 2916673279, lightcoral: 4034953471, lightcyan: 3774873599, lightgoldenrodyellow: 4210742015, lightgray: 3553874943, lightgreen: 2431553791, lightgrey: 3553874943, lightpink: 4290167295, lightsalmon: 4288707327, lightseagreen: 548580095, lightskyblue: 2278488831, lightslategray: 2005441023, lightslategrey: 2005441023, lightsteelblue: 2965692159, lightyellow: 4294959359, lime: 16711935, limegreen: 852308735, linen: 4210091775, magenta: 4278255615, maroon: 2147483903, mediumaquamarine: 1724754687, mediumblue: 52735, mediumorchid: 3126187007, mediumpurple: 2473647103, mediumseagreen: 1018393087, mediumslateblue: 2070474495, mediumspringgreen: 16423679, mediumturquoise: 1221709055, mediumvioletred: 3340076543, midnightblue: 421097727, mintcream: 4127193855, mistyrose: 4293190143, moccasin: 4293178879, navajowhite: 4292783615, navy: 33023, oldlace: 4260751103, olive: 2155872511, olivedrab: 1804477439, orange: 4289003775, orangered: 4282712319, orchid: 3664828159, palegoldenrod: 4008225535, palegreen: 2566625535, paleturquoise: 2951671551, palevioletred: 3681588223, papayawhip: 4293907967, peachpuff: 4292524543, peru: 3448061951, pink: 4290825215, plum: 3718307327, powderblue: 2967529215, purple: 2147516671, rebeccapurple: 1714657791, red: 4278190335, rosybrown: 3163525119, royalblue: 1097458175, saddlebrown: 2336560127, salmon: 4202722047, sandybrown: 4104413439, seagreen: 780883967, seashell: 4294307583, sienna: 2689740287, silver: 3233857791, skyblue: 2278484991, slateblue: 1784335871, slategray: 1887473919, slategrey: 1887473919, snow: 4294638335, springgreen: 16744447, steelblue: 1182971135, tan: 3535047935, teal: 8421631, thistle: 3636451583, tomato: 4284696575, turquoise: 1088475391, violet: 4001558271, wheat: 4125012991, white: 4294967295, whitesmoke: 4126537215, yellow: 4294902015, yellowgreen: 2597139199 }; var __defProp$8 = Object.defineProperty; var __defProps$7 = Object.defineProperties; var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols$b = Object.getOwnPropertySymbols; var __hasOwnProp$b = Object.prototype.hasOwnProperty; var __propIsEnum$b = Object.prototype.propertyIsEnumerable; var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$8 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$b.call(b, prop)) __defNormalProp$8(a, prop, b[prop]); if (__getOwnPropSymbols$b) for (var prop of __getOwnPropSymbols$b(b)) { if (__propIsEnum$b.call(b, prop)) __defNormalProp$8(a, prop, b[prop]); } return a; }; var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b)); let namedColorRegex; const colorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi; const numberRegex = /[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g; const unitRegex = new RegExp(`(${numberRegex.source})(%|[a-z]+)`, "i"); const rgbaRegex = /rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi; const rgbaRound = (_, p1, p2, p3, p4) => `rgba(${Math.round(p1)}, ${Math.round(p2)}, ${Math.round(p3)}, ${p4})`; let createStringInterpolator = (config) => { if (!namedColorRegex) namedColorRegex = colors ? new RegExp(`(${Object.keys(colors).join("|")})(?!\\w)`, "g") : /^\b$/; const output = config.output.map((value) => { return getFluidValue(value).replace(cssVariableRegex, variableToRgba).replace(colorRegex, colorToRgba).replace(namedColorRegex, colorToRgba); }); const keyframes = output.map((value) => value.match(numberRegex).map(Number)); const outputRanges = keyframes[0].map((_, i) => keyframes.map((values) => { if (!(i in values)) { throw Error('The arity of each "output" value must be equal'); } return values[i]; })); const interpolators = outputRanges.map((output2) => createInterpolator(__spreadProps$7(__spreadValues$8({}, config), { output: output2 }))); return (input) => { var _a; const missingUnit = !unitRegex.test(output[0]) && ((_a = output.find((value) => unitRegex.test(value))) == null ? void 0 : _a.replace(numberRegex, "")); let i = 0; return output[0].replace(numberRegex, () => `${interpolators[i++](input)}${missingUnit || ""}`).replace(rgbaRegex, rgbaRound); }; }; let to$1 = (source, args) => { return new Interpolation(source, args); }; let colors = colors$1; let skipAnimation = false; const variableToRgba = (input) => { const [token, fallback] = parseCSSVariable(input); if (!token || isSSR()) { return input; } const value = window.getComputedStyle(document.documentElement).getPropertyValue(token); if (value) { return value.trim(); } else if (fallback && fallback.startsWith("--")) { const value2 = window.getComputedStyle(document.documentElement).getPropertyValue(fallback); if (value2) { return value2; } else { return input; } } else if (fallback && cssVariableRegex.test(fallback)) { return variableToRgba(fallback); } else if (fallback) { return fallback; } return input; }; const parseCSSVariable = (current) => { const match = cssVariableRegex.exec(current); if (!match) return [,]; const [, token, fallback] = match; return [token, fallback]; }; function colorToRgba(input) { let int32Color = normalizeColor(input); if (int32Color === null) return input; int32Color = int32Color || 0; let r = (int32Color & 4278190080) >>> 24; let g = (int32Color & 16711680) >>> 16; let b = (int32Color & 65280) >>> 8; let a = (int32Color & 255) / 255; return `rgba(${r}, ${g}, ${b}, ${a})`; } const TreeContext = { dependencies: null }; class AnimatedObject extends Animated { constructor(source) { super(); this.source = source; this.setValue(source); } getValue(animated) { const values = {}; eachProp(this.source, (source, key) => { if (isAnimated(source)) { values[key] = source.getValue(animated); } else if (hasFluidValue(source)) { values[key] = getFluidValue(source); } else if (!animated) { values[key] = source; } }); return values; } setValue(source) { this.source = source; this.payload = this._makePayload(source); } reset() { if (this.payload) { each(this.payload, (node) => node.reset()); } } _makePayload(source) { if (source) { const payload = /* @__PURE__ */ new Set(); eachProp(source, this._addToPayload, payload); return Array.from(payload); } } _addToPayload(source) { if (TreeContext.dependencies && hasFluidValue(source)) { TreeContext.dependencies.add(source); } const payload = getPayload(source); if (payload) { each(payload, (node) => this.add(node)); } } } class AnimatedString extends AnimatedValue { constructor(value) { super(0); this._string = null; this._toString = createInterpolator({ output: [value, value] }); } static create(value) { return new AnimatedString(value); } getValue() { let value = this._string; return value == null ? this._string = this._toString(this._value) : value; } setValue(value) { if (is.str(value)) { if (value == this._string) { return false; } this._string = value; this._value = 1; } else if (super.setValue(value)) { this._string = null; } else { return false; } return true; } reset(goal) { if (goal) { this._toString = createInterpolator({ output: [this.getValue(), goal] }); } this._value = 0; super.reset(); } } class AnimatedArray extends AnimatedObject { constructor(source) { super(source); } static create(source) { return new AnimatedArray(source); } getValue() { return this.source.map((node) => node.getValue()); } setValue(source) { const payload = this.getPayload(); if (source.length == payload.length) { return payload.map((node, i) => node.setValue(source[i])).some(Boolean); } super.setValue(source.map(makeAnimated)); return true; } } function makeAnimated(value) { const nodeType = isAnimatedString(value) ? AnimatedString : AnimatedValue; return nodeType.create(value); } var __defProp$7 = Object.defineProperty; var __defProps$6 = Object.defineProperties; var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols$a = Object.getOwnPropertySymbols; var __hasOwnProp$a = Object.prototype.hasOwnProperty; var __propIsEnum$a = Object.prototype.propertyIsEnumerable; var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$7 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$a.call(b, prop)) __defNormalProp$7(a, prop, b[prop]); if (__getOwnPropSymbols$a) for (var prop of __getOwnPropSymbols$a(b)) { if (__propIsEnum$a.call(b, prop)) __defNormalProp$7(a, prop, b[prop]); } return a; }; var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b)); const config = { default: { tension: 170, friction: 26 }, gentle: { tension: 120, friction: 14 }, wobbly: { tension: 180, friction: 12 }, stiff: { tension: 210, friction: 20 }, slow: { tension: 280, friction: 60 }, molasses: { tension: 280, friction: 120 } }; const c1 = 1.70158; const c2 = c1 * 1.525; const c3 = c1 + 1; const c4 = 2 * Math.PI / 3; const c5 = 2 * Math.PI / 4.5; const bounceOut = (x) => { const n1 = 7.5625; const d1 = 2.75; if (x < 1 / d1) { return n1 * x * x; } else if (x < 2 / d1) { return n1 * (x -= 1.5 / d1) * x + 0.75; } else if (x < 2.5 / d1) { return n1 * (x -= 2.25 / d1) * x + 0.9375; } else { return n1 * (x -= 2.625 / d1) * x + 0.984375; } }; const easings = { linear: (x) => x, easeInQuad: (x) => x * x, easeOutQuad: (x) => 1 - (1 - x) * (1 - x), easeInOutQuad: (x) => x < 0.5 ? 2 * x * x : 1 - Math.pow(-2 * x + 2, 2) / 2, easeInCubic: (x) => x * x * x, easeOutCubic: (x) => 1 - Math.pow(1 - x, 3), easeInOutCubic: (x) => x < 0.5 ? 4 * x * x * x : 1 - Math.pow(-2 * x + 2, 3) / 2, easeInQuart: (x) => x * x * x * x, easeOutQuart: (x) => 1 - Math.pow(1 - x, 4), easeInOutQuart: (x) => x < 0.5 ? 8 * x * x * x * x : 1 - Math.pow(-2 * x + 2, 4) / 2, easeInQuint: (x) => x * x * x * x * x, easeOutQuint: (x) => 1 - Math.pow(1 - x, 5), easeInOutQuint: (x) => x < 0.5 ? 16 * x * x * x * x * x : 1 - Math.pow(-2 * x + 2, 5) / 2, easeInSine: (x) => 1 - Math.cos(x * Math.PI / 2), easeOutSine: (x) => Math.sin(x * Math.PI / 2), easeInOutSine: (x) => -(Math.cos(Math.PI * x) - 1) / 2, easeInExpo: (x) => x === 0 ? 0 : Math.pow(2, 10 * x - 10), easeOutExpo: (x) => x === 1 ? 1 : 1 - Math.pow(2, -10 * x), easeInOutExpo: (x) => x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? Math.pow(2, 20 * x - 10) / 2 : (2 - Math.pow(2, -20 * x + 10)) / 2, easeInCirc: (x) => 1 - Math.sqrt(1 - Math.pow(x, 2)), easeOutCirc: (x) => Math.sqrt(1 - Math.pow(x - 1, 2)), easeInOutCirc: (x) => x < 0.5 ? (1 - Math.sqrt(1 - Math.pow(2 * x, 2))) / 2 : (Math.sqrt(1 - Math.pow(-2 * x + 2, 2)) + 1) / 2, easeInBack: (x) => c3 * x * x * x - c1 * x * x, easeOutBack: (x) => 1 + c3 * Math.pow(x - 1, 3) + c1 * Math.pow(x - 1, 2), easeInOutBack: (x) => x < 0.5 ? Math.pow(2 * x, 2) * ((c2 + 1) * 2 * x - c2) / 2 : (Math.pow(2 * x - 2, 2) * ((c2 + 1) * (x * 2 - 2) + c2) + 2) / 2, easeInElastic: (x) => x === 0 ? 0 : x === 1 ? 1 : -Math.pow(2, 10 * x - 10) * Math.sin((x * 10 - 10.75) * c4), easeOutElastic: (x) => x === 0 ? 0 : x === 1 ? 1 : Math.pow(2, -10 * x) * Math.sin((x * 10 - 0.75) * c4) + 1, easeInOutElastic: (x) => x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? -(Math.pow(2, 20 * x - 10) * Math.sin((20 * x - 11.125) * c5)) / 2 : Math.pow(2, -20 * x + 10) * Math.sin((20 * x - 11.125) * c5) / 2 + 1, easeInBounce: (x) => 1 - bounceOut(1 - x), easeOutBounce: bounceOut, easeInOutBounce: (x) => x < 0.5 ? (1 - bounceOut(1 - 2 * x)) / 2 : (1 + bounceOut(2 * x - 1)) / 2 }; const defaults$1 = __spreadProps$6(__spreadValues$7({}, config.default), { mass: 1, damping: 1, easing: easings.linear, clamp: false }); class AnimationConfig { constructor() { this.velocity = 0; Object.assign(this, defaults$1); } } const is = { arr: Array.isArray, obj: (a) => !!a && a.constructor.name === "Object", fun: (a) => typeof a === "function", str: (a) => typeof a === "string", num: (a) => typeof a === "number", und: (a) => a === void 0 }; const defineHidden = (obj, key, value) => Object.defineProperty(obj, key, { value, writable: true, configurable: true }); function noop() { } function isEqual(a, b) { if (is.arr(a)) { if (!is.arr(b) || a.length !== b.length) return false; for (let i = 0; i < a.length; i++) { if (a[i] !== b[i]) return false; } return true; } return a === b; } const each = (obj, fn) => obj.forEach(fn); function eachProp(obj, fn, ctx) { if (is.arr(obj)) { for (let i = 0; i < obj.length; i++) { fn.call(ctx, obj[i], `${i}`); } return; } for (const key in obj) { if (obj.hasOwnProperty(key)) { fn.call(ctx, obj[key], key); } } } const toArray = (a) => is.und(a) ? [] : is.arr(a) ? a : [a]; function flush(queue, iterator) { if (queue.size) { const items = Array.from(queue); queue.clear(); each(items, iterator); } } const flushCalls = (queue, ...args) => flush(queue, (fn) => fn(...args)); const isSSR = () => typeof window === "undefined" || !window.navigator || /ServerSideRendering|^Deno\//.test(window.navigator.userAgent); function callProp(value, ...args) { return is.fun(value) ? value(...args) : value; } const matchProp = (value, key) => value === true || !!(key && value && (is.fun(value) ? value(key) : toArray(value).includes(key))); const resolveProp = (prop, key) => is.obj(prop) ? key && prop[key] : prop; const getDefaultProp = (props, key) => props.default === true ? props[key] : props.default ? props.default[key] : void 0; const noopTransform = (value) => value; const getDefaultProps = (props, transform = noopTransform) => { let keys = DEFAULT_PROPS; if (props.default && props.default !== true) { props = props.default; keys = Object.keys(props); } const defaults2 = {}; for (const key of keys) { const value = transform(props[key], key); if (!is.und(value)) { defaults2[key] = value; } } return defaults2; }; const DEFAULT_PROPS = [ "config", "onProps", "onStart", "onChange", "onPause", "onResume", "onRest" ]; function computeGoal(value) { value = getFluidValue(value); return is.arr(value) ? value.map(computeGoal) : isAnimatedString(value) ? createStringInterpolator({ range: [0, 1], output: [value, value] })(1) : value; } const cssVariableRegex = /var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/; function isAnimatedString(value) { return is.str(value) && (value[0] == "#" || /\d/.test(value) || !isSSR() && cssVariableRegex.test(value) || value in (colors || {})); } const RESERVED_PROPS = { config: 1, from: 1, to: 1, ref: 1, loop: 1, reset: 1, pause: 1, cancel: 1, reverse: 1, immediate: 1, default: 1, delay: 1, onProps: 1, onStart: 1, onChange: 1, onPause: 1, onResume: 1, onRest: 1, onResolve: 1, items: 1, trail: 1, sort: 1, expires: 1, initial: 1, enter: 1, update: 1, leave: 1, children: 1, onDestroyed: 1, keys: 1, callId: 1, parentId: 1 }; function getForwardProps(props) { const forward = {}; let count = 0; eachProp(props, (value, prop) => { if (!RESERVED_PROPS[prop]) { forward[prop] = value; count++; } }); if (count) { return forward; } } function inferTo(props) { const to = getForwardProps(props); if (to) { const out = { to }; eachProp(props, (val, key) => key in to || (out[key] = val)); return out; } return __spreadValues$7({}, props); } function isAsyncTo(to) { return is.fun(to) || is.arr(to) && is.obj(to[0]); } function getAnimatedType(value) { const parentNode = getAnimated(value); return parentNode ? parentNode.constructor : is.arr(value) ? AnimatedArray : isAnimatedString(value) ? AnimatedString : AnimatedValue; } function detachRefs(ctrl, ref) { var _a; (_a = ctrl.ref) == null ? void 0 : _a.delete(ctrl); ref == null ? void 0 : ref.delete(ctrl); } function replaceRef(ctrl, ref) { var _a; if (ref && ctrl.ref !== ref) { (_a = ctrl.ref) == null ? void 0 : _a.delete(ctrl); ref.add(ctrl); ctrl.ref = ref; } } const SpringRef = () => { const current = []; const SpringRef2 = function(props) { const results = []; each(current, (ctrl, i) => { if (is.und(props)) { results.push(ctrl.start()); } else { const update = _getProps(props, ctrl, i); if (update) { results.push(ctrl.start(update)); } } }); return results; }; SpringRef2.current = current; SpringRef2.add = function(ctrl) { if (!current.includes(ctrl)) { current.push(ctrl); } }; SpringRef2.delete = function(ctrl) { const i = current.indexOf(ctrl); if (~i) current.splice(i, 1); }; SpringRef2.pause = function() { each(current, (ctrl) => ctrl.pause(...arguments)); return this; }; SpringRef2.resume = function() { each(current, (ctrl) => ctrl.resume(...arguments)); return this; }; SpringRef2.set = function(values) { each(current, (ctrl) => ctrl.set(values)); }; SpringRef2.start = function(props) { const results = []; each(current, (ctrl, i) => { if (is.und(props)) { results.push(ctrl.start()); } else { const update = this._getProps(props, ctrl, i); if (update) { results.push(ctrl.start(update)); } } }); return results; }; SpringRef2.stop = function() { each(current, (ctrl) => ctrl.stop(...arguments)); return this; }; SpringRef2.update = function(props) { each(current, (ctrl, i) => ctrl.update(this._getProps(props, ctrl, i))); return this; }; const _getProps = function(arg, ctrl, index) { return is.fun(arg) ? arg(index, ctrl) : arg; }; SpringRef2._getProps = _getProps; return SpringRef2; }; var __defProp$6 = Object.defineProperty; var __defProps$5 = Object.defineProperties; var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols; var __hasOwnProp$9 = Object.prototype.hasOwnProperty; var __propIsEnum$9 = Object.prototype.propertyIsEnumerable; var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$6 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$9.call(b, prop)) __defNormalProp$6(a, prop, b[prop]); if (__getOwnPropSymbols$9) for (var prop of __getOwnPropSymbols$9(b)) { if (__propIsEnum$9.call(b, prop)) __defNormalProp$6(a, prop, b[prop]); } return a; }; var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b)); function scheduleProps(callId, { key, props, defaultProps, state, actions }) { return new Promise((resolve, reject) => { let delay; let timeout; let cancel = matchProp(props.cancel ?? (defaultProps == null ? void 0 : defaultProps.cancel), key); if (cancel) { onStart(); } else { if (!is.und(props.pause)) { state.paused = matchProp(props.pause, key); } let pause = defaultProps == null ? void 0 : defaultProps.pause; if (pause !== true) { pause = state.paused || matchProp(pause, key); } delay = callProp(props.delay || 0, key); if (pause) { state.resumeQueue.add(onResume); actions.pause(); } else { actions.resume(); onResume(); } } function onPause() { state.resumeQueue.add(onResume); state.timeouts.delete(timeout); timeout.cancel(); delay = timeout.time - raf.now(); } function onResume() { if (delay > 0 && !skipAnimation) { state.delayed = true; timeout = raf.setTimeout(onStart, delay); state.pauseQueue.add(onPause); state.timeouts.add(timeout); } else { onStart(); } } function onStart() { if (state.delayed) { state.delayed = false; } state.pauseQueue.delete(onPause); state.timeouts.delete(timeout); if (callId <= (state.cancelId || 0)) { cancel = true; } try { actions.start(__spreadProps$5(__spreadValues$6({}, props), { callId, cancel }), resolve); } catch (err) { reject(err); } } }); } const emptyArray = []; class Animation { constructor() { this.changed = false; this.values = emptyArray; this.toValues = null; this.fromValues = emptyArray; this.config = new AnimationConfig(); this.immediate = false; } } const getCombinedResult = (target, results) => results.length == 1 ? results[0] : results.some((result) => result.cancelled) ? getCancelledResult(target.get()) : results.every((result) => result.noop) ? getNoopResult(target.get()) : getFinishedResult(target.get(), results.every((result) => result.finished)); const getNoopResult = (value) => ({ value, noop: true, finished: true, cancelled: false }); const getFinishedResult = (value, finished, cancelled = false) => ({ value, finished, cancelled }); const getCancelledResult = (value) => ({ value, cancelled: true, finished: false }); var __defProp$5 = Object.defineProperty; var __defProps$4 = Object.defineProperties; var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols; var __hasOwnProp$8 = Object.prototype.hasOwnProperty; var __propIsEnum$8 = Object.prototype.propertyIsEnumerable; var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$5 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$8.call(b, prop)) __defNormalProp$5(a, prop, b[prop]); if (__getOwnPropSymbols$8) for (var prop of __getOwnPropSymbols$8(b)) { if (__propIsEnum$8.call(b, prop)) __defNormalProp$5(a, prop, b[prop]); } return a; }; var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b)); function runAsync(to, props, state, target) { const { callId, parentId, onRest } = props; const { asyncTo: prevTo, promise: prevPromise } = state; if (!parentId && to === prevTo && !props.reset) { return prevPromise; } return state.promise = (async () => { state.asyncId = callId; state.asyncTo = to; const defaultProps = getDefaultProps(props, (value, key) => key === "onRest" ? void 0 : value); let preventBail; let bail; const bailPromise = new Promise((resolve, reject) => (preventBail = resolve, bail = reject)); const bailIfEnded = (bailSignal) => { const bailResult = callId <= (state.cancelId || 0) && getCancelledResult(target) || callId !== state.asyncId && getFinishedResult(target, false); if (bailResult) { bailSignal.result = bailResult; bail(bailSignal); throw bailSignal; } }; const animate = (arg1, arg2) => { const bailSignal = new BailSignal(); new SkipAniamtionSignal(); return (async () => { bailIfEnded(bailSignal); const props2 = is.obj(arg1) ? __spreadValues$5({}, arg1) : __spreadProps$4(__spreadValues$5({}, arg2), { to: arg1 }); props2.parentId = callId; eachProp(defaultProps, (value, key) => { if (is.und(props2[key])) { props2[key] = value; } }); const result2 = await target.start(props2); bailIfEnded(bailSignal); if (state.paused) { await new Promise((resume) => { state.resumeQueue.add(resume); }); } return result2; })(); }; let result; try { let animating; if (is.arr(to)) { animating = (async (queue) => { for (const props2 of queue) { await animate(props2); } })(to); } else { animating = Promise.resolve(to(animate, target.stop.bind(target))); } await Promise.all([animating.then(preventBail), bailPromise]); result = getFinishedResult(target.get(), true, false); } catch (err) { if (err instanceof BailSignal) { result = err.result; } else if (err instanceof SkipAniamtionSignal) { result = err.result; } else { throw err; } } finally { if (callId == state.asyncId) { state.asyncId = parentId; state.asyncTo = parentId ? prevTo : void 0; state.promise = parentId ? prevPromise : void 0; } } if (is.fun(onRest)) { raf.batchedUpdates(() => { onRest(result, target, target.item); }); } return result; })(); } function stopAsync(state, cancelId) { flush(state.timeouts, (t) => t.cancel()); state.pauseQueue.clear(); state.resumeQueue.clear(); state.asyncId = state.asyncTo = state.promise = void 0; if (cancelId) state.cancelId = cancelId; } class BailSignal extends Error { constructor() { super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise."); } } class SkipAniamtionSignal extends Error { constructor() { super("SkipAnimationSignal"); } } const $P = Symbol.for("SpringPhase"); const HAS_ANIMATED = 1; const IS_ANIMATING = 2; const IS_PAUSED = 4; const hasAnimated = (target) => (target[$P] & HAS_ANIMATED) > 0; const isAnimating = (target) => (target[$P] & IS_ANIMATING) > 0; const isPaused = (target) => (target[$P] & IS_PAUSED) > 0; const setActiveBit = (target, active) => active ? target[$P] |= IS_ANIMATING | HAS_ANIMATED : target[$P] &= ~IS_ANIMATING; const setPausedBit = (target, paused) => paused ? target[$P] |= IS_PAUSED : target[$P] &= ~IS_PAUSED; var __defProp$4 = Object.defineProperty; var __defProps$3 = Object.defineProperties; var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols; var __hasOwnProp$7 = Object.prototype.hasOwnProperty; var __propIsEnum$7 = Object.prototype.propertyIsEnumerable; var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$4 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$7.call(b, prop)) __defNormalProp$4(a, prop, b[prop]); if (__getOwnPropSymbols$7) for (var prop of __getOwnPropSymbols$7(b)) { if (__propIsEnum$7.call(b, prop)) __defNormalProp$4(a, prop, b[prop]); } return a; }; var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b)); const defaults = __spreadProps$3(__spreadValues$4({}, config.default), { mass: 1, damping: 1, easing: easings.linear, clamp: false }); function mergeConfig(config2, newConfig, defaultConfig) { if (defaultConfig) { defaultConfig = __spreadValues$4({}, defaultConfig); sanitizeConfig(defaultConfig, newConfig); newConfig = __spreadValues$4(__spreadValues$4({}, defaultConfig), newConfig); } sanitizeConfig(config2, newConfig); Object.assign(config2, newConfig); for (const key in defaults) { if (config2[key] == null) { config2[key] = defaults[key]; } } let { mass, frequency, damping } = config2; if (!is.und(frequency)) { if (frequency < 0.01) frequency = 0.01; if (damping < 0) damping = 0; config2.tension = Math.pow(2 * Math.PI / frequency, 2) * mass; config2.friction = 4 * Math.PI * damping * mass / frequency; } return config2; } function sanitizeConfig(config2, props) { if (!is.und(props.decay)) { config2.duration = void 0; } else { const isTensionConfig = !is.und(props.tension) || !is.und(props.friction); if (isTensionConfig || !is.und(props.frequency) || !is.und(props.damping) || !is.und(props.mass)) { config2.duration = void 0; config2.decay = void 0; } if (isTensionConfig) { config2.frequency = void 0; } } } var __defProp$3 = Object.defineProperty; var __defProps$2 = Object.defineProperties; var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols; var __hasOwnProp$6 = Object.prototype.hasOwnProperty; var __propIsEnum$6 = Object.prototype.propertyIsEnumerable; var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$3 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$6.call(b, prop)) __defNormalProp$3(a, prop, b[prop]); if (__getOwnPropSymbols$6) for (var prop of __getOwnPropSymbols$6(b)) { if (__propIsEnum$6.call(b, prop)) __defNormalProp$3(a, prop, b[prop]); } return a; }; var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b)); var __objRest$3 = (source, exclude) => { var target = {}; for (var prop in source) if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop]; if (source != null && __getOwnPropSymbols$6) for (var prop of __getOwnPropSymbols$6(source)) { if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop)) target[prop] = source[prop]; } return target; }; class SpringValue extends FrameValue { constructor(arg1, arg2) { super(); this.animation = new Animation(); this.defaultProps = {}; this._state = { paused: false, delayed: false, pauseQueue: /* @__PURE__ */ new Set(), resumeQueue: /* @__PURE__ */ new Set(), timeouts: /* @__PURE__ */ new Set() }; this._pendingCalls = /* @__PURE__ */ new Set(); this._lastCallId = 0; this._lastToId = 0; this._memoizedDuration = 0; if (!is.und(arg1) || !is.und(arg2)) { const props = is.obj(arg1) ? __spreadValues$3({}, arg1) : __spreadProps$2(__spreadValues$3({}, arg2), { from: arg1 }); if (is.und(props.default)) { props.default = true; } this.start(props); } } get