@kyralabs/m3e-motion 1.4.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +20 -1
- package/README.md +35 -0
- package/dist/index.d.ts +764 -5
- package/dist/index.js +1421 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/spring-estimation.ts","../src/spring-simulation.ts","../src/spring.ts","../src/linear.ts","../src/animatable.ts","../src/fab-menu.ts","../src/menu-navigation.ts","../src/toolbar-navigation.ts","../src/cubic-bezier.ts","../src/app-bar-scroll.ts","../src/floating-toolbar-scroll.ts","../src/progress-indicator.ts","../src/loading-indicator.ts","../src/menu-position.ts","../src/search-bar.ts","../src/button-group.ts"],"names":["f32","dampingCoefficient","round","centerX","at"],"mappings":";AAuBA,IAAM,WAAW,CAAA,IAAK,EAAA;AACtB,IAAM,QAAA,GAAW,mBAAO;AACxB,IAAM,eAAA,GAAkB,aAAA;AAExB,IAAM,SAAS,CAAC,CAAA,KACd,MAAA,CAAO,KAAA,CAAM,CAAC,CAAA,GAAI,CAAA,GAAI,CAAA,IAAK,QAAA,GAAW,WAAW,CAAA,IAAK,QAAA,GAAW,QAAA,GAAW,IAAA,CAAK,MAAM,CAAC,CAAA;AAMnF,SAAS,+BAAA,CACd,SAAA,EACA,YAAA,EACA,eAAA,EACA,qBACA,KAAA,EACQ;AACR,EAAA,MAAMA,OAAM,IAAA,CAAK,MAAA;AACjB,EAAA,IAAIA,IAAAA,CAAI,YAAY,CAAA,KAAM,CAAA,EAAG;AAE3B,IAAA,OAAO,eAAA;AAAA,EACT;AAEA,EAAA,OAAO,qCAAA;AAAA,IACLA,KAAI,SAAS,CAAA;AAAA,IACbA,KAAI,YAAY,CAAA;AAAA,IAChBA,KAAI,eAAe,CAAA;AAAA,IACnBA,KAAI,mBAAmB,CAAA;AAAA,IACvBA,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AAE,KAAA,GAAQ,CAAC,CAAA,GAAI,KAAA;AACnC,MAAA,MAAA,GAAS,IAAA,GAAO,KAAA;AAAA,IAClB,CAAA,MAAA,IAAW,UAAU,CAAA,EAAG;AAEtB,MAAA,MAAM,MAAA,GAAS,KAAA,GAAQ,IAAA,CAAK,GAAA,CAAI,aAAA,GAAgB,CAAA,CAAE,KAAK,CAAA,EAAG,KAAA,CAAM,KAAA,GAAQ,CAAC,CAAC,CAAA;AAC1E,MAAA,MAAM,QAAQ,IAAA,CAAK,GAAA,CAAI,QAAQ,CAAA,CAAE,KAAA,GAAQ,CAAC,CAAC,CAAA;AAC3C,MAAA,MAAA,CAAO,QAAQ,CAAC,CAAA,GAAI,CAAA,CAAE,KAAA,GAAQ,CAAC,CAAA,GAAI,KAAA;AACnC,MAAA,MAAA,GAAS,KAAA;AAAA,IACX,CAAA,MAAO;AAEL,MAAA,MAAM,MAAA,GAAS,KAAA,GAAQ,IAAA,CAAK,GAAA,CAAI,aAAA,GAAgB,CAAA,CAAE,KAAK,CAAA,EAAG,KAAA,CAAM,KAAA,GAAQ,CAAC,CAAC,CAAA;AAC1E,MAAA,MAAM,OAAO,IAAA,CAAK,GAAA,CAAI,QAAQ,CAAA,CAAE,KAAA,GAAQ,CAAC,CAAC,CAAA;AAC1C,MAAA,MAAA,CAAO,QAAQ,CAAC,CAAA,GAAI,CAAA,CAAE,KAAA,GAAQ,CAAC,CAAA,GAAI,IAAA;AACnC,MAAA,MAAA,GAAS,IAAA;AAAA,IACX;AACA,IAAA,MAAA,CAAO,KAAK,CAAA,GAAI,CAAA,CAAE,KAAK,CAAA,GAAI,MAAA;AAAA,EAC7B;AACA,EAAA,OAAO,MAAA,CAAO,KAAA,CAAM,CAAA,EAAG,IAAI,CAAA;AAC7B","file":"index.js","sourcesContent":["/*\n * Copyright 2020 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/SpringEstimation.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// The Float overload's arguments are rounded to float32 (Math.fround) before widening to Double,\n// as in Kotlin. Durations are Long milliseconds: Kotlin's Double.toLong() (truncation, NaN → 0,\n// saturating) is reproduced by `toLong`.\n\n/** Maximum duration in Milliseconds. This takes into account that the duration will be converted to nanos. */\n// Long.MAX_VALUE / Long.MIN_VALUE as doubles (2^63 is what Kotlin's Long.toDouble() yields).\nconst LONG_MAX = 2 ** 63;\nconst LONG_MIN = -(2 ** 63);\nconst MAX_LONG_MILLIS = 9_223_372_036_854; // Long.MAX_VALUE / 1_000_000 (integer division)\n\nconst toLong = (x: number): number =>\n Number.isNaN(x) ? 0 : x >= LONG_MAX ? LONG_MAX : x <= LONG_MIN ? LONG_MIN : Math.trunc(x);\n\n/**\n * Returns the estimated time that the spring will last be at [delta]. Arguments are Kotlin\n * `Float`s (rounded to float32).\n */\nexport function estimateAnimationDurationMillis(\n stiffness: number,\n dampingRatio: number,\n initialVelocity: number,\n initialDisplacement: number,\n delta: number,\n): number {\n const f32 = Math.fround;\n if (f32(dampingRatio) === 0) {\n // No damping, duration is infinite (max value).\n return MAX_LONG_MILLIS;\n }\n\n return estimateAnimationDurationMillisDouble(\n f32(stiffness),\n f32(dampingRatio),\n f32(initialVelocity),\n f32(initialDisplacement),\n f32(delta),\n );\n}\n\n/** Returns the estimated time that the spring will last be at [delta] (Double overload). */\nexport function estimateAnimationDurationMillisDouble(\n stiffness: number,\n dampingRatio: number,\n initialVelocity: number,\n initialDisplacement: number,\n delta: number,\n): number {\n const dampingCoefficient = 2.0 * dampingRatio * Math.sqrt(stiffness);\n\n // Compute the roots of the polynomial [a]x^2+[b]x+[c]=0 which may be complex.\n // Here a is set to the constant 1.0, and folded into the other computations\n const partialRoot = dampingCoefficient * dampingCoefficient - 4.0 * stiffness;\n const partialRootReal = partialRoot < 0.0 ? 0.0 : Math.sqrt(partialRoot);\n const partialRootImaginary = partialRoot < 0.0 ? Math.sqrt(Math.abs(partialRoot)) : 0.0;\n\n const firstRootReal = (-dampingCoefficient + partialRootReal) * 0.5;\n const firstRootImaginary = partialRootImaginary * 0.5;\n const secondRootReal = (-dampingCoefficient - partialRootReal) * 0.5;\n\n return estimateDurationInternal(\n firstRootReal,\n firstRootImaginary,\n secondRootReal,\n dampingRatio,\n initialVelocity,\n initialDisplacement,\n delta,\n );\n}\n\n/**\n * In the under-damped case we simply calculate the envelope of the function. The general solution\n * is of the form x(t) = c_1*e^(r*t)*cos(...) + c_2*e^(r*t)sin(...) which simplifies to x(t) =\n * c*e^(r*t)*cos(...) where c*e^(r*t) is the envelope of x(t)\n */\nfunction estimateUnderDamped(\n firstRootReal: number,\n firstRootImaginary: number,\n p0: number,\n v0: number,\n delta: number,\n): number {\n const r = firstRootReal;\n const c1 = p0;\n const c2 = (v0 - r * c1) / firstRootImaginary;\n const c = Math.sqrt(c1 * c1 + c2 * c2);\n\n return Math.log(delta / c) / r;\n}\n\nconst isNotFinite = (x: number) => !Number.isFinite(x);\n\nconst iterateNewtonsMethod = (\n x: number,\n fn: (t: number) => number,\n fnPrime: (t: number) => number,\n): number => x - fn(x) / fnPrime(x);\n\n/**\n * In the critically-damped case we apply Newton-Raphson's iterative numerical method of solving the\n * equation x(t) = c_1*e^(r*t) + c_2*t*e^(r*t)\n */\nfunction estimateCriticallyDamped(\n firstRootReal: number,\n p0: number,\n v0: number,\n delta: number,\n): number {\n const r = firstRootReal;\n const c1 = p0;\n const c2 = v0 - r * c1;\n\n // For our initial guess, determine the max t of c_1*e^(r*t) = delta and\n // c_2*t*e^(r*t) = delta\n const t1 = Math.log(Math.abs(delta / c1)) / r;\n const t2 =\n (() => {\n // Application of Lambert's W function to solve te^t\n const guess = Math.log(Math.abs(delta / c2));\n let t = guess;\n for (let i = 0; i <= 5; i++) {\n t = guess - Math.log(Math.abs(t / r));\n }\n return t;\n })() / r;\n let tCurr = isNotFinite(t1) ? t2 : isNotFinite(t2) ? t1 : Math.max(t1, t2);\n\n // Calculate the inflection time. This is important if the inflection is in t > 0\n const tInflection = -(r * c1 + c2) / (r * c2);\n const xInflection = c1 * Math.exp(r * tInflection) + c2 * tInflection * Math.exp(r * tInflection);\n\n // For inflection that does not exist in real time, we always solve for x(t)=delta. Note\n // the system is manipulated such that p0 is always positive.\n let signedDelta: number;\n if (Number.isNaN(tInflection) || tInflection <= 0.0) {\n signedDelta = -delta;\n } else if (tInflection > 0.0 && -xInflection < delta) {\n // In this scenario the first crossing with the threshold is to be found. Note that\n // the inflection does not exceed delta. As such, we search from the left.\n if (c2 < 0 && c1 > 0) {\n tCurr = 0.0;\n }\n signedDelta = -delta;\n } else {\n // In this scenario there are three total crossings of the threshold, once from\n // above, and then once when the inflection exceeds the threshold and then one last\n // one when x(t) finally decays to zero. The point of determining concavity is to\n // find the final crossing.\n //\n // By finding a point between when concavity changes, and when the inflection point is,\n // Newton's method will always converge onto the rightmost point (in this case),\n // the one that we are interested in.\n tCurr = -(2.0 / r) - c1 / c2;\n signedDelta = delta;\n }\n\n let tDelta = Number.MAX_VALUE;\n let iterations = 0;\n while (tDelta > 0.001 && iterations < 100) {\n iterations++;\n const tLast = tCurr;\n tCurr = iterateNewtonsMethod(\n tCurr,\n (t) => (c1 + c2 * t) * Math.exp(r * t) + signedDelta,\n (t) => (c2 * (r * t + 1) + c1 * r) * Math.exp(r * t),\n );\n tDelta = Math.abs(tLast - tCurr);\n }\n\n return tCurr;\n}\n\n/**\n * In the over-damped case we apply Newton-Raphson's iterative numerical method of solving the\n * equation x(t) = c_1*e^(r_1*t) + c_2*e^(r_2*t)\n */\nfunction estimateOverDamped(\n firstRootReal: number,\n secondRootReal: number,\n p0: number,\n v0: number,\n delta: number,\n): number {\n const r1 = firstRootReal;\n const r2 = secondRootReal;\n const c2 = (r1 * p0 - v0) / (r1 - r2);\n const c1 = p0 - c2;\n\n // For our initial guess, determine the max t of c_1*e^(r_1*t) = delta and\n // c_2*e^(r_2*t) = delta\n const t1 = Math.log(Math.abs(delta / c1)) / r1;\n const t2 = Math.log(Math.abs(delta / c2)) / r2;\n\n let tCurr = isNotFinite(t1) ? t2 : isNotFinite(t2) ? t1 : Math.max(t1, t2);\n\n // Calculate the inflection time. This is important if the inflection is in t > 0\n const tInflection = Math.log((c1 * r1) / (-c2 * r2)) / (r2 - r1);\n const xInflection = () => c1 * Math.exp(r1 * tInflection) + c2 * Math.exp(r2 * tInflection);\n\n // For inflection that does not exist in real time, we always solve for x(t)=delta. Note\n // the system is manipulated such that p0 is always positive.\n let signedDelta: number;\n if (Number.isNaN(tInflection) || tInflection <= 0.0) {\n signedDelta = -delta;\n } else if (tInflection > 0.0 && -xInflection() < delta) {\n // In this scenario the first crossing with the threshold is to be found. Note that\n // the inflection does not exceed delta. As such, we search from the left.\n if (c2 > 0.0 && c1 < 0.0) {\n tCurr = 0.0;\n }\n signedDelta = -delta;\n } else {\n // In this scenario there are three total crossings of the threshold, once from\n // above, and then once when the inflection exceeds the threshold and then one last\n // one when x(t) finally decays to zero. The point of determining concavity is to\n // find the final crossing.\n //\n // By finding a point between when concavity changes, and when the inflection point is,\n // Newton's method will always converge onto the rightmost point (in this case),\n // the one that we are interested in.\n tCurr = Math.log(-(c2 * r2 * r2) / (c1 * r1 * r1)) / (r1 - r2);\n signedDelta = delta;\n }\n\n // For a good initial guess, simply return\n if (Math.abs(c1 * r1 * Math.exp(r1 * tCurr) + c2 * r2 * Math.exp(r2 * tCurr)) < 0.0001) {\n return tCurr;\n }\n let tDelta = Number.MAX_VALUE;\n\n // Cap iterations for safety - Experimentally this method takes <= 5 iterations\n let iterations = 0;\n while (tDelta > 0.001 && iterations < 100) {\n iterations++;\n const tLast = tCurr;\n tCurr = iterateNewtonsMethod(\n tCurr,\n (t) => c1 * Math.exp(r1 * t) + c2 * Math.exp(r2 * t) + signedDelta,\n (t) => c1 * r1 * Math.exp(r1 * t) + c2 * r2 * Math.exp(r2 * t),\n );\n tDelta = Math.abs(tLast - tCurr);\n }\n\n return tCurr;\n}\n\n// Applies Newton-Raphson's method to solve for the estimated time the spring mass system will\n// last be at [delta].\nfunction estimateDurationInternal(\n firstRootReal: number,\n firstRootImaginary: number,\n secondRootReal: number,\n dampingRatio: number,\n initialVelocity: number,\n initialPosition: number,\n delta: number,\n): number {\n if (initialPosition === 0.0 && initialVelocity === 0.0) {\n return 0;\n }\n\n const v0 = initialPosition < 0 ? -initialVelocity : initialVelocity;\n const p0 = Math.abs(initialPosition);\n\n const seconds =\n dampingRatio > 1.0\n ? estimateOverDamped(firstRootReal, secondRootReal, p0, v0, delta)\n : dampingRatio < 1.0\n ? estimateUnderDamped(firstRootReal, firstRootImaginary, p0, v0, delta)\n : estimateCriticallyDamped(firstRootReal, p0, v0, delta);\n return toLong(seconds * 1000.0);\n}\n","/*\n * Copyright 2019 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/SpringSimulation.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// Precision follows the Kotlin source: parameters and results are Float (Math.fround), the\n// solution is computed in Double, and time is whole milliseconds.\n\nconst f32 = Math.fround;\n\n/** `Spring.StiffnessVeryLow` / `Spring.DampingRatioNoBouncy` (VectorizedAnimationSpec.kt L813, L839). */\nconst STIFFNESS_VERY_LOW = 50;\nconst DAMPING_RATIO_NO_BOUNCY = 1;\n\nexport interface Motion {\n value: number;\n velocity: number;\n}\n\n/**\n * Spring Simulation simulates spring physics, and allows you to query the motion (i.e. value and\n * velocity) at certain time in the future based on the starting velocity and value.\n *\n * By configuring the stiffness and damping ratio, callers can create a spring with the look and\n * feel suits their use case. Stiffness corresponds to the spring constant. The stiffer the spring\n * is, the harder it is to stretch it, the faster it undergoes dampening.\n *\n * Spring damping ratio describes how oscillations in a system decay after a disturbance. When\n * damping ratio > 1* (i.e. over-damped), the object will quickly return to the rest position\n * without overshooting. If damping ratio equals to 1 (i.e. critically damped), the object will\n * return to equilibrium within the shortest amount of time. When damping ratio is less than 1 (i.e.\n * under-damped), the mass tends to overshoot, and return, and overshoot again. Without any damping\n * (i.e. damping ratio = 0), the mass will oscillate forever.\n */\nexport class SpringSimulation {\n // Natural frequency\n #naturalFreq = Math.sqrt(STIFFNESS_VERY_LOW);\n #dampingRatio = DAMPING_RATIO_NO_BOUNCY;\n #finalPosition: number;\n\n constructor(finalPosition: number) {\n this.#finalPosition = f32(finalPosition);\n }\n\n get finalPosition(): number {\n return this.#finalPosition;\n }\n\n set finalPosition(value: number) {\n this.#finalPosition = f32(value);\n }\n\n /** Stiffness of the spring. */\n get stiffness(): number {\n return f32(this.#naturalFreq * this.#naturalFreq);\n }\n\n set stiffness(value: number) {\n // Upstream checks the *current* stiffness here (always positive), so the new value is not\n // validated; kept as-is for parity.\n if (this.stiffness <= 0) {\n throw new RangeError('Spring stiffness constant must be positive.');\n }\n this.#naturalFreq = Math.sqrt(f32(value));\n }\n\n /** Returns the damping ratio of the spring. */\n get dampingRatio(): number {\n return this.#dampingRatio;\n }\n\n set dampingRatio(value: number) {\n if (value < 0) {\n throw new RangeError('Damping ratio must be non-negative');\n }\n this.#dampingRatio = f32(value);\n }\n\n getAcceleration(lastDisplacement: number, lastVelocity: number): number {\n const adjustedDisplacement = f32(f32(lastDisplacement) - this.#finalPosition);\n\n const k = this.#naturalFreq * this.#naturalFreq;\n const c = 2.0 * this.#naturalFreq * this.#dampingRatio;\n\n return f32(-k * adjustedDisplacement - c * f32(lastVelocity));\n }\n\n /**\n * Internal only call for Spring to calculate the spring position/velocity using an analytical\n * approach.\n */\n updateValues(lastDisplacement: number, lastVelocity: number, timeElapsed: number): Motion {\n const dampingRatio = this.#dampingRatio;\n const naturalFreq = this.#naturalFreq;\n const velocity0 = f32(lastVelocity);\n const adjustedDisplacement = f32(f32(lastDisplacement) - this.#finalPosition);\n const deltaT = Math.trunc(timeElapsed) / 1000.0; // unit: seconds\n const dampingRatioSquared = dampingRatio * dampingRatio;\n const r = -dampingRatio * naturalFreq;\n\n let displacement: number;\n let currentVelocity: number;\n\n if (dampingRatio > 1) {\n // Over damping\n const s = naturalFreq * Math.sqrt(dampingRatioSquared - 1);\n const gammaPlus = r + s;\n const gammaMinus = r - s;\n\n // Overdamped\n const coeffB = (gammaMinus * adjustedDisplacement - velocity0) / (gammaMinus - gammaPlus);\n const coeffA = adjustedDisplacement - coeffB;\n displacement = coeffA * Math.exp(gammaMinus * deltaT) + coeffB * Math.exp(gammaPlus * deltaT);\n currentVelocity =\n coeffA * gammaMinus * Math.exp(gammaMinus * deltaT) +\n coeffB * gammaPlus * Math.exp(gammaPlus * deltaT);\n } else if (dampingRatio === 1.0) {\n // Critically damped\n const coeffA = adjustedDisplacement;\n const coeffB = velocity0 + naturalFreq * adjustedDisplacement;\n const nFdT = -naturalFreq * deltaT;\n displacement = (coeffA + coeffB * deltaT) * Math.exp(nFdT);\n currentVelocity =\n (coeffA + coeffB * deltaT) * Math.exp(nFdT) * -naturalFreq + coeffB * Math.exp(nFdT);\n } else {\n const dampedFreq = naturalFreq * Math.sqrt(1 - dampingRatioSquared);\n // Underdamped\n const cosCoeff = adjustedDisplacement;\n const sinCoeff = (1 / dampedFreq) * (-r * adjustedDisplacement + velocity0);\n const dFdT = dampedFreq * deltaT;\n displacement = Math.exp(r * deltaT) * (cosCoeff * Math.cos(dFdT) + sinCoeff * Math.sin(dFdT));\n currentVelocity =\n displacement * r +\n Math.exp(r * deltaT) *\n (-dampedFreq * cosCoeff * Math.sin(dFdT) + dampedFreq * sinCoeff * Math.cos(dFdT));\n }\n\n return {\n value: f32(displacement + this.#finalPosition),\n velocity: f32(currentVelocity),\n };\n }\n}\n","// Spring helpers with Compose `FloatSpringSpec` semantics (animation-core FloatAnimationSpec.kt\n// L133–187 @19991f2c), built on the ported SpringSimulation / SpringEstimation.\nimport { estimateAnimationDurationMillis } from './spring-estimation.js';\nimport { SpringSimulation } from './spring-simulation.js';\n\n/** A Material motion-scheme spring (`dampingRatio` ζ, `stiffness` k; mass 1). */\nexport interface SpringSpec {\n readonly dampingRatio: number;\n readonly stiffness: number;\n}\n\n/** `Spring.DefaultDisplacementThreshold` (VectorizedAnimationSpec.kt L842). */\nexport const DEFAULT_DISPLACEMENT_THRESHOLD = 0.01;\n\nconst f32 = Math.fround;\n\nfunction simulation(spec: SpringSpec, targetValue: number): SpringSimulation {\n const sim = new SpringSimulation(targetValue);\n sim.dampingRatio = spec.dampingRatio;\n sim.stiffness = spec.stiffness;\n return sim;\n}\n\n/** Value at `playTimeMillis` (whole milliseconds, as in Compose). */\nexport function springValue(\n spec: SpringSpec,\n playTimeMillis: number,\n initialValue: number,\n targetValue: number,\n initialVelocity = 0,\n): number {\n return simulation(spec, targetValue).updateValues(initialValue, initialVelocity, playTimeMillis)\n .value;\n}\n\n/** Velocity (units/s) at `playTimeMillis`. */\nexport function springVelocity(\n spec: SpringSpec,\n playTimeMillis: number,\n initialValue: number,\n targetValue: number,\n initialVelocity = 0,\n): number {\n return simulation(spec, targetValue).updateValues(initialValue, initialVelocity, playTimeMillis)\n .velocity;\n}\n\n/**\n * Duration until the spring stays within `visibilityThreshold` of the target, as Compose computes\n * it (`FloatSpringSpec.getDurationNanos` / 1e6).\n */\nexport function springDurationMillis(\n spec: SpringSpec,\n initialValue: number,\n targetValue: number,\n initialVelocity = 0,\n visibilityThreshold = DEFAULT_DISPLACEMENT_THRESHOLD,\n): number {\n const sim = simulation(spec, targetValue);\n const threshold = f32(visibilityThreshold);\n return estimateAnimationDurationMillis(\n sim.stiffness,\n sim.dampingRatio,\n f32(f32(initialVelocity) / threshold),\n f32(f32(f32(initialValue) - f32(targetValue)) / threshold),\n 1,\n );\n}\n\n/**\n * Damping coefficient c = 2ζ√(k·m), for physics engines parameterized by stiffness/damping/mass\n * (e.g. Motion's `{ type: 'spring', stiffness, damping, mass }`).\n */\nexport function dampingCoefficient(spec: SpringSpec, mass = 1): number {\n return 2 * spec.dampingRatio * Math.sqrt(spec.stiffness * mass);\n}\n\n/** Inverse of {@link dampingCoefficient}: ζ = c / (2√(k·m)). */\nexport function dampingRatioFromCoefficient(damping: number, stiffness: number, mass = 1): number {\n return damping / (2 * Math.sqrt(stiffness * mass));\n}\n","// CSS `linear()` approximation of a spring (FOUNDATIONS §4).\n//\n// - Duration: Compose's own settle estimate (`FloatSpringSpec.getDurationNanos`) for a 0 → 1\n// animation at a visibility threshold of 0.001 (0.1% of the travel; e.g. Compose's 0.1 dp\n// Dp threshold over a 100 dp move).\n// - Samples: the exact spring at every whole millisecond (Compose's time resolution), last stop\n// forced to 1 so the animation lands on its target.\n// - Stops: Ramer–Douglas–Peucker in (progress, value) space with the smallest tolerance that fits\n// `maxStops`.\n//\n// Limits (FOUNDATIONS §4): no velocity carry-over on interruption and a fixed duration; use the JS\n// spring for drags, rapid toggles and other interruptible motion.\nimport { type SpringSpec, springDurationMillis } from './spring.js';\nimport { SpringSimulation } from './spring-simulation.js';\n\nexport interface LinearEasingOptions {\n /** Fraction of the travel considered settled. Default 0.001. */\n visibilityThreshold?: number;\n /** Maximum stops in the `linear()` function (FOUNDATIONS §4: ≤ 40). Default 40. */\n maxStops?: number;\n}\n\nexport interface LinearEasing {\n /** e.g. `linear(0, 0.1234 5%, …, 1)` */\n easing: string;\n durationMillis: number;\n /** `[progress 0–1, value]` pairs after rounding. */\n stops: readonly (readonly [number, number])[];\n /** Max |linear(t) − spring(t)| over every millisecond sample. */\n maxError: number;\n}\n\nconst round = (n: number, digits: number) => {\n const r = Number(n.toFixed(digits));\n return Object.is(r, -0) ? 0 : r;\n};\n\ntype Point = readonly [number, number];\n\nfunction at<T>(list: readonly T[], i: number): T {\n const item = list[i];\n if (item === undefined) throw new RangeError(`index ${String(i)} out of range`);\n return item;\n}\n\n/** Ramer–Douglas–Peucker: indices of points to keep (vertical distance, monotone x). */\nfunction simplify(points: readonly Point[], tolerance: number): number[] {\n const keep = new Set<number>([0, points.length - 1]);\n const stack: [number, number][] = [[0, points.length - 1]];\n for (let range = stack.pop(); range; range = stack.pop()) {\n const [a, b] = range;\n const [x0, y0] = at(points, a);\n const [x1, y1] = at(points, b);\n let worst = -1;\n let worstDistance = tolerance;\n for (let i = a + 1; i < b; i++) {\n const [x, y] = at(points, i);\n const expected = y0 + ((y1 - y0) * (x - x0)) / (x1 - x0);\n const distance = Math.abs(y - expected);\n if (distance > worstDistance) {\n worst = i;\n worstDistance = distance;\n }\n }\n if (worst !== -1) {\n keep.add(worst);\n stack.push([a, worst], [worst, b]);\n }\n }\n return [...keep].sort((x, y) => x - y);\n}\n\nfunction interpolate(stops: readonly Point[], x: number): number {\n for (let i = 1; i < stops.length; i++) {\n const [x1, y1] = at(stops, i);\n const [x0, y0] = at(stops, i - 1);\n if (x <= x1) return x1 === x0 ? y1 : y0 + ((y1 - y0) * (x - x0)) / (x1 - x0);\n }\n return at(stops, stops.length - 1)[1];\n}\n\nexport function springToLinear(spec: SpringSpec, options: LinearEasingOptions = {}): LinearEasing {\n const { visibilityThreshold = 0.001, maxStops = 40 } = options;\n if (maxStops < 2) throw new RangeError('maxStops must be at least 2');\n const durationMillis = Math.max(1, springDurationMillis(spec, 0, 1, 0, visibilityThreshold));\n\n const sim = new SpringSimulation(1);\n sim.dampingRatio = spec.dampingRatio;\n sim.stiffness = spec.stiffness;\n const samples: Point[] = [];\n for (let t = 0; t <= durationMillis; t++) {\n samples.push([t / durationMillis, sim.updateValues(0, 0, t).value]);\n }\n samples[samples.length - 1] = [1, 1];\n\n // Smallest tolerance (bisection) whose simplification fits maxStops.\n let lo = 0;\n let hi = 0.5;\n let best = simplify(samples, hi);\n for (let i = 0; i < 40; i++) {\n const mid = (lo + hi) / 2;\n const kept = simplify(samples, mid);\n if (kept.length <= maxStops) {\n best = kept;\n hi = mid;\n } else {\n lo = mid;\n }\n }\n\n const stops = best.map((i) => {\n const [x, y] = at(samples, i);\n return [round(x, 4), round(y, 4)] as const;\n });\n const maxError = samples.reduce(\n (m, [x, y]) => Math.max(m, Math.abs(interpolate(stops, x) - y)),\n 0,\n );\n const body = stops.map(([x, y], i) =>\n i === 0 || i === stops.length - 1 ? String(y) : `${String(y)} ${String(round(x * 100, 2))}%`,\n );\n return { easing: `linear(${body.join(', ')})`, durationMillis, stops, maxError };\n}\n","// An interruptible spring value with Compose `Animatable` semantics (animation-core Animatable.kt\n// @19991f2c): `animateTo` starts from the current value *and velocity*, the animation runs for\n// Compose's own duration estimate (FloatSpringSpec.getDurationNanos at the visibility threshold)\n// and then rests exactly on the target. Time is injected, so callers drive it from their frame loop\n// (m3e-elements) and tests can step it deterministically.\nimport {\n DEFAULT_DISPLACEMENT_THRESHOLD,\n type SpringSpec,\n springDurationMillis,\n springValue,\n springVelocity,\n} from './spring.js';\n\nexport class SpringAnimatable {\n #value: number;\n #velocity = 0;\n #target: number;\n #from = 0;\n #velocity0 = 0;\n #start = 0;\n #duration = 0;\n #spec: SpringSpec | null = null;\n\n /**\n * @param value initial value, at rest.\n * @param visibilityThreshold Compose's visibility threshold: 0.01 for Float animations\n * (`Spring.DefaultDisplacementThreshold`), 1 for an Int one.\n */\n constructor(\n value: number,\n readonly visibilityThreshold: number = DEFAULT_DISPLACEMENT_THRESHOLD,\n ) {\n this.#value = value;\n this.#target = value;\n }\n\n get value(): number {\n return this.#value;\n }\n\n /** Units per second. */\n get velocity(): number {\n return this.#velocity;\n }\n\n get target(): number {\n return this.#target;\n }\n\n get isRunning(): boolean {\n return this.#spec !== null;\n }\n\n /** Jumps to `value` and stops. */\n snapTo(value: number): void {\n this.#spec = null;\n this.#value = value;\n this.#target = value;\n this.#velocity = 0;\n }\n\n /**\n * Animates to `target` from the value and velocity at `now` (ms); a null spec (e.g. a spatial\n * spring under reduced motion) jumps there.\n */\n animateTo(target: number, spec: SpringSpec | null, now: number): void {\n this.sample(now);\n if (spec === null) {\n this.snapTo(target);\n return;\n }\n this.#from = this.#value;\n this.#velocity0 = this.#velocity;\n this.#target = target;\n this.#start = now;\n this.#spec = spec;\n this.#duration = springDurationMillis(\n spec,\n this.#from,\n target,\n this.#velocity0,\n this.visibilityThreshold,\n );\n if (this.#duration <= 0) this.snapTo(target);\n }\n\n /** Advances to `now` (ms) and returns the value; the animation ends once its duration is up. */\n sample(now: number): number {\n const spec = this.#spec;\n if (spec === null) return this.#value;\n const elapsed = Math.max(0, now - this.#start);\n if (elapsed >= this.#duration) {\n this.snapTo(this.#target);\n return this.#value;\n }\n this.#value = springValue(spec, elapsed, this.#from, this.#target, this.#velocity0);\n this.#velocity = springVelocity(spec, elapsed, this.#from, this.#target, this.#velocity0);\n return this.#value;\n }\n}\n","// FAB menu item stagger, as Compose's FloatingActionButtonMenuItemColumn lays it out\n// (FloatingActionButtonMenu.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898 L250–307): an Int\n// Animatable runs 0 ↔ the item count on the slow effects spring (visibility threshold 1, L208–218),\n// and item `index` (0 = top) is visible while `index >= itemCount - value` (L283), so items appear\n// from the bottom (next to the toggle) up and disappear top first. Each item then springs its own\n// width (fast spatial) and alpha (fast effects) toward 1 or 0 when its visibility flips (L339–376).\n// Shared by m3e-elements and m3e-react.\n\n/** `Int.VectorConverter` reads an animated Int by truncating the float toward zero. */\nexport const animatedInt = (value: number): number => Math.trunc(value);\n\n/** Whether item `index` (0 = top) shows at stagger value `stagger` (0 … `itemCount`). */\nexport const fabMenuItemVisible = (index: number, itemCount: number, stagger: number): boolean =>\n index >= itemCount - animatedInt(stagger);\n","// Arrow-key navigation among menu items (WAI-ARIA APG menu pattern, as React Aria's useMenu\n// keyboard delegate does it): ArrowDown / ArrowUp move to the next / previous item and wrap, Home and\n// End jump to the first / last. Pure index math shared by m3e-elements and m3e-react.\n//\n// Scoped to the FAB menu for now (COMPONENT_SPEC §6). Follow-up: unify with the Menus component's\n// keyboard helpers (COMPONENT_SPEC §21) once both are on main.\n\n/**\n * The item index `key` moves focus to from `current` (−1: none focused) among `count` items, or\n * null when the key does not navigate.\n */\nexport function menuNavigationTarget(key: string, count: number, current: number): number | null {\n if (count === 0) return null;\n switch (key) {\n case 'ArrowDown':\n return current < 0 ? 0 : (current + 1) % count;\n case 'ArrowUp':\n return current < 0 ? count - 1 : (current - 1 + count) % count;\n case 'Home':\n return 0;\n case 'End':\n return count - 1;\n default:\n return null;\n }\n}\n","// Arrow-key navigation in a toolbar (WAI-ARIA APG toolbar pattern, as React Aria's useToolbar and\n// the button group do it): one key pair along the orientation moves to the next / previous item\n// without wrapping (ArrowRight / ArrowLeft, mirrored in RTL; ArrowDown / ArrowUp when vertical),\n// Home and End jump to the first / last. Pure index math shared by m3e-elements' RovingFocus (the\n// floating toolbar, the docked toolbar) and m3e-react.\n\nexport type ToolbarOrientation = 'horizontal' | 'vertical';\n\n/**\n * The item index `key` moves focus to from `current` (−1: none focused) among `count` items, or\n * null when the key does not navigate. At either end the index stays put (no wrapping).\n */\nexport function toolbarNavigationTarget(\n key: string,\n count: number,\n current: number,\n orientation: ToolbarOrientation = 'horizontal',\n rtl = false,\n): number | null {\n if (count === 0) return null;\n let step: number;\n switch (key) {\n case 'Home':\n return 0;\n case 'End':\n return count - 1;\n case 'ArrowRight':\n case 'ArrowLeft':\n if (orientation !== 'horizontal') return null;\n step = (key === 'ArrowRight') !== rtl ? 1 : -1;\n break;\n case 'ArrowDown':\n case 'ArrowUp':\n if (orientation !== 'vertical') return null;\n step = key === 'ArrowDown' ? 1 : -1;\n break;\n default:\n return null;\n }\n if (current < 0) return step > 0 ? 0 : count - 1;\n return Math.min(Math.max(current + step, 0), count - 1);\n}\n","// A CSS / Compose `CubicBezierEasing(a, b, c, d)`: the curve from (0, 0) to (1, 1) with control\n// points (a, b) and (c, d), solved for y at x = fraction (animation-core Easing.kt@19991f2c: x is\n// solved for its first root in [0, 1], y evaluated there; fractions outside ]0, 1[ pass through).\n// Compose solves the cubic in closed form (ui-graphics Bezier.kt); this bisects x(t), which is\n// monotonic for control x in [0, 1], to 2^-30 (far below what a frame can show).\n\nexport type Easing = (fraction: number) => number;\n\nconst bezier = (p1: number, p2: number, t: number) =>\n 3 * (1 - t) * (1 - t) * t * p1 + 3 * (1 - t) * t * t * p2 + t * t * t;\n\n/** `cubic-bezier(a, b, c, d)` as an easing function. */\nexport const cubicBezier =\n (a: number, b: number, c: number, d: number): Easing =>\n (fraction) => {\n if (!(fraction > 0 && fraction < 1)) return fraction;\n let lo = 0;\n let hi = 1;\n for (let i = 0; i < 30; i++) {\n const mid = (lo + hi) / 2;\n if (bezier(a, c, mid) < fraction) lo = mid;\n else hi = mid;\n }\n return bezier(b, d, (lo + hi) / 2);\n };\n\n/** Parses a resolved CSS `cubic-bezier(a, b, c, d)` (e.g. a motion easing token); null otherwise. */\nexport function parseCubicBezier(css: string): Easing | null {\n const values = /cubic-bezier\\(([^)]*)\\)/.exec(css)?.[1]?.split(',').map(Number);\n return values?.length === 4 && values.every(Number.isFinite)\n ? cubicBezier(...(values as [number, number, number, number]))\n : null;\n}\n","/*\n * Copyright 2021 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/AppBar.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n// Ported to TypeScript by Kyra Labs from compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/Easing.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// TopAppBarState (L2050-2130), the pinned, enter-always and exit-until-collapsed scroll behaviors\n// (L3267-3303, L3400-3455, L3476-3536), the settle decision of settleAppBar (L3542-3589) and the\n// two-rows bar's collapsed-fraction interpolation (TwoRowsTopAppBar L2818-2836,\n// TopAppBarColors.containerColor L2229-2235, TopTitleAlphaEasing L3604; FastOutLinearInEasing\n// from Easing.kt L66, solved by the shared cubic-bezier.ts), adapted to DOM scrolling. Compose\n// receives nested scroll deltas and can consume them; the web observes `scrollTop` after the\n// browser scrolled, so every delta goes to both the bar and the content, and momentum comes from\n// the browser instead of flingAnimationSpec. Offsets are in CSS px; y grows downward, so\n// collapsing is negative.\n\nimport { cubicBezier } from './cubic-bezier.js';\n\n/** How the bar reacts to its scroll container (TopAppBarDefaults.*ScrollBehavior). */\nexport type AppBarScrollBehavior = 'pinned' | 'enter-always' | 'exit-until-collapsed';\n\nexport interface AppBarScrollState {\n /** Most negative height offset: minus the bar's full height (adjustHeightOffsetLimit). */\n readonly heightOffsetLimit: number;\n /** Current height offset, between heightOffsetLimit and 0. */\n readonly heightOffset: number;\n /** Content scrolled under the bar (minus the scroll position). */\n readonly contentOffset: number;\n /** Whether the scrolling content is at its start (scroll position 0). */\n readonly atStart: boolean;\n}\n\n/** A fully expanded bar of `height` px over unscrolled content. */\nexport function appBarScrollState(height: number): AppBarScrollState {\n return { heightOffsetLimit: -height, heightOffset: 0, contentOffset: 0, atStart: true };\n}\n\n/** TopAppBarState.heightOffset setter: coerced between heightOffsetLimit and 0. */\nexport function withHeightOffset(state: AppBarScrollState, offset: number): AppBarScrollState {\n return { ...state, heightOffset: Math.min(Math.max(offset, state.heightOffsetLimit), 0) };\n}\n\n/** A new bar height (onSizeChanged → adjustHeightOffsetLimit), keeping the offset in range. */\nexport function withHeight(state: AppBarScrollState, height: number): AppBarScrollState {\n return withHeightOffset({ ...state, heightOffsetLimit: -height }, state.heightOffset);\n}\n\n/** 0 = fully expanded, 1 = fully collapsed (TopAppBarState.collapsedFraction). */\nexport function collapsedFraction(state: AppBarScrollState): number {\n // `+ 0` turns the -0 of 0 / -height into 0.\n return state.heightOffsetLimit !== 0 ? state.heightOffset / state.heightOffsetLimit + 0 : 0;\n}\n\n/** Share of the visible bar overlapping scrolled content (TopAppBarState.overlappedFraction). */\nexport function overlappedFraction(state: AppBarScrollState): number {\n if (!state.atStart && state.contentOffset === 0) return 1;\n if (state.heightOffsetLimit === 0) return 0;\n const limit = state.heightOffsetLimit;\n const clamped = Math.min(Math.max(limit + Math.abs(state.contentOffset), limit), 0);\n return 1 - clamped / limit;\n}\n\n/**\n * Whether the bar shows its scrolled container color: SingleRowTopAppBar targets the scrolled\n * color once `overlappedFraction > 0.01f` (L2689-2693).\n */\nexport function isScrolledUnder(state: AppBarScrollState): boolean {\n return overlappedFraction(state) > 0.01;\n}\n\n/**\n * Applies a scroll position change. `delta` is the previous minus the new scroll position\n * (positive when the content is pulled down, like Compose's `available.y`).\n * - pinned: only the content offset moves (PinnedScrollBehavior.onPostScroll).\n * - enter-always: the bar also collapses/expands by the same amount\n * (EnterAlwaysScrollBehavior.onPreScroll: `heightOffset += available.y`).\n * - exit-until-collapsed: scrolling down collapses the bar by the same amount\n * (ExitUntilCollapsedScrollBehavior.onPreScroll); scrolling up expands it only by what the\n * content cannot take (onPostScroll: `heightOffset += available.y` once the content is at its\n * start). On the web the content scrolls by the whole delta, so the part of an upward scroll\n * that lies within the collapsed distance of the top (scroll position below -heightOffset) is\n * the part Compose hands to the bar: the bar is fully expanded when the content reaches its\n * start, and a bar that collapsed together with the content stays attached to it.\n */\nexport function scrollAppBar(\n state: AppBarScrollState,\n behavior: AppBarScrollBehavior,\n scrollTop: number,\n delta: number,\n): AppBarScrollState {\n const next: AppBarScrollState = { ...state, contentOffset: -scrollTop, atStart: scrollTop <= 0 };\n if (behavior === 'pinned') return next;\n if (behavior === 'enter-always' || delta < 0) {\n return withHeightOffset(next, state.heightOffset + delta);\n }\n const below = (top: number) => Math.max(0, -state.heightOffset - top);\n return withHeightOffset(next, state.heightOffset + below(scrollTop) - below(scrollTop + delta));\n}\n\n/**\n * Where a partially collapsed bar snaps when scrolling stops (settleAppBar): fully expanded below\n * half, fully collapsed from half, or null when it is already (within 1%) settled.\n */\nexport function settleTarget(state: AppBarScrollState): number | null {\n const fraction = collapsedFraction(state);\n if (fraction < 0.01 || fraction === 1) return null;\n if (!(state.heightOffset < 0 && state.heightOffset > state.heightOffsetLimit)) return null;\n return fraction < 0.5 ? 0 : state.heightOffsetLimit;\n}\n\n/** TopTitleAlphaEasing (AppBar.kt L3604): CubicBezierEasing(.8f, 0f, .8f, .15f). */\nexport const TOP_TITLE_ALPHA_EASING = [0.8, 0, 0.8, 0.15] as const;\n/** FastOutLinearInEasing (Easing.kt L66): CubicBezierEasing(0.4f, 0.0f, 1.0f, 1.0f). */\nexport const FAST_OUT_LINEAR_IN_EASING = [0.4, 0, 1, 1] as const;\n\nconst topTitleAlpha = /* @__PURE__ */ cubicBezier(...TOP_TITLE_ALPHA_EASING);\nconst fastOutLinearIn = /* @__PURE__ */ cubicBezier(...FAST_OUT_LINEAR_IN_EASING);\n\n/** What a two-rows bar (medium / large flexible, TwoRowsTopAppBar) draws at a collapsed fraction. */\nexport interface TwoRowsFrame {\n /** Alpha of the collapsed (top row) title and subtitle: TopTitleAlphaEasing(fraction). */\n readonly collapsedTitleAlpha: number;\n /** Alpha of the expanded (bottom row) title and subtitle: 1 - fraction. */\n readonly expandedTitleAlpha: number;\n /** Container → scrolled container color mix (TopAppBarColors.containerColor): FastOutLinearIn. */\n readonly containerColorFraction: number;\n /** Below 0.5 the collapsed title is hidden from accessibility, from 0.5 the expanded one. */\n readonly collapsedTitleHidden: boolean;\n}\n\n/** TwoRowsTopAppBar (L2818-2836): the color, both title alphas and semantics follow the fraction. */\nexport function twoRowsFrame(fraction: number): TwoRowsFrame {\n return {\n collapsedTitleAlpha: topTitleAlpha(fraction),\n expandedTitleAlpha: 1 - fraction,\n containerColorFraction: fastOutLinearIn(fraction),\n collapsedTitleHidden: fraction < 0.5,\n };\n}\n","/*\n * Copyright 2024 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/FloatingToolbar.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// FloatingToolbarState (L1299-1377), ExitAlwaysFloatingToolbarScrollBehavior (onPostScroll and the\n// offset limit, L540-628), the settle decision of settleFloatingToolbar (L1383-1437) and\n// FloatingToolbarDefaults.VerticalNestedScrollExpansionNode (floatingToolbarVerticalNestedScroll,\n// L1013-1106), adapted to DOM scrolling like app-bar-scroll.ts: the web observes `scrollTop` after\n// the browser scrolled, so `delta` (previous minus new scroll position, positive when the content\n// is pulled down, like Compose's `consumed.y`) moves both, and momentum comes from the browser\n// instead of flingAnimationSpec. Offsets are CSS px; hiding is negative.\n//\n// The docked toolbar (FlexibleBottomAppBar) and the legacy BottomAppBar use the same math, so they\n// reuse these functions (AppBar.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898):\n// BottomAppBarStateImpl (L2513-2539) coerces heightOffset between heightOffsetLimit (minus the\n// bar's measured height, BottomAppBarLayout L1365-1375) and 0 like FloatingToolbarState.offset,\n// ExitAlwaysScrollBehavior.onPostScroll (L2569-2579) moves contentOffset and heightOffset by\n// `consumed.y` like the floating toolbar's, and settleAppBarBottom (L2600-2648) makes the same\n// settle decision (none within 1 % of either end; shown below half, hidden from half).\nimport { settleTarget } from './app-bar-scroll.js';\n\n/** Where a floating toolbar leaves the screen (FloatingToolbarExitDirection), logical. */\nexport type FloatingToolbarExitDirection = 'bottom' | 'top' | 'start' | 'end';\n\nexport interface FloatingToolbarScrollState {\n /** Most negative offset: minus the distance that takes the toolbar off its container. */\n readonly offsetLimit: number;\n /** Current offset, between offsetLimit and 0. */\n readonly offset: number;\n /** Total content scrolled under the toolbar (sum of the deltas). */\n readonly contentOffset: number;\n}\n\n/** rememberFloatingToolbarState() defaults: no limit known yet, fully shown. */\nexport function floatingToolbarScrollState(\n offsetLimit = -Number.MAX_VALUE,\n offset = 0,\n contentOffset = 0,\n): FloatingToolbarScrollState {\n return withToolbarOffset({ offsetLimit, offset: 0, contentOffset }, offset);\n}\n\n/** FloatingToolbarState.offset setter: coerced between offsetLimit and 0. */\nexport function withToolbarOffset(\n state: FloatingToolbarScrollState,\n offset: number,\n): FloatingToolbarScrollState {\n return { ...state, offset: Math.min(Math.max(offset, state.offsetLimit), 0) };\n}\n\n/**\n * The offset limit from the toolbar's layout (onGloballyPositioned): `distance` is how far the\n * toolbar must travel along its exit direction to leave its container, i.e. its size plus its gap\n * to that edge, measured without the current offset. The offset stays in range.\n */\nexport function withToolbarOffsetLimit(\n state: FloatingToolbarScrollState,\n distance: number,\n): FloatingToolbarScrollState {\n return withToolbarOffset({ ...state, offsetLimit: -Math.max(distance, 0) }, state.offset);\n}\n\n/** exitAlways onPostScroll: the content offset and the toolbar offset both move by `delta`. */\nexport function scrollFloatingToolbar(\n state: FloatingToolbarScrollState,\n delta: number,\n): FloatingToolbarScrollState {\n return withToolbarOffset(\n { ...state, contentOffset: state.contentOffset + delta },\n state.offset + delta,\n );\n}\n\n/** 0 = fully shown, 1 = fully hidden (FloatingToolbarState.collapsedFraction()). */\nexport function toolbarCollapsedFraction(state: FloatingToolbarScrollState): number {\n // `+ 0` turns the -0 of 0 / -limit into 0.\n return state.offsetLimit !== 0 ? state.offset / state.offsetLimit + 0 : 0;\n}\n\n/**\n * Where a partly hidden toolbar snaps when scrolling stops (settleFloatingToolbar): shown below\n * half, hidden from half, or null when it is already (within 1%) settled. The decision is the\n * same as the top app bar's settleAppBar, so it reuses that port.\n */\nexport function toolbarSettleTarget(state: FloatingToolbarScrollState): number | null {\n return settleTarget({\n heightOffsetLimit: state.offsetLimit,\n heightOffset: state.offset,\n contentOffset: state.contentOffset,\n atStart: false,\n });\n}\n\n/**\n * floatingToolbarVerticalNestedScroll: collapses the toolbar after scrolling down by the collapse\n * threshold and expands it after scrolling up by the expand threshold (both\n * FloatingToolbarDefaults.ScrollDistanceThreshold by default).\n */\nexport interface ToolbarExpansionScroll {\n readonly contentOffset: number;\n /** The content offset that triggers the next change. */\n readonly threshold: number;\n}\n\n/** A tracker for a toolbar that is `expanded` (updateThreshold). */\nexport function toolbarExpansionScroll(\n expanded: boolean,\n collapseThreshold: number,\n expandThreshold: number,\n contentOffset = 0,\n): ToolbarExpansionScroll {\n return {\n contentOffset,\n threshold: expanded ? contentOffset - collapseThreshold : contentOffset + expandThreshold,\n };\n}\n\n/**\n * onPostScroll: moves the content offset by `delta`; returns the new tracker and `'collapse'` /\n * `'expand'` when a threshold was crossed (Compose calls onCollapse / onExpand then).\n */\nexport function scrollToolbarExpansion(\n state: ToolbarExpansionScroll,\n delta: number,\n collapseThreshold: number,\n expandThreshold: number,\n): { state: ToolbarExpansionScroll; change: 'collapse' | 'expand' | null } {\n const contentOffset = state.contentOffset + delta;\n if (delta < 0 && contentOffset <= state.threshold) {\n return {\n state: { contentOffset, threshold: contentOffset + expandThreshold },\n change: 'collapse',\n };\n }\n if (delta > 0 && contentOffset >= state.threshold) {\n return {\n state: { contentOffset, threshold: contentOffset - collapseThreshold },\n change: 'expand',\n };\n }\n return { state: { contentOffset, threshold: state.threshold }, change: null };\n}\n","/*\n * Copyright 2022 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ProgressIndicator.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/WavyProgressIndicator.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/internal/LinearWavyProgressModifiers.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/internal/CircularWavyProgressModifiers.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// The progress indicators' timelines as pure functions of elapsed time (shared by m3e-elements and\n// m3e-react; the numbers come from the generated `--m3e-comp-progress-indicator-defaults-*` tokens):\n// - indeterminate linear: two lines whose head and tail each run `0f at delay using easing` →\n// `1f at delay + duration` keyframes on one infinitely repeating cycle (L979–1025);\n// - indeterminate circular: a linear global rotation, an additional rotation in linear steps and a\n// sweep that grows linearly and shrinks on the easing, all on one cycle (L929–977; in Compose\n// keyframes, `using` eases the interval that *starts* at its keyframe);\n// - the wave offset: a linear 0 → 1 tween repeating every wavelength / waveSpeed seconds (times the\n// polygon's vertex count for circular indicators), never shorter than MinAnimationDuration;\n// - the determinate amplitude (`WavyProgressIndicatorDefaults.indicatorAmplitude`) and its tweens,\n// which Compose never retargets while one runs.\n\nimport type { Easing } from './cubic-bezier.js';\n\nexport interface LinearIndeterminateTiming {\n /** `LinearAnimationDuration`: one cycle. */\n readonly durationMillis: number;\n /** `[delay, duration]` of each keyframe pair. */\n readonly firstHead: readonly [number, number];\n readonly firstTail: readonly [number, number];\n readonly secondHead: readonly [number, number];\n readonly secondTail: readonly [number, number];\n /** `LinearIndeterminateProgressEasing`. */\n readonly easing: Easing;\n}\n\n/** A 0 → 1 keyframe pair (`0f at delay using easing; 1f at delay + duration`) at cycle time `t`. */\nconst line = (t: number, [delay, duration]: readonly [number, number], easing: Easing) =>\n t <= delay ? 0 : t >= delay + duration ? 1 : easing((t - delay) / duration);\n\n/**\n * The indeterminate linear indicator's fractions at `elapsedMillis`, in the order the wavy indicator\n * draws them (`getProgressFractions`): first tail, first head, second tail, second head (0–1 each).\n */\nexport function linearIndeterminateFractions(\n elapsedMillis: number,\n timing: LinearIndeterminateTiming,\n): [number, number, number, number] {\n const t = Math.max(0, elapsedMillis) % timing.durationMillis;\n return [\n line(t, timing.firstTail, timing.easing),\n line(t, timing.firstHead, timing.easing),\n line(t, timing.secondTail, timing.easing),\n line(t, timing.secondHead, timing.easing),\n ];\n}\n\nexport interface CircularIndeterminateTiming {\n /** `CircularAnimationProgressDuration`: one cycle. */\n readonly durationMillis: number;\n /** `CircularGlobalRotationDegreesTarget`: linear rotation per cycle (degrees). */\n readonly rotation: number;\n /** `CircularAdditionalRotationDegreesTarget`: the steps' total per cycle (degrees). */\n readonly additionalRotation: number;\n /** `CircularAnimationAdditionalRotationDelay`: a step starts every this. */\n readonly additionalDelayMillis: number;\n /** `CircularAnimationAdditionalRotationDuration`: and moves for this. */\n readonly additionalDurationMillis: number;\n /** `CircularIndeterminateMinProgress` / `MaxProgress`: the sweep range (0–1). */\n readonly minProgress: number;\n readonly maxProgress: number;\n /** `CircularProgressEasing`: the shrinking half of the sweep. */\n readonly easing: Easing;\n}\n\nexport interface CircularIndeterminateFrame {\n /** Global + additional rotation, degrees clockwise. */\n rotation: number;\n /** Sweep, 0–1 of a full turn. */\n sweep: number;\n}\n\n/** The indeterminate circular indicator at `elapsedMillis`. */\nexport function circularIndeterminateFrame(\n elapsedMillis: number,\n timing: CircularIndeterminateTiming,\n): CircularIndeterminateFrame {\n const d = timing.durationMillis;\n const t = Math.max(0, elapsedMillis) % d;\n const steps = Math.round(d / timing.additionalDelayMillis);\n const step = timing.additionalRotation / steps;\n const index = Math.floor(t / timing.additionalDelayMillis);\n const within = t - index * timing.additionalDelayMillis;\n const additional = step * index + step * Math.min(1, within / timing.additionalDurationMillis);\n const half = d / 2;\n const range = timing.maxProgress - timing.minProgress;\n const sweep =\n t <= half\n ? timing.minProgress + range * (t / half)\n : timing.maxProgress - range * timing.easing((t - half) / half);\n return { rotation: (timing.rotation * t) / d + additional, sweep };\n}\n\n/**\n * The wave offset tween's duration: `((wavelength / waveSpeed) * 1000 * vertexCount)` rounded and\n * floored at `minMillis`; `Infinity` (the offset holds at 0) when either is not positive.\n */\nexport function waveTravelMillis(\n wavelength: number,\n waveSpeed: number,\n minMillis: number,\n vertexCount = 1,\n): number {\n if (!(waveSpeed > 0 && wavelength > 0)) return Number.POSITIVE_INFINITY;\n return Math.max(minMillis, Math.round((wavelength / waveSpeed) * 1000 * vertexCount));\n}\n\n/** The wave offset (0–1) after `elapsedMillis` of a tween of `travelMillis`. */\nexport const waveOffset = (elapsedMillis: number, travelMillis: number): number =>\n Number.isFinite(travelMillis) ? (Math.max(0, elapsedMillis) % travelMillis) / travelMillis : 0;\n\n/** `WavyProgressIndicatorDefaults.indicatorAmplitude`: no wave near the start and the end. */\nexport const indicatorAmplitude = (\n progress: number,\n minProgress: number,\n maxProgress: number,\n): number => (progress <= minProgress || progress >= maxProgress ? 0 : 1);\n\nexport interface AmplitudeTween {\n readonly durationMillis: number;\n readonly easing: Easing;\n}\n\n/**\n * The amplitude Animatable of the wavy modifiers: starts at its first target without animating;\n * a new target tweens with `increase` or `decrease` (by direction), but only once the running\n * tween has finished (`amplitudeAnimationJob == null || isCompleted`); a target set meanwhile is\n * ignored, as in Compose, until the next `update` after it finishes.\n */\nexport class AmplitudeAnimation {\n #from: number;\n #to: number;\n #start = 0;\n #tween: AmplitudeTween | null = null;\n #value: number;\n\n constructor(initial: number) {\n this.#from = initial;\n this.#to = initial;\n this.#value = initial;\n }\n\n get value(): number {\n return this.#value;\n }\n\n get target(): number {\n return this.#to;\n }\n\n get isRunning(): boolean {\n return this.#tween !== null;\n }\n\n /** Advances to `now` (ms). */\n sample(now: number): number {\n const tween = this.#tween;\n if (tween === null) return this.#value;\n const fraction = tween.durationMillis > 0 ? (now - this.#start) / tween.durationMillis : 1;\n if (fraction >= 1) {\n this.#tween = null;\n this.#value = this.#to;\n } else {\n this.#value = this.#from + (this.#to - this.#from) * tween.easing(Math.max(0, fraction));\n }\n return this.#value;\n }\n\n /** Requests `target` at `now`; returns true when a tween started. */\n update(target: number, now: number, increase: AmplitudeTween, decrease: AmplitudeTween): boolean {\n this.sample(now);\n if (this.#tween !== null || target === this.#to) return false;\n const tween = this.#value < target ? increase : decrease;\n this.#from = this.#value;\n this.#to = target;\n this.#start = now;\n this.#tween = tween;\n if (tween.durationMillis <= 0) this.sample(now);\n return true;\n }\n}\n","/*\n * Copyright 2024 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/LoadingIndicator.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// The indeterminate LoadingIndicator's LaunchedEffect (L391–451) as a pure function of elapsed\n// time. Compose runs two coroutines:\n// - every MorphIntervalMillis a spring animates the morph progress 0 → 1; when it finishes, the\n// indicator advances to the next morph, snaps the progress to 0 and adds a quarter turn to the\n// morph rotation. The loop then waits for the rest of the interval (or for the spring, if it is\n// slower than the interval);\n// - a linear global rotation turns 360° every GlobalRotationDurationMillis, restarting.\n// The drawn rotation is `progress × 90 + morphRotationTargetAngle + globalRotation` (L473).\n// The interval, rotation duration and spring are tokens (components/loading-indicator-motion.css).\n\nimport { type SpringSpec, springDurationMillis, springValue } from './spring.js';\n\nconst FULL_ROTATION = 360;\nconst QUARTER_ROTATION = FULL_ROTATION / 4;\n\nexport interface LoadingIndicatorTiming {\n /** `MorphIntervalMillis`: how often a morph starts. */\n readonly morphIntervalMillis: number;\n /** `GlobalRotationDurationMillis`: one linear turn. */\n readonly rotationDurationMillis: number;\n /** The morph spring (`morphAnimationSpec`). */\n readonly spring: SpringSpec;\n /** The morph spring's `visibilityThreshold`; it decides when the spring finishes. */\n readonly visibilityThreshold: number;\n}\n\n/** What the indicator draws: a morph at a progress, rotated clockwise about the center. */\nexport interface IndeterminateFrame {\n morphIndex: number;\n /** The raw spring value: it overshoots past 1, as in Compose (the morph extrapolates). */\n morphProgress: number;\n /** Degrees, clockwise. */\n rotation: number;\n}\n\n/**\n * The first frame (and the one held under reduced motion): the first morph at 0, rotated by the\n * initial `morphRotationTargetAngle` (a quarter turn).\n */\nexport const initialIndeterminateFrame: Readonly<IndeterminateFrame> = {\n morphIndex: 0,\n morphProgress: 0,\n rotation: QUARTER_ROTATION,\n};\n\n/** How long one morph spring runs (Compose's `FloatSpringSpec.getDurationNanos`), in ms. */\nexport const morphSpringDurationMillis = (timing: LoadingIndicatorTiming): number =>\n springDurationMillis(timing.spring, 0, 1, 0, timing.visibilityThreshold);\n\n/**\n * The frame of an indeterminate loading indicator [elapsedMillis] after it started, cycling\n * through [morphCount] morphs.\n */\nexport function indeterminateFrame(\n elapsedMillis: number,\n morphCount: number,\n timing: LoadingIndicatorTiming,\n): IndeterminateFrame {\n const t = Math.max(0, elapsedMillis);\n const springMillis = morphSpringDurationMillis(timing);\n // `delay(MorphIntervalMillis)` then `deferred.await()`: the next morph starts after both.\n const period = Math.max(timing.morphIntervalMillis, springMillis);\n const completed = Math.floor(t / period);\n const local = t - completed * period;\n const running = local < springMillis;\n // Each finished spring advances the index and adds a quarter turn (starting at a quarter turn).\n const finished = running ? completed : completed + 1;\n const morphIndex = finished % morphCount;\n const targetAngle = (QUARTER_ROTATION * (finished + 1)) % FULL_ROTATION;\n // Compose samples the spring at whole milliseconds of play time.\n const morphProgress = running ? springValue(timing.spring, Math.floor(local), 0, 1) : 0;\n const globalRotation =\n (FULL_ROTATION * Math.floor(t % timing.rotationDurationMillis)) / timing.rotationDurationMillis;\n return {\n morphIndex,\n morphProgress,\n rotation: morphProgress * QUARTER_ROTATION + targetAngle + globalRotation,\n };\n}\n","/*\n * Copyright 2022 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/internal/MenuPosition.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n// and compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Menu.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// MenuPosition, AnchorAlignmentOffsetPosition and WindowAlignmentMarginPosition (MenuPosition.kt\n// L50-L275), DropdownMenuPositionProvider.positioningLogic (L317-L392), the MenuAnchorPosition\n// candidate lists (Menu.kt L1507-L1785) and calculateTransformOrigin (Menu.kt L2216-L2242). Coordinates are CSS px relative to the viewport\n// (\"window\"); Compose works in integer px, the web keeps fractions. Alignment.align is\n// BiasAlignment's `round((space - size) / 2 * (1 + bias))` (Kotlin roundToInt = Math.round).\n\n/** Where a menu opens relative to its anchor (MenuAnchorPosition.Below…End). */\nexport type MenuAnchorPosition = 'below' | 'above' | 'start' | 'end' | 'left' | 'right';\n\nexport interface MenuRect {\n readonly left: number;\n readonly top: number;\n readonly right: number;\n readonly bottom: number;\n}\n\nexport interface MenuPositionInput {\n /** Anchor bounds in viewport px. */\n anchor: MenuRect;\n /** Viewport (window) size in px. */\n window: { readonly width: number; readonly height: number };\n /** Untransformed menu size in px. */\n menu: { readonly width: number; readonly height: number };\n /** Layout direction of the anchor (`direction: rtl`). */\n rtl: boolean;\n /** Default `below`. */\n position?: MenuAnchorPosition | undefined;\n /** DpOffset: x is mirrored in RTL. Default 0, 0. */\n offset?: { readonly x: number; readonly y: number } | undefined;\n /** Kept from the window top/bottom (MenuVerticalMargin). */\n verticalMargin: number;\n /** Kept from the window left/right (MenuHorizontalMargin; 0 for the baseline DropdownMenu). */\n horizontalMargin: number;\n}\n\nexport interface MenuPositionResult {\n /** Menu left edge in viewport px. */\n x: number;\n /** Menu top edge in viewport px. */\n y: number;\n /** Transform origin as fractions of the menu size (0 = left/top, 1 = right/bottom). */\n originX: number;\n originY: number;\n}\n\ntype Horizontal = (anchor: MenuRect, width: number, menuWidth: number, rtl: boolean) => number;\ntype Vertical = (anchor: MenuRect, height: number, menuHeight: number) => number;\n\nconst round = Math.round;\n\n/** BiasAlignment.Horizontal.align (Start = -1, CenterHorizontally = 0, End = 1). */\nconst alignH = (bias: number, size: number, space: number, rtl: boolean) =>\n round(((space - size) / 2) * (1 + (rtl ? -bias : bias)));\n/** BiasAlignment.Vertical.align (Top = -1, CenterVertically = 0, Bottom = 1). */\nconst alignV = (bias: number, size: number, space: number) =>\n round(((space - size) / 2) * (1 + bias));\n\nconst START = -1;\nconst END = 1;\nconst TOP = -1;\nconst CENTER = 0;\nconst BOTTOM = 1;\n\n/** AnchorAlignmentOffsetPosition.Horizontal. */\nconst anchorH =\n (menuBias: number, anchorBias: number): Horizontal =>\n (anchor, _width, menuWidth, rtl) =>\n anchor.left +\n alignH(anchorBias, 0, anchor.right - anchor.left, rtl) -\n alignH(menuBias, 0, menuWidth, rtl);\n\n/** AnchorAlignmentOffsetPosition.Vertical. */\nconst anchorV =\n (menuBias: number, anchorBias: number): Vertical =>\n (anchor, _height, menuHeight) =>\n anchor.top +\n alignV(anchorBias, 0, anchor.bottom - anchor.top) -\n alignV(menuBias, 0, menuHeight);\n\nconst startToAnchorStart = anchorH(START, START);\nconst startToAnchorEnd = anchorH(START, END);\nconst endToAnchorEnd = anchorH(END, END);\nconst endToAnchorStart = anchorH(END, START);\n/** WindowAlignmentMarginPosition.Horizontal with AbsoluteAlignment.Left / Right (ignore RTL). */\nconst leftToWindowLeft: Horizontal = (_a, width, menuWidth) =>\n alignH(START, menuWidth, width, false);\nconst rightToWindowRight: Horizontal = (_a, width, menuWidth) =>\n alignH(END, menuWidth, width, false);\n\nconst topToAnchorBottom = anchorV(TOP, BOTTOM);\nconst topToAnchorTop = anchorV(TOP, TOP);\nconst bottomToAnchorTop = anchorV(BOTTOM, TOP);\nconst bottomToAnchorBottom = anchorV(BOTTOM, BOTTOM);\nconst centerToAnchorTop = anchorV(CENTER, TOP);\nconst topToWindowTop: Vertical = (_a, height, menuHeight) => alignV(TOP, menuHeight, height);\nconst bottomToWindowBottom: Vertical = (_a, height, menuHeight) =>\n alignV(BOTTOM, menuHeight, height);\n\nconst centerX = (r: MenuRect) => (r.left + r.right) / 2;\nconst centerY = (r: MenuRect) => (r.top + r.bottom) / 2;\n\n/** The window-edge fallback every MenuAnchorPosition ends its x list with. */\nconst windowX = (anchor: MenuRect, width: number) =>\n centerX(anchor) < width / 2 ? leftToWindowLeft : rightToWindowRight;\nconst windowY = (anchor: MenuRect, height: number) =>\n centerY(anchor) < height / 2 ? topToWindowTop : bottomToWindowBottom;\n\n/** MenuAnchorPosition.{Below, Above, Left, Right, Start, End}: candidate x and y lists, in order. */\nfunction candidates(\n position: MenuAnchorPosition,\n anchor: MenuRect,\n width: number,\n height: number,\n): [Horizontal[], Vertical[]] {\n const wx = windowX(anchor, width);\n const wy = windowY(anchor, height);\n switch (position) {\n case 'above':\n return [\n [startToAnchorStart, endToAnchorEnd, wx],\n [bottomToAnchorTop, topToAnchorBottom, centerToAnchorTop, wy],\n ];\n // Left and Start (Right and End) list the same candidates; Start/End resolve against the\n // layout direction inside the candidates, Left/Right too (Menu.kt keeps them identical).\n case 'left':\n case 'start':\n return [\n [endToAnchorStart, startToAnchorEnd, wx],\n [topToAnchorTop, bottomToAnchorBottom, wy],\n ];\n case 'right':\n case 'end':\n return [\n [startToAnchorEnd, endToAnchorStart, wx],\n [topToAnchorTop, bottomToAnchorBottom, wy],\n ];\n // 'below' (unrecognized values too).\n default:\n return [\n [startToAnchorStart, endToAnchorEnd, wx],\n [topToAnchorBottom, bottomToAnchorTop, centerToAnchorTop, wy],\n ];\n }\n}\n\nconst coerceIn = (v: number, min: number, max: number) => Math.min(Math.max(v, min), max);\n\n/** First candidate that fits between the margins; else the last one coerced (or centered). */\nfunction pick(\n values: readonly number[],\n size: number,\n space: number,\n margin: number,\n center: () => number,\n): number {\n for (const [i, candidate] of values.entries()) {\n if (candidate >= margin && candidate + size <= space - margin) return candidate;\n if (i === values.length - 1) {\n return size >= space - 2 * margin\n ? center()\n : coerceIn(candidate, margin, space - margin - size);\n }\n }\n return 0;\n}\n\n/** calculateTransformOrigin (Menu.kt L2216). */\nexport function menuTransformOrigin(\n anchor: MenuRect,\n menu: MenuRect,\n): { originX: number; originY: number } {\n const menuWidth = menu.right - menu.left;\n const menuHeight = menu.bottom - menu.top;\n const originX =\n menu.left >= anchor.right\n ? 0\n : menu.right <= anchor.left\n ? 1\n : menuWidth === 0\n ? 0\n : ((Math.max(anchor.left, menu.left) + Math.min(anchor.right, menu.right)) / 2 -\n menu.left) /\n menuWidth;\n const originY =\n menu.top >= anchor.bottom\n ? 0\n : menu.bottom <= anchor.top\n ? 1\n : menuHeight === 0\n ? 0\n : ((Math.max(anchor.top, menu.top) + Math.min(anchor.bottom, menu.bottom)) / 2 -\n menu.top) /\n menuHeight;\n return { originX, originY };\n}\n\n/**\n * Where Compose's DropdownMenuPositionProvider places a menu: the first x and y candidates of the\n * MenuAnchorPosition that keep the menu inside the window margins (below the anchor, then above it,\n * then centered on its top, then against the nearer window edge), plus the transform origin the\n * open/close scale animates from.\n */\nexport function menuPosition(input: MenuPositionInput): MenuPositionResult {\n const { anchor, window: win, menu, rtl, verticalMargin, horizontalMargin } = input;\n const offset = input.offset ?? { x: 0, y: 0 };\n const [xs, ys] = candidates(input.position ?? 'below', anchor, win.width, win.height);\n const offsetX = offset.x * (rtl ? -1 : 1);\n const x = pick(\n xs.map((c) => c(anchor, win.width, menu.width, rtl) + offsetX),\n menu.width,\n win.width,\n horizontalMargin,\n () => alignH(CENTER, menu.width, win.width, rtl),\n );\n const y = pick(\n ys.map((c) => c(anchor, win.height, menu.height) + offset.y),\n menu.height,\n win.height,\n verticalMargin,\n () => alignV(CENTER, menu.height, win.height),\n );\n return {\n x,\n y,\n ...menuTransformOrigin(anchor, {\n left: x,\n top: y,\n right: x + menu.width,\n bottom: y + menu.height,\n }),\n };\n}\n","/*\n * Copyright 2024 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SearchBar.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// SearchBarState (L1434-1628: the expand / collapse animatable, the content fade animatable and\n// currentValue's 0.02 threshold), the drop-down slide of ExpandedDockedSearchBarWithGap\n// (DockedSearchBarLayout L3659-3690: AnimatedVisibility once progress > 0.1, sliding by half its\n// height on the state's expand / collapse springs) and the geometry of the expanded views:\n// FullScreenSearchBarLayout (L3880-4023, without predictive back), DockedSearchBarLayoutImpl\n// (L3724-3771) and the with-gap popup (ExpandedDockedSearchBarImpl L1172-1203). Compose lays the\n// expanded views out in a dialog / popup window; here they are fixed-position boxes in the top\n// layer, so every rectangle is in viewport (window) px. Time is injected (ms), so m3e-elements\n// drives it from its frame loop and tests step it deterministically.\n\nimport { SpringAnimatable } from './animatable.js';\nimport type { Easing } from './cubic-bezier.js';\nimport type { SpringSpec } from './spring.js';\n\n/** SearchBarState.currentValue is Expanded above this (L1535, \"tolerance for spring anim\"). */\nexport const SEARCH_BAR_EXPANDED_THRESHOLD = 0.02;\n/** ExpandedDockedSearchBarWithGap shows its results once progress passes this (L3667). */\nexport const SEARCH_DROPDOWN_VISIBLE_PROGRESS = 0.1;\n\n/** A Compose `tween(durationMillis, delayMillis, easing)`. */\nexport interface TweenSpec {\n readonly duration: number;\n readonly delay: number;\n readonly easing: Easing;\n}\n\n/**\n * A float with Compose `Animatable.animateTo(tween)` semantics: each target starts a tween from the\n * current value (velocity is not carried), held for `delay`, then eased over `duration`. A null\n * spec is Compose's `snap()`: the value jumps.\n */\nexport class TweenAnimatable {\n #value: number;\n #from: number;\n #target: number;\n #start = 0;\n #spec: TweenSpec | null = null;\n\n constructor(value: number) {\n this.#value = value;\n this.#from = value;\n this.#target = value;\n }\n\n get value(): number {\n return this.#value;\n }\n\n get target(): number {\n return this.#target;\n }\n\n get isRunning(): boolean {\n return this.#spec !== null;\n }\n\n snapTo(value: number): void {\n this.#spec = null;\n this.#value = value;\n this.#from = value;\n this.#target = value;\n }\n\n animateTo(target: number, spec: TweenSpec | null, now: number): void {\n this.sample(now);\n if (spec === null || spec.delay + spec.duration <= 0) {\n this.snapTo(target);\n return;\n }\n this.#from = this.#value;\n this.#target = target;\n this.#start = now;\n this.#spec = spec;\n }\n\n sample(now: number): number {\n const spec = this.#spec;\n if (spec === null) return this.#value;\n const elapsed = now - this.#start - spec.delay;\n if (elapsed >= spec.duration) {\n this.snapTo(this.#target);\n return this.#value;\n }\n const fraction = elapsed <= 0 ? 0 : spec.easing(elapsed / spec.duration);\n this.#value = this.#from + (this.#target - this.#from) * fraction;\n return this.#value;\n }\n}\n\n/** The four animation specs of a SearchBarState (null springs / tweens jump, as `snap()`). */\nexport interface SearchBarSpecs {\n readonly expand: SpringSpec | null;\n readonly collapse: SpringSpec | null;\n readonly contentFadeIn: TweenSpec | null;\n readonly contentFadeOut: TweenSpec | null;\n}\n\n/** One sampled frame of a {@link SearchBarAnimation}. */\nexport interface SearchBarSample {\n /** `animatable.value`: may overshoot 1 (expressive spatial springs). */\n readonly value: number;\n /** `progress`: the value clamped to [0, 1]. */\n readonly progress: number;\n /** `contentProgress` (the contained / with-gap results' alpha). */\n readonly contentProgress: number;\n /** The with-gap drop-down's slide offset in px (0 at rest, minus half its height hidden). */\n readonly slide: number;\n /** Whether the with-gap drop-down is shown (AnimatedVisibility is entering, visible or exiting). */\n readonly dropdownShown: boolean;\n}\n\n/**\n * SearchBarState's animation: `animateToExpanded` / `animateToCollapsed` run the progress spring\n * and the content tween together; a new target starts from the current value and velocity\n * (Animatable). Optionally (ExpandedDockedSearchBarWithGap) it also runs the drop-down's\n * slide-in / slide-out on the same springs, from progress 0.1.\n */\nexport class SearchBarAnimation {\n readonly #progress: SpringAnimatable;\n readonly #content: TweenAnimatable;\n readonly #slide = new SpringAnimatable(0);\n #specs: SearchBarSpecs | null = null;\n #dropdownShown = false;\n #dropdownVisible = false;\n\n constructor(expanded = false) {\n this.#progress = new SpringAnimatable(expanded ? 1 : 0);\n this.#content = new TweenAnimatable(expanded ? 1 : 0);\n this.#dropdownShown = expanded;\n this.#dropdownVisible = expanded;\n }\n\n /** SearchBarState.targetValue. */\n get isTargetExpanded(): boolean {\n return this.#progress.target === 1;\n }\n\n /** SearchBarState.currentValue: expanded until the value drops to the 0.02 tolerance. */\n get isExpanded(): boolean {\n return this.#progress.value > SEARCH_BAR_EXPANDED_THRESHOLD;\n }\n\n get isRunning(): boolean {\n return this.#progress.isRunning || this.#content.isRunning || this.#slide.isRunning;\n }\n\n /** animateToExpanded() at `now` (ms). */\n expand(specs: SearchBarSpecs, now: number): void {\n this.#specs = specs;\n this.#progress.animateTo(1, specs.expand, now);\n this.#content.animateTo(1, specs.contentFadeIn, now);\n }\n\n /** animateToCollapsed() at `now` (ms). */\n collapse(specs: SearchBarSpecs, now: number): void {\n this.#specs = specs;\n this.#content.animateTo(0, specs.contentFadeOut, now);\n this.#progress.animateTo(0, specs.collapse, now);\n }\n\n /** Jumps to collapsed (0) or expanded (1), stopping every animation. */\n snapTo(expanded: boolean): void {\n this.#progress.snapTo(expanded ? 1 : 0);\n this.#content.snapTo(expanded ? 1 : 0);\n this.#slide.snapTo(0);\n this.#dropdownShown = expanded;\n this.#dropdownVisible = expanded;\n }\n\n /**\n * Advances to `now`. `dropdownHeight` (px, the drop-down's full height) enables the with-gap\n * slide: AnimatedVisibility(visible = progress > 0.1 && target == Expanded) slides in from minus\n * half the height on the expand spring and out to it on the collapse spring.\n */\n sample(now: number, dropdownHeight?: number): SearchBarSample {\n const value = this.#progress.sample(now);\n const progress = Math.min(Math.max(value, 0), 1);\n const contentProgress = Math.min(Math.max(this.#content.sample(now), 0), 1);\n if (dropdownHeight !== undefined) {\n const hidden = Math.round(-dropdownHeight / 2);\n const visible = progress > SEARCH_DROPDOWN_VISIBLE_PROGRESS && this.isTargetExpanded;\n if (visible !== this.#dropdownVisible) {\n this.#dropdownVisible = visible;\n if (visible) {\n // Enter: from minus half the height (or from where an exit got to).\n if (!this.#dropdownShown) this.#slide.snapTo(hidden);\n this.#dropdownShown = true;\n this.#slide.animateTo(0, this.#specs?.expand ?? null, now);\n } else if (this.#dropdownShown) {\n this.#slide.animateTo(hidden, this.#specs?.collapse ?? null, now);\n }\n }\n this.#slide.sample(now);\n if (!visible && this.#dropdownShown && !this.#slide.isRunning) this.#dropdownShown = false;\n }\n return {\n value,\n progress,\n contentProgress,\n slide: this.#slide.value,\n dropdownShown: this.#dropdownShown,\n };\n }\n}\n\n/** The expanded views Compose offers for a SearchBarState. */\nexport type SearchViewVariant =\n 'full-screen' | 'full-screen-contained' | 'docked' | 'docked-with-gap';\n\nexport interface SearchRect {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n}\n\n/** The SearchBar.kt measurements the layouts read (px; search-defaults.css). */\nexport interface SearchViewMetrics {\n /** SearchBarVerticalPadding (8dp). */\n readonly verticalPadding: number;\n /** AppBarWithSearchVerticalPadding (4dp): the contained view's top padding. */\n readonly containedTopPadding: number;\n /** FullScreenExpandedHorizontalPadding (8dp). */\n readonly containedHorizontalPadding: number;\n /** SearchBarCornerRadius = InputFieldHeight / 2 (28dp). */\n readonly cornerRadius: number;\n /** DockedExpandedTableMinHeight (240dp). */\n readonly dockedMinHeight: number;\n /** DockedExpandedTableMaxHeightScreenRatio (2/3). */\n readonly dockedMaxHeightRatio: number;\n /** DockedExpandedWithGapTableMaxHeightScreenRatio (1/2). */\n readonly withGapMaxHeightRatio: number;\n /** dockedDropdownGapSize (2dp). */\n readonly dropdownGap: number;\n}\n\nexport interface SearchViewInput {\n readonly variant: SearchViewVariant;\n /** The collapsed search bar (`collapsedBounds`), viewport px. */\n readonly collapsed: SearchRect;\n /** The window (viewport) size. */\n readonly window: { readonly width: number; readonly height: number };\n /** The unconsumed top window inset (safe area). */\n readonly insetTop: number;\n readonly sample: Pick<SearchBarSample, 'value' | 'progress'>;\n readonly metrics: SearchViewMetrics;\n}\n\n/** Where everything of an expanded view goes in one frame (viewport px). */\nexport interface SearchViewFrame {\n /**\n * The surface: full-screen, the growing container (with `radius`); contained, the window,\n * faded in by `alpha`; docked, the panel holding field and results (height between `minHeight`\n * and `maxHeight`); with gap, the scrim (drawn at `alpha` × the scrim opacity).\n */\n readonly surface: SearchRect & {\n readonly radius: number;\n readonly alpha: number;\n readonly minHeight: number;\n readonly maxHeight: number;\n };\n /** The input field (collapsed height). */\n readonly field: { readonly x: number; readonly y: number; readonly width: number };\n /** The results: top-left, width and the height they may take. */\n readonly results: {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly maxHeight: number;\n };\n}\n\nconst lerp = (a: number, b: number, t: number) => a + (b - a) * t;\n\n/**\n * The layout of an expanded view at one animation frame: FullScreenSearchBarLayout (`isContained`\n * false / true), DockedSearchBarLayoutImpl (docked) and the with-gap popup. Predictive back is not\n * ported (the web has no back gesture progress).\n */\nexport function searchViewFrame(input: SearchViewInput): SearchViewFrame {\n const { variant, collapsed: c, window: w, insetTop, metrics: m } = input;\n const { value, progress: p } = input.sample;\n const none = { radius: 0, alpha: 1, minHeight: 0, maxHeight: 0 };\n\n if (variant === 'docked' || variant === 'docked-with-gap') {\n const ratio = variant === 'docked' ? m.dockedMaxHeightRatio : m.withGapMaxHeightRatio;\n const tableMax = w.height * ratio;\n const maxHeight = lerp(c.height, tableMax, Math.max(value, 0));\n const minHeight = Math.min(Math.min(m.dockedMinHeight, tableMax), maxHeight);\n if (variant === 'docked') {\n return {\n surface: { ...c, radius: 0, alpha: 1, minHeight, maxHeight },\n field: { x: c.x, y: c.y, width: c.width },\n results: { x: c.x, y: c.y + c.height, width: c.width, maxHeight: maxHeight - c.height },\n };\n }\n return {\n surface: { x: 0, y: 0, width: w.width, height: w.height, ...none, alpha: p },\n field: { x: c.x, y: c.y, width: c.width },\n results: {\n x: c.x,\n y: c.y + c.height + m.dropdownGap,\n width: c.width,\n maxHeight: Math.max(0, maxHeight - c.height - m.dropdownGap),\n },\n };\n }\n\n const contained = variant === 'full-screen-contained';\n const width = contained ? w.width : lerp(c.width, w.width, p);\n const height = contained ? w.height : lerp(c.height, w.height, p);\n const offsetX = contained ? 0 : lerp(c.x, 0, p);\n const padding = contained ? m.containedHorizontalPadding : 0;\n const fieldWidth = lerp(c.width, width - 2 * padding, value);\n const centerX = lerp(c.x + c.width / 2, offsetX + width / 2, value);\n const topPadding = insetTop + (contained ? m.containedTopPadding : m.verticalPadding);\n const animatedTopPadding = topPadding * Math.min(p, 1);\n const bottomPadding = contained ? m.verticalPadding : m.verticalPadding * p;\n const offsetY = lerp(c.y, 0, p);\n const fieldY = offsetY + animatedTopPadding;\n return {\n surface: contained\n ? { x: 0, y: 0, width, height, ...none, alpha: p }\n : { x: offsetX, y: offsetY, width, height, ...none, radius: m.cornerRadius * (1 - p) },\n field: { x: Math.round(centerX - fieldWidth / 2), y: fieldY, width: fieldWidth },\n results: {\n x: offsetX,\n y: fieldY + c.height + bottomPadding,\n width,\n maxHeight: Math.max(0, height - (c.height + animatedTopPadding + bottomPadding)),\n },\n };\n}\n\n/**\n * The combobox's next active option for a key (React Aria / APG list autocomplete): ArrowDown\n * from the input goes to the first option and then down, stopping at the last; ArrowUp from the\n * input goes to the last option and then up, and from the first option back to the input (-1).\n * Returns null for keys it does not handle or an empty list. `enabled` filters disabled options.\n */\nexport function searchNavigationTarget(\n key: string,\n enabled: readonly boolean[],\n active: number,\n): number | null {\n const indices = enabled.flatMap((on, i) => (on ? [i] : []));\n const first = indices[0];\n const last = indices.at(-1);\n if (first === undefined || last === undefined) return null;\n const at = indices.indexOf(active);\n if (key === 'ArrowDown') return at === -1 ? first : (indices[at + 1] ?? last);\n if (key === 'ArrowUp') return at === -1 ? last : at === 0 ? -1 : (indices[at - 1] ?? first);\n return null;\n}\n","/*\n * Copyright 2024 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ButtonGroup.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// ButtonGroupMeasurePolicy.measure (L554-L812): how many items fit before the overflow indicator\n// (L673-L716) and the expand/compress pass that grows a pressed item and shrinks its neighbors\n// (L718-L769). Widths are CSS px; Compose rounds each growth to whole device px (roundToInt), the\n// web keeps fractions so the animation does not step.\n\nexport interface ButtonGroupItemSize {\n /** Resting width (Compose: the item's max intrinsic width). */\n readonly width: number;\n /**\n * Most this item may be compressed by a pressed neighbor (Compose `compressionLimit`: the end\n * content padding of the item, `ButtonDefaults.ContentPadding` by default).\n */\n readonly compressionLimit: number;\n}\n\n/**\n * Number of leading items that fit in `maxWidth` (ButtonGroupMeasurePolicy L673-L716). When all\n * items and their spacing fit, every item shows; otherwise the overflow indicator's width is\n * reserved and items are added while each one fits in what is left (each after the first also\n * pays one `spacing`, the gap before the next item or the indicator).\n */\nexport function buttonGroupVisibleCount(\n widths: readonly number[],\n spacing: number,\n maxWidth: number,\n overflowWidth: number,\n): number {\n const desired = widths.reduce((sum, w) => sum + w, 0) + spacing * (widths.length - 1);\n if (desired <= maxWidth) return widths.length;\n let remaining = maxWidth - overflowWidth;\n let last = 0;\n for (const width of widths) {\n if (width > remaining) break;\n remaining -= width + spacing;\n last++;\n }\n return last;\n}\n\n/**\n * Widths of the visible items while some are pressed (ButtonGroupMeasurePolicy L718-L769).\n * `pressed[i]` is item i's press animation value (0 at rest, 1 fully expanded; it overshoots on a\n * bouncy spring). A pressed middle item grows by `pressed × min(expandedRatio × width / 2, both\n * neighbors' compression limits)` on each side, taken from each neighbor; the first and last items\n * grow by `pressed × min(expandedRatio × width, neighbor's limit)` taken from their only neighbor.\n * Items are processed in order on the running widths, as Compose does, so the total width stays\n * constant. `visibleCount` is the number of items shown (the rest are in the overflow menu).\n */\nexport function buttonGroupWidths(\n items: readonly ButtonGroupItemSize[],\n pressed: readonly number[],\n expandedRatio: number,\n visibleCount: number = items.length,\n): number[] {\n const widths = items.map((item) => item.width);\n const w = (i: number) => widths[i] ?? 0;\n const limit = (i: number) => items[i]?.compressionLimit ?? 0;\n const last = Math.min(visibleCount, items.length);\n if (items.length <= 1) return widths.slice(0, last);\n for (let index = 0; index < last; index++) {\n const value = pressed[index] ?? 0;\n if (value === 0) continue;\n let growth: number;\n if (index >= 1 && index < last - 1) {\n // A middle item compresses both neighbors.\n const target =\n value * Math.min((expandedRatio * w(index)) / 2, limit(index - 1), limit(index + 1));\n const left = Math.min(target, w(index - 1));\n const right = Math.min(target, w(index + 1));\n widths[index - 1] = w(index - 1) - left;\n widths[index + 1] = w(index + 1) - right;\n growth = left + right;\n } else if (index === 0) {\n // The first item compresses the next one.\n const target = value * Math.min(expandedRatio * w(index), limit(index + 1));\n const right = Math.min(target, w(index + 1));\n widths[index + 1] = w(index + 1) - right;\n growth = right;\n } else {\n // The last item compresses the previous one.\n const target = value * Math.min(expandedRatio * w(index), limit(index - 1));\n const left = Math.min(target, w(index - 1));\n widths[index - 1] = w(index - 1) - left;\n growth = left;\n }\n widths[index] = w(index) + growth;\n }\n return widths.slice(0, last);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/spring-estimation.ts","../src/spring-simulation.ts","../src/spring.ts","../src/linear.ts","../src/animatable.ts","../src/fab-menu.ts","../src/menu-navigation.ts","../src/type-select.ts","../src/toolbar-navigation.ts","../src/cubic-bezier.ts","../src/app-bar-scroll.ts","../src/floating-toolbar-scroll.ts","../src/progress-indicator.ts","../src/loading-indicator.ts","../src/menu-position.ts","../src/search-bar.ts","../src/button-group.ts","../src/window-size-class.ts","../src/navigation-suite.ts","../src/wide-navigation-rail.ts","../src/navigation-drawer.ts","../src/slider.ts","../src/tabs.ts","../src/three-pane-scaffold.ts"],"names":["f32","dampingCoefficient","round","centerX","at","lerp","pick","panes","to","candidates"],"mappings":";AAuBA,IAAM,WAAW,CAAA,IAAK,EAAA;AACtB,IAAM,QAAA,GAAW,mBAAO;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QACZ,CAAA,EAAG,CAAA,CAAE,CAAA,CAAE,MAAA,CAAO,GAAG,CAAA;AAAA,QACjB,CAAA,EAAG,CAAA,CAAE,CAAA,CAAE,MAAA,CAAO,GAAG,CAAA;AAAA,QACjB,KAAA,EAAO,KAAK,GAAA,CAAI,CAAA,EAAG,EAAE,KAAA,CAAM,MAAA,CAAO,GAAG,CAAC,CAAA;AAAA,QACtC,MAAA,EAAQ,KAAK,GAAA,CAAI,CAAA,EAAG,EAAE,MAAA,CAAO,MAAA,CAAO,GAAG,CAAC;AAAA,OAC1C;AACA,MAAA,IAAI,IAAA,CAAK,UAAA,KAAe,IAAA,IAAQ,IAAA,CAAK,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,CAAC,CAAA,CAAE,SAAS,CAAA,EAAG,OAAA,GAAU,IAAA;AAAA,IAC9E;AACA,IAAA,OAAO,EAAE,OAAO,OAAA,EAAQ;AAAA,EAC1B;AACF","file":"index.js","sourcesContent":["/*\n * Copyright 2020 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/SpringEstimation.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// The Float overload's arguments are rounded to float32 (Math.fround) before widening to Double,\n// as in Kotlin. Durations are Long milliseconds: Kotlin's Double.toLong() (truncation, NaN → 0,\n// saturating) is reproduced by `toLong`.\n\n/** Maximum duration in Milliseconds. This takes into account that the duration will be converted to nanos. */\n// Long.MAX_VALUE / Long.MIN_VALUE as doubles (2^63 is what Kotlin's Long.toDouble() yields).\nconst LONG_MAX = 2 ** 63;\nconst LONG_MIN = -(2 ** 63);\nconst MAX_LONG_MILLIS = 9_223_372_036_854; // Long.MAX_VALUE / 1_000_000 (integer division)\n\nconst toLong = (x: number): number =>\n Number.isNaN(x) ? 0 : x >= LONG_MAX ? LONG_MAX : x <= LONG_MIN ? LONG_MIN : Math.trunc(x);\n\n/**\n * Returns the estimated time that the spring will last be at [delta]. Arguments are Kotlin\n * `Float`s (rounded to float32).\n */\nexport function estimateAnimationDurationMillis(\n stiffness: number,\n dampingRatio: number,\n initialVelocity: number,\n initialDisplacement: number,\n delta: number,\n): number {\n const f32 = Math.fround;\n if (f32(dampingRatio) === 0) {\n // No damping, duration is infinite (max value).\n return MAX_LONG_MILLIS;\n }\n\n return estimateAnimationDurationMillisDouble(\n f32(stiffness),\n f32(dampingRatio),\n f32(initialVelocity),\n f32(initialDisplacement),\n f32(delta),\n );\n}\n\n/** Returns the estimated time that the spring will last be at [delta] (Double overload). */\nexport function estimateAnimationDurationMillisDouble(\n stiffness: number,\n dampingRatio: number,\n initialVelocity: number,\n initialDisplacement: number,\n delta: number,\n): number {\n const dampingCoefficient = 2.0 * dampingRatio * Math.sqrt(stiffness);\n\n // Compute the roots of the polynomial [a]x^2+[b]x+[c]=0 which may be complex.\n // Here a is set to the constant 1.0, and folded into the other computations\n const partialRoot = dampingCoefficient * dampingCoefficient - 4.0 * stiffness;\n const partialRootReal = partialRoot < 0.0 ? 0.0 : Math.sqrt(partialRoot);\n const partialRootImaginary = partialRoot < 0.0 ? Math.sqrt(Math.abs(partialRoot)) : 0.0;\n\n const firstRootReal = (-dampingCoefficient + partialRootReal) * 0.5;\n const firstRootImaginary = partialRootImaginary * 0.5;\n const secondRootReal = (-dampingCoefficient - partialRootReal) * 0.5;\n\n return estimateDurationInternal(\n firstRootReal,\n firstRootImaginary,\n secondRootReal,\n dampingRatio,\n initialVelocity,\n initialDisplacement,\n delta,\n );\n}\n\n/**\n * In the under-damped case we simply calculate the envelope of the function. The general solution\n * is of the form x(t) = c_1*e^(r*t)*cos(...) + c_2*e^(r*t)sin(...) which simplifies to x(t) =\n * c*e^(r*t)*cos(...) where c*e^(r*t) is the envelope of x(t)\n */\nfunction estimateUnderDamped(\n firstRootReal: number,\n firstRootImaginary: number,\n p0: number,\n v0: number,\n delta: number,\n): number {\n const r = firstRootReal;\n const c1 = p0;\n const c2 = (v0 - r * c1) / firstRootImaginary;\n const c = Math.sqrt(c1 * c1 + c2 * c2);\n\n return Math.log(delta / c) / r;\n}\n\nconst isNotFinite = (x: number) => !Number.isFinite(x);\n\nconst iterateNewtonsMethod = (\n x: number,\n fn: (t: number) => number,\n fnPrime: (t: number) => number,\n): number => x - fn(x) / fnPrime(x);\n\n/**\n * In the critically-damped case we apply Newton-Raphson's iterative numerical method of solving the\n * equation x(t) = c_1*e^(r*t) + c_2*t*e^(r*t)\n */\nfunction estimateCriticallyDamped(\n firstRootReal: number,\n p0: number,\n v0: number,\n delta: number,\n): number {\n const r = firstRootReal;\n const c1 = p0;\n const c2 = v0 - r * c1;\n\n // For our initial guess, determine the max t of c_1*e^(r*t) = delta and\n // c_2*t*e^(r*t) = delta\n const t1 = Math.log(Math.abs(delta / c1)) / r;\n const t2 =\n (() => {\n // Application of Lambert's W function to solve te^t\n const guess = Math.log(Math.abs(delta / c2));\n let t = guess;\n for (let i = 0; i <= 5; i++) {\n t = guess - Math.log(Math.abs(t / r));\n }\n return t;\n })() / r;\n let tCurr = isNotFinite(t1) ? t2 : isNotFinite(t2) ? t1 : Math.max(t1, t2);\n\n // Calculate the inflection time. This is important if the inflection is in t > 0\n const tInflection = -(r * c1 + c2) / (r * c2);\n const xInflection = c1 * Math.exp(r * tInflection) + c2 * tInflection * Math.exp(r * tInflection);\n\n // For inflection that does not exist in real time, we always solve for x(t)=delta. Note\n // the system is manipulated such that p0 is always positive.\n let signedDelta: number;\n if (Number.isNaN(tInflection) || tInflection <= 0.0) {\n signedDelta = -delta;\n } else if (tInflection > 0.0 && -xInflection < delta) {\n // In this scenario the first crossing with the threshold is to be found. Note that\n // the inflection does not exceed delta. As such, we search from the left.\n if (c2 < 0 && c1 > 0) {\n tCurr = 0.0;\n }\n signedDelta = -delta;\n } else {\n // In this scenario there are three total crossings of the threshold, once from\n // above, and then once when the inflection exceeds the threshold and then one last\n // one when x(t) finally decays to zero. The point of determining concavity is to\n // find the final crossing.\n //\n // By finding a point between when concavity changes, and when the inflection point is,\n // Newton's method will always converge onto the rightmost point (in this case),\n // the one that we are interested in.\n tCurr = -(2.0 / r) - c1 / c2;\n signedDelta = delta;\n }\n\n let tDelta = Number.MAX_VALUE;\n let iterations = 0;\n while (tDelta > 0.001 && iterations < 100) {\n iterations++;\n const tLast = tCurr;\n tCurr = iterateNewtonsMethod(\n tCurr,\n (t) => (c1 + c2 * t) * Math.exp(r * t) + signedDelta,\n (t) => (c2 * (r * t + 1) + c1 * r) * Math.exp(r * t),\n );\n tDelta = Math.abs(tLast - tCurr);\n }\n\n return tCurr;\n}\n\n/**\n * In the over-damped case we apply Newton-Raphson's iterative numerical method of solving the\n * equation x(t) = c_1*e^(r_1*t) + c_2*e^(r_2*t)\n */\nfunction estimateOverDamped(\n firstRootReal: number,\n secondRootReal: number,\n p0: number,\n v0: number,\n delta: number,\n): number {\n const r1 = firstRootReal;\n const r2 = secondRootReal;\n const c2 = (r1 * p0 - v0) / (r1 - r2);\n const c1 = p0 - c2;\n\n // For our initial guess, determine the max t of c_1*e^(r_1*t) = delta and\n // c_2*e^(r_2*t) = delta\n const t1 = Math.log(Math.abs(delta / c1)) / r1;\n const t2 = Math.log(Math.abs(delta / c2)) / r2;\n\n let tCurr = isNotFinite(t1) ? t2 : isNotFinite(t2) ? t1 : Math.max(t1, t2);\n\n // Calculate the inflection time. This is important if the inflection is in t > 0\n const tInflection = Math.log((c1 * r1) / (-c2 * r2)) / (r2 - r1);\n const xInflection = () => c1 * Math.exp(r1 * tInflection) + c2 * Math.exp(r2 * tInflection);\n\n // For inflection that does not exist in real time, we always solve for x(t)=delta. Note\n // the system is manipulated such that p0 is always positive.\n let signedDelta: number;\n if (Number.isNaN(tInflection) || tInflection <= 0.0) {\n signedDelta = -delta;\n } else if (tInflection > 0.0 && -xInflection() < delta) {\n // In this scenario the first crossing with the threshold is to be found. Note that\n // the inflection does not exceed delta. As such, we search from the left.\n if (c2 > 0.0 && c1 < 0.0) {\n tCurr = 0.0;\n }\n signedDelta = -delta;\n } else {\n // In this scenario there are three total crossings of the threshold, once from\n // above, and then once when the inflection exceeds the threshold and then one last\n // one when x(t) finally decays to zero. The point of determining concavity is to\n // find the final crossing.\n //\n // By finding a point between when concavity changes, and when the inflection point is,\n // Newton's method will always converge onto the rightmost point (in this case),\n // the one that we are interested in.\n tCurr = Math.log(-(c2 * r2 * r2) / (c1 * r1 * r1)) / (r1 - r2);\n signedDelta = delta;\n }\n\n // For a good initial guess, simply return\n if (Math.abs(c1 * r1 * Math.exp(r1 * tCurr) + c2 * r2 * Math.exp(r2 * tCurr)) < 0.0001) {\n return tCurr;\n }\n let tDelta = Number.MAX_VALUE;\n\n // Cap iterations for safety - Experimentally this method takes <= 5 iterations\n let iterations = 0;\n while (tDelta > 0.001 && iterations < 100) {\n iterations++;\n const tLast = tCurr;\n tCurr = iterateNewtonsMethod(\n tCurr,\n (t) => c1 * Math.exp(r1 * t) + c2 * Math.exp(r2 * t) + signedDelta,\n (t) => c1 * r1 * Math.exp(r1 * t) + c2 * r2 * Math.exp(r2 * t),\n );\n tDelta = Math.abs(tLast - tCurr);\n }\n\n return tCurr;\n}\n\n// Applies Newton-Raphson's method to solve for the estimated time the spring mass system will\n// last be at [delta].\nfunction estimateDurationInternal(\n firstRootReal: number,\n firstRootImaginary: number,\n secondRootReal: number,\n dampingRatio: number,\n initialVelocity: number,\n initialPosition: number,\n delta: number,\n): number {\n if (initialPosition === 0.0 && initialVelocity === 0.0) {\n return 0;\n }\n\n const v0 = initialPosition < 0 ? -initialVelocity : initialVelocity;\n const p0 = Math.abs(initialPosition);\n\n const seconds =\n dampingRatio > 1.0\n ? estimateOverDamped(firstRootReal, secondRootReal, p0, v0, delta)\n : dampingRatio < 1.0\n ? estimateUnderDamped(firstRootReal, firstRootImaginary, p0, v0, delta)\n : estimateCriticallyDamped(firstRootReal, p0, v0, delta);\n return toLong(seconds * 1000.0);\n}\n","/*\n * Copyright 2019 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/SpringSimulation.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// Precision follows the Kotlin source: parameters and results are Float (Math.fround), the\n// solution is computed in Double, and time is whole milliseconds.\n\nconst f32 = Math.fround;\n\n/** `Spring.StiffnessVeryLow` / `Spring.DampingRatioNoBouncy` (VectorizedAnimationSpec.kt L813, L839). */\nconst STIFFNESS_VERY_LOW = 50;\nconst DAMPING_RATIO_NO_BOUNCY = 1;\n\nexport interface Motion {\n value: number;\n velocity: number;\n}\n\n/**\n * Spring Simulation simulates spring physics, and allows you to query the motion (i.e. value and\n * velocity) at certain time in the future based on the starting velocity and value.\n *\n * By configuring the stiffness and damping ratio, callers can create a spring with the look and\n * feel suits their use case. Stiffness corresponds to the spring constant. The stiffer the spring\n * is, the harder it is to stretch it, the faster it undergoes dampening.\n *\n * Spring damping ratio describes how oscillations in a system decay after a disturbance. When\n * damping ratio > 1* (i.e. over-damped), the object will quickly return to the rest position\n * without overshooting. If damping ratio equals to 1 (i.e. critically damped), the object will\n * return to equilibrium within the shortest amount of time. When damping ratio is less than 1 (i.e.\n * under-damped), the mass tends to overshoot, and return, and overshoot again. Without any damping\n * (i.e. damping ratio = 0), the mass will oscillate forever.\n */\nexport class SpringSimulation {\n // Natural frequency\n #naturalFreq = Math.sqrt(STIFFNESS_VERY_LOW);\n #dampingRatio = DAMPING_RATIO_NO_BOUNCY;\n #finalPosition: number;\n\n constructor(finalPosition: number) {\n this.#finalPosition = f32(finalPosition);\n }\n\n get finalPosition(): number {\n return this.#finalPosition;\n }\n\n set finalPosition(value: number) {\n this.#finalPosition = f32(value);\n }\n\n /** Stiffness of the spring. */\n get stiffness(): number {\n return f32(this.#naturalFreq * this.#naturalFreq);\n }\n\n set stiffness(value: number) {\n // Upstream checks the *current* stiffness here (always positive), so the new value is not\n // validated; kept as-is for parity.\n if (this.stiffness <= 0) {\n throw new RangeError('Spring stiffness constant must be positive.');\n }\n this.#naturalFreq = Math.sqrt(f32(value));\n }\n\n /** Returns the damping ratio of the spring. */\n get dampingRatio(): number {\n return this.#dampingRatio;\n }\n\n set dampingRatio(value: number) {\n if (value < 0) {\n throw new RangeError('Damping ratio must be non-negative');\n }\n this.#dampingRatio = f32(value);\n }\n\n getAcceleration(lastDisplacement: number, lastVelocity: number): number {\n const adjustedDisplacement = f32(f32(lastDisplacement) - this.#finalPosition);\n\n const k = this.#naturalFreq * this.#naturalFreq;\n const c = 2.0 * this.#naturalFreq * this.#dampingRatio;\n\n return f32(-k * adjustedDisplacement - c * f32(lastVelocity));\n }\n\n /**\n * Internal only call for Spring to calculate the spring position/velocity using an analytical\n * approach.\n */\n updateValues(lastDisplacement: number, lastVelocity: number, timeElapsed: number): Motion {\n const dampingRatio = this.#dampingRatio;\n const naturalFreq = this.#naturalFreq;\n const velocity0 = f32(lastVelocity);\n const adjustedDisplacement = f32(f32(lastDisplacement) - this.#finalPosition);\n const deltaT = Math.trunc(timeElapsed) / 1000.0; // unit: seconds\n const dampingRatioSquared = dampingRatio * dampingRatio;\n const r = -dampingRatio * naturalFreq;\n\n let displacement: number;\n let currentVelocity: number;\n\n if (dampingRatio > 1) {\n // Over damping\n const s = naturalFreq * Math.sqrt(dampingRatioSquared - 1);\n const gammaPlus = r + s;\n const gammaMinus = r - s;\n\n // Overdamped\n const coeffB = (gammaMinus * adjustedDisplacement - velocity0) / (gammaMinus - gammaPlus);\n const coeffA = adjustedDisplacement - coeffB;\n displacement = coeffA * Math.exp(gammaMinus * deltaT) + coeffB * Math.exp(gammaPlus * deltaT);\n currentVelocity =\n coeffA * gammaMinus * Math.exp(gammaMinus * deltaT) +\n coeffB * gammaPlus * Math.exp(gammaPlus * deltaT);\n } else if (dampingRatio === 1.0) {\n // Critically damped\n const coeffA = adjustedDisplacement;\n const coeffB = velocity0 + naturalFreq * adjustedDisplacement;\n const nFdT = -naturalFreq * deltaT;\n displacement = (coeffA + coeffB * deltaT) * Math.exp(nFdT);\n currentVelocity =\n (coeffA + coeffB * deltaT) * Math.exp(nFdT) * -naturalFreq + coeffB * Math.exp(nFdT);\n } else {\n const dampedFreq = naturalFreq * Math.sqrt(1 - dampingRatioSquared);\n // Underdamped\n const cosCoeff = adjustedDisplacement;\n const sinCoeff = (1 / dampedFreq) * (-r * adjustedDisplacement + velocity0);\n const dFdT = dampedFreq * deltaT;\n displacement = Math.exp(r * deltaT) * (cosCoeff * Math.cos(dFdT) + sinCoeff * Math.sin(dFdT));\n currentVelocity =\n displacement * r +\n Math.exp(r * deltaT) *\n (-dampedFreq * cosCoeff * Math.sin(dFdT) + dampedFreq * sinCoeff * Math.cos(dFdT));\n }\n\n return {\n value: f32(displacement + this.#finalPosition),\n velocity: f32(currentVelocity),\n };\n }\n}\n","// Spring helpers with Compose `FloatSpringSpec` semantics (animation-core FloatAnimationSpec.kt\n// L133–187 @19991f2c), built on the ported SpringSimulation / SpringEstimation.\nimport { estimateAnimationDurationMillis } from './spring-estimation.js';\nimport { SpringSimulation } from './spring-simulation.js';\n\n/** A Material motion-scheme spring (`dampingRatio` ζ, `stiffness` k; mass 1). */\nexport interface SpringSpec {\n readonly dampingRatio: number;\n readonly stiffness: number;\n}\n\n/** `Spring.DefaultDisplacementThreshold` (VectorizedAnimationSpec.kt L842). */\nexport const DEFAULT_DISPLACEMENT_THRESHOLD = 0.01;\n\nconst f32 = Math.fround;\n\nfunction simulation(spec: SpringSpec, targetValue: number): SpringSimulation {\n const sim = new SpringSimulation(targetValue);\n sim.dampingRatio = spec.dampingRatio;\n sim.stiffness = spec.stiffness;\n return sim;\n}\n\n/** Value at `playTimeMillis` (whole milliseconds, as in Compose). */\nexport function springValue(\n spec: SpringSpec,\n playTimeMillis: number,\n initialValue: number,\n targetValue: number,\n initialVelocity = 0,\n): number {\n return simulation(spec, targetValue).updateValues(initialValue, initialVelocity, playTimeMillis)\n .value;\n}\n\n/** Velocity (units/s) at `playTimeMillis`. */\nexport function springVelocity(\n spec: SpringSpec,\n playTimeMillis: number,\n initialValue: number,\n targetValue: number,\n initialVelocity = 0,\n): number {\n return simulation(spec, targetValue).updateValues(initialValue, initialVelocity, playTimeMillis)\n .velocity;\n}\n\n/**\n * Duration until the spring stays within `visibilityThreshold` of the target, as Compose computes\n * it (`FloatSpringSpec.getDurationNanos` / 1e6).\n */\nexport function springDurationMillis(\n spec: SpringSpec,\n initialValue: number,\n targetValue: number,\n initialVelocity = 0,\n visibilityThreshold = DEFAULT_DISPLACEMENT_THRESHOLD,\n): number {\n const sim = simulation(spec, targetValue);\n const threshold = f32(visibilityThreshold);\n return estimateAnimationDurationMillis(\n sim.stiffness,\n sim.dampingRatio,\n f32(f32(initialVelocity) / threshold),\n f32(f32(f32(initialValue) - f32(targetValue)) / threshold),\n 1,\n );\n}\n\n/**\n * Damping coefficient c = 2ζ√(k·m), for physics engines parameterized by stiffness/damping/mass\n * (e.g. Motion's `{ type: 'spring', stiffness, damping, mass }`).\n */\nexport function dampingCoefficient(spec: SpringSpec, mass = 1): number {\n return 2 * spec.dampingRatio * Math.sqrt(spec.stiffness * mass);\n}\n\n/** Inverse of {@link dampingCoefficient}: ζ = c / (2√(k·m)). */\nexport function dampingRatioFromCoefficient(damping: number, stiffness: number, mass = 1): number {\n return damping / (2 * Math.sqrt(stiffness * mass));\n}\n","// CSS `linear()` approximation of a spring (FOUNDATIONS §4).\n//\n// - Duration: Compose's own settle estimate (`FloatSpringSpec.getDurationNanos`) for a 0 → 1\n// animation at a visibility threshold of 0.001 (0.1% of the travel; e.g. Compose's 0.1 dp\n// Dp threshold over a 100 dp move).\n// - Samples: the exact spring at every whole millisecond (Compose's time resolution), last stop\n// forced to 1 so the animation lands on its target.\n// - Stops: Ramer–Douglas–Peucker in (progress, value) space with the smallest tolerance that fits\n// `maxStops`.\n//\n// Limits (FOUNDATIONS §4): no velocity carry-over on interruption and a fixed duration; use the JS\n// spring for drags, rapid toggles and other interruptible motion.\nimport { type SpringSpec, springDurationMillis } from './spring.js';\nimport { SpringSimulation } from './spring-simulation.js';\n\nexport interface LinearEasingOptions {\n /** Fraction of the travel considered settled. Default 0.001. */\n visibilityThreshold?: number;\n /** Maximum stops in the `linear()` function (FOUNDATIONS §4: ≤ 40). Default 40. */\n maxStops?: number;\n}\n\nexport interface LinearEasing {\n /** e.g. `linear(0, 0.1234 5%, …, 1)` */\n easing: string;\n durationMillis: number;\n /** `[progress 0–1, value]` pairs after rounding. */\n stops: readonly (readonly [number, number])[];\n /** Max |linear(t) − spring(t)| over every millisecond sample. */\n maxError: number;\n}\n\nconst round = (n: number, digits: number) => {\n const r = Number(n.toFixed(digits));\n return Object.is(r, -0) ? 0 : r;\n};\n\ntype Point = readonly [number, number];\n\nfunction at<T>(list: readonly T[], i: number): T {\n const item = list[i];\n if (item === undefined) throw new RangeError(`index ${String(i)} out of range`);\n return item;\n}\n\n/** Ramer–Douglas–Peucker: indices of points to keep (vertical distance, monotone x). */\nfunction simplify(points: readonly Point[], tolerance: number): number[] {\n const keep = new Set<number>([0, points.length - 1]);\n const stack: [number, number][] = [[0, points.length - 1]];\n for (let range = stack.pop(); range; range = stack.pop()) {\n const [a, b] = range;\n const [x0, y0] = at(points, a);\n const [x1, y1] = at(points, b);\n let worst = -1;\n let worstDistance = tolerance;\n for (let i = a + 1; i < b; i++) {\n const [x, y] = at(points, i);\n const expected = y0 + ((y1 - y0) * (x - x0)) / (x1 - x0);\n const distance = Math.abs(y - expected);\n if (distance > worstDistance) {\n worst = i;\n worstDistance = distance;\n }\n }\n if (worst !== -1) {\n keep.add(worst);\n stack.push([a, worst], [worst, b]);\n }\n }\n return [...keep].sort((x, y) => x - y);\n}\n\nfunction interpolate(stops: readonly Point[], x: number): number {\n for (let i = 1; i < stops.length; i++) {\n const [x1, y1] = at(stops, i);\n const [x0, y0] = at(stops, i - 1);\n if (x <= x1) return x1 === x0 ? y1 : y0 + ((y1 - y0) * (x - x0)) / (x1 - x0);\n }\n return at(stops, stops.length - 1)[1];\n}\n\nexport function springToLinear(spec: SpringSpec, options: LinearEasingOptions = {}): LinearEasing {\n const { visibilityThreshold = 0.001, maxStops = 40 } = options;\n if (maxStops < 2) throw new RangeError('maxStops must be at least 2');\n const durationMillis = Math.max(1, springDurationMillis(spec, 0, 1, 0, visibilityThreshold));\n\n const sim = new SpringSimulation(1);\n sim.dampingRatio = spec.dampingRatio;\n sim.stiffness = spec.stiffness;\n const samples: Point[] = [];\n for (let t = 0; t <= durationMillis; t++) {\n samples.push([t / durationMillis, sim.updateValues(0, 0, t).value]);\n }\n samples[samples.length - 1] = [1, 1];\n\n // Smallest tolerance (bisection) whose simplification fits maxStops.\n let lo = 0;\n let hi = 0.5;\n let best = simplify(samples, hi);\n for (let i = 0; i < 40; i++) {\n const mid = (lo + hi) / 2;\n const kept = simplify(samples, mid);\n if (kept.length <= maxStops) {\n best = kept;\n hi = mid;\n } else {\n lo = mid;\n }\n }\n\n const stops = best.map((i) => {\n const [x, y] = at(samples, i);\n return [round(x, 4), round(y, 4)] as const;\n });\n const maxError = samples.reduce(\n (m, [x, y]) => Math.max(m, Math.abs(interpolate(stops, x) - y)),\n 0,\n );\n const body = stops.map(([x, y], i) =>\n i === 0 || i === stops.length - 1 ? String(y) : `${String(y)} ${String(round(x * 100, 2))}%`,\n );\n return { easing: `linear(${body.join(', ')})`, durationMillis, stops, maxError };\n}\n","// An interruptible spring value with Compose `Animatable` semantics (animation-core Animatable.kt\n// @19991f2c): `animateTo` starts from the current value *and velocity*, the animation runs for\n// Compose's own duration estimate (FloatSpringSpec.getDurationNanos at the visibility threshold)\n// and then rests exactly on the target. Time is injected, so callers drive it from their frame loop\n// (m3e-elements) and tests can step it deterministically.\nimport {\n DEFAULT_DISPLACEMENT_THRESHOLD,\n type SpringSpec,\n springDurationMillis,\n springValue,\n springVelocity,\n} from './spring.js';\n\nexport class SpringAnimatable {\n #value: number;\n #velocity = 0;\n #target: number;\n #from = 0;\n #velocity0 = 0;\n #start = 0;\n #duration = 0;\n #spec: SpringSpec | null = null;\n\n /**\n * @param value initial value, at rest.\n * @param visibilityThreshold Compose's visibility threshold: 0.01 for Float animations\n * (`Spring.DefaultDisplacementThreshold`), 1 for an Int one.\n */\n constructor(\n value: number,\n readonly visibilityThreshold: number = DEFAULT_DISPLACEMENT_THRESHOLD,\n ) {\n this.#value = value;\n this.#target = value;\n }\n\n get value(): number {\n return this.#value;\n }\n\n /** Units per second. */\n get velocity(): number {\n return this.#velocity;\n }\n\n get target(): number {\n return this.#target;\n }\n\n get isRunning(): boolean {\n return this.#spec !== null;\n }\n\n /** Jumps to `value` and stops. */\n snapTo(value: number): void {\n this.#spec = null;\n this.#value = value;\n this.#target = value;\n this.#velocity = 0;\n }\n\n /**\n * Animates to `target` from the value and velocity at `now` (ms); a null spec (e.g. a spatial\n * spring under reduced motion) jumps there. `velocity` (units per second) overrides the current\n * velocity, e.g. after the value was driven by something else (a drag, a tween).\n */\n animateTo(target: number, spec: SpringSpec | null, now: number, velocity?: number): void {\n this.sample(now);\n if (spec === null) {\n this.snapTo(target);\n return;\n }\n this.#from = this.#value;\n this.#velocity0 = velocity ?? this.#velocity;\n this.#target = target;\n this.#start = now;\n this.#spec = spec;\n this.#duration = springDurationMillis(\n spec,\n this.#from,\n target,\n this.#velocity0,\n this.visibilityThreshold,\n );\n if (this.#duration <= 0) this.snapTo(target);\n }\n\n /** Advances to `now` (ms) and returns the value; the animation ends once its duration is up. */\n sample(now: number): number {\n const spec = this.#spec;\n if (spec === null) return this.#value;\n const elapsed = Math.max(0, now - this.#start);\n if (elapsed >= this.#duration) {\n this.snapTo(this.#target);\n return this.#value;\n }\n this.#value = springValue(spec, elapsed, this.#from, this.#target, this.#velocity0);\n this.#velocity = springVelocity(spec, elapsed, this.#from, this.#target, this.#velocity0);\n return this.#value;\n }\n}\n","// FAB menu item stagger, as Compose's FloatingActionButtonMenuItemColumn lays it out\n// (FloatingActionButtonMenu.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898 L250–307): an Int\n// Animatable runs 0 ↔ the item count on the slow effects spring (visibility threshold 1, L208–218),\n// and item `index` (0 = top) is visible while `index >= itemCount - value` (L283), so items appear\n// from the bottom (next to the toggle) up and disappear top first. Each item then springs its own\n// width (fast spatial) and alpha (fast effects) toward 1 or 0 when its visibility flips (L339–376).\n// Shared by m3e-elements and m3e-react.\n\n/** `Int.VectorConverter` reads an animated Int by truncating the float toward zero. */\nexport const animatedInt = (value: number): number => Math.trunc(value);\n\n/** Whether item `index` (0 = top) shows at stagger value `stagger` (0 … `itemCount`). */\nexport const fabMenuItemVisible = (index: number, itemCount: number, stagger: number): boolean =>\n index >= itemCount - animatedInt(stagger);\n","// Arrow-key navigation among menu items (WAI-ARIA APG menu pattern, as React Aria's useMenu\n// keyboard delegate does it): ArrowDown / ArrowUp move to the next / previous item and wrap, Home and\n// End jump to the first / last. Pure index math shared by m3e-elements and m3e-react.\n//\n// Scoped to the FAB menu for now (COMPONENT_SPEC §6). Follow-up: unify with the Menus component's\n// keyboard helpers (COMPONENT_SPEC §21) once both are on main.\n\n/**\n * The item index `key` moves focus to from `current` (−1: none focused) among `count` items, or\n * null when the key does not navigate.\n */\nexport function menuNavigationTarget(key: string, count: number, current: number): number | null {\n if (count === 0) return null;\n switch (key) {\n case 'ArrowDown':\n return current < 0 ? 0 : (current + 1) % count;\n case 'ArrowUp':\n return current < 0 ? count - 1 : (current - 1 + count) % count;\n case 'Home':\n return 0;\n case 'End':\n return count - 1;\n default:\n return null;\n }\n}\n","// Typeahead (\"type to select\") in a collection, as React Aria's useTypeSelect and\n// ListKeyboardDelegate.getKeyForSearch do it: the item whose text starts with the typed string\n// (compared with a base-sensitivity search collator: case and accents ignored), looking from the\n// focused item to the end first, then from the start. Pure index math shared by m3e-elements'\n// menu and interactive list; m3e-react gets it from React Aria.\n\n/** React Aria useTypeSelect clears the typed string after this long (TYPEAHEAD_DEBOUNCE_WAIT_MS). */\nexport const TYPEAHEAD_TIMEOUT_MS = 1000;\n\nlet collator: Intl.Collator | undefined;\n\n/**\n * Index of the first item in `texts` that starts with `search`, from `from` (the focused item,\n * −1: none) to the end, then from the start; −1 when none does.\n */\nexport function typeSelectTarget(texts: readonly string[], from: number, search: string): number {\n collator ??= new Intl.Collator(undefined, { usage: 'search', sensitivity: 'base' });\n const compare = collator;\n const matches = (text: string) =>\n text !== '' && compare.compare(text.slice(0, search.length), search) === 0;\n const start = Math.max(from, 0);\n for (let i = start; i < texts.length; i++) if (matches(texts[i] ?? '')) return i;\n for (let i = 0; i < start; i++) if (matches(texts[i] ?? '')) return i;\n return -1;\n}\n","// Arrow-key navigation in a toolbar (WAI-ARIA APG toolbar pattern, as React Aria's useToolbar and\n// the button group do it): one key pair along the orientation moves to the next / previous item\n// without wrapping (ArrowRight / ArrowLeft, mirrored in RTL; ArrowDown / ArrowUp when vertical),\n// Home and End jump to the first / last. Pure index math shared by m3e-elements' RovingFocus (the\n// floating toolbar, the docked toolbar, the chip set, the interactive list) and m3e-react.\n//\n// Options for other composites: `wrap` moves from the last item to the first and back (an\n// interactive list, m3.material.io Lists › Accessibility \"focus wraps\"), and the `both`\n// orientation takes both key pairs (Down / Right next, Up / Left previous, Left / Right mirrored in\n// RTL), as m3.material.io's list keyboard table does.\n\nexport type ToolbarOrientation = 'horizontal' | 'vertical';\n\n/** A toolbar orientation, or `both`: both arrow key pairs move along the one item order. */\nexport type NavigationOrientation = ToolbarOrientation | 'both';\n\n/**\n * The item index `key` moves focus to from `current` (−1: none focused) among `count` items, or\n * null when the key does not navigate. At either end the index stays put unless `wrap`.\n */\nexport function toolbarNavigationTarget(\n key: string,\n count: number,\n current: number,\n orientation: NavigationOrientation = 'horizontal',\n rtl = false,\n wrap = false,\n): number | null {\n if (count === 0) return null;\n let step: number;\n switch (key) {\n case 'Home':\n return 0;\n case 'End':\n return count - 1;\n case 'ArrowRight':\n case 'ArrowLeft':\n if (orientation === 'vertical') return null;\n step = (key === 'ArrowRight') !== rtl ? 1 : -1;\n break;\n case 'ArrowDown':\n case 'ArrowUp':\n if (orientation === 'horizontal') return null;\n step = key === 'ArrowDown' ? 1 : -1;\n break;\n default:\n return null;\n }\n if (current < 0) return step > 0 ? 0 : count - 1;\n const next = current + step;\n if (wrap) return (next + count) % count;\n return Math.min(Math.max(next, 0), count - 1);\n}\n","// A CSS / Compose `CubicBezierEasing(a, b, c, d)`: the curve from (0, 0) to (1, 1) with control\n// points (a, b) and (c, d), solved for y at x = fraction (animation-core Easing.kt@19991f2c: x is\n// solved for its first root in [0, 1], y evaluated there; fractions outside ]0, 1[ pass through).\n// Compose solves the cubic in closed form (ui-graphics Bezier.kt); this bisects x(t), which is\n// monotonic for control x in [0, 1], to 2^-30 (far below what a frame can show).\n\nexport type Easing = (fraction: number) => number;\n\nconst bezier = (p1: number, p2: number, t: number) =>\n 3 * (1 - t) * (1 - t) * t * p1 + 3 * (1 - t) * t * t * p2 + t * t * t;\n\n/** `cubic-bezier(a, b, c, d)` as an easing function. */\nexport const cubicBezier =\n (a: number, b: number, c: number, d: number): Easing =>\n (fraction) => {\n if (!(fraction > 0 && fraction < 1)) return fraction;\n let lo = 0;\n let hi = 1;\n for (let i = 0; i < 30; i++) {\n const mid = (lo + hi) / 2;\n if (bezier(a, c, mid) < fraction) lo = mid;\n else hi = mid;\n }\n return bezier(b, d, (lo + hi) / 2);\n };\n\n/** Parses a resolved CSS `cubic-bezier(a, b, c, d)` (e.g. a motion easing token); null otherwise. */\nexport function parseCubicBezier(css: string): Easing | null {\n const values = /cubic-bezier\\(([^)]*)\\)/.exec(css)?.[1]?.split(',').map(Number);\n return values?.length === 4 && values.every(Number.isFinite)\n ? cubicBezier(...(values as [number, number, number, number]))\n : null;\n}\n","/*\n * Copyright 2021 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/AppBar.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n// Ported to TypeScript by Kyra Labs from compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/Easing.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// TopAppBarState (L2050-2130), the pinned, enter-always and exit-until-collapsed scroll behaviors\n// (L3267-3303, L3400-3455, L3476-3536), the settle decision of settleAppBar (L3542-3589) and the\n// two-rows bar's collapsed-fraction interpolation (TwoRowsTopAppBar L2818-2836,\n// TopAppBarColors.containerColor L2229-2235, TopTitleAlphaEasing L3604; FastOutLinearInEasing\n// from Easing.kt L66, solved by the shared cubic-bezier.ts), adapted to DOM scrolling. Compose\n// receives nested scroll deltas and can consume them; the web observes `scrollTop` after the\n// browser scrolled, so every delta goes to both the bar and the content, and momentum comes from\n// the browser instead of flingAnimationSpec. Offsets are in CSS px; y grows downward, so\n// collapsing is negative.\n\nimport { cubicBezier } from './cubic-bezier.js';\n\n/** How the bar reacts to its scroll container (TopAppBarDefaults.*ScrollBehavior). */\nexport type AppBarScrollBehavior = 'pinned' | 'enter-always' | 'exit-until-collapsed';\n\nexport interface AppBarScrollState {\n /** Most negative height offset: minus the bar's full height (adjustHeightOffsetLimit). */\n readonly heightOffsetLimit: number;\n /** Current height offset, between heightOffsetLimit and 0. */\n readonly heightOffset: number;\n /** Content scrolled under the bar (minus the scroll position). */\n readonly contentOffset: number;\n /** Whether the scrolling content is at its start (scroll position 0). */\n readonly atStart: boolean;\n}\n\n/** A fully expanded bar of `height` px over unscrolled content. */\nexport function appBarScrollState(height: number): AppBarScrollState {\n return { heightOffsetLimit: -height, heightOffset: 0, contentOffset: 0, atStart: true };\n}\n\n/** TopAppBarState.heightOffset setter: coerced between heightOffsetLimit and 0. */\nexport function withHeightOffset(state: AppBarScrollState, offset: number): AppBarScrollState {\n return { ...state, heightOffset: Math.min(Math.max(offset, state.heightOffsetLimit), 0) };\n}\n\n/** A new bar height (onSizeChanged → adjustHeightOffsetLimit), keeping the offset in range. */\nexport function withHeight(state: AppBarScrollState, height: number): AppBarScrollState {\n return withHeightOffset({ ...state, heightOffsetLimit: -height }, state.heightOffset);\n}\n\n/** 0 = fully expanded, 1 = fully collapsed (TopAppBarState.collapsedFraction). */\nexport function collapsedFraction(state: AppBarScrollState): number {\n // `+ 0` turns the -0 of 0 / -height into 0.\n return state.heightOffsetLimit !== 0 ? state.heightOffset / state.heightOffsetLimit + 0 : 0;\n}\n\n/** Share of the visible bar overlapping scrolled content (TopAppBarState.overlappedFraction). */\nexport function overlappedFraction(state: AppBarScrollState): number {\n if (!state.atStart && state.contentOffset === 0) return 1;\n if (state.heightOffsetLimit === 0) return 0;\n const limit = state.heightOffsetLimit;\n const clamped = Math.min(Math.max(limit + Math.abs(state.contentOffset), limit), 0);\n return 1 - clamped / limit;\n}\n\n/**\n * Whether the bar shows its scrolled container color: SingleRowTopAppBar targets the scrolled\n * color once `overlappedFraction > 0.01f` (L2689-2693).\n */\nexport function isScrolledUnder(state: AppBarScrollState): boolean {\n return overlappedFraction(state) > 0.01;\n}\n\n/**\n * Applies a scroll position change. `delta` is the previous minus the new scroll position\n * (positive when the content is pulled down, like Compose's `available.y`).\n * - pinned: only the content offset moves (PinnedScrollBehavior.onPostScroll).\n * - enter-always: the bar also collapses/expands by the same amount\n * (EnterAlwaysScrollBehavior.onPreScroll: `heightOffset += available.y`).\n * - exit-until-collapsed: scrolling down collapses the bar by the same amount\n * (ExitUntilCollapsedScrollBehavior.onPreScroll); scrolling up expands it only by what the\n * content cannot take (onPostScroll: `heightOffset += available.y` once the content is at its\n * start). On the web the content scrolls by the whole delta, so the part of an upward scroll\n * that lies within the collapsed distance of the top (scroll position below -heightOffset) is\n * the part Compose hands to the bar: the bar is fully expanded when the content reaches its\n * start, and a bar that collapsed together with the content stays attached to it.\n */\nexport function scrollAppBar(\n state: AppBarScrollState,\n behavior: AppBarScrollBehavior,\n scrollTop: number,\n delta: number,\n): AppBarScrollState {\n const next: AppBarScrollState = { ...state, contentOffset: -scrollTop, atStart: scrollTop <= 0 };\n if (behavior === 'pinned') return next;\n if (behavior === 'enter-always' || delta < 0) {\n return withHeightOffset(next, state.heightOffset + delta);\n }\n const below = (top: number) => Math.max(0, -state.heightOffset - top);\n return withHeightOffset(next, state.heightOffset + below(scrollTop) - below(scrollTop + delta));\n}\n\n/**\n * Where a partially collapsed bar snaps when scrolling stops (settleAppBar): fully expanded below\n * half, fully collapsed from half, or null when it is already (within 1%) settled.\n */\nexport function settleTarget(state: AppBarScrollState): number | null {\n const fraction = collapsedFraction(state);\n if (fraction < 0.01 || fraction === 1) return null;\n if (!(state.heightOffset < 0 && state.heightOffset > state.heightOffsetLimit)) return null;\n return fraction < 0.5 ? 0 : state.heightOffsetLimit;\n}\n\n/** TopTitleAlphaEasing (AppBar.kt L3604): CubicBezierEasing(.8f, 0f, .8f, .15f). */\nexport const TOP_TITLE_ALPHA_EASING = [0.8, 0, 0.8, 0.15] as const;\n/** FastOutLinearInEasing (Easing.kt L66): CubicBezierEasing(0.4f, 0.0f, 1.0f, 1.0f). */\nexport const FAST_OUT_LINEAR_IN_EASING = [0.4, 0, 1, 1] as const;\n\nconst topTitleAlpha = /* @__PURE__ */ cubicBezier(...TOP_TITLE_ALPHA_EASING);\nconst fastOutLinearIn = /* @__PURE__ */ cubicBezier(...FAST_OUT_LINEAR_IN_EASING);\n\n/** What a two-rows bar (medium / large flexible, TwoRowsTopAppBar) draws at a collapsed fraction. */\nexport interface TwoRowsFrame {\n /** Alpha of the collapsed (top row) title and subtitle: TopTitleAlphaEasing(fraction). */\n readonly collapsedTitleAlpha: number;\n /** Alpha of the expanded (bottom row) title and subtitle: 1 - fraction. */\n readonly expandedTitleAlpha: number;\n /** Container → scrolled container color mix (TopAppBarColors.containerColor): FastOutLinearIn. */\n readonly containerColorFraction: number;\n /** Below 0.5 the collapsed title is hidden from accessibility, from 0.5 the expanded one. */\n readonly collapsedTitleHidden: boolean;\n}\n\n/** TwoRowsTopAppBar (L2818-2836): the color, both title alphas and semantics follow the fraction. */\nexport function twoRowsFrame(fraction: number): TwoRowsFrame {\n return {\n collapsedTitleAlpha: topTitleAlpha(fraction),\n expandedTitleAlpha: 1 - fraction,\n containerColorFraction: fastOutLinearIn(fraction),\n collapsedTitleHidden: fraction < 0.5,\n };\n}\n","/*\n * Copyright 2024 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/FloatingToolbar.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// FloatingToolbarState (L1299-1377), ExitAlwaysFloatingToolbarScrollBehavior (onPostScroll and the\n// offset limit, L540-628), the settle decision of settleFloatingToolbar (L1383-1437) and\n// FloatingToolbarDefaults.VerticalNestedScrollExpansionNode (floatingToolbarVerticalNestedScroll,\n// L1013-1106), adapted to DOM scrolling like app-bar-scroll.ts: the web observes `scrollTop` after\n// the browser scrolled, so `delta` (previous minus new scroll position, positive when the content\n// is pulled down, like Compose's `consumed.y`) moves both, and momentum comes from the browser\n// instead of flingAnimationSpec. Offsets are CSS px; hiding is negative.\n//\n// The docked toolbar (FlexibleBottomAppBar) and the legacy BottomAppBar use the same math, so they\n// reuse these functions (AppBar.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898):\n// BottomAppBarStateImpl (L2513-2539) coerces heightOffset between heightOffsetLimit (minus the\n// bar's measured height, BottomAppBarLayout L1365-1375) and 0 like FloatingToolbarState.offset,\n// ExitAlwaysScrollBehavior.onPostScroll (L2569-2579) moves contentOffset and heightOffset by\n// `consumed.y` like the floating toolbar's, and settleAppBarBottom (L2600-2648) makes the same\n// settle decision (none within 1 % of either end; shown below half, hidden from half).\nimport { settleTarget } from './app-bar-scroll.js';\n\n/** Where a floating toolbar leaves the screen (FloatingToolbarExitDirection), logical. */\nexport type FloatingToolbarExitDirection = 'bottom' | 'top' | 'start' | 'end';\n\nexport interface FloatingToolbarScrollState {\n /** Most negative offset: minus the distance that takes the toolbar off its container. */\n readonly offsetLimit: number;\n /** Current offset, between offsetLimit and 0. */\n readonly offset: number;\n /** Total content scrolled under the toolbar (sum of the deltas). */\n readonly contentOffset: number;\n}\n\n/** rememberFloatingToolbarState() defaults: no limit known yet, fully shown. */\nexport function floatingToolbarScrollState(\n offsetLimit = -Number.MAX_VALUE,\n offset = 0,\n contentOffset = 0,\n): FloatingToolbarScrollState {\n return withToolbarOffset({ offsetLimit, offset: 0, contentOffset }, offset);\n}\n\n/** FloatingToolbarState.offset setter: coerced between offsetLimit and 0. */\nexport function withToolbarOffset(\n state: FloatingToolbarScrollState,\n offset: number,\n): FloatingToolbarScrollState {\n return { ...state, offset: Math.min(Math.max(offset, state.offsetLimit), 0) };\n}\n\n/**\n * The offset limit from the toolbar's layout (onGloballyPositioned): `distance` is how far the\n * toolbar must travel along its exit direction to leave its container, i.e. its size plus its gap\n * to that edge, measured without the current offset. The offset stays in range.\n */\nexport function withToolbarOffsetLimit(\n state: FloatingToolbarScrollState,\n distance: number,\n): FloatingToolbarScrollState {\n return withToolbarOffset({ ...state, offsetLimit: -Math.max(distance, 0) }, state.offset);\n}\n\n/** exitAlways onPostScroll: the content offset and the toolbar offset both move by `delta`. */\nexport function scrollFloatingToolbar(\n state: FloatingToolbarScrollState,\n delta: number,\n): FloatingToolbarScrollState {\n return withToolbarOffset(\n { ...state, contentOffset: state.contentOffset + delta },\n state.offset + delta,\n );\n}\n\n/** 0 = fully shown, 1 = fully hidden (FloatingToolbarState.collapsedFraction()). */\nexport function toolbarCollapsedFraction(state: FloatingToolbarScrollState): number {\n // `+ 0` turns the -0 of 0 / -limit into 0.\n return state.offsetLimit !== 0 ? state.offset / state.offsetLimit + 0 : 0;\n}\n\n/**\n * Where a partly hidden toolbar snaps when scrolling stops (settleFloatingToolbar): shown below\n * half, hidden from half, or null when it is already (within 1%) settled. The decision is the\n * same as the top app bar's settleAppBar, so it reuses that port.\n */\nexport function toolbarSettleTarget(state: FloatingToolbarScrollState): number | null {\n return settleTarget({\n heightOffsetLimit: state.offsetLimit,\n heightOffset: state.offset,\n contentOffset: state.contentOffset,\n atStart: false,\n });\n}\n\n/**\n * floatingToolbarVerticalNestedScroll: collapses the toolbar after scrolling down by the collapse\n * threshold and expands it after scrolling up by the expand threshold (both\n * FloatingToolbarDefaults.ScrollDistanceThreshold by default).\n */\nexport interface ToolbarExpansionScroll {\n readonly contentOffset: number;\n /** The content offset that triggers the next change. */\n readonly threshold: number;\n}\n\n/** A tracker for a toolbar that is `expanded` (updateThreshold). */\nexport function toolbarExpansionScroll(\n expanded: boolean,\n collapseThreshold: number,\n expandThreshold: number,\n contentOffset = 0,\n): ToolbarExpansionScroll {\n return {\n contentOffset,\n threshold: expanded ? contentOffset - collapseThreshold : contentOffset + expandThreshold,\n };\n}\n\n/**\n * onPostScroll: moves the content offset by `delta`; returns the new tracker and `'collapse'` /\n * `'expand'` when a threshold was crossed (Compose calls onCollapse / onExpand then).\n */\nexport function scrollToolbarExpansion(\n state: ToolbarExpansionScroll,\n delta: number,\n collapseThreshold: number,\n expandThreshold: number,\n): { state: ToolbarExpansionScroll; change: 'collapse' | 'expand' | null } {\n const contentOffset = state.contentOffset + delta;\n if (delta < 0 && contentOffset <= state.threshold) {\n return {\n state: { contentOffset, threshold: contentOffset + expandThreshold },\n change: 'collapse',\n };\n }\n if (delta > 0 && contentOffset >= state.threshold) {\n return {\n state: { contentOffset, threshold: contentOffset - collapseThreshold },\n change: 'expand',\n };\n }\n return { state: { contentOffset, threshold: state.threshold }, change: null };\n}\n","/*\n * Copyright 2022 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ProgressIndicator.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/WavyProgressIndicator.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/internal/LinearWavyProgressModifiers.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/internal/CircularWavyProgressModifiers.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// The progress indicators' timelines as pure functions of elapsed time (shared by m3e-elements and\n// m3e-react; the numbers come from the generated `--m3e-comp-progress-indicator-defaults-*` tokens):\n// - indeterminate linear: two lines whose head and tail each run `0f at delay using easing` →\n// `1f at delay + duration` keyframes on one infinitely repeating cycle (L979–1025);\n// - indeterminate circular: a linear global rotation, an additional rotation in linear steps and a\n// sweep that grows linearly and shrinks on the easing, all on one cycle (L929–977; in Compose\n// keyframes, `using` eases the interval that *starts* at its keyframe);\n// - the wave offset: a linear 0 → 1 tween repeating every wavelength / waveSpeed seconds (times the\n// polygon's vertex count for circular indicators), never shorter than MinAnimationDuration;\n// - the determinate amplitude (`WavyProgressIndicatorDefaults.indicatorAmplitude`) and its tweens,\n// which Compose never retargets while one runs.\n\nimport type { Easing } from './cubic-bezier.js';\n\nexport interface LinearIndeterminateTiming {\n /** `LinearAnimationDuration`: one cycle. */\n readonly durationMillis: number;\n /** `[delay, duration]` of each keyframe pair. */\n readonly firstHead: readonly [number, number];\n readonly firstTail: readonly [number, number];\n readonly secondHead: readonly [number, number];\n readonly secondTail: readonly [number, number];\n /** `LinearIndeterminateProgressEasing`. */\n readonly easing: Easing;\n}\n\n/** A 0 → 1 keyframe pair (`0f at delay using easing; 1f at delay + duration`) at cycle time `t`. */\nconst line = (t: number, [delay, duration]: readonly [number, number], easing: Easing) =>\n t <= delay ? 0 : t >= delay + duration ? 1 : easing((t - delay) / duration);\n\n/**\n * The indeterminate linear indicator's fractions at `elapsedMillis`, in the order the wavy indicator\n * draws them (`getProgressFractions`): first tail, first head, second tail, second head (0–1 each).\n */\nexport function linearIndeterminateFractions(\n elapsedMillis: number,\n timing: LinearIndeterminateTiming,\n): [number, number, number, number] {\n const t = Math.max(0, elapsedMillis) % timing.durationMillis;\n return [\n line(t, timing.firstTail, timing.easing),\n line(t, timing.firstHead, timing.easing),\n line(t, timing.secondTail, timing.easing),\n line(t, timing.secondHead, timing.easing),\n ];\n}\n\nexport interface CircularIndeterminateTiming {\n /** `CircularAnimationProgressDuration`: one cycle. */\n readonly durationMillis: number;\n /** `CircularGlobalRotationDegreesTarget`: linear rotation per cycle (degrees). */\n readonly rotation: number;\n /** `CircularAdditionalRotationDegreesTarget`: the steps' total per cycle (degrees). */\n readonly additionalRotation: number;\n /** `CircularAnimationAdditionalRotationDelay`: a step starts every this. */\n readonly additionalDelayMillis: number;\n /** `CircularAnimationAdditionalRotationDuration`: and moves for this. */\n readonly additionalDurationMillis: number;\n /** `CircularIndeterminateMinProgress` / `MaxProgress`: the sweep range (0–1). */\n readonly minProgress: number;\n readonly maxProgress: number;\n /** `CircularProgressEasing`: the shrinking half of the sweep. */\n readonly easing: Easing;\n}\n\nexport interface CircularIndeterminateFrame {\n /** Global + additional rotation, degrees clockwise. */\n rotation: number;\n /** Sweep, 0–1 of a full turn. */\n sweep: number;\n}\n\n/** The indeterminate circular indicator at `elapsedMillis`. */\nexport function circularIndeterminateFrame(\n elapsedMillis: number,\n timing: CircularIndeterminateTiming,\n): CircularIndeterminateFrame {\n const d = timing.durationMillis;\n const t = Math.max(0, elapsedMillis) % d;\n const steps = Math.round(d / timing.additionalDelayMillis);\n const step = timing.additionalRotation / steps;\n const index = Math.floor(t / timing.additionalDelayMillis);\n const within = t - index * timing.additionalDelayMillis;\n const additional = step * index + step * Math.min(1, within / timing.additionalDurationMillis);\n const half = d / 2;\n const range = timing.maxProgress - timing.minProgress;\n const sweep =\n t <= half\n ? timing.minProgress + range * (t / half)\n : timing.maxProgress - range * timing.easing((t - half) / half);\n return { rotation: (timing.rotation * t) / d + additional, sweep };\n}\n\n/**\n * The wave offset tween's duration: `((wavelength / waveSpeed) * 1000 * vertexCount)` rounded and\n * floored at `minMillis`; `Infinity` (the offset holds at 0) when either is not positive.\n */\nexport function waveTravelMillis(\n wavelength: number,\n waveSpeed: number,\n minMillis: number,\n vertexCount = 1,\n): number {\n if (!(waveSpeed > 0 && wavelength > 0)) return Number.POSITIVE_INFINITY;\n return Math.max(minMillis, Math.round((wavelength / waveSpeed) * 1000 * vertexCount));\n}\n\n/** The wave offset (0–1) after `elapsedMillis` of a tween of `travelMillis`. */\nexport const waveOffset = (elapsedMillis: number, travelMillis: number): number =>\n Number.isFinite(travelMillis) ? (Math.max(0, elapsedMillis) % travelMillis) / travelMillis : 0;\n\n/** `WavyProgressIndicatorDefaults.indicatorAmplitude`: no wave near the start and the end. */\nexport const indicatorAmplitude = (\n progress: number,\n minProgress: number,\n maxProgress: number,\n): number => (progress <= minProgress || progress >= maxProgress ? 0 : 1);\n\nexport interface AmplitudeTween {\n readonly durationMillis: number;\n readonly easing: Easing;\n}\n\n/**\n * The amplitude Animatable of the wavy modifiers: starts at its first target without animating;\n * a new target tweens with `increase` or `decrease` (by direction), but only once the running\n * tween has finished (`amplitudeAnimationJob == null || isCompleted`); a target set meanwhile is\n * ignored, as in Compose, until the next `update` after it finishes.\n */\nexport class AmplitudeAnimation {\n #from: number;\n #to: number;\n #start = 0;\n #tween: AmplitudeTween | null = null;\n #value: number;\n\n constructor(initial: number) {\n this.#from = initial;\n this.#to = initial;\n this.#value = initial;\n }\n\n get value(): number {\n return this.#value;\n }\n\n get target(): number {\n return this.#to;\n }\n\n get isRunning(): boolean {\n return this.#tween !== null;\n }\n\n /** Advances to `now` (ms). */\n sample(now: number): number {\n const tween = this.#tween;\n if (tween === null) return this.#value;\n const fraction = tween.durationMillis > 0 ? (now - this.#start) / tween.durationMillis : 1;\n if (fraction >= 1) {\n this.#tween = null;\n this.#value = this.#to;\n } else {\n this.#value = this.#from + (this.#to - this.#from) * tween.easing(Math.max(0, fraction));\n }\n return this.#value;\n }\n\n /** Requests `target` at `now`; returns true when a tween started. */\n update(target: number, now: number, increase: AmplitudeTween, decrease: AmplitudeTween): boolean {\n this.sample(now);\n if (this.#tween !== null || target === this.#to) return false;\n const tween = this.#value < target ? increase : decrease;\n this.#from = this.#value;\n this.#to = target;\n this.#start = now;\n this.#tween = tween;\n if (tween.durationMillis <= 0) this.sample(now);\n return true;\n }\n}\n","/*\n * Copyright 2024 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/LoadingIndicator.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// The indeterminate LoadingIndicator's LaunchedEffect (L391–451) as a pure function of elapsed\n// time. Compose runs two coroutines:\n// - every MorphIntervalMillis a spring animates the morph progress 0 → 1; when it finishes, the\n// indicator advances to the next morph, snaps the progress to 0 and adds a quarter turn to the\n// morph rotation. The loop then waits for the rest of the interval (or for the spring, if it is\n// slower than the interval);\n// - a linear global rotation turns 360° every GlobalRotationDurationMillis, restarting.\n// The drawn rotation is `progress × 90 + morphRotationTargetAngle + globalRotation` (L473).\n// The interval, rotation duration and spring are tokens (components/loading-indicator-motion.css).\n\nimport { type SpringSpec, springDurationMillis, springValue } from './spring.js';\n\nconst FULL_ROTATION = 360;\nconst QUARTER_ROTATION = FULL_ROTATION / 4;\n\nexport interface LoadingIndicatorTiming {\n /** `MorphIntervalMillis`: how often a morph starts. */\n readonly morphIntervalMillis: number;\n /** `GlobalRotationDurationMillis`: one linear turn. */\n readonly rotationDurationMillis: number;\n /** The morph spring (`morphAnimationSpec`). */\n readonly spring: SpringSpec;\n /** The morph spring's `visibilityThreshold`; it decides when the spring finishes. */\n readonly visibilityThreshold: number;\n}\n\n/** What the indicator draws: a morph at a progress, rotated clockwise about the center. */\nexport interface IndeterminateFrame {\n morphIndex: number;\n /** The raw spring value: it overshoots past 1, as in Compose (the morph extrapolates). */\n morphProgress: number;\n /** Degrees, clockwise. */\n rotation: number;\n}\n\n/**\n * The first frame (and the one held under reduced motion): the first morph at 0, rotated by the\n * initial `morphRotationTargetAngle` (a quarter turn).\n */\nexport const initialIndeterminateFrame: Readonly<IndeterminateFrame> = {\n morphIndex: 0,\n morphProgress: 0,\n rotation: QUARTER_ROTATION,\n};\n\n/** How long one morph spring runs (Compose's `FloatSpringSpec.getDurationNanos`), in ms. */\nexport const morphSpringDurationMillis = (timing: LoadingIndicatorTiming): number =>\n springDurationMillis(timing.spring, 0, 1, 0, timing.visibilityThreshold);\n\n/**\n * The frame of an indeterminate loading indicator [elapsedMillis] after it started, cycling\n * through [morphCount] morphs.\n */\nexport function indeterminateFrame(\n elapsedMillis: number,\n morphCount: number,\n timing: LoadingIndicatorTiming,\n): IndeterminateFrame {\n const t = Math.max(0, elapsedMillis);\n const springMillis = morphSpringDurationMillis(timing);\n // `delay(MorphIntervalMillis)` then `deferred.await()`: the next morph starts after both.\n const period = Math.max(timing.morphIntervalMillis, springMillis);\n const completed = Math.floor(t / period);\n const local = t - completed * period;\n const running = local < springMillis;\n // Each finished spring advances the index and adds a quarter turn (starting at a quarter turn).\n const finished = running ? completed : completed + 1;\n const morphIndex = finished % morphCount;\n const targetAngle = (QUARTER_ROTATION * (finished + 1)) % FULL_ROTATION;\n // Compose samples the spring at whole milliseconds of play time.\n const morphProgress = running ? springValue(timing.spring, Math.floor(local), 0, 1) : 0;\n const globalRotation =\n (FULL_ROTATION * Math.floor(t % timing.rotationDurationMillis)) / timing.rotationDurationMillis;\n return {\n morphIndex,\n morphProgress,\n rotation: morphProgress * QUARTER_ROTATION + targetAngle + globalRotation,\n };\n}\n","/*\n * Copyright 2022 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/internal/MenuPosition.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n// and compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Menu.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// MenuPosition, AnchorAlignmentOffsetPosition and WindowAlignmentMarginPosition (MenuPosition.kt\n// L50-L275), DropdownMenuPositionProvider.positioningLogic (L317-L392), the MenuAnchorPosition\n// candidate lists (Menu.kt L1507-L1785) and calculateTransformOrigin (Menu.kt L2216-L2242). Coordinates are CSS px relative to the viewport\n// (\"window\"); Compose works in integer px, the web keeps fractions. Alignment.align is\n// BiasAlignment's `round((space - size) / 2 * (1 + bias))` (Kotlin roundToInt = Math.round).\n\n/** Where a menu opens relative to its anchor (MenuAnchorPosition.Below…End). */\nexport type MenuAnchorPosition = 'below' | 'above' | 'start' | 'end' | 'left' | 'right';\n\nexport interface MenuRect {\n readonly left: number;\n readonly top: number;\n readonly right: number;\n readonly bottom: number;\n}\n\nexport interface MenuPositionInput {\n /** Anchor bounds in viewport px. */\n anchor: MenuRect;\n /** Viewport (window) size in px. */\n window: { readonly width: number; readonly height: number };\n /** Untransformed menu size in px. */\n menu: { readonly width: number; readonly height: number };\n /** Layout direction of the anchor (`direction: rtl`). */\n rtl: boolean;\n /** Default `below`. */\n position?: MenuAnchorPosition | undefined;\n /** DpOffset: x is mirrored in RTL. Default 0, 0. */\n offset?: { readonly x: number; readonly y: number } | undefined;\n /** Kept from the window top/bottom (MenuVerticalMargin). */\n verticalMargin: number;\n /** Kept from the window left/right (MenuHorizontalMargin; 0 for the baseline DropdownMenu). */\n horizontalMargin: number;\n}\n\nexport interface MenuPositionResult {\n /** Menu left edge in viewport px. */\n x: number;\n /** Menu top edge in viewport px. */\n y: number;\n /** Transform origin as fractions of the menu size (0 = left/top, 1 = right/bottom). */\n originX: number;\n originY: number;\n}\n\ntype Horizontal = (anchor: MenuRect, width: number, menuWidth: number, rtl: boolean) => number;\ntype Vertical = (anchor: MenuRect, height: number, menuHeight: number) => number;\n\nconst round = Math.round;\n\n/** BiasAlignment.Horizontal.align (Start = -1, CenterHorizontally = 0, End = 1). */\nconst alignH = (bias: number, size: number, space: number, rtl: boolean) =>\n round(((space - size) / 2) * (1 + (rtl ? -bias : bias)));\n/** BiasAlignment.Vertical.align (Top = -1, CenterVertically = 0, Bottom = 1). */\nconst alignV = (bias: number, size: number, space: number) =>\n round(((space - size) / 2) * (1 + bias));\n\nconst START = -1;\nconst END = 1;\nconst TOP = -1;\nconst CENTER = 0;\nconst BOTTOM = 1;\n\n/** AnchorAlignmentOffsetPosition.Horizontal. */\nconst anchorH =\n (menuBias: number, anchorBias: number): Horizontal =>\n (anchor, _width, menuWidth, rtl) =>\n anchor.left +\n alignH(anchorBias, 0, anchor.right - anchor.left, rtl) -\n alignH(menuBias, 0, menuWidth, rtl);\n\n/** AnchorAlignmentOffsetPosition.Vertical. */\nconst anchorV =\n (menuBias: number, anchorBias: number): Vertical =>\n (anchor, _height, menuHeight) =>\n anchor.top +\n alignV(anchorBias, 0, anchor.bottom - anchor.top) -\n alignV(menuBias, 0, menuHeight);\n\nconst startToAnchorStart = anchorH(START, START);\nconst startToAnchorEnd = anchorH(START, END);\nconst endToAnchorEnd = anchorH(END, END);\nconst endToAnchorStart = anchorH(END, START);\n/** WindowAlignmentMarginPosition.Horizontal with AbsoluteAlignment.Left / Right (ignore RTL). */\nconst leftToWindowLeft: Horizontal = (_a, width, menuWidth) =>\n alignH(START, menuWidth, width, false);\nconst rightToWindowRight: Horizontal = (_a, width, menuWidth) =>\n alignH(END, menuWidth, width, false);\n\nconst topToAnchorBottom = anchorV(TOP, BOTTOM);\nconst topToAnchorTop = anchorV(TOP, TOP);\nconst bottomToAnchorTop = anchorV(BOTTOM, TOP);\nconst bottomToAnchorBottom = anchorV(BOTTOM, BOTTOM);\nconst centerToAnchorTop = anchorV(CENTER, TOP);\nconst topToWindowTop: Vertical = (_a, height, menuHeight) => alignV(TOP, menuHeight, height);\nconst bottomToWindowBottom: Vertical = (_a, height, menuHeight) =>\n alignV(BOTTOM, menuHeight, height);\n\nconst centerX = (r: MenuRect) => (r.left + r.right) / 2;\nconst centerY = (r: MenuRect) => (r.top + r.bottom) / 2;\n\n/** The window-edge fallback every MenuAnchorPosition ends its x list with. */\nconst windowX = (anchor: MenuRect, width: number) =>\n centerX(anchor) < width / 2 ? leftToWindowLeft : rightToWindowRight;\nconst windowY = (anchor: MenuRect, height: number) =>\n centerY(anchor) < height / 2 ? topToWindowTop : bottomToWindowBottom;\n\n/** MenuAnchorPosition.{Below, Above, Left, Right, Start, End}: candidate x and y lists, in order. */\nfunction candidates(\n position: MenuAnchorPosition,\n anchor: MenuRect,\n width: number,\n height: number,\n): [Horizontal[], Vertical[]] {\n const wx = windowX(anchor, width);\n const wy = windowY(anchor, height);\n switch (position) {\n case 'above':\n return [\n [startToAnchorStart, endToAnchorEnd, wx],\n [bottomToAnchorTop, topToAnchorBottom, centerToAnchorTop, wy],\n ];\n // Left and Start (Right and End) list the same candidates; Start/End resolve against the\n // layout direction inside the candidates, Left/Right too (Menu.kt keeps them identical).\n case 'left':\n case 'start':\n return [\n [endToAnchorStart, startToAnchorEnd, wx],\n [topToAnchorTop, bottomToAnchorBottom, wy],\n ];\n case 'right':\n case 'end':\n return [\n [startToAnchorEnd, endToAnchorStart, wx],\n [topToAnchorTop, bottomToAnchorBottom, wy],\n ];\n // 'below' (unrecognized values too).\n default:\n return [\n [startToAnchorStart, endToAnchorEnd, wx],\n [topToAnchorBottom, bottomToAnchorTop, centerToAnchorTop, wy],\n ];\n }\n}\n\nconst coerceIn = (v: number, min: number, max: number) => Math.min(Math.max(v, min), max);\n\n/** First candidate that fits between the margins; else the last one coerced (or centered). */\nfunction pick(\n values: readonly number[],\n size: number,\n space: number,\n margin: number,\n center: () => number,\n): number {\n for (const [i, candidate] of values.entries()) {\n if (candidate >= margin && candidate + size <= space - margin) return candidate;\n if (i === values.length - 1) {\n return size >= space - 2 * margin\n ? center()\n : coerceIn(candidate, margin, space - margin - size);\n }\n }\n return 0;\n}\n\n/** calculateTransformOrigin (Menu.kt L2216). */\nexport function menuTransformOrigin(\n anchor: MenuRect,\n menu: MenuRect,\n): { originX: number; originY: number } {\n const menuWidth = menu.right - menu.left;\n const menuHeight = menu.bottom - menu.top;\n const originX =\n menu.left >= anchor.right\n ? 0\n : menu.right <= anchor.left\n ? 1\n : menuWidth === 0\n ? 0\n : ((Math.max(anchor.left, menu.left) + Math.min(anchor.right, menu.right)) / 2 -\n menu.left) /\n menuWidth;\n const originY =\n menu.top >= anchor.bottom\n ? 0\n : menu.bottom <= anchor.top\n ? 1\n : menuHeight === 0\n ? 0\n : ((Math.max(anchor.top, menu.top) + Math.min(anchor.bottom, menu.bottom)) / 2 -\n menu.top) /\n menuHeight;\n return { originX, originY };\n}\n\n/**\n * Where Compose's DropdownMenuPositionProvider places a menu: the first x and y candidates of the\n * MenuAnchorPosition that keep the menu inside the window margins (below the anchor, then above it,\n * then centered on its top, then against the nearer window edge), plus the transform origin the\n * open/close scale animates from.\n */\nexport function menuPosition(input: MenuPositionInput): MenuPositionResult {\n const { anchor, window: win, menu, rtl, verticalMargin, horizontalMargin } = input;\n const offset = input.offset ?? { x: 0, y: 0 };\n const [xs, ys] = candidates(input.position ?? 'below', anchor, win.width, win.height);\n const offsetX = offset.x * (rtl ? -1 : 1);\n const x = pick(\n xs.map((c) => c(anchor, win.width, menu.width, rtl) + offsetX),\n menu.width,\n win.width,\n horizontalMargin,\n () => alignH(CENTER, menu.width, win.width, rtl),\n );\n const y = pick(\n ys.map((c) => c(anchor, win.height, menu.height) + offset.y),\n menu.height,\n win.height,\n verticalMargin,\n () => alignV(CENTER, menu.height, win.height),\n );\n return {\n x,\n y,\n ...menuTransformOrigin(anchor, {\n left: x,\n top: y,\n right: x + menu.width,\n bottom: y + menu.height,\n }),\n };\n}\n","/*\n * Copyright 2024 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SearchBar.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// SearchBarState (L1434-1628: the expand / collapse animatable, the content fade animatable and\n// currentValue's 0.02 threshold), the drop-down slide of ExpandedDockedSearchBarWithGap\n// (DockedSearchBarLayout L3659-3690: AnimatedVisibility once progress > 0.1, sliding by half its\n// height on the state's expand / collapse springs) and the geometry of the expanded views:\n// FullScreenSearchBarLayout (L3880-4023, without predictive back), DockedSearchBarLayoutImpl\n// (L3724-3771) and the with-gap popup (ExpandedDockedSearchBarImpl L1172-1203). Compose lays the\n// expanded views out in a dialog / popup window; here they are fixed-position boxes in the top\n// layer, so every rectangle is in viewport (window) px. Time is injected (ms), so m3e-elements\n// drives it from its frame loop and tests step it deterministically.\n\nimport { SpringAnimatable } from './animatable.js';\nimport type { Easing } from './cubic-bezier.js';\nimport type { SpringSpec } from './spring.js';\n\n/** SearchBarState.currentValue is Expanded above this (L1535, \"tolerance for spring anim\"). */\nexport const SEARCH_BAR_EXPANDED_THRESHOLD = 0.02;\n/** ExpandedDockedSearchBarWithGap shows its results once progress passes this (L3667). */\nexport const SEARCH_DROPDOWN_VISIBLE_PROGRESS = 0.1;\n\n/** A Compose `tween(durationMillis, delayMillis, easing)`. */\nexport interface TweenSpec {\n readonly duration: number;\n readonly delay: number;\n readonly easing: Easing;\n}\n\n/**\n * A float with Compose `Animatable.animateTo(tween)` semantics: each target starts a tween from the\n * current value (velocity is not carried), held for `delay`, then eased over `duration`. A null\n * spec is Compose's `snap()`: the value jumps.\n */\nexport class TweenAnimatable {\n #value: number;\n #from: number;\n #target: number;\n #start = 0;\n #spec: TweenSpec | null = null;\n\n constructor(value: number) {\n this.#value = value;\n this.#from = value;\n this.#target = value;\n }\n\n get value(): number {\n return this.#value;\n }\n\n get target(): number {\n return this.#target;\n }\n\n get isRunning(): boolean {\n return this.#spec !== null;\n }\n\n snapTo(value: number): void {\n this.#spec = null;\n this.#value = value;\n this.#from = value;\n this.#target = value;\n }\n\n animateTo(target: number, spec: TweenSpec | null, now: number): void {\n this.sample(now);\n if (spec === null || spec.delay + spec.duration <= 0) {\n this.snapTo(target);\n return;\n }\n this.#from = this.#value;\n this.#target = target;\n this.#start = now;\n this.#spec = spec;\n }\n\n sample(now: number): number {\n const spec = this.#spec;\n if (spec === null) return this.#value;\n const elapsed = now - this.#start - spec.delay;\n if (elapsed >= spec.duration) {\n this.snapTo(this.#target);\n return this.#value;\n }\n const fraction = elapsed <= 0 ? 0 : spec.easing(elapsed / spec.duration);\n this.#value = this.#from + (this.#target - this.#from) * fraction;\n return this.#value;\n }\n}\n\n/** The four animation specs of a SearchBarState (null springs / tweens jump, as `snap()`). */\nexport interface SearchBarSpecs {\n readonly expand: SpringSpec | null;\n readonly collapse: SpringSpec | null;\n readonly contentFadeIn: TweenSpec | null;\n readonly contentFadeOut: TweenSpec | null;\n}\n\n/** One sampled frame of a {@link SearchBarAnimation}. */\nexport interface SearchBarSample {\n /** `animatable.value`: may overshoot 1 (expressive spatial springs). */\n readonly value: number;\n /** `progress`: the value clamped to [0, 1]. */\n readonly progress: number;\n /** `contentProgress` (the contained / with-gap results' alpha). */\n readonly contentProgress: number;\n /** The with-gap drop-down's slide offset in px (0 at rest, minus half its height hidden). */\n readonly slide: number;\n /** Whether the with-gap drop-down is shown (AnimatedVisibility is entering, visible or exiting). */\n readonly dropdownShown: boolean;\n}\n\n/**\n * SearchBarState's animation: `animateToExpanded` / `animateToCollapsed` run the progress spring\n * and the content tween together; a new target starts from the current value and velocity\n * (Animatable). Optionally (ExpandedDockedSearchBarWithGap) it also runs the drop-down's\n * slide-in / slide-out on the same springs, from progress 0.1.\n */\nexport class SearchBarAnimation {\n readonly #progress: SpringAnimatable;\n readonly #content: TweenAnimatable;\n readonly #slide = new SpringAnimatable(0);\n #specs: SearchBarSpecs | null = null;\n #dropdownShown = false;\n #dropdownVisible = false;\n\n constructor(expanded = false) {\n this.#progress = new SpringAnimatable(expanded ? 1 : 0);\n this.#content = new TweenAnimatable(expanded ? 1 : 0);\n this.#dropdownShown = expanded;\n this.#dropdownVisible = expanded;\n }\n\n /** SearchBarState.targetValue. */\n get isTargetExpanded(): boolean {\n return this.#progress.target === 1;\n }\n\n /** SearchBarState.currentValue: expanded until the value drops to the 0.02 tolerance. */\n get isExpanded(): boolean {\n return this.#progress.value > SEARCH_BAR_EXPANDED_THRESHOLD;\n }\n\n get isRunning(): boolean {\n return this.#progress.isRunning || this.#content.isRunning || this.#slide.isRunning;\n }\n\n /** animateToExpanded() at `now` (ms). */\n expand(specs: SearchBarSpecs, now: number): void {\n this.#specs = specs;\n this.#progress.animateTo(1, specs.expand, now);\n this.#content.animateTo(1, specs.contentFadeIn, now);\n }\n\n /** animateToCollapsed() at `now` (ms). */\n collapse(specs: SearchBarSpecs, now: number): void {\n this.#specs = specs;\n this.#content.animateTo(0, specs.contentFadeOut, now);\n this.#progress.animateTo(0, specs.collapse, now);\n }\n\n /** Jumps to collapsed (0) or expanded (1), stopping every animation. */\n snapTo(expanded: boolean): void {\n this.#progress.snapTo(expanded ? 1 : 0);\n this.#content.snapTo(expanded ? 1 : 0);\n this.#slide.snapTo(0);\n this.#dropdownShown = expanded;\n this.#dropdownVisible = expanded;\n }\n\n /**\n * Advances to `now`. `dropdownHeight` (px, the drop-down's full height) enables the with-gap\n * slide: AnimatedVisibility(visible = progress > 0.1 && target == Expanded) slides in from minus\n * half the height on the expand spring and out to it on the collapse spring.\n */\n sample(now: number, dropdownHeight?: number): SearchBarSample {\n const value = this.#progress.sample(now);\n const progress = Math.min(Math.max(value, 0), 1);\n const contentProgress = Math.min(Math.max(this.#content.sample(now), 0), 1);\n if (dropdownHeight !== undefined) {\n const hidden = Math.round(-dropdownHeight / 2);\n const visible = progress > SEARCH_DROPDOWN_VISIBLE_PROGRESS && this.isTargetExpanded;\n if (visible !== this.#dropdownVisible) {\n this.#dropdownVisible = visible;\n if (visible) {\n // Enter: from minus half the height (or from where an exit got to).\n if (!this.#dropdownShown) this.#slide.snapTo(hidden);\n this.#dropdownShown = true;\n this.#slide.animateTo(0, this.#specs?.expand ?? null, now);\n } else if (this.#dropdownShown) {\n this.#slide.animateTo(hidden, this.#specs?.collapse ?? null, now);\n }\n }\n this.#slide.sample(now);\n if (!visible && this.#dropdownShown && !this.#slide.isRunning) this.#dropdownShown = false;\n }\n return {\n value,\n progress,\n contentProgress,\n slide: this.#slide.value,\n dropdownShown: this.#dropdownShown,\n };\n }\n}\n\n/** The expanded views Compose offers for a SearchBarState. */\nexport type SearchViewVariant =\n 'full-screen' | 'full-screen-contained' | 'docked' | 'docked-with-gap';\n\nexport interface SearchRect {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n}\n\n/** The SearchBar.kt measurements the layouts read (px; search-defaults.css). */\nexport interface SearchViewMetrics {\n /** SearchBarVerticalPadding (8dp). */\n readonly verticalPadding: number;\n /** AppBarWithSearchVerticalPadding (4dp): the contained view's top padding. */\n readonly containedTopPadding: number;\n /** FullScreenExpandedHorizontalPadding (8dp). */\n readonly containedHorizontalPadding: number;\n /** SearchBarCornerRadius = InputFieldHeight / 2 (28dp). */\n readonly cornerRadius: number;\n /** DockedExpandedTableMinHeight (240dp). */\n readonly dockedMinHeight: number;\n /** DockedExpandedTableMaxHeightScreenRatio (2/3). */\n readonly dockedMaxHeightRatio: number;\n /** DockedExpandedWithGapTableMaxHeightScreenRatio (1/2). */\n readonly withGapMaxHeightRatio: number;\n /** dockedDropdownGapSize (2dp). */\n readonly dropdownGap: number;\n}\n\nexport interface SearchViewInput {\n readonly variant: SearchViewVariant;\n /** The collapsed search bar (`collapsedBounds`), viewport px. */\n readonly collapsed: SearchRect;\n /** The window (viewport) size. */\n readonly window: { readonly width: number; readonly height: number };\n /** The unconsumed top window inset (safe area). */\n readonly insetTop: number;\n readonly sample: Pick<SearchBarSample, 'value' | 'progress'>;\n readonly metrics: SearchViewMetrics;\n}\n\n/** Where everything of an expanded view goes in one frame (viewport px). */\nexport interface SearchViewFrame {\n /**\n * The surface: full-screen, the growing container (with `radius`); contained, the window,\n * faded in by `alpha`; docked, the panel holding field and results (height between `minHeight`\n * and `maxHeight`); with gap, the scrim (drawn at `alpha` × the scrim opacity).\n */\n readonly surface: SearchRect & {\n readonly radius: number;\n readonly alpha: number;\n readonly minHeight: number;\n readonly maxHeight: number;\n };\n /** The input field (collapsed height). */\n readonly field: { readonly x: number; readonly y: number; readonly width: number };\n /** The results: top-left, width and the height they may take. */\n readonly results: {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly maxHeight: number;\n };\n}\n\nconst lerp = (a: number, b: number, t: number) => a + (b - a) * t;\n\n/**\n * The layout of an expanded view at one animation frame: FullScreenSearchBarLayout (`isContained`\n * false / true), DockedSearchBarLayoutImpl (docked) and the with-gap popup. Predictive back is not\n * ported (the web has no back gesture progress).\n */\nexport function searchViewFrame(input: SearchViewInput): SearchViewFrame {\n const { variant, collapsed: c, window: w, insetTop, metrics: m } = input;\n const { value, progress: p } = input.sample;\n const none = { radius: 0, alpha: 1, minHeight: 0, maxHeight: 0 };\n\n if (variant === 'docked' || variant === 'docked-with-gap') {\n const ratio = variant === 'docked' ? m.dockedMaxHeightRatio : m.withGapMaxHeightRatio;\n const tableMax = w.height * ratio;\n const maxHeight = lerp(c.height, tableMax, Math.max(value, 0));\n const minHeight = Math.min(Math.min(m.dockedMinHeight, tableMax), maxHeight);\n if (variant === 'docked') {\n return {\n surface: { ...c, radius: 0, alpha: 1, minHeight, maxHeight },\n field: { x: c.x, y: c.y, width: c.width },\n results: { x: c.x, y: c.y + c.height, width: c.width, maxHeight: maxHeight - c.height },\n };\n }\n return {\n surface: { x: 0, y: 0, width: w.width, height: w.height, ...none, alpha: p },\n field: { x: c.x, y: c.y, width: c.width },\n results: {\n x: c.x,\n y: c.y + c.height + m.dropdownGap,\n width: c.width,\n maxHeight: Math.max(0, maxHeight - c.height - m.dropdownGap),\n },\n };\n }\n\n const contained = variant === 'full-screen-contained';\n const width = contained ? w.width : lerp(c.width, w.width, p);\n const height = contained ? w.height : lerp(c.height, w.height, p);\n const offsetX = contained ? 0 : lerp(c.x, 0, p);\n const padding = contained ? m.containedHorizontalPadding : 0;\n const fieldWidth = lerp(c.width, width - 2 * padding, value);\n const centerX = lerp(c.x + c.width / 2, offsetX + width / 2, value);\n const topPadding = insetTop + (contained ? m.containedTopPadding : m.verticalPadding);\n const animatedTopPadding = topPadding * Math.min(p, 1);\n const bottomPadding = contained ? m.verticalPadding : m.verticalPadding * p;\n const offsetY = lerp(c.y, 0, p);\n const fieldY = offsetY + animatedTopPadding;\n return {\n surface: contained\n ? { x: 0, y: 0, width, height, ...none, alpha: p }\n : { x: offsetX, y: offsetY, width, height, ...none, radius: m.cornerRadius * (1 - p) },\n field: { x: Math.round(centerX - fieldWidth / 2), y: fieldY, width: fieldWidth },\n results: {\n x: offsetX,\n y: fieldY + c.height + bottomPadding,\n width,\n maxHeight: Math.max(0, height - (c.height + animatedTopPadding + bottomPadding)),\n },\n };\n}\n\n/**\n * The combobox's next active option for a key (React Aria / APG list autocomplete): ArrowDown\n * from the input goes to the first option and then down, stopping at the last; ArrowUp from the\n * input goes to the last option and then up, and from the first option back to the input (-1).\n * Returns null for keys it does not handle or an empty list. `enabled` filters disabled options.\n */\nexport function searchNavigationTarget(\n key: string,\n enabled: readonly boolean[],\n active: number,\n): number | null {\n const indices = enabled.flatMap((on, i) => (on ? [i] : []));\n const first = indices[0];\n const last = indices.at(-1);\n if (first === undefined || last === undefined) return null;\n const at = indices.indexOf(active);\n if (key === 'ArrowDown') return at === -1 ? first : (indices[at + 1] ?? last);\n if (key === 'ArrowUp') return at === -1 ? last : at === 0 ? -1 : (indices[at - 1] ?? first);\n return null;\n}\n","/*\n * Copyright 2024 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ButtonGroup.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// ButtonGroupMeasurePolicy.measure (L554-L812): how many items fit before the overflow indicator\n// (L673-L716) and the expand/compress pass that grows a pressed item and shrinks its neighbors\n// (L718-L769). Widths are CSS px; Compose rounds each growth to whole device px (roundToInt), the\n// web keeps fractions so the animation does not step.\n\nexport interface ButtonGroupItemSize {\n /** Resting width (Compose: the item's max intrinsic width). */\n readonly width: number;\n /**\n * Most this item may be compressed by a pressed neighbor (Compose `compressionLimit`: the end\n * content padding of the item, `ButtonDefaults.ContentPadding` by default).\n */\n readonly compressionLimit: number;\n}\n\n/**\n * Number of leading items that fit in `maxWidth` (ButtonGroupMeasurePolicy L673-L716). When all\n * items and their spacing fit, every item shows; otherwise the overflow indicator's width is\n * reserved and items are added while each one fits in what is left (each after the first also\n * pays one `spacing`, the gap before the next item or the indicator).\n */\nexport function buttonGroupVisibleCount(\n widths: readonly number[],\n spacing: number,\n maxWidth: number,\n overflowWidth: number,\n): number {\n const desired = widths.reduce((sum, w) => sum + w, 0) + spacing * (widths.length - 1);\n if (desired <= maxWidth) return widths.length;\n let remaining = maxWidth - overflowWidth;\n let last = 0;\n for (const width of widths) {\n if (width > remaining) break;\n remaining -= width + spacing;\n last++;\n }\n return last;\n}\n\n/**\n * Widths of the visible items while some are pressed (ButtonGroupMeasurePolicy L718-L769).\n * `pressed[i]` is item i's press animation value (0 at rest, 1 fully expanded; it overshoots on a\n * bouncy spring). A pressed middle item grows by `pressed × min(expandedRatio × width / 2, both\n * neighbors' compression limits)` on each side, taken from each neighbor; the first and last items\n * grow by `pressed × min(expandedRatio × width, neighbor's limit)` taken from their only neighbor.\n * Items are processed in order on the running widths, as Compose does, so the total width stays\n * constant. `visibleCount` is the number of items shown (the rest are in the overflow menu).\n */\nexport function buttonGroupWidths(\n items: readonly ButtonGroupItemSize[],\n pressed: readonly number[],\n expandedRatio: number,\n visibleCount: number = items.length,\n): number[] {\n const widths = items.map((item) => item.width);\n const w = (i: number) => widths[i] ?? 0;\n const limit = (i: number) => items[i]?.compressionLimit ?? 0;\n const last = Math.min(visibleCount, items.length);\n if (items.length <= 1) return widths.slice(0, last);\n for (let index = 0; index < last; index++) {\n const value = pressed[index] ?? 0;\n if (value === 0) continue;\n let growth: number;\n if (index >= 1 && index < last - 1) {\n // A middle item compresses both neighbors.\n const target =\n value * Math.min((expandedRatio * w(index)) / 2, limit(index - 1), limit(index + 1));\n const left = Math.min(target, w(index - 1));\n const right = Math.min(target, w(index + 1));\n widths[index - 1] = w(index - 1) - left;\n widths[index + 1] = w(index + 1) - right;\n growth = left + right;\n } else if (index === 0) {\n // The first item compresses the next one.\n const target = value * Math.min(expandedRatio * w(index), limit(index + 1));\n const right = Math.min(target, w(index + 1));\n widths[index + 1] = w(index + 1) - right;\n growth = right;\n } else {\n // The last item compresses the previous one.\n const target = value * Math.min(expandedRatio * w(index), limit(index - 1));\n const left = Math.min(target, w(index - 1));\n widths[index - 1] = w(index - 1) - left;\n growth = left;\n }\n widths[index] = w(index) + growth;\n }\n return widths.slice(0, last);\n}\n","/*\n * Copyright 2022 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from window/window-core/src/commonMain/kotlin/androidx/window/core/layout/WindowSizeClass.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n// and (Copyright 2023-2025 The Android Open Source Project, same license)\n// compose/material3/adaptive/adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/WindowSizeClassHelper.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898,\n// compose/material3/adaptive/adaptive/src/commonMain/kotlin/androidx/compose/material3/adaptive/WindowAdaptiveInfo.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898,\n// compose/material3/adaptive/adaptive-layout/src/commonMain/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldDirective.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n// and compose/material3/material3-adaptive-navigation-suite/src/commonMain/kotlin/androidx/compose/material3/adaptive/navigationsuite/NavigationSuiteScaffold.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// The breakpoints are WindowSizeClass's companion lower bounds (L146-161; the released\n// window-core 1.5.0 that material3-adaptive depends on has the identical file). Classification is\n// computeFromDpSize (WindowSizeClassHelper.kt L162-170): the largest supported lower bound <= the\n// window size, with the V2 width set (Compact, Medium, Expanded, Large, ExtraLarge; L96, used by\n// currentWindowAdaptiveInfoV2, WindowAdaptiveInfo.kt L40-41) by default and the V1 set (L90,\n// the deprecated currentWindowAdaptiveInfo()) on request. paneScaffoldDirective is\n// calculatePaneScaffoldDirective (PaneScaffoldDirective.kt L48-106) without hinge exclusion, and\n// navigationSuiteType is NavigationSuiteScaffoldDefaults.navigationSuiteType (L1167-1180). Sizes\n// are dp, which the web reads as CSS px.\n\n/** Width size classes, smallest first (DpWidthSizeClasses). */\nexport type WindowWidthSizeClass = 'compact' | 'medium' | 'expanded' | 'large' | 'extra-large';\n\n/** Height size classes, smallest first (DpHeightSizeClasses). */\nexport type WindowHeightSizeClass = 'compact' | 'medium' | 'expanded';\n\n/** Lower bound (min-width, dp = CSS px) of each width size class (WindowSizeClass L146-155). */\nexport const WINDOW_WIDTH_BREAKPOINTS: Readonly<Record<WindowWidthSizeClass, number>> =\n /* @__PURE__ */ Object.freeze({\n compact: 0,\n medium: 600,\n expanded: 840,\n large: 1200,\n 'extra-large': 1600,\n });\n\n/** Lower bound (min-height, dp = CSS px) of each height size class (WindowSizeClass L158-161). */\nexport const WINDOW_HEIGHT_BREAKPOINTS: Readonly<Record<WindowHeightSizeClass, number>> =\n /* @__PURE__ */ Object.freeze({ compact: 0, medium: 480, expanded: 900 });\n\n/** A window's (or container's) size class: androidx `WindowSizeClass` plus its bucket names. */\nexport interface WindowSizeClass {\n readonly widthClass: WindowWidthSizeClass;\n readonly heightClass: WindowHeightSizeClass;\n /** Lower bound of the width class in CSS px (`minWidthDp`). */\n readonly minWidth: number;\n /** Lower bound of the height class in CSS px (`minHeightDp`). */\n readonly minHeight: number;\n}\n\nexport interface WindowSizeClassOptions {\n /**\n * Classify widths into the large and extra-large classes (currentWindowAdaptiveInfoV2; default\n * `true`). `false` keeps the V1 set, where every width from 840 is `expanded`.\n */\n largeAndExtraLargeWidth?: boolean | undefined;\n}\n\nconst WIDTH_CLASSES: readonly WindowWidthSizeClass[] = [\n 'compact',\n 'medium',\n 'expanded',\n 'large',\n 'extra-large',\n];\nconst HEIGHT_CLASSES: readonly WindowHeightSizeClass[] = ['compact', 'medium', 'expanded'];\n\n/** The largest class whose lower bound is <= `size` (computeFromDpSize's filter + maxOf). */\nfunction bucket<T extends string>(\n size: number,\n compact: T,\n classes: readonly T[],\n bounds: Readonly<Record<T, number>>,\n): T {\n let match = compact;\n for (const c of classes) if (size >= bounds[c]) match = c;\n return match;\n}\n\n/**\n * The width size class of a window `widthPx` CSS px wide. Negative or NaN widths (androidx\n * rejects them) classify as compact.\n */\nexport function windowWidthSizeClass(\n widthPx: number,\n options: WindowSizeClassOptions = {},\n): WindowWidthSizeClass {\n const classes =\n options.largeAndExtraLargeWidth === false ? WIDTH_CLASSES.slice(0, 3) : WIDTH_CLASSES;\n return bucket(widthPx, 'compact', classes, WINDOW_WIDTH_BREAKPOINTS);\n}\n\n/** The height size class of a window `heightPx` CSS px tall. */\nexport function windowHeightSizeClass(heightPx: number): WindowHeightSizeClass {\n return bucket(heightPx, 'compact', HEIGHT_CLASSES, WINDOW_HEIGHT_BREAKPOINTS);\n}\n\n/** The size class of a `width` × `height` CSS px window or container. */\nexport function windowSizeClass(\n size: { readonly width: number; readonly height: number },\n options: WindowSizeClassOptions = {},\n): WindowSizeClass {\n const widthClass = windowWidthSizeClass(size.width, options);\n const heightClass = windowHeightSizeClass(size.height);\n return {\n widthClass,\n heightClass,\n minWidth: WINDOW_WIDTH_BREAKPOINTS[widthClass],\n minHeight: WINDOW_HEIGHT_BREAKPOINTS[heightClass],\n };\n}\n\n/** Whether two size classes are the same bucket (WindowSizeClass.equals). */\nexport function sameWindowSizeClass(a: WindowSizeClass, b: WindowSizeClass): boolean {\n return a.minWidth === b.minWidth && a.minHeight === b.minHeight;\n}\n\nconst widthBound = (b: WindowWidthSizeClass | number) =>\n typeof b === 'number' ? b : WINDOW_WIDTH_BREAKPOINTS[b];\nconst heightBound = (b: WindowHeightSizeClass | number) =>\n typeof b === 'number' ? b : WINDOW_HEIGHT_BREAKPOINTS[b];\n\n/**\n * `minWidth >= breakpoint` (isWidthAtLeastBreakpoint, L98-100). `breakpoint` is a class name or a\n * px lower bound. Like androidx, check from the largest breakpoint down.\n */\nexport function isWidthAtLeastBreakpoint(\n sizeClass: WindowSizeClass,\n breakpoint: WindowWidthSizeClass | number,\n): boolean {\n return sizeClass.minWidth >= widthBound(breakpoint);\n}\n\n/** `minHeight >= breakpoint` (isHeightAtLeastBreakpoint, L107-109). */\nexport function isHeightAtLeastBreakpoint(\n sizeClass: WindowSizeClass,\n breakpoint: WindowHeightSizeClass | number,\n): boolean {\n return sizeClass.minHeight >= heightBound(breakpoint);\n}\n\n/** Both of the above (isAtLeastBreakpoint, L117-120). */\nexport function isAtLeastBreakpoint(\n sizeClass: WindowSizeClass,\n widthBreakpoint: WindowWidthSizeClass | number,\n heightBreakpoint: WindowHeightSizeClass | number,\n): boolean {\n return (\n isWidthAtLeastBreakpoint(sizeClass, widthBreakpoint) &&\n isHeightAtLeastBreakpoint(sizeClass, heightBreakpoint)\n );\n}\n\n/** Posture input for the directive and the navigation suite (Compose `Posture.isTabletop`). */\nexport interface WindowPostureOptions {\n /** A half-folded device with a horizontal hinge. Default `false`. */\n isTabletop?: boolean | undefined;\n}\n\n/** Material's recommended pane layout for a size class (PaneScaffoldDirective, without hinges). */\nexport interface PaneScaffoldDirective {\n /** Panes side by side at most: 1 at compact/medium, 2 at expanded, 3 from large. */\n readonly maxHorizontalPartitions: number;\n /** Spacer between side-by-side panes, CSS px. */\n readonly horizontalPartitionSpacerSize: number;\n /** Panes stacked at most: 2 on a tabletop posture or a single-pane expanded-height window. */\n readonly maxVerticalPartitions: number;\n readonly verticalPartitionSpacerSize: number;\n /** Default preferred pane width, CSS px (the fixed pane of a fixed-and-flexible layout). */\n readonly defaultPanePreferredWidth: number;\n readonly defaultPanePreferredHeight: number;\n}\n\n// PaneScaffoldDirective.kt: partition spacers (L68, L73, L88) and the companion's default pane\n// sizes (L346-348).\nconst PARTITION_SPACER = 24;\nconst DEFAULT_PREFERRED_WIDTH = 360;\nconst DEFAULT_PREFERRED_WIDTH_XL = 412;\nconst DEFAULT_PREFERRED_HEIGHT = 420;\n\n/** calculatePaneScaffoldDirective (PaneScaffoldDirective.kt L48-106), without hinge bounds. */\nexport function paneScaffoldDirective(\n sizeClass: WindowSizeClass,\n options: WindowPostureOptions = {},\n): PaneScaffoldDirective {\n let maxHorizontalPartitions: number;\n let horizontalPartitionSpacerSize: number;\n let defaultPanePreferredWidth: number;\n switch (sizeClass.minWidth) {\n case WINDOW_WIDTH_BREAKPOINTS.compact:\n case WINDOW_WIDTH_BREAKPOINTS.medium:\n maxHorizontalPartitions = 1;\n horizontalPartitionSpacerSize = 0;\n defaultPanePreferredWidth = DEFAULT_PREFERRED_WIDTH;\n break;\n case WINDOW_WIDTH_BREAKPOINTS.expanded:\n maxHorizontalPartitions = 2;\n horizontalPartitionSpacerSize = PARTITION_SPACER;\n defaultPanePreferredWidth = DEFAULT_PREFERRED_WIDTH;\n break;\n default:\n maxHorizontalPartitions = 3;\n horizontalPartitionSpacerSize = PARTITION_SPACER;\n defaultPanePreferredWidth = DEFAULT_PREFERRED_WIDTH_XL;\n }\n const stacked =\n options.isTabletop === true ||\n (maxHorizontalPartitions === 1 && sizeClass.minHeight === WINDOW_HEIGHT_BREAKPOINTS.expanded);\n return {\n maxHorizontalPartitions,\n horizontalPartitionSpacerSize,\n maxVerticalPartitions: stacked ? 2 : 1,\n verticalPartitionSpacerSize: stacked ? PARTITION_SPACER : 0,\n defaultPanePreferredWidth,\n defaultPanePreferredHeight: DEFAULT_PREFERRED_HEIGHT,\n };\n}\n\n/**\n * NavigationSuiteType (NavigationSuiteScaffold.kt L1068-1155) without the types of deprecated\n * components (`NavigationBar`, `NavigationRail`: the legacy bar / rail, D4): which navigation\n * component a navigation suite shows. `none` shows none.\n */\nexport type NavigationSuiteType =\n | 'short-navigation-bar-compact'\n | 'short-navigation-bar-medium'\n | 'wide-navigation-rail-collapsed'\n | 'wide-navigation-rail-expanded'\n | 'navigation-drawer'\n | 'none';\n\n/** The suite types, in NavigationSuiteType's order. */\nexport const NAVIGATION_SUITE_TYPES: readonly NavigationSuiteType[] = [\n 'short-navigation-bar-compact',\n 'short-navigation-bar-medium',\n 'wide-navigation-rail-collapsed',\n 'wide-navigation-rail-expanded',\n 'navigation-drawer',\n 'none',\n];\n\n/** Whether a type puts the navigation at the bottom (`NavigationSuiteType.isNavigationBar`). */\nexport function isNavigationBarType(type: NavigationSuiteType): boolean {\n return type === 'short-navigation-bar-compact' || type === 'short-navigation-bar-medium';\n}\n\nexport interface NavigationSuiteTypeOptions extends WindowPostureOptions {\n /**\n * From this width class (or px lower bound, compared with the class's lower bound like\n * `isWidthAtLeastBreakpoint`) on, windows that would get the collapsed rail get `expandedType`\n * instead. Compose's default never expands (`undefined` / `null`); the navigation suite scaffold\n * passes {@link NAVIGATION_SUITE_EXPANDED_FROM}. The bar rules (compact width, then tabletop or\n * compact height) still come first, as in Compose's custom configuration sample.\n */\n expandedFrom?: WindowWidthSizeClass | number | null | undefined;\n /** What the expanded suite shows: the expanded wide navigation rail (default) or a drawer. */\n expandedType?: 'wide-navigation-rail-expanded' | 'navigation-drawer' | undefined;\n}\n\n/**\n * The navigation suite scaffold's default `expandedFrom`: the expanded wide navigation rail at\n * large and extra-large widths (m3.material.io guidance, owner decision 2026-10-17, COMPONENT_SPEC\n * §16). Not a Compose default: Compose's navigationSuiteType never returns the expanded rail.\n */\nexport const NAVIGATION_SUITE_EXPANDED_FROM: WindowWidthSizeClass = 'large';\n\n/**\n * NavigationSuiteScaffoldDefaults.navigationSuiteType (L1167-1180): a short navigation bar at\n * compact width (compact arrangement), a short navigation bar with the medium (horizontal item)\n * arrangement on a tabletop posture or at compact height, otherwise a collapsed wide navigation\n * rail. With `expandedFrom`, the collapsed rail becomes `expandedType` (default: the expanded wide\n * navigation rail) from that width on.\n */\nexport function navigationSuiteType(\n sizeClass: WindowSizeClass,\n options: NavigationSuiteTypeOptions = {},\n): NavigationSuiteType {\n if (sizeClass.minWidth === WINDOW_WIDTH_BREAKPOINTS.compact)\n return 'short-navigation-bar-compact';\n if (options.isTabletop === true || sizeClass.minHeight === WINDOW_HEIGHT_BREAKPOINTS.compact) {\n return 'short-navigation-bar-medium';\n }\n const { expandedFrom } = options;\n if (\n expandedFrom !== undefined &&\n expandedFrom !== null &&\n isWidthAtLeastBreakpoint(sizeClass, expandedFrom)\n ) {\n return options.expandedType ?? 'wide-navigation-rail-expanded';\n }\n return 'wide-navigation-rail-collapsed';\n}\n","/*\n * Copyright 2023 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3-adaptive-navigation-suite/src/commonMain/kotlin/androidx/compose/material3/adaptive/navigationsuite/NavigationSuiteScaffold.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// NavigationSuiteScaffoldStateImpl (L1407-1464) and the progress NavigationSuiteScaffoldLayout\n// animates (L387-391, L410-480). The state runs one Animatable between Hidden (0) and Visible (1)\n// on AnimationSpec (L1594-1595); its currentValue is Visible only while that value is exactly 1\n// (L1411-1417). The layout animates its own progress (animateFloatAsState, same spec) to\n// currentValue. So hiding moves the navigation as soon as the state leaves 1, while showing waits\n// until the state's spring has settled at 1 and only then slides the navigation in; snapTo jumps\n// the state, and the layout still animates. Both springs keep their velocity when retargeted.\nimport { SpringAnimatable } from './animatable.js';\nimport type { SpringSpec } from './spring.js';\n\nconst HIDDEN = 0;\nconst VISIBLE = 1;\n\nexport interface NavigationSuiteSample {\n /** The layout's animationProgress: 0 hidden … 1 shown. */\n readonly progress: number;\n /** Either spring is still moving (the caller keeps its frame loop going). */\n readonly running: boolean;\n}\n\n/**\n * NavigationSuiteScaffoldState plus its layout's progress, driven by the caller's clock (ms).\n * `spec` is the scaffold's AnimationSpec (`--m3e-comp-navigation-suite-scaffold-visibility-*`), or\n * null to jump (the spatial spring under reduced motion).\n */\nexport class NavigationSuiteScaffoldAnimation {\n readonly #state: SpringAnimatable;\n readonly #progress: SpringAnimatable;\n #spec: SpringSpec | null = null;\n\n /** `hidden`: rememberNavigationSuiteScaffoldState(initialValue = Hidden); rendered at rest. */\n constructor(hidden = false) {\n const value = hidden ? HIDDEN : VISIBLE;\n this.#state = new SpringAnimatable(value);\n this.#progress = new SpringAnimatable(value);\n }\n\n /** NavigationSuiteScaffoldState.targetValue == Hidden. */\n get targetHidden(): boolean {\n return this.#state.target !== VISIBLE;\n }\n\n /** NavigationSuiteScaffoldState.currentValue == Hidden (anything but exactly Visible). */\n get currentHidden(): boolean {\n return this.#state.value !== VISIBLE;\n }\n\n /** NavigationSuiteScaffoldState.isAnimating (the state's spring, not the layout's). */\n get isAnimating(): boolean {\n return this.#state.isRunning;\n }\n\n /** NavigationSuiteScaffoldState.hide(). */\n hide(spec: SpringSpec | null, now: number): void {\n this.#animate(HIDDEN, spec, now);\n }\n\n /** NavigationSuiteScaffoldState.show(). */\n show(spec: SpringSpec | null, now: number): void {\n this.#animate(VISIBLE, spec, now);\n }\n\n /** NavigationSuiteScaffoldState.toggle(): towards the opposite of the target. */\n toggle(spec: SpringSpec | null, now: number): void {\n this.#animate(this.targetHidden ? VISIBLE : HIDDEN, spec, now);\n }\n\n /** NavigationSuiteScaffoldState.snapTo(): the state jumps; the layout animates from `now`. */\n snapTo(hidden: boolean, spec: SpringSpec | null, now: number): void {\n this.#spec = spec;\n this.#state.snapTo(hidden ? HIDDEN : VISIBLE);\n this.sample(now);\n }\n\n #animate(target: number, spec: SpringSpec | null, now: number): void {\n this.#spec = spec;\n this.#state.animateTo(target, spec, now);\n this.sample(now);\n }\n\n /** Advances both springs to `now`; the layout retargets when currentValue changes. */\n sample(now: number): NavigationSuiteSample {\n this.#state.sample(now);\n const target = this.currentHidden ? HIDDEN : VISIBLE;\n if (this.#progress.target !== target) this.#progress.animateTo(target, this.#spec, now);\n const progress = this.#progress.sample(now);\n return { progress, running: this.#state.isRunning || this.#progress.isRunning };\n }\n}\n\n/**\n * How far the navigation is pushed out of the layout (px) for `size` (its height with a bar, its\n * width otherwise) at `progress`: `size − (size × progress).toInt()`. The content gets the rest of\n * the layout; the navigation sits at `layoutHeight − (height × progress).toInt()` (bar types) or\n * `−(width × (1 − progress)).toInt()` (L417-479).\n */\nexport function navigationSuiteOffset(size: number, progress: number): number {\n return size - Math.trunc(size * progress);\n}\n","/*\n * Copyright 2024 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/WideNavigationRail.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n// and compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationItem.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// The animated wide navigation rail (COMPONENT_SPEC §14):\n// - WideNavigationRailLayout (WideNavigationRail.kt L314-476): minWidth / widthFullRange on the\n// rail's spring (DefaultSpatial; FastSpatial in the modal window), itemVerticalSpacedBy and\n// itemMinHeight on DefaultSpatial, and the measure policy's width (wideNavigationRailWidth).\n// - AnimatedNavigationItem (NavigationItem.kt L488-493, L1103-1199): the item's\n// iconPositionProgress on DefaultSpatial and its width (wideNavigationRailItemWidth); the rest of\n// the item geometry is CSS (wide-navigation-rail.css) driven by the same progress.\n// - ModalWideNavigationRail / ModalWideNavigationRailImpl (L593-600, L726-863): positionProgress\n// on DefaultEffects shows the modal window while > 0 and expands its rail from 0.3\n// (modalExpanded); the window rail's width / spacing / scrim animate from there and are dropped\n// with the window. hideOnCollapse: ModalWideNavigationRailState slides the always-expanded rail\n// in from minus its width on DefaultSpatial; the window closes once the slide is done (the scrim\n// path, animateToDismiss).\n// Time is injected (ms): m3e-elements drives it from its frame loop and tests step it.\n\nimport { SpringAnimatable } from './animatable.js';\nimport type { SpringSpec } from './spring.js';\n\n/** ModalWideNavigationRail: the window rail expands once positionProgress reaches this (L600). */\nexport const MODAL_RAIL_EXPANDED_PROGRESS = 0.3;\n\n/** The springs of a wide navigation rail (null jumps: reduced motion snaps spatial springs). */\nexport interface WideNavigationRailSpecs {\n /** WideNavigationRailLayout `animationSpec` (L324): non-modal width, item spacing / min height. */\n readonly width: SpringSpec | null;\n /** `modalAnimationSpec` (L325): the modal window rail's width. */\n readonly modalWidth: SpringSpec | null;\n /** AnimatedNavigationItem `iconPositionProgress` (NavigationItem.kt L488-493). */\n readonly iconPosition: SpringSpec | null;\n /** ModalWideNavigationRail `positionProgress` (L593-598). */\n readonly position: SpringSpec | null;\n /** The modal scrim alpha (L826-831). */\n readonly scrim: SpringSpec | null;\n /** hideOnCollapse: ModalWideNavigationRailState (L732-736). */\n readonly slide: SpringSpec | null;\n}\n\n/** One frame of a {@link WideNavigationRailAnimation}. */\nexport interface WideNavigationRailSample {\n /** The items' iconPositionProgress (0 top icon … 1 start icon); expressive springs overshoot. */\n readonly item: number;\n /** The rail's minWidth / widthFullRange progress (0 collapsed … 1 expanded). */\n readonly width: number;\n /** itemVerticalSpacedBy / itemMinHeight progress (0 collapsed … 1 expanded). */\n readonly layout: number;\n /** Modal: the window (scrim + rail in the top layer) is shown. */\n readonly open: boolean;\n /**\n * The `expanded` WideNavigationRailLayout measures with: the target (non-modal); in the modal\n * window `hideOnCollapse || modalExpanded`; false for the collapsed rail of a modal one.\n */\n readonly railExpanded: boolean;\n /** Modal: the scrim alpha, 0…1. */\n readonly scrim: number;\n /** hideOnCollapse: 0 off screen (offset −width) … 1 in place. */\n readonly slide: number;\n /** Any value is still moving. */\n readonly running: boolean;\n}\n\nexport interface WideNavigationRailAnimationOptions {\n readonly expanded: boolean;\n /** ModalWideNavigationRail. */\n readonly modal?: boolean;\n /** ModalWideNavigationRail(hideOnCollapse = true): slides in expanded instead of expanding. */\n readonly hideOnCollapse?: boolean;\n /**\n * Visibility threshold of the width spring in progress units: animateDpAsState uses\n * Spring.DefaultDisplacementThreshold (0.01dp) over the width range (default: 0.01 / 264dp).\n */\n readonly widthThreshold?: number;\n /** Likewise for spacing / min height (default: 0.01 / 16dp, the min-height range). */\n readonly layoutThreshold?: number;\n}\n\nconst to = (expanded: boolean) => (expanded ? 1 : 0);\n\n/**\n * WideNavigationRailState plus the animations it drives. `setExpanded` retargets every value from\n * its current value and velocity (Compose `animate*AsState` / `Animatable.animateTo`).\n */\nexport class WideNavigationRailAnimation {\n readonly modal: boolean;\n readonly hideOnCollapse: boolean;\n #expanded: boolean;\n readonly #item: SpringAnimatable;\n readonly #width: SpringAnimatable;\n readonly #layout: SpringAnimatable;\n readonly #position: SpringAnimatable;\n readonly #scrim = new SpringAnimatable(0);\n readonly #slide: SpringAnimatable;\n #specs: WideNavigationRailSpecs | null = null;\n #open = false;\n #modalExpanded = false;\n /** hideOnCollapse: positionProgress waits for the slide out (animateToDismiss). */\n #closeAfterSlide = false;\n\n constructor(options: WideNavigationRailAnimationOptions) {\n this.modal = Boolean(options.modal);\n this.hideOnCollapse = this.modal && Boolean(options.hideOnCollapse);\n this.#expanded = options.expanded;\n const v = to(options.expanded);\n // hideOnCollapse lays the window rail out expanded (`expanded = hideOnCollapse || …`, L839).\n const laidOut = this.hideOnCollapse ? 1 : this.modal ? (options.expanded ? 1 : 0) : v;\n this.#item = new SpringAnimatable(this.hideOnCollapse ? 1 : v);\n this.#width = new SpringAnimatable(laidOut, options.widthThreshold ?? 0.01 / 264);\n this.#layout = new SpringAnimatable(laidOut, options.layoutThreshold ?? 0.01 / 16);\n this.#position = new SpringAnimatable(this.modal ? v : 0);\n this.#slide = new SpringAnimatable(v, 0.01 / 360);\n if (this.modal && options.expanded) {\n this.#open = true;\n this.#modalExpanded = true;\n this.#scrim.snapTo(1);\n }\n }\n\n /** WideNavigationRailState.targetValue. */\n get expanded(): boolean {\n return this.#expanded;\n }\n\n get isRunning(): boolean {\n return (\n this.#item.isRunning ||\n this.#width.isRunning ||\n this.#layout.isRunning ||\n this.#position.isRunning ||\n this.#scrim.isRunning ||\n this.#slide.isRunning ||\n this.#closeAfterSlide\n );\n }\n\n /** expand() / collapse() at `now` (ms). */\n setExpanded(expanded: boolean, specs: WideNavigationRailSpecs, now: number): void {\n this.sample(now);\n this.#specs = specs;\n if (expanded === this.#expanded) return;\n this.#expanded = expanded;\n const v = to(expanded);\n if (!this.modal) {\n this.#item.animateTo(v, specs.iconPosition, now);\n this.#width.animateTo(v, specs.width, now);\n this.#layout.animateTo(v, specs.width, now);\n return;\n }\n if (this.hideOnCollapse) {\n // isScrimVisible = modalState.targetValue != Collapsed (L819-824).\n this.#slide.animateTo(v, specs.slide, now);\n this.#scrim.animateTo(v, specs.scrim, now);\n if (expanded) {\n this.#closeAfterSlide = false;\n this.#position.animateTo(1, specs.position, now);\n } else {\n this.#closeAfterSlide = true;\n }\n this.sample(now);\n return;\n }\n // The items follow the state at once (railExpanded = state.targetValue in the samples).\n this.#item.animateTo(v, specs.iconPosition, now);\n this.#position.animateTo(v, specs.position, now);\n this.sample(now);\n }\n\n /** WideNavigationRailState.snapTo. */\n snapTo(expanded: boolean): void {\n this.#expanded = expanded;\n const v = to(expanded);\n this.#closeAfterSlide = false;\n if (!this.modal) {\n for (const a of [this.#item, this.#width, this.#layout]) a.snapTo(v);\n return;\n }\n this.#position.snapTo(v);\n this.#slide.snapTo(v);\n this.#scrim.snapTo(v);\n this.#open = expanded;\n this.#modalExpanded = expanded;\n if (!this.hideOnCollapse) {\n for (const a of [this.#item, this.#width, this.#layout]) a.snapTo(v);\n }\n }\n\n sample(now: number): WideNavigationRailSample {\n const item = this.#item.sample(now);\n if (this.modal) this.#sampleModal(now);\n const width = this.#width.sample(now);\n const layout = this.#layout.sample(now);\n return {\n item: Math.max(item, 0), // iconPositionProgress.coerceAtLeast(0f) (NavigationItem.kt L544)\n width,\n layout,\n open: this.#open,\n railExpanded: !this.modal\n ? this.#expanded\n : this.#open && (this.hideOnCollapse || this.#modalExpanded),\n scrim: Math.min(Math.max(this.#scrim.value, 0), 1),\n slide: this.#slide.value,\n running: this.isRunning,\n };\n }\n\n #sampleModal(now: number): void {\n const specs = this.#specs;\n if (this.hideOnCollapse) {\n this.#slide.sample(now);\n this.#scrim.sample(now);\n if (this.#closeAfterSlide && !this.#slide.isRunning) {\n this.#closeAfterSlide = false;\n this.#position.animateTo(0, specs?.position ?? null, now);\n }\n this.#open = this.#position.sample(now) > 0;\n return;\n }\n // isCollapsed = positionProgress == 0 (L599): the window shows while it is above 0.\n const position = this.#position.sample(now);\n const open = position > 0;\n const modalExpanded = position >= MODAL_RAIL_EXPANDED_PROGRESS;\n if (!open) {\n // The window and its animate*AsState values are dropped; the collapsed rail stays.\n this.#width.snapTo(0);\n this.#layout.snapTo(0);\n this.#scrim.snapTo(0);\n } else if (!this.#open) {\n // A new window composes its animate*AsState values at their targets.\n const v = to(modalExpanded);\n this.#width.snapTo(v);\n this.#layout.snapTo(v);\n this.#scrim.snapTo(v);\n } else if (modalExpanded !== this.#modalExpanded) {\n const v = to(modalExpanded);\n this.#width.animateTo(v, specs?.modalWidth ?? null, now);\n this.#layout.animateTo(v, specs?.width ?? null, now);\n this.#scrim.animateTo(v, specs?.scrim ?? null, now);\n }\n this.#scrim.sample(now);\n this.#open = open;\n this.#modalExpanded = open && modalExpanded;\n }\n}\n\n/** The dp values WideNavigationRailLayout and AnimatedNavigationItem measure with. */\nexport interface WideNavigationRailMetrics {\n /** NavigationRailCollapsedTokens.ContainerWidth (96dp). */\n readonly collapsedWidth: number;\n /** NavigationRailExpandedTokens.ContainerWidthMinimum (220dp). */\n readonly expandedMinWidth: number;\n /** NavigationRailExpandedTokens.ContainerWidthMaximum (360dp). */\n readonly expandedMaxWidth: number;\n /** WNRItemHorizontalPadding (20dp). */\n readonly itemHorizontalPadding: number;\n /** NavigationRailBaselineItemTokens.IconSize (24dp). */\n readonly iconSize: number;\n /** NavigationRailHorizontalItemTokens.IconLabelSpace (8dp). */\n readonly iconLabelSpace: number;\n /** Indicator horizontal padding per side, collapsed: (ActiveIndicatorWidth − IconSize) / 2. */\n readonly collapsedIndicatorPadding: number;\n /** Expanded: NavigationRailHorizontalItemTokens.FullWidthLeadingSpace. */\n readonly expandedIndicatorPadding: number;\n}\n\nconst lerp = (a: number, b: number, t: number) => a + (b - a) * t;\n\n/**\n * An item's measured width (placeAnimatedLabelAndIcon, NavigationItem.kt L1119-1133). `content` is\n * the item's start-icon pill width (icon + gap + label + both expanded paddings), or null for an\n * icon-only item (TopIconOrIconOnlyMeasurePolicy: the 56dp circle plus the padding on both sides).\n * `maxWidth` is the rail's item constraint (expanded: rail maximum − item padding).\n */\nexport function wideNavigationRailItemWidth(\n content: number | null,\n progress: number,\n m: WideNavigationRailMetrics,\n maxWidth: number,\n): number {\n const pad = m.itemHorizontalPadding;\n const indicatorPadding = lerp(m.collapsedIndicatorPadding, m.expandedIndicatorPadding, progress);\n if (content === null)\n return Math.min(m.iconSize + 2 * m.collapsedIndicatorPadding + 2 * pad, maxWidth);\n const gapAndLabel = content - m.iconSize - 2 * m.expandedIndicatorPadding;\n const label = gapAndLabel - m.iconLabelSpace;\n // widthTopIcon = max(label, topIconIndicatorWidth + 2·padding + indicator padding).\n const widthTop = Math.min(Math.max(label, m.iconSize + 2 * pad + 2 * indicatorPadding), maxWidth);\n // indicatorRipple: lerp(icon, icon + gap + label, p) + indicator padding; widthStartIcon adds one padding.\n const ripple = lerp(m.iconSize, m.iconSize + gapAndLabel, progress) + 2 * indicatorPadding;\n const widthStart = Math.min(ripple + pad, maxWidth);\n return widthTop + (widthStart - widthTop) * progress;\n}\n\nexport interface WideNavigationRailWidthInput {\n /** `expanded` passed to WideNavigationRailLayout (the state's target, or modalExpanded). */\n readonly expanded: boolean;\n /** minWidth / widthFullRange progress. */\n readonly widthProgress: number;\n /** The items' iconPositionProgress. */\n readonly itemProgress: number;\n /** Each item's start-icon pill width (null: icon only). */\n readonly items: readonly (number | null)[];\n /** The header's width (0 without one). */\n readonly header: number;\n /** The width of the previous frame (`currentWidth`). */\n readonly previousWidth: number;\n /** `actualMaxExpandedWidth > 0`: the rail was wider than its expanded minimum. */\n readonly wide: boolean;\n /** The available width (the rail's maximum when unconstrained). */\n readonly maxWidth?: number;\n readonly metrics: WideNavigationRailMetrics;\n}\n\n/**\n * WideNavigationRailLayout's measured width (L373-476): expanding, `widthFullRange` up to the\n * widest item (+ padding) or header when that is wider than the expanded minimum, else\n * `minWidth`; collapsing from such a rail, `widthFullRange` kept between `minWidth` and the previous\n * width. Returns the width and whether the rail is now `wide`.\n */\nexport function wideNavigationRailWidth(input: WideNavigationRailWidthInput): {\n width: number;\n wide: boolean;\n} {\n const m = input.metrics;\n const max = Math.min(input.maxWidth ?? m.expandedMaxWidth, m.expandedMaxWidth);\n const minWidth = Math.min(lerp(m.collapsedWidth, m.expandedMinWidth, input.widthProgress), max);\n const fullRange = lerp(m.collapsedWidth, m.expandedMaxWidth, input.widthProgress);\n const expandedMin = Math.min(m.expandedMinWidth, max);\n if (input.expanded) {\n const itemMax = max - m.itemHorizontalPadding;\n let widestItem = 0;\n for (const content of input.items) {\n const w = wideNavigationRailItemWidth(content, input.itemProgress, m, itemMax);\n widestItem = Math.max(widestItem, w + m.itemHorizontalPadding);\n }\n const widest = Math.max(widestItem, input.header);\n if (widest > minWidth && widest > expandedMin) {\n const constrain = Math.min(Math.max(widest, expandedMin), max);\n return { width: Math.min(fullRange, constrain), wide: true };\n }\n return { width: minWidth, wide: input.wide };\n }\n if (input.wide) {\n const upper = Math.max(input.previousWidth, minWidth);\n return { width: Math.min(Math.max(fullRange, minWidth), upper), wide: true };\n }\n return { width: minWidth, wide: false };\n}\n","/*\n * Copyright 2021 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationDrawer.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898,\n// compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/AnchoredDraggable.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n// and compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/FloatDecayAnimationSpec.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// DrawerState (NavigationDrawer.kt L129-297) over its AnchoredDraggableState: the sheet offset in\n// px between the Closed anchor (−sheet width) and the Open anchor (0).\n// - open() / close() (L180-190, L267-285): animate from the current offset *and velocity*\n// (lastVelocity) on the drawer's springs (open DefaultSpatial, close FastEffects; L354-355).\n// Springs may overshoot the anchors (the sheet is then stretched, DrawerSheet horizontalScaleUp).\n// - Drags (anchoredDraggable, AnchoredDraggable.kt L410-428) move the offset by the pointer delta,\n// coerced between the anchors (newOffsetForDelta), interrupting any animation.\n// - Release: AnchoredDraggableState.settle(velocity) (L1064-1085; DrawerState sets thresholds and\n// specs through the deprecated constructor, so usePreModifierChangeBehavior is true): the target\n// is computeTarget (L1485-1514; positional threshold 50% of the distance, velocity threshold\n// 400dp/s, NavigationDrawer.kt L1339-1341), reached by animateToWithDecay (L1403-1477): an\n// exponential decay (FloatExponentialDecaySpec, friction −4.2, velocity threshold 0.1;\n// FloatDecayAnimationSpec.kt L82-141) clamped at the target when it would reach it, else the\n// snap spec, AnchoredDraggableDefaultAnimationSpec = tween(256ms, FastOutSlowInEasing)\n// (NavigationDrawer.kt L1354; DrawerState captures it at construction, L134-146).\n// - The scrim alpha is calculateFraction(closed, open, offset) (L391, L1336-1337).\n// Time is injected (ms): m3e-elements drives it from its frame loop and tests step it.\n\nimport { SpringAnimatable } from './animatable.js';\nimport type { Easing } from './cubic-bezier.js';\nimport type { SpringSpec } from './spring.js';\n\n/** NavigationDrawer.kt `DrawerPositionalThreshold` (L1339): a fraction of the sheet width. */\nexport const DRAWER_POSITIONAL_THRESHOLD = 0.5;\n/** NavigationDrawer.kt `DrawerVelocityThreshold` (L1340-1341), in dp (= CSS px) per second. */\nexport const DRAWER_VELOCITY_THRESHOLD = 400;\n/** NavigationDrawer.kt `AnchoredDraggableDefaultAnimationSpec` (L1354): the settle tween. */\nexport const DRAWER_SETTLE_MILLIS = 256;\n/** FloatDecayAnimationSpec.kt `ExponentialDecayFriction` (L82; frictionMultiplier 1). */\nconst DECAY_FRICTION = -4.2;\n/** FloatExponentialDecaySpec's default `absVelocityThreshold` (L98). */\nconst DECAY_VELOCITY_THRESHOLD = 0.1;\n\n/** The springs and settle tween of a drawer (null jumps: reduced motion). */\nexport interface DrawerSpecs {\n readonly open: SpringSpec | null;\n readonly close: SpringSpec | null;\n /** AnchoredDraggableDefaultAnimationSpec; null (0ms) jumps. */\n readonly settle: { readonly duration: number; readonly easing: Easing } | null;\n}\n\n/** FloatExponentialDecaySpec.getTargetValue (L132-141). */\nexport function exponentialDecayTarget(value: number, velocity: number): number {\n if (Math.abs(velocity) <= DECAY_VELOCITY_THRESHOLD) return value;\n const duration =\n (Math.log(Math.abs(DECAY_VELOCITY_THRESHOLD / velocity)) / DECAY_FRICTION) * 1000;\n return (\n value -\n velocity / DECAY_FRICTION +\n (velocity / DECAY_FRICTION) * Math.exp((DECAY_FRICTION * duration) / 1000)\n );\n}\n\n/**\n * DraggableAnchors.computeTarget (AnchoredDraggable.kt L1485-1514) for the drawer's two anchors:\n * whether a release at `offset` (px, −width…0) with `velocity` (px/s, positive towards open)\n * settles open. `velocityThreshold` is px/s.\n */\nexport function drawerSettlesOpen(\n offset: number,\n velocity: number,\n width: number,\n velocityThreshold = DRAWER_VELOCITY_THRESHOLD,\n): boolean {\n const closed = -width;\n if (velocity === 0) return Math.abs(offset) <= Math.abs(offset - closed);\n const forward = velocity > 0;\n if (Math.abs(velocity) >= Math.abs(velocityThreshold)) return forward;\n const threshold = Math.abs(width * DRAWER_POSITIONAL_THRESHOLD);\n // Distance travelled from the anchor behind the movement.\n const fromStart = Math.abs((forward ? closed : 0) - offset);\n return fromStart >= threshold ? forward : !forward;\n}\n\ntype Mode = 'rest' | 'spring' | 'tween' | 'decay' | 'drag';\n\n/** One frame of a {@link DrawerAnimation}. */\nexport interface DrawerSample {\n /** Sheet offset in px: −width (closed) … 0 (open); above 0 while an open spring overshoots. */\n readonly offset: number;\n /** calculateFraction(closed, open, offset): 0 closed … 1 open (the scrim alpha). */\n readonly fraction: number;\n /** Something is moving (an animation or a drag). */\n readonly running: boolean;\n /** The sheet is visible (fraction > 0): Compose only places it then. */\n readonly visible: boolean;\n}\n\n/** DrawerState: the offset, its animations, drags and the settle after a release. */\nexport class DrawerAnimation {\n #width: number;\n #open: boolean;\n #settled: boolean;\n #mode: Mode = 'rest';\n readonly #spring: SpringAnimatable;\n #offset: number;\n #velocity = 0;\n // Tween / decay state.\n #from = 0;\n #to = 0;\n #v0 = 0;\n #start = 0;\n #duration = 0;\n #easing: Easing = (t) => t;\n\n /** @param open initial value (at rest); @param width the sheet width in px. */\n constructor(open: boolean, width: number) {\n this.#width = Math.max(0, width);\n this.#open = open;\n this.#settled = open;\n this.#offset = open ? 0 : -this.#width;\n this.#spring = new SpringAnimatable(this.#offset);\n }\n\n /** DrawerState.targetValue === Open. */\n get isOpen(): boolean {\n return this.#open;\n }\n\n /** DrawerState.currentValue === Open: the last anchor it settled on. */\n get isSettledOpen(): boolean {\n return this.#settled;\n }\n\n get isDragging(): boolean {\n return this.#mode === 'drag';\n }\n\n get width(): number {\n return this.#width;\n }\n\n /** Units: px per second, positive towards open (AnchoredDraggableState.lastVelocity). */\n get velocity(): number {\n return this.#velocity;\n }\n\n /** New anchors (the sheet was measured): at rest the offset follows its anchor. */\n setWidth(width: number): void {\n const w = Math.max(0, width);\n if (w === this.#width) return;\n const previous = this.#width;\n this.#width = w;\n if (this.#mode === 'rest') {\n this.#offset = this.#open ? 0 : -w;\n this.#spring.snapTo(this.#offset);\n } else if (this.#mode !== 'drag' && !this.#open && this.#to === -previous) {\n this.#to = -w;\n }\n }\n\n /** Jumps (DrawerState.snapTo). */\n snapTo(open: boolean): void {\n this.#mode = 'rest';\n this.#open = open;\n this.#settled = open;\n this.#offset = open ? 0 : -this.#width;\n this.#velocity = 0;\n this.#spring.snapTo(this.#offset);\n }\n\n /** DrawerState.open() / close() at `now` (ms): springs from the current offset and velocity. */\n animateTo(open: boolean, specs: DrawerSpecs, now: number): void {\n this.sample(now);\n if (this.#mode === 'drag') this.#mode = 'rest';\n this.#open = open;\n const target = open ? 0 : -this.#width;\n const spec = open ? specs.open : specs.close;\n if (spec === null || (this.#offset === target && this.#velocity === 0)) {\n this.snapTo(open);\n return;\n }\n // From the current offset and velocity (lastVelocity), whatever drove them.\n const velocity = this.#velocity;\n this.#spring.snapTo(this.#offset);\n this.#spring.animateTo(target, spec, now, velocity);\n if (this.#spring.isRunning) this.#mode = 'spring';\n else this.snapTo(open);\n }\n\n /** Grabs the sheet (pointer down past the slop): stops any animation where it is. */\n startDrag(now: number): void {\n this.sample(now);\n this.#mode = 'drag';\n this.#velocity = 0;\n }\n\n /** Moves the offset by `delta` px (positive towards open), coerced between the anchors. */\n dragBy(delta: number): void {\n if (this.#mode !== 'drag') return;\n this.#offset = Math.min(0, Math.max(-this.#width, this.#offset + delta));\n }\n\n /**\n * Ends a drag with the pointer `velocity` (px/s, positive towards open): picks the target\n * (computeTarget) and settles on it (animateToWithDecay). Returns whether it settles open.\n * `velocityThreshold`: DrawerVelocityThreshold in px/s.\n */\n release(\n velocity: number,\n specs: DrawerSpecs,\n now: number,\n velocityThreshold = DRAWER_VELOCITY_THRESHOLD,\n confirm: (open: boolean) => boolean = () => true,\n ): boolean {\n if (this.#mode !== 'drag') return this.#open;\n const proposed = drawerSettlesOpen(this.#offset, velocity, this.#width, velocityThreshold);\n // confirmValueChange: a veto rolls back to the previous value.\n const open = proposed === this.#settled || confirm(proposed) ? proposed : this.#settled;\n this.#open = open;\n const target = open ? 0 : -this.#width;\n const prev = this.#offset;\n this.#start = now;\n this.#from = prev;\n this.#to = target;\n this.#v0 = velocity;\n this.#velocity = velocity;\n if (prev === target) {\n this.snapTo(open);\n return open;\n }\n const towards = velocity * (target - prev) > 0;\n if (towards) {\n const projected = exponentialDecayTarget(prev, velocity);\n if (velocity > 0 ? projected >= target : projected <= target) {\n this.#mode = 'decay';\n this.#duration =\n (1000 * Math.log(DECAY_VELOCITY_THRESHOLD / Math.abs(velocity))) / DECAY_FRICTION;\n return open;\n }\n }\n if (specs.settle === null || specs.settle.duration <= 0) {\n this.snapTo(open);\n return open;\n }\n this.#mode = 'tween';\n this.#duration = specs.settle.duration;\n this.#easing = specs.settle.easing;\n return open;\n }\n\n /** Advances to `now` (ms). */\n sample(now: number): DrawerSample {\n switch (this.#mode) {\n case 'spring': {\n this.#offset = this.#spring.sample(now);\n this.#velocity = this.#spring.velocity;\n if (!this.#spring.isRunning) this.#settle();\n break;\n }\n case 'tween': {\n const elapsed = now - this.#start;\n if (elapsed >= this.#duration) {\n this.#settle();\n break;\n }\n const f = (t: number) => {\n const p = Math.min(1, Math.max(0, t / this.#duration));\n return this.#from + (this.#to - this.#from) * this.#easing(p);\n };\n const value = f(elapsed);\n // Finite difference (VectorizedTweenSpec derives the velocity numerically too).\n this.#velocity = (f(elapsed + 1) - value) * 1000;\n this.#offset = value;\n break;\n }\n case 'decay': {\n const t = (now - this.#start) / 1000;\n const value =\n this.#from -\n this.#v0 / DECAY_FRICTION +\n (this.#v0 / DECAY_FRICTION) * Math.exp(DECAY_FRICTION * t);\n const crossed = this.#v0 > 0 ? value >= this.#to : value <= this.#to;\n if (crossed || now - this.#start >= this.#duration) {\n this.#settle();\n break;\n }\n this.#offset = value;\n this.#velocity = this.#v0 * Math.exp(DECAY_FRICTION * t);\n break;\n }\n case 'drag':\n break;\n case 'rest':\n break;\n }\n const w = this.#width;\n const fraction =\n w <= 0 ? (this.#open ? 1 : 0) : Math.min(1, Math.max(0, (this.#offset + w) / w));\n return {\n offset: this.#offset,\n fraction,\n running: this.#mode !== 'rest',\n visible: fraction !== 0,\n };\n }\n\n #settle(): void {\n this.#mode = 'rest';\n this.#offset = this.#open ? 0 : -this.#width;\n this.#velocity = 0;\n this.#settled = this.#open;\n this.#spring.snapTo(this.#offset);\n }\n}\n","/*\n * Copyright 2022 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// The slider's value and track math, shared by m3e-elements' <m3e-slider> and m3e-react's\n// <Slider> / <RangeSlider> (one place, CLAUDE.md \"never duplicate\"); lengths in CSS px (= dp):\n// - Steps: Compose's `steps` is the number of stops between the ends; the web API takes a `step`\n// (a value increment), so `sliderSteps` = range / step − 1. Ticks are `steps + 2` fractions\n// i / (steps + 1) (stepsToTickFractions L2800); values snap to the nearest (snapValueToTick\n// L2775, SliderState.value with shouldAutoSnap L3431–3450, RangeSliderState setters L3656–3683),\n// coerced into the range first; a range thumb is coerced between the other thumb and its end of\n// the track, so the thumbs can meet but not cross.\n// - Keys (slideOnKeyEvents L1084–1215, rangeSliderOnKeyEvents L1217–1381): one step of\n// range / (steps + 1), or 1 % of the range without steps; PageUp / PageDown move\n// clamp(actualSteps / 10, 1, 10) steps; Home / End go to the thumb's bounds. Arrow directions\n// follow ARIA (see sliderKeyAction).\n// - Pointer: a press picks the closer range thumb, the start one when both are as close and it\n// lies after the pointer (RangeSliderLogic.compareOffsets L3197, rangeSliderPressDragModifier\n// L3074–3077); the pointer maps linearly onto the track (SliderState.dispatchRawDeltaInternal\n// L3466–3489: minPx = thumb width / 2, maxPx = width − thumb width / 2).\n// - Track (SliderImpl layout L992–1046 and SliderDefaults.drawTrack L2398–2671): the geometry\n// slider.css draws, for tests and checks: the thumb positions, the active and inactive parts with\n// their gaps, thresholds and corners, the stop indicators and the ticks.\n\n/** No `steps`: a key moves 1 % of the range (slideOnKeyEvents: `if (steps > 0) steps + 1 else 100`). */\nexport const SLIDER_KEY_DIVISIONS = 100;\n/** PageUp / PageDown: `(actualSteps / 10).coerceIn(1, 10)` steps. */\nexport const SLIDER_PAGE_DIVISOR = 10;\nexport const SLIDER_PAGE_MAX_STEPS = 10;\n\nconst clamp = (v: number, lo: number, hi: number) => Math.min(Math.max(v, lo), hi);\n\n/** Kotlin `lerp(start, stop, fraction)`. */\nconst lerp = (a: number, b: number, t: number) => a + (b - a) * t;\n\n/**\n * Compose `steps` for a web `step` (a value increment; 0, negative or absent = continuous):\n * the stops between the ends, `round((max − min) / step) − 1`, at least 0. A `step` that does not\n * divide the range gives evenly spaced ticks the nearest to it.\n */\nexport function sliderSteps(min: number, max: number, step?: number): number {\n if (step === undefined || !(step > 0) || !(max > min)) return 0;\n return Math.max(0, Math.round((max - min) / step) - 1);\n}\n\n/** stepsToTickFractions: `steps + 2` fractions i / (steps + 1); none without steps. */\nexport function sliderTickFractions(steps: number): number[] {\n if (steps <= 0) return [];\n return Array.from({ length: steps + 2 }, (_, i) => i / (steps + 1));\n}\n\n/** calcFraction: the 0..1 fraction `value` is of min..max (0 for an empty range). */\nexport function sliderFraction(value: number, min: number, max: number): number {\n return clamp(max - min === 0 ? 0 : (value - min) / (max - min), 0, 1);\n}\n\n/** The value at `fraction` of min..max. */\nexport const sliderValueAt = (fraction: number, min: number, max: number): number =>\n lerp(min, max, fraction);\n\n/** snapValueToTick in value space: the nearest tick value (the first of equals), or `value`. */\nexport function sliderSnap(value: number, steps: number, min: number, max: number): number {\n const ticks = sliderTickFractions(steps);\n if (ticks.length === 0) return value;\n let best = value;\n let distance = Infinity;\n for (const t of ticks) {\n const v = lerp(min, max, t);\n const d = Math.abs(v - value);\n if (d < distance) {\n distance = d;\n best = v;\n }\n }\n return best;\n}\n\n/** The bounds of one thumb: the track, or for a range thumb up to / from the other thumb. */\nexport interface SliderThumbBounds {\n readonly min: number;\n readonly max: number;\n}\n\n/**\n * The value a thumb takes for a requested `value`: coerced into its bounds, then snapped to the\n * nearest tick of the whole track (SliderState.value / RangeSliderState.startValue / endValue).\n */\nexport function sliderThumbValue(\n value: number,\n bounds: SliderThumbBounds,\n steps: number,\n min: number,\n max: number,\n): number {\n return sliderSnap(clamp(value, bounds.min, bounds.max), steps, min, max);\n}\n\n/** The bounds of thumb `index` among `values` (one thumb, or a range's start and end). */\nexport function sliderThumbBounds(\n values: readonly number[],\n index: number,\n min: number,\n max: number,\n): SliderThumbBounds {\n return {\n min: index > 0 ? (values[index - 1] ?? min) : min,\n max: index < values.length - 1 ? (values[index + 1] ?? max) : max,\n };\n}\n\n/** One key step: `rangeLength / actualSteps`. */\nexport function sliderKeyDelta(steps: number, min: number, max: number): number {\n const actual = steps > 0 ? steps + 1 : SLIDER_KEY_DIVISIONS;\n return Math.abs(max - min) / actual;\n}\n\n/** PageUp / PageDown: how many key steps a page is. */\nexport function sliderPageSteps(steps: number): number {\n const actual = steps > 0 ? steps + 1 : SLIDER_KEY_DIVISIONS;\n return clamp(Math.floor(actual / SLIDER_PAGE_DIVISOR), 1, SLIDER_PAGE_MAX_STEPS);\n}\n\nexport type SliderKeyAction =\n 'increment' | 'decrement' | 'page-increment' | 'page-decrement' | 'min' | 'max';\n\nexport interface SliderKeyOptions {\n readonly vertical?: boolean;\n /** Right-to-left layout: the horizontal arrows swap (Compose `sign = -1`). */\n readonly rtl?: boolean;\n /** Shift held: an arrow moves a page (m3.material.io \"a larger interval\"; React Aria). */\n readonly shiftKey?: boolean;\n}\n\n/**\n * What a key does. Compose: ArrowRight / ArrowLeft on a horizontal slider (swapped in RTL),\n * ArrowUp / ArrowDown on a vertical one (minimum at the bottom: up increases, owner decision\n * M8 #21), PageUp / PageDown, Home / End. The web adds the other arrow pair per the ARIA slider\n * pattern (Up / Right increase) and Shift + arrow for a page (m3.material.io keyboard table);\n * Compose ignores them. Other keys: null.\n */\nexport function sliderKeyAction(\n key: string,\n options: SliderKeyOptions = {},\n): SliderKeyAction | null {\n const { vertical = false, rtl = false, shiftKey = false } = options;\n const page = (up: boolean): SliderKeyAction =>\n shiftKey ? (up ? 'page-increment' : 'page-decrement') : up ? 'increment' : 'decrement';\n switch (key) {\n case 'ArrowUp':\n return page(true);\n case 'ArrowDown':\n return page(false);\n case 'ArrowRight':\n return page(vertical || !rtl);\n case 'ArrowLeft':\n return page(!(vertical || !rtl));\n case 'PageUp':\n return 'page-increment';\n case 'PageDown':\n return 'page-decrement';\n case 'Home':\n return 'min';\n case 'End':\n return 'max';\n default:\n return null;\n }\n}\n\n/**\n * The value a key action gives thumb `index` (the result is coerced into the thumb's bounds and\n * snapped). Home / End go to the thumb's bounds: a range start thumb's End meets the end thumb.\n */\nexport function sliderKeyValue(\n action: SliderKeyAction,\n values: readonly number[],\n index: number,\n steps: number,\n min: number,\n max: number,\n): number {\n const value = values[index] ?? min;\n const bounds = sliderThumbBounds(values, index, min, max);\n const delta = sliderKeyDelta(steps, min, max);\n const page = sliderPageSteps(steps) * delta;\n const target =\n action === 'increment'\n ? value + delta\n : action === 'decrement'\n ? value - delta\n : action === 'page-increment'\n ? value + page\n : action === 'page-decrement'\n ? value - page\n : action === 'min'\n ? bounds.min\n : bounds.max;\n return sliderThumbValue(target, bounds, steps, min, max);\n}\n\n/**\n * The range thumb a press at `value` moves (RangeSliderLogic): the closer one; when both are as\n * close, the start thumb if it lies after the pointer (stacked thumbs pressed before them), else\n * the end thumb.\n */\nexport function sliderClosestThumb(values: readonly number[], value: number): number {\n const [start, end] = values;\n if (start === undefined || end === undefined) return 0;\n const diffStart = Math.abs(start - value);\n const diffEnd = Math.abs(end - value);\n if (diffStart !== diffEnd) return diffStart < diffEnd ? 0 : 1;\n return start > value ? 0 : 1;\n}\n\n/** Input of `sliderTrackGeometry` (one axis; slider.css mirrors it for RTL and vertical). */\nexport interface SliderTrackInput {\n /** Track length: the slider's length less the thumb width. */\n readonly length: number;\n /** Outer corner size (the default Track: thickness / 2). */\n readonly cornerSize: number;\n /** TrackInsideCornerSize. */\n readonly insideCornerSize: number;\n /** ThumbWidth (the thumb's layout size along the track; its handle may be narrower). */\n readonly thumbWidth: number;\n /** ThumbTrackGapSize. */\n readonly gapSize: number;\n readonly steps: number;\n /** The single thumb's fraction, or the range end's. */\n readonly fraction: number;\n /** A range's start fraction. */\n readonly startFraction?: number;\n readonly centered?: boolean;\n /** Track(trackCornerSize) and CenteredTrack shrink corners; the default Track does not. */\n readonly cornerShrinking?: boolean;\n /** Stop indicators drawn (SliderWithTrackIconsSample passes null). Default true. */\n readonly stopIndicator?: boolean;\n}\n\nexport type SliderTrackPartKind = 'inactive-start' | 'active' | 'inactive-end';\n\nexport interface SliderTrackPart {\n readonly kind: SliderTrackPartKind;\n readonly start: number;\n readonly end: number;\n readonly startRadius: number;\n readonly endRadius: number;\n}\n\nexport interface SliderTick {\n readonly position: number;\n readonly active: boolean;\n}\n\nexport interface SliderTrackGeometry {\n /** Thumb centres along the track (one, or a range's start and end). */\n readonly thumbs: readonly number[];\n readonly parts: readonly SliderTrackPart[];\n /** Stop indicator centres. */\n readonly stops: readonly number[];\n readonly ticks: readonly SliderTick[];\n}\n\n/**\n * SliderImpl's thumb placement and drawTrack (LTR, horizontal), in track coordinates: with steps,\n * a value off the first and last tick sits between the corners\n * ((length − 2 × corner) × fraction + corner), else length × fraction.\n */\nexport function sliderTrackGeometry(input: SliderTrackInput): SliderTrackGeometry {\n const {\n length,\n cornerSize: c,\n insideCornerSize: inside,\n thumbWidth,\n gapSize,\n steps,\n fraction,\n centered = false,\n cornerShrinking = false,\n stopIndicator = true,\n } = input;\n const range = input.startFraction !== undefined;\n const ticks = sliderTickFractions(steps);\n const onEdge = (f: number) => f === ticks[0] || f === ticks[ticks.length - 1];\n const position = (f: number) =>\n ticks.length > 0 && !onEdge(f) ? (length - c * 2) * f + c : length * f;\n const end = position(fraction);\n const start = range ? position(input.startFraction) : 0;\n const centre = length / 2;\n // Thumb widths per gap: a centered slider has a start gap only while not after the centre and\n // an end gap only while not before it (each still ThumbTrackGapSize wide without the thumb).\n const before = fraction < 0.5;\n const after = fraction > 0.5;\n const startThumb = centered ? (!after ? thumbWidth : 0) : range ? thumbWidth : 0;\n const endThumb = centered ? (!before ? thumbWidth : 0) : thumbWidth;\n const startGapSize = centered || range ? gapSize : 0;\n const startGap = startGapSize > 0 ? startThumb / 2 + startGapSize : 0;\n const endGap = gapSize > 0 ? endThumb / 2 + gapSize : 0;\n const thresholdCorner = !cornerShrinking || ticks.length > 0;\n const parts: SliderTrackPart[] = [];\n const stops: number[] = [];\n\n // Inactive track before the start (range) or the centre (centered).\n const adjustedEnd = centered ? Math.min(end, centre) : start;\n const rangeThreshold = startGap + (thresholdCorner ? c : 0);\n if ((centered || range) && adjustedEnd > rangeThreshold) {\n parts.push({\n kind: 'inactive-start',\n start: 0,\n end: adjustedEnd - startGap,\n startRadius: c,\n endRadius: inside,\n });\n if (stopIndicator) stops.push(c);\n }\n // Inactive track after the thumb (or the centre).\n const adjustedStart = centered ? Math.max(end, centre) : end;\n const inactiveThreshold = length - endGap - (thresholdCorner ? c : 0);\n if (adjustedStart < inactiveThreshold) {\n parts.push({\n kind: 'inactive-end',\n start: adjustedStart + endGap,\n end: length,\n startRadius: inside,\n endRadius: c,\n });\n if (stopIndicator) stops.push(length - c);\n }\n // Active track.\n const activeStart = centered\n ? adjustedEnd + (adjustedEnd < centre ? startGap : 0)\n : range\n ? start + startGap\n : 0;\n const activeEnd = centered ? adjustedStart - (adjustedStart > centre ? endGap : 0) : end - endGap;\n const activeStartRadius = centered || range ? inside : c;\n const activeThreshold = thresholdCorner ? activeStartRadius : 0;\n if (activeEnd - activeStart > activeThreshold) {\n parts.push({\n kind: 'active',\n start: activeStart,\n end: activeEnd,\n startRadius: activeStartRadius,\n endRadius: inside,\n });\n }\n\n // Ticks between the corners, skipping the stop indicators' and those in a gap.\n const tickList: SliderTick[] = [];\n const centreGap = centered ? (end > centre ? startGap : endGap) : 0;\n const thumbGap = centered ? (end > centre ? endGap : startGap) : endGap;\n ticks.forEach((t, i) => {\n if (stopIndicator && (((centered || range) && i === 0) || i === ticks.length - 1)) return;\n const p = lerp(c, length - c, t);\n const within = (centreOf: number, gap: number) => p >= centreOf - gap && p <= centreOf + gap;\n if (\n (centered && within(centre, centreGap)) ||\n (range && within(start, startGap)) ||\n within(end, thumbGap)\n ) {\n return;\n }\n tickList.push({ position: p, active: p >= activeStart && p <= activeEnd });\n });\n\n return { thumbs: range ? [start, end] : [end], parts, stops, ticks: tickList };\n}\n","/*\n * Copyright 2022 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TabRow.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// The tab rows' indicator and scroll math, in CSS px (= dp):\n// - TabPosition (L946-973): a tab's left edge, width and contentWidth. Fixed rows (TabRowImpl\n// L454-465): rowWidth / count wide tabs, contentWidth = min(intrinsic width, tab width) −\n// 2 × HorizontalTextPadding; scrollable rows (ScrollableTabRowImpl L597-613): at least\n// minTabWidth wide from edgePadding, contentWidth = intrinsic width − 2 × HorizontalTextPadding;\n// both at least 24dp (\"minimum touch target\"). The caller measures the tab content directly\n// (the intrinsic width less the padding), so `tabPositions` only accumulates and clamps.\n// - TabIndicatorOffsetNode (L680-751): two Animatable<Dp>s, the indicator offset (the selected\n// tab's left) and width (contentWidth for PrimaryIndicator, matchContentSize = true; width for\n// SecondaryIndicator), each retargeted with animateTo(target, DefaultSpatial) when its target\n// changes, so a new selection starts from the current value and velocity; the first layout\n// snaps. The indicator is centred in the selected tab's slot: x = offset + (tab width − width)/2\n// (fixed rows: the indicator constraints are the tab width; scrollable rows: relativeOffset,\n// L634-638), so its centre is offset + tab width / 2. In RTL the offset is negated (mirrored).\n// - ScrollableTabData.calculateTabOffset (L1168-1184): the scroll position that centres the\n// selected tab, clamped to the scroll range; animateScrollTo runs it on DefaultSpatial from rest.\n// Time is injected (ms): m3e-elements drives it from its frame loop and tests step it.\n\nimport { SpringAnimatable } from './animatable.js';\nimport type { SpringSpec } from './spring.js';\n\n/** TabRow.kt L461 / L608: `maxOf(contentWidth, 24.dp)` (\"Enforce minimum touch target of 24.dp\"). */\nexport const TAB_INDICATOR_MIN_WIDTH = 24;\n\n/**\n * Visibility threshold of the indicator Animatables (Animatable<Dp> on a MotionScheme spring with\n * no threshold: Spring.DefaultDisplacementThreshold, 0.01dp), and of animateScrollTo's Float.\n */\nconst THRESHOLD = 0.01;\n\nexport type TabRowVariant = 'primary' | 'secondary';\n\n/** What the caller measures per tab: its laid-out width and its content's width. */\nexport interface TabMeasure {\n readonly width: number;\n readonly contentWidth: number;\n}\n\n/** Compose `TabPosition`. */\nexport interface TabPosition {\n readonly left: number;\n readonly width: number;\n readonly contentWidth: number;\n}\n\n/** The tabs' positions from `start` (a scrollable row's edge padding; 0 for a fixed row). */\nexport function tabPositions(\n tabs: readonly TabMeasure[],\n start = 0,\n minIndicatorWidth = TAB_INDICATOR_MIN_WIDTH,\n): TabPosition[] {\n let left = start;\n return tabs.map(({ width, contentWidth }) => {\n const position = { left, width, contentWidth: Math.max(contentWidth, minIndicatorWidth) };\n left += width;\n return position;\n });\n}\n\n/** The indicator's target: offset (the tab's left) and width (per variant). */\nexport function tabIndicatorTarget(\n position: TabPosition,\n variant: TabRowVariant,\n): { offset: number; width: number } {\n return {\n offset: position.left,\n width: variant === 'primary' ? position.contentWidth : position.width,\n };\n}\n\n/** One frame of the indicator. */\nexport interface TabIndicatorSample {\n /** The animated offset (a tab's left edge). */\n readonly offset: number;\n readonly width: number;\n readonly running: boolean;\n}\n\n/** TabIndicatorOffsetNode: the offset and width Animatables. */\nexport class TabIndicatorAnimation {\n #offset: SpringAnimatable;\n #width: SpringAnimatable;\n\n /** Starts at rest on the first layout's target (Compose: initialOffset / initialWidth). */\n constructor(offset: number, width: number) {\n this.#offset = new SpringAnimatable(offset, THRESHOLD);\n this.#width = new SpringAnimatable(width, THRESHOLD);\n }\n\n get offset(): SpringAnimatable {\n return this.#offset;\n }\n\n get width(): SpringAnimatable {\n return this.#width;\n }\n\n get running(): boolean {\n return this.#offset.isRunning || this.#width.isRunning;\n }\n\n /**\n * Retargets each Animatable whose target changed, from its value and velocity at `now`; a null\n * spec (reduced motion) jumps.\n */\n animateTo(offset: number, width: number, spec: SpringSpec | null, now: number): void {\n if (width !== this.#width.target) this.#width.animateTo(width, spec, now);\n if (offset !== this.#offset.target) this.#offset.animateTo(offset, spec, now);\n }\n\n snapTo(offset: number, width: number): void {\n this.#offset.snapTo(offset);\n this.#width.snapTo(width);\n }\n\n sample(now: number): TabIndicatorSample {\n const offset = this.#offset.sample(now);\n const width = this.#width.sample(now);\n return { offset, width, running: this.running };\n }\n}\n\n/**\n * The indicator's shift from where the selected tab draws it at rest (centred in the tab), in the\n * row's logical direction: the centre is offset + tab width / 2 in both cases, so the shift is the\n * animated offset less the tab's left.\n */\nexport const tabIndicatorShift = (sample: { offset: number }, selected: TabPosition): number =>\n sample.offset - selected.left;\n\n/**\n * ScrollableTabData.calculateTabOffset: the scroll position centring `tab` (its left includes the\n * edge padding) in a row `scrollWidth` wide (edge padding × 2 + the tabs) seen through\n * `visibleWidth`, clamped to the scroll range.\n */\nexport function scrollableTabOffset(\n tab: Pick<TabPosition, 'left' | 'width'>,\n scrollWidth: number,\n visibleWidth: number,\n): number {\n const centered = tab.left - (visibleWidth / 2 - tab.width / 2);\n const available = Math.max(scrollWidth - visibleWidth, 0);\n return Math.min(Math.max(centered, 0), available);\n}\n\n/** animateScrollTo: a Float animation from the current scroll position, from rest. */\nexport class TabScrollAnimation {\n readonly value: SpringAnimatable;\n\n constructor(position: number) {\n this.value = new SpringAnimatable(position, THRESHOLD);\n }\n\n /** Starts a new scroll from `from` (the scroll state's value), velocity 0. */\n animateTo(from: number, target: number, spec: SpringSpec | null, now: number): void {\n this.value.snapTo(from);\n this.value.animateTo(target, spec, now, 0);\n }\n}\n","/*\n * Copyright 2023 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/adaptive/adaptive-layout/src/commonMain/kotlin/androidx/compose/material3/adaptive/layout/ThreePaneScaffoldValue.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n// and (Copyright 2023-2025 The Android Open Source Project, same license), at the same commit, from\n// compose/material3/adaptive/adaptive-layout/src/commonMain/kotlin/androidx/compose/material3/adaptive/layout/ThreePaneScaffold.kt,\n// .../layout/PaneMotion.kt, .../layout/AdaptStrategy.kt, .../layout/PaneExpansionState.kt,\n// .../layout/ListDetailPaneScaffold.kt, .../layout/SupportingPaneScaffold.kt and\n// compose/material3/adaptive/adaptive-navigation/src/commonMain/kotlin/androidx/compose/material3/adaptive/navigation/ThreePaneScaffoldNavigator.kt,\n// .../navigation/BackNavigationBehavior.kt.\n//\n// The canonical list-detail and supporting-pane layouts (COMPONENT_SPEC §16a) as pure functions:\n// - calculateThreePaneScaffoldValue (ThreePaneScaffoldValue.kt L86-190): which pane is expanded,\n// reflowed or hidden for a directive's partitions, the adapt strategies and the destination\n// history. AdaptStrategy.Levitate is not ported (its dialog / sheet presentation waits for M9).\n// - ThreePaneScaffoldNavigator (DefaultThreePaneScaffoldNavigator, ThreePaneScaffoldNavigator.kt\n// L359-490): the destination history behind navigateTo / navigateBack and the four\n// BackNavigationBehaviors. Synchronous here: the caller animates.\n// - threePaneScaffoldLayout (ThreePaneContentMeasurePolicy.measure, ThreePaneScaffold.kt\n// L256-771): pane bounds from the preferred widths (the directive's default or a pane's own),\n// the remaining width to the highest-priority expanded pane or every pane scaled down, the\n// reflowed pane under its anchor, and the pane expansion (drag handle) split. Hinges\n// (excludedBounds) and levitated panes are not ported.\n// - calculatePaneMotion and the slide offsets (PaneMotion.kt L276-476, L636-750).\n// - Pane expansion anchors (PaneExpansionState.kt L345-366, L610-646, L700-860).\n// Sizes are dp, which the web reads as CSS px; geometry is physical left-to-right: pass the pane\n// order already mirrored for RTL (ThreePaneScaffoldHorizontalOrder.toLtrOrder).\nimport { SpringAnimatable } from './animatable.js';\nimport { type SpringSpec, springDurationMillis } from './spring.js';\nimport type { WindowSizeClass, WindowWidthSizeClass } from './window-size-class.js';\nimport { type PaneScaffoldDirective, paneScaffoldDirective } from './window-size-class.js';\n\n/** ThreePaneScaffoldRole. */\nexport type ThreePaneScaffoldRole = 'primary' | 'secondary' | 'tertiary';\n\n/** Roles in priority order (forEachPaneByPriority's tail, ThreePaneScaffoldValue.kt L187-189). */\nexport const THREE_PANE_SCAFFOLD_ROLES: readonly ThreePaneScaffoldRole[] = [\n 'primary',\n 'secondary',\n 'tertiary',\n];\n\n/** ThreePaneScaffoldDefaults.Primary/Secondary/TertiaryPanePriority (ThreePaneScaffold.kt L1049-1051). */\nconst PRIORITY: Readonly<Record<ThreePaneScaffoldRole, number>> = {\n primary: 10,\n secondary: 5,\n tertiary: 1,\n};\n\n/** AdaptStrategy.Hide, or AdaptStrategy.Reflow(reflowUnder). */\nexport type AdaptStrategy = 'hide' | { readonly reflowUnder: ThreePaneScaffoldRole };\n\nexport type ThreePaneScaffoldAdaptStrategies = Readonly<\n Record<ThreePaneScaffoldRole, AdaptStrategy>\n>;\n\n/** ListDetailPaneScaffoldDefaults.adaptStrategies() (L208-217): every pane hides. */\nexport const LIST_DETAIL_ADAPT_STRATEGIES: ThreePaneScaffoldAdaptStrategies = {\n primary: 'hide',\n secondary: 'hide',\n tertiary: 'hide',\n};\n\n/**\n * SupportingPaneScaffoldDefaults.adaptStrategies() (L190-200): the supporting pane reflows under\n * the main pane; the others hide.\n */\nexport const SUPPORTING_PANE_ADAPT_STRATEGIES: ThreePaneScaffoldAdaptStrategies = {\n primary: 'hide',\n secondary: { reflowUnder: 'primary' },\n tertiary: 'hide',\n};\n\n/** ListDetailPaneScaffoldRole (ListDetailPaneScaffold.kt L238-259). */\nexport const ListDetailPaneScaffoldRole = /* @__PURE__ */ Object.freeze({\n List: 'secondary',\n Detail: 'primary',\n Extra: 'tertiary',\n} as const);\n\n/** SupportingPaneScaffoldRole (SupportingPaneScaffold.kt L221-243). */\nexport const SupportingPaneScaffoldRole = /* @__PURE__ */ Object.freeze({\n Main: 'primary',\n Supporting: 'secondary',\n Extra: 'tertiary',\n} as const);\n\n/** Start-to-end order: list (secondary), detail (primary), extra (ListDetailPaneScaffold L224-229). */\nexport const LIST_DETAIL_PANE_ORDER: readonly ThreePaneScaffoldRole[] = [\n 'secondary',\n 'primary',\n 'tertiary',\n];\n\n/** Start-to-end order: main, supporting, extra (SupportingPaneScaffold L207-212). */\nexport const SUPPORTING_PANE_ORDER: readonly ThreePaneScaffoldRole[] = [\n 'primary',\n 'secondary',\n 'tertiary',\n];\n\n/** PaneAdaptedValue (Levitated is not ported). */\nexport type PaneAdaptedValue = 'expanded' | 'reflowed' | 'hidden';\n\n/** ThreePaneScaffoldValue. */\nexport interface ThreePaneScaffoldValue {\n readonly primary: PaneAdaptedValue;\n readonly secondary: PaneAdaptedValue;\n readonly tertiary: PaneAdaptedValue;\n /** The destination the value was calculated for (internal in Compose; not part of equality). */\n readonly currentDestination: ThreePaneScaffoldRole | null;\n}\n\n/** ThreePaneScaffoldValue.equals (L260-267): the three adapted values. */\nexport function sameThreePaneScaffoldValue(\n a: ThreePaneScaffoldValue,\n b: ThreePaneScaffoldValue,\n): boolean {\n return a.primary === b.primary && a.secondary === b.secondary && a.tertiary === b.tertiary;\n}\n\n/** ThreePaneScaffoldDestinationItem. */\nexport interface ThreePaneScaffoldDestinationItem<T = unknown> {\n readonly pane: ThreePaneScaffoldRole;\n readonly contentKey?: T | undefined;\n}\n\n/**\n * calculateThreePaneScaffoldValue (ThreePaneScaffoldValue.kt L86-179): the last destination\n * first, then the earlier ones (newest first), then primary, secondary, tertiary each take a free\n * horizontal partition; with a single partition and `maxVerticalPartitions` ≥ 2, the first pane\n * whose strategy is Reflow goes under its (expanded) anchor instead.\n */\nexport function calculateThreePaneScaffoldValue(\n maxHorizontalPartitions: number,\n adaptStrategies: ThreePaneScaffoldAdaptStrategies,\n destinationHistory: readonly ThreePaneScaffoldDestinationItem[],\n maxVerticalPartitions = 1,\n): ThreePaneScaffoldValue {\n let expandedCount = 0;\n const values: Partial<Record<ThreePaneScaffoldRole, PaneAdaptedValue>> = {};\n let checkReflowedPane =\n maxHorizontalPartitions === 1 &&\n maxVerticalPartitions > 1 &&\n THREE_PANE_SCAFFOLD_ROLES.some((r) => adaptStrategies[r] !== 'hide');\n const order = [...destinationHistory.map((d) => d.pane).reverse(), ...THREE_PANE_SCAFFOLD_ROLES];\n for (const pane of order) {\n const hasAvailablePartition = expandedCount < maxHorizontalPartitions;\n if (!hasAvailablePartition && !checkReflowedPane) break;\n if (values[pane] !== undefined) continue;\n let reflowedPane: ThreePaneScaffoldRole | null = null;\n let anchorPane = pane;\n let anchorValue: PaneAdaptedValue | undefined;\n const strategy = adaptStrategies[pane];\n if (checkReflowedPane && strategy !== 'hide') {\n reflowedPane = pane;\n anchorPane = strategy.reflowUnder;\n anchorValue = values[anchorPane];\n }\n if (anchorValue === undefined) {\n if (!hasAvailablePartition) continue;\n values[anchorPane] = 'expanded';\n expandedCount++;\n } else if (anchorValue !== 'expanded') {\n continue;\n }\n if (reflowedPane !== null) {\n values[reflowedPane] = 'reflowed';\n checkReflowedPane = false;\n }\n }\n return {\n primary: values.primary ?? 'hidden',\n secondary: values.secondary ?? 'hidden',\n tertiary: values.tertiary ?? 'hidden',\n currentDestination: destinationHistory[destinationHistory.length - 1]?.pane ?? null,\n };\n}\n\n/** The roles a value expands, in `order` (start to end). */\nexport function expandedPanes(\n value: ThreePaneScaffoldValue,\n order: readonly ThreePaneScaffoldRole[],\n): ThreePaneScaffoldRole[] {\n return order.filter((r) => value[r] === 'expanded');\n}\n\n// --- Directive ----------------------------------------------------------------------------------\n\n/**\n * How many panes may sit side by side: `recommended` (the default, owner decision 2026-10-18) =\n * m3.material.io Breakpoints (1 / 1 / 2 / 2 / 3: two panes at large, three at extra-large), never\n * more than Compose allows; `compose` = calculatePaneScaffoldDirective (1 / 1 / 2 / 3 / 3 by width\n * class: three panes from large).\n */\nexport type PaneRule = 'compose' | 'recommended';\n\n/** m3.material.io Foundations › Layout › Breakpoints, \"recommended\" pane counts (FOUNDATIONS §9). */\nexport const RECOMMENDED_MAX_PANES: Readonly<Record<WindowWidthSizeClass, number>> =\n /* @__PURE__ */ Object.freeze({\n compact: 1,\n medium: 1,\n expanded: 2,\n large: 2,\n 'extra-large': 3,\n });\n\nexport interface ThreePaneScaffoldDirectiveOptions {\n /** Default `recommended`; `compose` keeps calculatePaneScaffoldDirective's counts. */\n paneRule?: PaneRule | undefined;\n isTabletop?: boolean | undefined;\n}\n\n/**\n * paneScaffoldDirective (calculatePaneScaffoldDirective) with the `paneRule` cap applied: capped by\n * RECOMMENDED_MAX_PANES unless `paneRule` is `compose`.\n */\nexport function threePaneScaffoldDirective(\n sizeClass: WindowSizeClass,\n options: ThreePaneScaffoldDirectiveOptions = {},\n): PaneScaffoldDirective {\n const directive = paneScaffoldDirective(sizeClass, options);\n if (options.paneRule === 'compose') return directive;\n return {\n ...directive,\n maxHorizontalPartitions: Math.min(\n directive.maxHorizontalPartitions,\n RECOMMENDED_MAX_PANES[sizeClass.widthClass],\n ),\n };\n}\n\n// --- Navigator ----------------------------------------------------------------------------------\n\n/** BackNavigationBehavior (BackNavigationBehavior.kt L40-75). */\nexport type BackNavigationBehavior =\n | 'pop-latest'\n | 'pop-until-scaffold-value-change'\n | 'pop-until-current-destination-change'\n | 'pop-until-content-change';\n\nexport interface ThreePaneScaffoldNavigatorOptions<T> {\n scaffoldDirective: PaneScaffoldDirective;\n adaptStrategies: ThreePaneScaffoldAdaptStrategies;\n /** Default `true` (rememberListDetailPaneScaffoldNavigator). */\n isDestinationHistoryAware?: boolean | undefined;\n /** Default: the list pane (list-detail) or main pane (supporting pane); see the defaults below. */\n initialDestinationHistory: readonly ThreePaneScaffoldDestinationItem<T>[];\n}\n\n/** DefaultListDetailPaneHistory (ThreePaneScaffoldNavigator.kt L536-537): the list. */\nexport const LIST_DETAIL_INITIAL_HISTORY: readonly ThreePaneScaffoldDestinationItem<never>[] = [\n { pane: 'secondary' },\n];\n\n/** DefaultSupportingPaneHistory (L540-541): the main pane. */\nexport const SUPPORTING_PANE_INITIAL_HISTORY: readonly ThreePaneScaffoldDestinationItem<never>[] = [\n { pane: 'primary' },\n];\n\n/**\n * DefaultThreePaneScaffoldNavigator (ThreePaneScaffoldNavigator.kt L359-490) without Compose's\n * transition state: navigateTo / navigateBack change the history and the value at once; the\n * caller animates (and Compose's directive change snaps, L349-354: so does setting\n * `scaffoldDirective` here). Content keys compare with Object.is (Kotlin `equals` for data\n * classes: use primitives or shared objects).\n */\nexport class ThreePaneScaffoldNavigator<T = unknown> {\n #history: ThreePaneScaffoldDestinationItem<T>[];\n #directive: PaneScaffoldDirective;\n #strategies: ThreePaneScaffoldAdaptStrategies;\n #historyAware: boolean;\n #value: ThreePaneScaffoldValue;\n readonly #listeners = new Set<() => void>();\n\n constructor(options: ThreePaneScaffoldNavigatorOptions<T>) {\n this.#history = [...options.initialDestinationHistory];\n this.#directive = options.scaffoldDirective;\n this.#strategies = options.adaptStrategies;\n this.#historyAware = options.isDestinationHistoryAware ?? true;\n this.#value = this.#calculate(this.#history.length - 1);\n }\n\n get scaffoldDirective(): PaneScaffoldDirective {\n return this.#directive;\n }\n\n set scaffoldDirective(directive: PaneScaffoldDirective) {\n this.#directive = directive;\n this.#recalculate();\n }\n\n get adaptStrategies(): ThreePaneScaffoldAdaptStrategies {\n return this.#strategies;\n }\n\n set adaptStrategies(strategies: ThreePaneScaffoldAdaptStrategies) {\n this.#strategies = strategies;\n this.#recalculate();\n }\n\n get isDestinationHistoryAware(): boolean {\n return this.#historyAware;\n }\n\n set isDestinationHistoryAware(aware: boolean) {\n this.#historyAware = aware;\n this.#recalculate();\n }\n\n /** The destination history, oldest first. */\n get destinationHistory(): readonly ThreePaneScaffoldDestinationItem<T>[] {\n return this.#history;\n }\n\n get currentDestination(): ThreePaneScaffoldDestinationItem<T> | null {\n return this.#history[this.#history.length - 1] ?? null;\n }\n\n get scaffoldValue(): ThreePaneScaffoldValue {\n return this.#value;\n }\n\n /** Calls `listener` after every change of the history or the value; returns the unsubscriber. */\n subscribe(listener: () => void): () => void {\n this.#listeners.add(listener);\n return () => {\n this.#listeners.delete(listener);\n };\n }\n\n peekPreviousScaffoldValue(\n behavior: BackNavigationBehavior = 'pop-until-scaffold-value-change',\n ): ThreePaneScaffoldValue {\n const index = this.#previousIndex(behavior);\n return index === -1 ? this.#value : this.#calculate(index);\n }\n\n navigateTo(pane: ThreePaneScaffoldRole, contentKey?: T): void {\n this.#history.push({ pane, contentKey });\n this.#recalculate(true);\n }\n\n canNavigateBack(behavior: BackNavigationBehavior = 'pop-until-scaffold-value-change'): boolean {\n return this.#previousIndex(behavior) >= 0;\n }\n\n /** Returns true when there was a destination to go back to (else the history is cleared). */\n navigateBack(behavior: BackNavigationBehavior = 'pop-until-scaffold-value-change'): boolean {\n const previous = this.#previousIndex(behavior);\n if (previous < 0) {\n this.#history = [];\n this.#recalculate(true);\n return false;\n }\n this.#history.length = previous + 1;\n this.#recalculate(true);\n return true;\n }\n\n #recalculate(force = false): void {\n const next = this.#calculate(this.#history.length - 1);\n const changed = force || !sameThreePaneScaffoldValue(next, this.#value);\n this.#value = next;\n if (changed) for (const listener of [...this.#listeners]) listener();\n }\n\n /** getPreviousDestinationIndex (L430-466). */\n #previousIndex(behavior: BackNavigationBehavior): number {\n const history = this.#history;\n if (history.length <= 1) return -1;\n const last = history.length - 1;\n const current = history[last];\n for (let i = last - 1; i >= 0; i--) {\n const item = history[i];\n if (!item) continue;\n switch (behavior) {\n case 'pop-latest':\n return i;\n case 'pop-until-scaffold-value-change':\n if (!sameThreePaneScaffoldValue(this.#calculate(i), this.#value)) return i;\n break;\n case 'pop-until-current-destination-change':\n if (item.pane !== current?.pane) return i;\n break;\n case 'pop-until-content-change':\n if (!Object.is(item.contentKey, current?.contentKey)) return i;\n if (!sameThreePaneScaffoldValue(this.#calculate(i), this.#value)) return i;\n break;\n }\n }\n return -1;\n }\n\n /** calculateScaffoldValue (L468-490). */\n #calculate(index: number): ThreePaneScaffoldValue {\n const { maxHorizontalPartitions, maxVerticalPartitions } = this.#directive;\n const history =\n index === -1\n ? []\n : this.#historyAware\n ? this.#history.slice(0, index + 1)\n : this.#history.slice(index, index + 1);\n return calculateThreePaneScaffoldValue(\n maxHorizontalPartitions,\n this.#strategies,\n history,\n maxVerticalPartitions,\n );\n }\n}\n\n// --- Layout -------------------------------------------------------------------------------------\n\n/** A pane's bounds in the scaffold, CSS px, physical (x from the left edge). */\nexport interface PaneRect {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n}\n\n/** PaneExpansionState as the layout reads it (all CSS px). */\nexport interface PaneExpansionLayout {\n /** currentDraggingOffset: the handle's centre while dragging or settling. */\n readonly draggingOffset?: number | undefined;\n /** firstPaneWidth: a resting split (set from an anchor or a released drag). */\n readonly firstPaneWidth?: number | undefined;\n}\n\nexport interface ThreePaneScaffoldLayoutInput {\n readonly width: number;\n readonly height: number;\n readonly directive: PaneScaffoldDirective;\n readonly value: ThreePaneScaffoldValue;\n /** Start to end, already mirrored for RTL (physical left to right). */\n readonly order: readonly ThreePaneScaffoldRole[];\n readonly adaptStrategies: ThreePaneScaffoldAdaptStrategies;\n /** Panes that exist (a scaffold without an extra pane has no tertiary pane). Default: all. */\n readonly present?: readonly ThreePaneScaffoldRole[] | undefined;\n /** PaneScaffoldScope.preferredWidth per pane (px); default the directive's. */\n readonly preferredWidths?: Partial<Record<ThreePaneScaffoldRole, number>> | undefined;\n /** PaneScaffoldScope.preferredHeight per pane (px); default the directive's. */\n readonly preferredHeights?: Partial<Record<ThreePaneScaffoldRole, number>> | undefined;\n readonly expansion?: PaneExpansionLayout | undefined;\n}\n\nexport interface ThreePaneScaffoldLayout {\n /** Bounds of the expanded and reflowed panes (a collapsed pane of a split has width 0). */\n readonly panes: Partial<Record<ThreePaneScaffoldRole, PaneRect>>;\n /** The drag handle's centre x when exactly two panes are expanded, else null. */\n readonly handleOffset: number | null;\n}\n\ninterface Measuring {\n role: ThreePaneScaffoldRole;\n width: number;\n height: number;\n bounds: PaneRect | null;\n}\n\n/** ThreePaneContentMeasurePolicy.measure (ThreePaneScaffold.kt L256-594), no hinges. */\nexport function threePaneScaffoldLayout(\n input: ThreePaneScaffoldLayoutInput,\n): ThreePaneScaffoldLayout {\n const { width: W, height: H, directive, value, order } = input;\n const present = input.present ?? THREE_PANE_SCAFFOLD_ROLES;\n const make = (role: ThreePaneScaffoldRole): Measuring => ({\n role,\n width: input.preferredWidths?.[role] ?? directive.defaultPanePreferredWidth,\n height: input.preferredHeights?.[role] ?? directive.defaultPanePreferredHeight,\n bounds: null,\n });\n const select = (pick: (v: PaneAdaptedValue) => boolean) =>\n order.filter((r) => present.includes(r) && pick(value[r])).map(make);\n const expanded = select((v) => v === 'expanded');\n const reflowed = select((v) => v === 'reflowed');\n const spacer = directive.horizontalPartitionSpacerSize;\n const vSpacer = directive.verticalPartitionSpacerSize;\n const outer: PaneRect = { x: 0, y: 0, width: W, height: H };\n const right = (r: PaneRect) => r.x + r.width;\n const between = (left: number, rightEdge: number): PaneRect => ({\n x: left,\n y: 0,\n width: rightEdge - left,\n height: H,\n });\n\n /** measureAndPlacePanesInPartition (L737-771). */\n const inPartition = (partition: PaneRect, pane: Measuring) => {\n const flowed = reflowed[0];\n const strategy = flowed ? input.adaptStrategies[flowed.role] : 'hide';\n if (flowed && strategy !== 'hide' && strategy.reflowUnder === pane.role) {\n const available = partition.height - vSpacer;\n pane.height = Math.max(available - flowed.height, Math.trunc(available / 2));\n flowed.height = available - pane.height;\n flowed.bounds = {\n x: partition.x,\n y: partition.y + pane.height + vSpacer,\n width: partition.width,\n height: partition.height - pane.height - vSpacer,\n };\n } else {\n pane.height = partition.height;\n }\n pane.bounds = { ...partition, height: pane.height };\n };\n\n /** measureAndPlacePartitionsInBounds (L700-735). */\n const partitions = (bounds: PaneRect, panes: Measuring[]) => {\n if (panes.length === 0) return;\n const allocatable = bounds.width - (panes.length - 1) * spacer;\n const total = panes.reduce((sum, p) => sum + p.width, 0);\n if (allocatable > total) {\n const top = panes.reduce((a, b) => (PRIORITY[b.role] > PRIORITY[a.role] ? b : a));\n top.width += allocatable - total;\n } else if (allocatable < total) {\n const scale = Math.fround(allocatable / total);\n for (const p of panes) p.width = Math.trunc(Math.fround(p.width * scale));\n }\n let x = bounds.x;\n for (const p of panes) {\n inPartition({ x, y: bounds.y, width: p.width, height: bounds.height }, p);\n x += p.width + spacer;\n }\n };\n\n const expansion = input.expansion;\n const first = expanded[0];\n const second = expanded[1];\n const dragging = expansion?.draggingOffset;\n const resting = expansion?.firstPaneWidth;\n if (\n expanded.length === 2 &&\n first &&\n second &&\n (dragging !== undefined || resting !== undefined)\n ) {\n const half = Math.trunc(spacer / 2);\n if (dragging !== undefined) {\n // Respect the user's drag (L363-439); the bounds shift while dragging or settling.\n if (dragging <= half)\n inPartition({ ...outer, x: dragging * 2, width: W - dragging * 2 }, second);\n else if (dragging >= W - half) inPartition({ ...outer, width: dragging * 2 - W }, first);\n else {\n inPartition(between(0, dragging - half), first);\n inPartition(between(dragging + half, W), second);\n }\n } else if (resting !== undefined) {\n // Pane expansion from a resting value (L382-437).\n const firstWidth = Math.max(0, Math.min(resting, W));\n if (firstWidth === 0) inPartition(outer, second);\n else if (firstWidth >= W - spacer) inPartition(outer, first);\n else {\n inPartition(between(0, firstWidth), first);\n inPartition(between(firstWidth + spacer, W), second);\n }\n }\n } else {\n partitions(outer, expanded);\n }\n\n // The drag handle sits in the middle of the spacer (getSpacerMiddleOffsetX L914-922).\n let handleOffset: number | null = null;\n if (expanded.length === 2 && first && second) {\n if (dragging !== undefined) handleOffset = dragging;\n else if (first.bounds && second.bounds)\n handleOffset = Math.trunc((right(first.bounds) + second.bounds.x) / 2);\n else if (first.bounds) handleOffset = right(first.bounds);\n else if (second.bounds) handleOffset = 0;\n }\n\n const panes: Partial<Record<ThreePaneScaffoldRole, PaneRect>> = {};\n for (const p of [...expanded, ...reflowed]) {\n panes[p.role] = p.bounds ?? { x: 0, y: 0, width: 0, height: 0 };\n }\n return { panes, handleOffset };\n}\n\n// --- Motion -------------------------------------------------------------------------------------\n\n/** PaneMotion (PaneMotion.kt L556-632; EnterAsModal / ExitAsModal belong to Levitate). */\nexport type PaneMotion =\n | 'none'\n | 'animate-bounds'\n | 'enter-from-left'\n | 'enter-from-right'\n | 'enter-from-left-delayed'\n | 'enter-from-right-delayed'\n | 'exit-to-left'\n | 'exit-to-right'\n | 'enter-with-expand'\n | 'exit-with-shrink';\n\ntype MotionType = 'hidden' | 'exiting' | 'entering' | 'shown';\n\nconst motionType = (motion: PaneMotion): MotionType =>\n motion === 'none'\n ? 'hidden'\n : motion === 'animate-bounds'\n ? 'shown'\n : motion.startsWith('enter')\n ? 'entering'\n : 'exiting';\n\n/** PaneMotion.Type.calculate (L531-547). */\nfunction typeOf(previous: PaneAdaptedValue, current: PaneAdaptedValue): MotionType {\n const was = previous !== 'hidden';\n const is = current !== 'hidden';\n return was && is ? 'shown' : was ? 'exiting' : is ? 'entering' : 'hidden';\n}\n\n/** calculatePaneMotion (PaneMotion.kt L636-750) for the panes in `order` (physical, LTR). */\nexport function calculatePaneMotion(\n previous: ThreePaneScaffoldValue,\n current: ThreePaneScaffoldValue,\n order: readonly ThreePaneScaffoldRole[],\n): Record<ThreePaneScaffoldRole, PaneMotion> {\n const n = order.length;\n const types = order.map((r) => typeOf(previous[r], current[r]));\n const motions: PaneMotion[] = order.map(() => 'none');\n let firstShown = n;\n let firstEntering = n;\n let lastShown = -1;\n let lastEntering = -1;\n types.forEach((t, i) => {\n if (t === 'shown') {\n firstShown = Math.min(firstShown, i);\n lastShown = Math.max(lastShown, i);\n motions[i] = 'animate-bounds';\n } else if (t === 'entering') {\n firstEntering = Math.min(firstEntering, i);\n lastEntering = Math.max(lastEntering, i);\n }\n });\n let exitRight = false;\n let exitLeft = false;\n let firstExitRight = n;\n let lastExitLeft = -1;\n types.forEach((t, i) => {\n if (t !== 'exiting') return;\n const shownLeft = firstShown < i;\n const enteringLeft = firstEntering < i;\n const shownRight = lastShown > i;\n const enteringRight = lastEntering > i;\n const toRight = () => {\n exitRight = true;\n firstExitRight = Math.min(firstExitRight, i);\n motions[i] = 'exit-to-right';\n };\n const toLeft = () => {\n exitLeft = true;\n lastExitLeft = Math.max(lastExitLeft, i);\n motions[i] = 'exit-to-left';\n };\n // Nothing on that side, else only shown panes block it, else both sides are blocked.\n if (!shownRight && !enteringRight) toRight();\n else if (!shownLeft && !enteringLeft) toLeft();\n else if (!shownRight) toRight();\n else if (!shownLeft) toLeft();\n else motions[i] = 'exit-with-shrink';\n });\n types.forEach((t, i) => {\n if (t !== 'entering') return;\n const freeRight = !(lastShown > i) && !(lastExitLeft > i);\n const freeLeft = !(firstShown < i) && !(firstExitRight < i);\n motions[i] =\n freeRight && !exitRight\n ? 'enter-from-right'\n : freeLeft && !exitLeft\n ? 'enter-from-left'\n : freeRight\n ? 'enter-from-right-delayed'\n : freeLeft\n ? 'enter-from-left-delayed'\n : 'enter-with-expand';\n });\n const out = { primary: 'none', secondary: 'none', tertiary: 'none' } as Record<\n ThreePaneScaffoldRole,\n PaneMotion\n >;\n order.forEach((r, i) => {\n out[r] = motions[i] ?? 'none';\n });\n return out;\n}\n\n/** Where each pane animates from and to for a motion (the default enter / exit transitions). */\nexport interface PaneTransition {\n readonly motion: PaneMotion;\n readonly from: PaneRect;\n readonly to: PaneRect;\n /** EnterFrom*Delayed: DelayedSpringSpec's delayedRatio (PaneMotionDefaults L167-173). */\n readonly delayed: boolean;\n}\n\n/** PaneMotionDefaults.DelayedAnimationSpec's delayedRatio (PaneMotion.kt L171). */\nexport const PANE_MOTION_DELAYED_RATIO = 0.1;\n\n/**\n * calculateDefaultEnterTransition / calculateDefaultExitTransition (PaneMotion.kt L425-476) with\n * the slide offsets (L276-414): `origin` holds the bounds before the change (the panes shown\n * then), `target` the bounds after it, both from threePaneScaffoldLayout. Entering panes slide (or\n * expand) from outside to `target`; exiting panes slide (or shrink) from `origin` out; panes shown\n * before and after animate their bounds.\n */\nexport function paneTransitions(\n motions: Readonly<Record<ThreePaneScaffoldRole, PaneMotion>>,\n order: readonly ThreePaneScaffoldRole[],\n origin: Partial<Record<ThreePaneScaffoldRole, PaneRect>>,\n target: Partial<Record<ThreePaneScaffoldRole, PaneRect>>,\n scaffoldWidth: number,\n): Partial<Record<ThreePaneScaffoldRole, PaneTransition>> {\n const zero: PaneRect = { x: 0, y: 0, width: 0, height: 0 };\n const t = (r: ThreePaneScaffoldRole) => target[r] ?? origin[r] ?? zero;\n const o = (r: ThreePaneScaffoldRole) => origin[r] ?? target[r] ?? zero;\n const type = (r: ThreePaneScaffoldRole) => motionType(motions[r]);\n const shown = (r: ThreePaneScaffoldRole, other: MotionType) =>\n type(r) === 'shown' || type(r) === other;\n const reversed = [...order].reverse();\n\n const slideInFromLeft = (): number => {\n let previous: ThreePaneScaffoldRole | null = null;\n for (const r of reversed) {\n const m = motions[r];\n if (m === 'enter-from-left' || m === 'enter-from-left-delayed')\n return -(previous ? t(previous).x : t(r).x + t(r).width);\n if (shown(r, 'entering')) previous = r;\n }\n return 0;\n };\n const slideInFromRight = (): number => {\n let previous: ThreePaneScaffoldRole | null = null;\n for (const r of order) {\n const m = motions[r];\n if (m === 'enter-from-right' || m === 'enter-from-right-delayed')\n return scaffoldWidth - (previous ? t(previous).x + t(previous).width : t(r).x);\n if (shown(r, 'entering')) previous = r;\n }\n return 0;\n };\n const slideOutToLeft = (): number => {\n let previous: ThreePaneScaffoldRole | null = null;\n for (const r of reversed) {\n if (motions[r] === 'exit-to-left') return -(previous ? o(previous).x : o(r).x + o(r).width);\n if (shown(r, 'exiting')) previous = r;\n }\n return 0;\n };\n const slideOutToRight = (): number => {\n let previous: ThreePaneScaffoldRole | null = null;\n for (const r of order) {\n if (motions[r] === 'exit-to-right')\n return scaffoldWidth - (previous ? o(previous).x + o(previous).width : o(r).x);\n if (shown(r, 'exiting')) previous = r;\n }\n return 0;\n };\n /** getHiddenPaneCurrentLeft (L379-393) / getHidingPaneTargetLeft (L397-414). */\n const leftEdge = (role: ThreePaneScaffoldRole, other: MotionType, rect: typeof t) => {\n let edge = 0;\n for (const r of order) {\n if (r === role) return edge;\n if (shown(r, other)) edge = rect(r).x + rect(r).width;\n }\n return edge;\n };\n\n const out: Partial<Record<ThreePaneScaffoldRole, PaneTransition>> = {};\n for (const r of order) {\n const motion = motions[r];\n const to = t(r);\n const from = o(r);\n const shift = (rect: PaneRect, dx: number): PaneRect => ({ ...rect, x: rect.x + dx });\n let transition: PaneTransition | null = null;\n switch (motion) {\n case 'animate-bounds':\n transition = { motion, from, to, delayed: false };\n break;\n case 'enter-from-left':\n case 'enter-from-left-delayed':\n transition = {\n motion,\n from: shift(to, slideInFromLeft()),\n to,\n delayed: motion.endsWith('delayed'),\n };\n break;\n case 'enter-from-right':\n case 'enter-from-right-delayed':\n transition = {\n motion,\n from: shift(to, slideInFromRight()),\n to,\n delayed: motion.endsWith('delayed'),\n };\n break;\n case 'enter-with-expand':\n // expandHorizontally(CenterHorizontally) + slideInHorizontally from the hidden left edge.\n transition = {\n motion,\n from: { ...to, x: leftEdge(r, 'exiting', o), width: 0 },\n to,\n delayed: false,\n };\n break;\n case 'exit-to-left':\n transition = { motion, from, to: shift(from, slideOutToLeft()), delayed: false };\n break;\n case 'exit-to-right':\n transition = { motion, from, to: shift(from, slideOutToRight()), delayed: false };\n break;\n case 'exit-with-shrink':\n transition = {\n motion,\n from,\n to: { ...from, x: leftEdge(r, 'entering', t), width: 0 },\n delayed: false,\n };\n break;\n case 'none':\n break;\n }\n if (transition) out[r] = transition;\n }\n return out;\n}\n\n// --- Pane expansion -----------------------------------------------------------------------------\n\n/** PaneExpansionAnchor: Proportion, Offset.fromStart or Offset.fromEnd (px). */\nexport type PaneExpansionAnchor =\n | { readonly proportion: number }\n | { readonly offsetFromStart: number }\n | { readonly offsetFromEnd: number };\n\n/**\n * The samples' anchors (ThreePaneScaffoldSample.kt L1102-1109): 0 %, 240dp from the start, 50 %,\n * 240dp from the end, 100 %. Compose's own default is no anchors.\n */\nexport const PANE_EXPANSION_SAMPLE_ANCHORS: readonly PaneExpansionAnchor[] = [\n { proportion: 0 },\n { offsetFromStart: 240 },\n { proportion: 0.5 },\n { offsetFromEnd: 240 },\n { proportion: 1 },\n];\n\n/** PaneExpansionState.AnchoringVelocityThreshold (px/s, L648). */\nexport const PANE_EXPANSION_ANCHORING_VELOCITY_THRESHOLD = 200;\n\n/** PaneExpansionAnchor.positionIn (L700-712, L754-755, L835-856): the handle's centre x. */\nexport function paneExpansionAnchorPosition(\n anchor: PaneExpansionAnchor,\n width: number,\n rtl = false,\n): number {\n const offset =\n 'proportion' in anchor\n ? Math.min(Math.max(Math.round(width * anchor.proportion), 0), width)\n : 'offsetFromStart' in anchor\n ? Math.round(anchor.offsetFromStart)\n : width - Math.round(anchor.offsetFromEnd);\n return rtl ? width - offset : offset;\n}\n\n/**\n * The anchor a release settles to (getPositionOfTheClosestAnchor, L610-646): the closest one, or\n * with |velocity| ≥ 200 px/s the closest in the direction of the fling (the closest overall when\n * none lies that way). Returns the index into `anchors`, or -1 without anchors. Compose first runs\n * the fling's decay and settles from where it stops; this picks from the release position.\n */\nexport function closestPaneExpansionAnchor(\n anchors: readonly PaneExpansionAnchor[],\n width: number,\n position: number,\n velocity: number,\n rtl = false,\n): number {\n let best = -1;\n let bestScore = Infinity;\n const candidates: { at: number; index: number; score: number }[] = [];\n anchors.forEach((anchor, index) => {\n const at = paneExpansionAnchorPosition(anchor, width, rtl);\n let score: number;\n if (velocity >= PANE_EXPANSION_ANCHORING_VELOCITY_THRESHOLD) {\n const delta = at - position;\n score = delta < 0 ? width - delta : delta;\n } else if (velocity <= -PANE_EXPANSION_ANCHORING_VELOCITY_THRESHOLD) {\n const delta = position - at;\n score = delta < 0 ? width - delta : delta;\n } else score = Math.abs(position - at);\n candidates.push({ at, index, score });\n });\n // Compose sorts the anchors by position and keeps the first minimum.\n candidates.sort((a, b) => a.at - b.at || a.index - b.index);\n for (const c of candidates) {\n if (c.score < bestScore) {\n best = c.index;\n bestScore = c.score;\n }\n }\n return best;\n}\n\n/**\n * PaneExpansionState.nextAnchor (L345-366): the first anchor (by position) right of `position`,\n * wrapping to the leftmost. The drag handle's click action moves there. -1 without anchors.\n */\nexport function nextPaneExpansionAnchor(\n anchors: readonly PaneExpansionAnchor[],\n width: number,\n position: number,\n rtl = false,\n): number {\n const sorted = anchors\n .map((anchor, index) => ({ at: paneExpansionAnchorPosition(anchor, width, rtl), index }))\n .sort((a, b) => a.at - b.at || a.index - b.index);\n return (sorted.find((a) => position < a.at) ?? sorted[0])?.index ?? -1;\n}\n\n// --- Animation ----------------------------------------------------------------------------------\n\n/** PaneMotionDefaults' IntRect / IntOffset visibility threshold (PaneMotion.kt L148): 1px. */\nexport const PANE_MOTION_VISIBILITY_THRESHOLD = 1;\n\nconst KEYS = ['x', 'y', 'width', 'height'] as const;\n\ninterface PaneSprings {\n readonly springs: Record<(typeof KEYS)[number], SpringAnimatable>;\n readonly to: PaneRect;\n readonly spec: SpringSpec | null;\n /** Start time of a delayed spring that has not started yet. */\n delayUntil: number | null;\n}\n\nexport interface ThreePaneScaffoldSample {\n /** The animated bounds of every pane in the transition (entering, shown, exiting). */\n readonly panes: Partial<Record<ThreePaneScaffoldRole, PaneRect>>;\n readonly running: boolean;\n}\n\n/**\n * The pane transitions of one scaffold change, driven by the caller's clock (ms): each pane's\n * bounds run on PaneMotionDefaults.AnimationSpec (spring 0.8 / 380 at a 1px threshold, each\n * component on its own, as Compose's IntRect / IntOffset springs), EnterFrom*Delayed after 10 % of\n * that spring's duration (DelayedSpringSpec, PaneMotion.kt L822-908). A new `start` mid-flight\n * continues every pane still in the transition from its current bounds and velocity. `spec` null\n * (reduced motion) jumps to the end.\n */\nexport class ThreePaneScaffoldAnimation {\n #panes = new Map<ThreePaneScaffoldRole, PaneSprings>();\n\n start(\n transitions: Partial<Record<ThreePaneScaffoldRole, PaneTransition>>,\n spec: SpringSpec | null,\n now: number,\n ): void {\n const next = new Map<ThreePaneScaffoldRole, PaneSprings>();\n for (const role of THREE_PANE_SCAFFOLD_ROLES) {\n const transition = transitions[role];\n if (!transition) continue;\n const { from, to } = transition;\n const previous = this.#panes.get(role);\n if (previous) for (const k of KEYS) previous.springs[k].sample(now);\n const springs =\n previous?.springs ??\n (Object.fromEntries(\n KEYS.map((k) => [k, new SpringAnimatable(from[k], PANE_MOTION_VISIBILITY_THRESHOLD)]),\n ) as PaneSprings['springs']);\n const pane: PaneSprings = { springs, to, spec, delayUntil: null };\n if (transition.delayed && spec !== null && !previous) {\n const duration = Math.max(\n ...KEYS.map((k) =>\n springDurationMillis(spec, from[k], to[k], 0, PANE_MOTION_VISIBILITY_THRESHOLD),\n ),\n );\n pane.delayUntil = now + Math.trunc(duration * PANE_MOTION_DELAYED_RATIO);\n } else {\n for (const k of KEYS) springs[k].animateTo(to[k], spec, now);\n }\n next.set(role, pane);\n }\n this.#panes = next;\n }\n\n /** Jumps every pane to its target. */\n finish(): void {\n for (const pane of this.#panes.values()) {\n pane.delayUntil = null;\n for (const k of KEYS) pane.springs[k].snapTo(pane.to[k]);\n }\n }\n\n sample(now: number): ThreePaneScaffoldSample {\n const panes: Partial<Record<ThreePaneScaffoldRole, PaneRect>> = {};\n let running = false;\n for (const [role, pane] of this.#panes) {\n const s = pane.springs;\n if (pane.delayUntil !== null && now >= pane.delayUntil) {\n for (const k of KEYS) s[k].animateTo(pane.to[k], pane.spec, pane.delayUntil);\n pane.delayUntil = null;\n }\n panes[role] = {\n x: s.x.sample(now),\n y: s.y.sample(now),\n width: Math.max(0, s.width.sample(now)),\n height: Math.max(0, s.height.sample(now)),\n };\n if (pane.delayUntil !== null || KEYS.some((k) => s[k].isRunning)) running = true;\n }\n return { panes, running };\n }\n}\n"]}
|