"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../render/utils/keys-position.mjs.js"),s=require("../../value/types/dimensions.mjs.js"),r=require("../utils/css-variables-conversion.mjs.js"),t=require("../utils/is-css-variable.mjs.js"),i=require("./KeyframesResolver.mjs.js"),n=require("./utils/is-none.mjs.js"),a=require("./utils/make-none-animatable.mjs.js"),o=require("./utils/unit-conversion.mjs.js");class l extends i.KeyframeResolver{constructor(e,s,r,t,i){super(e,s,r,t,i,!0)}readKeyframes(){const{unresolvedKeyframes:i,element:n,name:a}=this;if(!n||!n.current)return;super.readKeyframes();for(let e=0;e<i.length;e++){let s=i[e];if("string"==typeof s&&(s=s.trim(),t.isCSSVariableToken(s))){const t=r.getVariableValue(s,n.current);void 0!==t&&(i[e]=t),e===i.length-1&&(this.finalKeyframe=s)}}if(this.resolveNoneKeyframes(),!e.positionalKeys.has(a)||2!==i.length)return;const[l,u]=i,m=s.findDimensionValueType(l),f=s.findDimensionValueType(u);if(t.containsCSSVariable(l)!==t.containsCSSVariable(u)&&o.positionalValues[a])this.needsMeasurement=!0;else if(m!==f)if(o.isNumOrPxType(m)&&o.isNumOrPxType(f))for(let e=0;e<i.length;e++){const s=i[e];"string"==typeof s&&(i[e]=parseFloat(s))}else o.positionalValues[a]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:s}=this,r=[];for(let s=0;s<e.length;s++)(null===e[s]||n.isNone(e[s]))&&r.push(s);r.length&&a.makeNoneKeyframesAnimatable(e,r,s)}measureInitialState(){const{element:e,unresolvedKeyframes:s,name:r}=this;if(!e||!e.current)return;"height"===r&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=o.positionalValues[r](e.measureViewportBox(),window.getComputedStyle(e.current)),s[0]=this.measuredOrigin;const t=s[s.length-1];void 0!==t&&e.getValue(r,t).jump(t,!1)}measureEndState(){const{element:e,name:s,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const t=e.getValue(s);t&&t.jump(this.measuredOrigin,!1);const i=r.length-1,n=r[i];r[i]=o.positionalValues[s](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==n&&void 0===this.finalKeyframe&&(this.finalKeyframe=n),this.removedTransforms?.length&&this.removedTransforms.forEach((s=>{let[r,t]=s;e.getValue(r).set(t)})),this.resolveNoneKeyframes()}}exports.DOMKeyframesResolver=l;
//# sourceMappingURL=DOMKeyframesResolver.mjs.js.map
