framer-motion
Version:
A simple and powerful JavaScript animation library
1 lines • 112 kB
JavaScript
import{jsx as t,jsxs as e}from"react/jsx-runtime";import{createContext as n,useContext as i,useId as s,useEffect as o,useCallback as r,Component as a,useMemo as l,useLayoutEffect as u,useRef as h,useInsertionEffect as c,forwardRef as d,Fragment as p,createElement as m}from"react";function f(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function g(t){const e=[{},{}];return t?.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function y(t,e,n,i){if("function"==typeof e){const[s,o]=g(i);e=e(void 0!==n?n:t.custom,s,o)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[s,o]=g(i);e=e(void 0!==n?n:t.custom,s,o)}return e}function v(t,e,n){const i=t.getProps();return y(i,e,void 0!==n?n:i.custom,t)}function x(t,e){-1===t.indexOf(e)&&t.push(e)}function P(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const T={skipAnimations:!1,useManualTiming:!1};function w(t){let e;return()=>(void 0===e&&(e=t()),e)}const S=t=>t,b=(t,e,n)=>{const i=e-t;return 0===i?1:(n-t)/i};class A{constructor(){this.subscriptions=[]}add(t){return x(this.subscriptions,t),()=>P(this.subscriptions,t)}notify(t,e,n){const i=this.subscriptions.length;if(i)if(1===i)this.subscriptions[0](t,e,n);else for(let s=0;s<i;s++){const i=this.subscriptions[s];i&&i(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const V=t=>1e3*t,E=t=>t/1e3;function M(t,e){return e?t*(1e3/e):0}const D=w((()=>void 0!==window.ScrollTimeline));class C{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map((t=>t.finished)))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t,e){const n=this.animations.map((n=>D()&&n.attachTimeline?n.attachTimeline(t):"function"==typeof e?e(n):void 0));return()=>{n.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach((e=>e[t]()))}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class k extends C{then(t,e){return this.finished.finally(t).then((()=>{}))}}const R={value:null,addProjectionMetrics:null},L=t=>Array.isArray(t)&&"number"==typeof t[0],B={};function j(t,e){const n=w(t);return()=>B[e]??n()}const F=j((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing"),O=(t,e,n=10)=>{let i="";const s=Math.max(Math.round(e/n),2);for(let e=0;e<s;e++)i+=t(e/(s-1))+", ";return`linear(${i.substring(0,i.length-2)})`},I=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,U={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:I([0,.65,.55,1]),circOut:I([.55,0,1,.45]),backIn:I([.31,.01,.66,-.59]),backOut:I([.33,1.53,.69,.99])};function N(t,e){return t?"function"==typeof t&&F()?O(t,e):L(t)?I(t):Array.isArray(t)?t.map((t=>N(t,e)||U.easeOut)):U[t]:void 0}function W(t,e,n,{delay:i=0,duration:s=300,repeat:o=0,repeatType:r="loop",ease:a="easeInOut",times:l}={},u=void 0){const h={[e]:n};l&&(h.offset=l);const c=N(a,s);Array.isArray(c)&&(h.easing=c);return t.animate(h,{delay:i,duration:s,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:o+1,direction:"reverse"===r?"alternate":"normal",pseudoElement:u})}function $(t){return"function"==typeof t&&"applyToOptions"in t}function Y(t,e){return t?.[e]??t?.default??t}const X=2e4;function K(t){let e=0;let n=t.next(e);for(;!n.done&&e<X;)e+=50,n=t.next(e);return e>=X?1/0:e}function z(t){return Boolean("function"==typeof t&&F()||!t||"string"==typeof t&&(t in U||F())||L(t)||Array.isArray(t)&&t.every(z))}function H(t,e){t.timeline=e,t.onfinish=null}const G=["read","resolveKeyframes","update","preRender","render","postRender"];function q(t,e){let n=!1,i=!0;const s={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,r=G.reduce(((t,n)=>(t[n]=function(t,e){let n=new Set,i=new Set,s=!1,o=!1;const r=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1},l=0;function u(e){r.has(e)&&(h.schedule(e),t()),l++,e(a)}const h={schedule:(t,e=!1,o=!1)=>{const a=o&&s?n:i;return e&&r.add(t),a.has(t)||a.add(t),t},cancel:t=>{i.delete(t),r.delete(t)},process:t=>{a=t,s?o=!0:(s=!0,[n,i]=[i,n],n.forEach(u),e&&R.value&&R.value.frameloop[e].push(l),l=0,n.clear(),s=!1,o&&(o=!1,h.process(t)))}};return h}(o,e?n:void 0),t)),{}),{read:a,resolveKeyframes:l,update:u,preRender:h,render:c,postRender:d}=r,p=()=>{const o=performance.now();n=!1,s.delta=i?1e3/60:Math.max(Math.min(o-s.timestamp,40),1),s.timestamp=o,s.isProcessing=!0,a.process(s),l.process(s),u.process(s),h.process(s),c.process(s),d.process(s),s.isProcessing=!1,n&&e&&(i=!1,t(p))};return{schedule:G.reduce(((e,o)=>{const a=r[o];return e[o]=(e,o=!1,r=!1)=>(n||(n=!0,i=!0,s.isProcessing||t(p)),a.schedule(e,o,r)),e}),{}),cancel:t=>{for(let e=0;e<G.length;e++)r[G[e]].cancel(t)},state:s,steps:r}}const{schedule:Z,cancel:_}=q(queueMicrotask,!1),{schedule:J,cancel:Q,state:tt,steps:et}=q("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:S,!0);let nt;function it(){nt=void 0}const st={now:()=>(void 0===nt&&st.set(tt.isProcessing||T.useManualTiming?tt.timestamp:performance.now()),nt),set:t=>{nt=t,queueMicrotask(it)}},ot={x:!1,y:!1};function rt(){return ot.x||ot.y}function at(t,e){const n=function(t,e,n){if(t instanceof EventTarget)return[t];if("string"==typeof t){let i=document;e&&(i=e.current);const s=n?.[t]??i.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t)}(t),i=new AbortController;return[n,{passive:!0,...e,signal:i.signal},()=>i.abort()]}function lt(t){return!("touch"===t.pointerType||rt())}const ut=(t,e)=>!!e&&(t===e||ut(t,e.parentElement)),ht=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,ct=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const dt=new WeakSet;function pt(t){return e=>{"Enter"===e.key&&t(e)}}function mt(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function ft(t){return ht(t)&&!rt()}function gt(t,e,n={}){const[i,s,o]=at(t,n),r=t=>{const i=t.currentTarget;if(!ft(t)||dt.has(i))return;dt.add(i);const o=e(i,t),r=(t,e)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",l),ft(t)&&dt.has(i)&&(dt.delete(i),"function"==typeof o&&o(t,{success:e}))},a=t=>{r(t,i===window||i===document||n.useGlobalTarget||ut(i,t.target))},l=t=>{r(t,!1)};window.addEventListener("pointerup",a,s),window.addEventListener("pointercancel",l,s)};return i.forEach((t=>{var e;(n.useGlobalTarget?window:t).addEventListener("pointerdown",r,s),t instanceof HTMLElement&&(t.addEventListener("focus",(t=>((t,e)=>{const n=t.currentTarget;if(!n)return;const i=pt((()=>{if(dt.has(n))return;mt(n,"down");const t=pt((()=>{mt(n,"up")}));n.addEventListener("keyup",t,e),n.addEventListener("blur",(()=>mt(n,"cancel")),e)}));n.addEventListener("keydown",i,e),n.addEventListener("blur",(()=>n.removeEventListener("keydown",i)),e)})(t,s))),e=t,ct.has(e.tagName)||-1!==e.tabIndex||t.hasAttribute("tabindex")||(t.tabIndex=0))})),o}class yt{constructor(t,e={}){this.version="12.7.3",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=st.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),e&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=st.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new A);const n=this.events[t].add(e);return"change"===t?()=>{n(),J.read((()=>{this.events.change.getSize()||this.stop()}))}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,n){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=st.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return M(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise((e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()})).then((()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()}))}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function vt(t,e){return new yt(t,e)}const xt=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Pt=new Set(xt),Tt=new Set(["width","height","top","left","right","bottom",...xt]),wt=t=>Array.isArray(t);function St(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,vt(n))}const bt=t=>Boolean(t&&t.getVelocity);function At(t,e){const n=t.getValue("willChange");if(i=n,Boolean(bt(i)&&i.add))return n.add(e);if(!n&&T.WillChange){const n=new T.WillChange("auto");t.addValue("willChange",n),n.add(e)}var i}const Vt=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Et="data-"+Vt("framerAppearId");function Mt(t){return t.props[Et]}const Dt=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function Ct(t,e,n,i){if(t===e&&n===i)return S;const s=e=>function(t,e,n,i,s){let o,r,a=0;do{r=e+(n-e)/2,o=Dt(r,i,s)-t,o>0?n=r:e=r}while(Math.abs(o)>1e-7&&++a<12);return r}(e,0,1,t,n);return t=>0===t||1===t?t:Dt(s(t),e,i)}const kt=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Rt=t=>e=>1-t(1-e),Lt=Ct(.33,1.53,.69,.99),Bt=Rt(Lt),jt=kt(Bt),Ft=t=>(t*=2)<1?.5*Bt(t):.5*(2-Math.pow(2,-10*(t-1))),Ot=t=>1-Math.sin(Math.acos(t)),It=Rt(Ot),Ut=kt(Ot),Nt=t=>/^0[^.\s]+$/u.test(t);const Wt=(t,e,n)=>n>e?e:n<t?t:n,$t={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},Yt={...$t,transform:t=>Wt(0,1,t)},Xt={...$t,default:1},Kt=t=>Math.round(1e5*t)/1e5,zt=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const Ht=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Gt=(t,e)=>n=>Boolean("string"==typeof n&&Ht.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),qt=(t,e,n)=>i=>{if("string"!=typeof i)return i;const[s,o,r,a]=i.match(zt);return{[t]:parseFloat(s),[e]:parseFloat(o),[n]:parseFloat(r),alpha:void 0!==a?parseFloat(a):1}},Zt={...$t,transform:t=>Math.round((t=>Wt(0,255,t))(t))},_t={test:Gt("rgb","red"),parse:qt("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+Zt.transform(t)+", "+Zt.transform(e)+", "+Zt.transform(n)+", "+Kt(Yt.transform(i))+")"};const Jt={test:Gt("#"),parse:function(t){let e="",n="",i="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),i=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),i=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,i+=i,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:s?parseInt(s,16)/255:1}},transform:_t.transform},Qt=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),te=Qt("deg"),ee=Qt("%"),ne=Qt("px"),ie=Qt("vh"),se=Qt("vw"),oe={...ee,parse:t=>ee.parse(t)/100,transform:t=>ee.transform(100*t)},re={test:Gt("hsl","hue"),parse:qt("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:i=1})=>"hsla("+Math.round(t)+", "+ee.transform(Kt(e))+", "+ee.transform(Kt(n))+", "+Kt(Yt.transform(i))+")"},ae={test:t=>_t.test(t)||Jt.test(t)||re.test(t),parse:t=>_t.test(t)?_t.parse(t):re.test(t)?re.parse(t):Jt.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?_t.transform(t):re.transform(t)},le=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const ue="number",he="color",ce=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function de(t){const e=t.toString(),n=[],i={color:[],number:[],var:[]},s=[];let o=0;const r=e.replace(ce,(t=>(ae.test(t)?(i.color.push(o),s.push(he),n.push(ae.parse(t))):t.startsWith("var(")?(i.var.push(o),s.push("var"),n.push(t)):(i.number.push(o),s.push(ue),n.push(parseFloat(t))),++o,"${}"))).split("${}");return{values:n,split:r,indexes:i,types:s}}function pe(t){return de(t).values}function me(t){const{split:e,types:n}=de(t),i=e.length;return t=>{let s="";for(let o=0;o<i;o++)if(s+=e[o],void 0!==t[o]){const e=n[o];s+=e===ue?Kt(t[o]):e===he?ae.transform(t[o]):t[o]}return s}}const fe=t=>"number"==typeof t?0:t;const ge={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match(zt)?.length||0)+(t.match(le)?.length||0)>0},parse:pe,createTransformer:me,getAnimatableNone:function(t){const e=pe(t);return me(t)(e.map(fe))}},ye=new Set(["brightness","contrast","saturate","opacity"]);function ve(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[i]=n.match(zt)||[];if(!i)return t;const s=n.replace(i,"");let o=ye.has(e)?1:0;return i!==n&&(o*=100),e+"("+o+s+")"}const xe=/\b([a-z-]*)\(.*?\)/gu,Pe={...ge,getAnimatableNone:t=>{const e=t.match(xe);return e?e.map(ve).join(" "):t}},Te={borderWidth:ne,borderTopWidth:ne,borderRightWidth:ne,borderBottomWidth:ne,borderLeftWidth:ne,borderRadius:ne,radius:ne,borderTopLeftRadius:ne,borderTopRightRadius:ne,borderBottomRightRadius:ne,borderBottomLeftRadius:ne,width:ne,maxWidth:ne,height:ne,maxHeight:ne,top:ne,right:ne,bottom:ne,left:ne,padding:ne,paddingTop:ne,paddingRight:ne,paddingBottom:ne,paddingLeft:ne,margin:ne,marginTop:ne,marginRight:ne,marginBottom:ne,marginLeft:ne,backgroundPositionX:ne,backgroundPositionY:ne},we={rotate:te,rotateX:te,rotateY:te,rotateZ:te,scale:Xt,scaleX:Xt,scaleY:Xt,scaleZ:Xt,skew:te,skewX:te,skewY:te,distance:ne,translateX:ne,translateY:ne,translateZ:ne,x:ne,y:ne,z:ne,perspective:ne,transformPerspective:ne,opacity:Yt,originX:oe,originY:oe,originZ:ne},Se={...$t,transform:Math.round},be={...Te,...we,zIndex:Se,size:ne,fillOpacity:Yt,strokeOpacity:Yt,numOctaves:Se},Ae={...be,color:ae,backgroundColor:ae,outlineColor:ae,fill:ae,stroke:ae,borderColor:ae,borderTopColor:ae,borderRightColor:ae,borderBottomColor:ae,borderLeftColor:ae,filter:Pe,WebkitFilter:Pe},Ve=t=>Ae[t];function Ee(t,e){let n=Ve(t);return n!==Pe&&(n=ge),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Me=new Set(["auto","none","0"]);const De=t=>180*t/Math.PI,Ce=t=>{const e=De(Math.atan2(t[1],t[0]));return Re(e)},ke={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Ce,rotateZ:Ce,skewX:t=>De(Math.atan(t[1])),skewY:t=>De(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Re=t=>((t%=360)<0&&(t+=360),t),Le=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Be=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),je={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Le,scaleY:Be,scale:t=>(Le(t)+Be(t))/2,rotateX:t=>Re(De(Math.atan2(t[6],t[5]))),rotateY:t=>Re(De(Math.atan2(-t[2],t[0]))),rotateZ:Ce,rotate:Ce,skewX:t=>De(Math.atan(t[4])),skewY:t=>De(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Fe(t){return t.includes("scale")?1:0}function Oe(t,e){if(!t||"none"===t)return Fe(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,s;if(n)i=je,s=n;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=ke,s=e}if(!s)return Fe(e);const o=i[e],r=s[1].split(",").map(Ie);return"function"==typeof o?o(r):r[o]}function Ie(t){return parseFloat(t.trim())}const Ue=t=>t===$t||t===ne,Ne=new Set(["x","y","z"]),We=xt.filter((t=>!Ne.has(t)));const $e={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>Oe(e,"x"),y:(t,{transform:e})=>Oe(e,"y")};$e.translateX=$e.x,$e.translateY=$e.y;const Ye=new Set;let Xe=!1,Ke=!1;function ze(){if(Ke){const t=Array.from(Ye).filter((t=>t.needsMeasurement)),e=new Set(t.map((t=>t.element))),n=new Map;e.forEach((t=>{const e=function(t){const e=[];return We.forEach((n=>{const i=t.getValue(n);void 0!==i&&(e.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))})),e}(t);e.length&&(n.set(t,e),t.render())})),t.forEach((t=>t.measureInitialState())),e.forEach((t=>{t.render();const e=n.get(t);e&&e.forEach((([e,n])=>{t.getValue(e)?.set(n)}))})),t.forEach((t=>t.measureEndState())),t.forEach((t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)}))}Ke=!1,Xe=!1,Ye.forEach((t=>t.complete())),Ye.clear()}function He(){Ye.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(Ke=!0)}))}class Ge{constructor(t,e,n,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Ye.add(this),Xe||(Xe=!0,J.read(He),J.resolveKeyframes(ze))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:i}=this;for(let s=0;s<t.length;s++)if(null===t[s])if(0===s){const s=i?.get(),o=t[t.length-1];if(void 0!==s)t[0]=s;else if(n&&e){const i=n.readValue(e,o);null!=i&&(t[0]=i)}void 0===t[0]&&(t[0]=o),i&&void 0===s&&i.set(t[0])}else t[s]=t[s-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Ye.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Ye.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const qe=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),Ze=t=>e=>"string"==typeof e&&e.startsWith(t),_e=Ze("--"),Je=Ze("var(--"),Qe=t=>!!Je(t)&&tn.test(t.split("/*")[0].trim()),tn=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,en=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function nn(t,e,n=1){const[i,s]=function(t){const e=en.exec(t);if(!e)return[,];const[,n,i,s]=e;return[`--${n??i}`,s]}(t);if(!i)return;const o=window.getComputedStyle(e).getPropertyValue(i);if(o){const t=o.trim();return qe(t)?parseFloat(t):t}return Qe(s)?nn(s,e,n+1):s}const sn=t=>e=>e.test(t),on=[$t,ne,ee,te,se,ie,{test:t=>"auto"===t,parse:t=>t}],rn=t=>on.find(sn(t));class an extends Ge{constructor(t,e,n,i,s){super(t,e,n,i,s,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n<t.length;n++){let i=t[n];if("string"==typeof i&&(i=i.trim(),Qe(i))){const s=nn(i,e.current);void 0!==s&&(t[n]=s),n===t.length-1&&(this.finalKeyframe=i)}}if(this.resolveNoneKeyframes(),!Tt.has(n)||2!==t.length)return;const[i,s]=t,o=rn(i),r=rn(s);if(o!==r)if(Ue(o)&&Ue(r))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,n=[];for(let e=0;e<t.length;e++)("number"==typeof(i=t[e])?0===i:null===i||"none"===i||"0"===i||Nt(i))&&n.push(e);var i;n.length&&function(t,e,n){let i,s=0;for(;s<t.length&&!i;){const e=t[s];"string"==typeof e&&!Me.has(e)&&de(e).values.length&&(i=t[s]),s++}if(i&&n)for(const s of e)t[s]=Ee(n,i)}(t,n,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:n}=this;if(!t||!t.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=$e[n](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const i=e[e.length-1];void 0!==i&&t.getValue(n,i).jump(i,!1)}measureEndState(){const{element:t,name:e,unresolvedKeyframes:n}=this;if(!t||!t.current)return;const i=t.getValue(e);i&&i.jump(this.measuredOrigin,!1);const s=n.length-1,o=n[s];n[s]=$e[e](t.measureViewportBox(),window.getComputedStyle(t.current)),null!==o&&void 0===this.finalKeyframe&&(this.finalKeyframe=o),this.removedTransforms?.length&&this.removedTransforms.forEach((([e,n])=>{t.getValue(e).set(n)})),this.resolveNoneKeyframes()}}const ln=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!ge.test(t)&&"0"!==t||t.startsWith("url(")));function un(t,e,n,i){const s=t[0];if(null===s)return!1;if("display"===e||"visibility"===e)return!0;const o=t[t.length-1],r=ln(s,e),a=ln(o,e);return!(!r||!a)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}(t)||("spring"===n||$(n))&&i)}const hn=t=>null!==t;function cn(t,{repeat:e,repeatType:n="loop"},i){const s=t.filter(hn),o=e&&"loop"!==n&&e%2==1?0:s.length-1;return o&&void 0!==i?i:s[o]}class dn{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:o="loop",...r}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=st.now(),this.options={autoplay:t,delay:e,type:n,repeat:i,repeatDelay:s,repeatType:o,...r},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(He(),ze()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=st.now(),this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:o,onComplete:r,onUpdate:a,isGenerator:l}=this.options;if(!l&&!un(t,n,i,s)){if(!o)return a&&a(cn(t,this.options,e)),r&&r(),void this.resolveFinishedPromise();this.options.duration=0}const u=this.initPlayback(t,e);!1!==u&&(this._resolved={keyframes:t,finalKeyframe:e,...u},this.onPostResolved())}onPostResolved(){}then(t,e){return this.currentFinishedPromise.then(t,e)}flatten(){this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear")}updateFinishedPromise(){this.currentFinishedPromise=new Promise((t=>{this.resolveFinishedPromise=t}))}}const pn=(t,e,n)=>t+(e-t)*n;function mn(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function fn(t,e){return n=>n>0?e:t}const gn=(t,e,n)=>{const i=t*t,s=n*(e*e-i)+i;return s<0?0:Math.sqrt(s)},yn=[Jt,_t,re];function vn(t){const e=(n=t,yn.find((t=>t.test(n))));var n;if(!Boolean(e))return!1;let i=e.parse(t);return e===re&&(i=function({hue:t,saturation:e,lightness:n,alpha:i}){t/=360,n/=100;let s=0,o=0,r=0;if(e/=100){const i=n<.5?n*(1+e):n+e-n*e,a=2*n-i;s=mn(a,i,t+1/3),o=mn(a,i,t),r=mn(a,i,t-1/3)}else s=o=r=n;return{red:Math.round(255*s),green:Math.round(255*o),blue:Math.round(255*r),alpha:i}}(i)),i}const xn=(t,e)=>{const n=vn(t),i=vn(e);if(!n||!i)return fn(t,e);const s={...n};return t=>(s.red=gn(n.red,i.red,t),s.green=gn(n.green,i.green,t),s.blue=gn(n.blue,i.blue,t),s.alpha=pn(n.alpha,i.alpha,t),_t.transform(s))},Pn=(t,e)=>n=>e(t(n)),Tn=(...t)=>t.reduce(Pn),wn=new Set(["none","hidden"]);function Sn(t,e){return n=>pn(t,e,n)}function bn(t){return"number"==typeof t?Sn:"string"==typeof t?Qe(t)?fn:ae.test(t)?xn:En:Array.isArray(t)?An:"object"==typeof t?ae.test(t)?xn:Vn:fn}function An(t,e){const n=[...t],i=n.length,s=t.map(((t,n)=>bn(t)(t,e[n])));return t=>{for(let e=0;e<i;e++)n[e]=s[e](t);return n}}function Vn(t,e){const n={...t,...e},i={};for(const s in n)void 0!==t[s]&&void 0!==e[s]&&(i[s]=bn(t[s])(t[s],e[s]));return t=>{for(const e in i)n[e]=i[e](t);return n}}const En=(t,e)=>{const n=ge.createTransformer(e),i=de(t),s=de(e);return i.indexes.var.length===s.indexes.var.length&&i.indexes.color.length===s.indexes.color.length&&i.indexes.number.length>=s.indexes.number.length?wn.has(t)&&!s.values.length||wn.has(e)&&!i.values.length?function(t,e){return wn.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):Tn(An(function(t,e){const n=[],i={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const o=e.types[s],r=t.indexes[o][i[o]],a=t.values[r]??0;n[s]=a,i[o]++}return n}(i,s),s.values),n):fn(t,e)};function Mn(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return pn(t,e,n);return bn(t)(t,e)}function Dn(t,e,n){const i=Math.max(e-5,0);return M(n-t(i),e-i)}const Cn=100,kn=10,Rn=1,Ln=0,Bn=800,jn=.3,Fn=.3,On={granular:.01,default:2},In={granular:.005,default:.5},Un=.01,Nn=10,Wn=.05,$n=1,Yn=.001;function Xn({duration:t=Bn,bounce:e=jn,velocity:n=Ln,mass:i=Rn}){let s,o,r=1-e;r=Wt(Wn,$n,r),t=Wt(Un,Nn,E(t)),r<1?(s=e=>{const i=e*r,s=i*t,o=i-n,a=zn(e,r),l=Math.exp(-s);return Yn-o/a*l},o=e=>{const i=e*r*t,o=i*n+n,a=Math.pow(r,2)*Math.pow(e,2)*t,l=Math.exp(-i),u=zn(Math.pow(e,2),r);return(-s(e)+Yn>0?-1:1)*((o-a)*l)/u}):(s=e=>Math.exp(-e*t)*((e-n)*t+1)-.001,o=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let i=n;for(let n=1;n<Kn;n++)i-=t(i)/e(i);return i}(s,o,5/t);if(t=V(t),isNaN(a))return{stiffness:Cn,damping:kn,duration:t};{const e=Math.pow(a,2)*i;return{stiffness:e,damping:2*r*Math.sqrt(i*e),duration:t}}}const Kn=12;function zn(t,e){return t*Math.sqrt(1-e*e)}const Hn=["duration","bounce"],Gn=["stiffness","damping","mass"];function qn(t,e){return e.some((e=>void 0!==t[e]))}function Zn(t=Fn,e=jn){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:i,restDelta:s}=n;const o=n.keyframes[0],r=n.keyframes[n.keyframes.length-1],a={done:!1,value:o},{stiffness:l,damping:u,mass:h,duration:c,velocity:d,isResolvedFromDuration:p}=function(t){let e={velocity:Ln,stiffness:Cn,damping:kn,mass:Rn,isResolvedFromDuration:!1,...t};if(!qn(t,Gn)&&qn(t,Hn))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(1.2*n),s=i*i,o=2*Wt(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:Rn,stiffness:s,damping:o}}else{const n=Xn(t);e={...e,...n,mass:Rn},e.isResolvedFromDuration=!0}return e}({...n,velocity:-E(n.velocity||0)}),m=d||0,f=u/(2*Math.sqrt(l*h)),g=r-o,y=E(Math.sqrt(l/h)),v=Math.abs(g)<5;let x;if(i||(i=v?On.granular:On.default),s||(s=v?In.granular:In.default),f<1){const t=zn(y,f);x=e=>{const n=Math.exp(-f*y*e);return r-n*((m+f*y*g)/t*Math.sin(t*e)+g*Math.cos(t*e))}}else if(1===f)x=t=>r-Math.exp(-y*t)*(g+(m+y*g)*t);else{const t=y*Math.sqrt(f*f-1);x=e=>{const n=Math.exp(-f*y*e),i=Math.min(t*e,300);return r-n*((m+f*y*g)*Math.sinh(i)+t*g*Math.cosh(i))/t}}const P={calculatedDuration:p&&c||null,next:t=>{const e=x(t);if(p)a.done=t>=c;else{let n=0;f<1&&(n=0===t?V(m):Dn(x,t,e));const o=Math.abs(n)<=i,l=Math.abs(r-e)<=s;a.done=o&&l}return a.value=a.done?r:e,a},toString:()=>{const t=Math.min(K(P),X),e=O((e=>P.next(t*e).value),t,30);return t+"ms "+e},toTransition:()=>{}};return P}function _n({keyframes:t,velocity:e=0,power:n=.8,timeConstant:i=325,bounceDamping:s=10,bounceStiffness:o=500,modifyTarget:r,min:a,max:l,restDelta:u=.5,restSpeed:h}){const c=t[0],d={done:!1,value:c},p=t=>void 0===a?l:void 0===l||Math.abs(a-t)<Math.abs(l-t)?a:l;let m=n*e;const f=c+m,g=void 0===r?f:r(f);g!==f&&(m=g-c);const y=t=>-m*Math.exp(-t/i),v=t=>g+y(t),x=t=>{const e=y(t),n=v(t);d.done=Math.abs(e)<=u,d.value=d.done?g:n};let P,T;const w=t=>{var e;(e=d.value,void 0!==a&&e<a||void 0!==l&&e>l)&&(P=t,T=Zn({keyframes:[d.value,p(d.value)],velocity:Dn(v,t,d.value),damping:s,stiffness:o,restDelta:u,restSpeed:h}))};return w(0),{calculatedDuration:null,next:t=>{let e=!1;return T||void 0!==P||(e=!0,x(t),w(t)),void 0!==P&&t>=P?T.next(t-P):(!e&&x(t),d)}}}Zn.applyToOptions=t=>{const e=function(t,e=100,n){const i=n({...t,keyframes:[0,e]}),s=Math.min(K(i),X);return{type:"keyframes",ease:t=>i.next(s*t).value/e,duration:E(s)}}(t,100,Zn);return t.ease=F()?e.ease:"easeOut",t.duration=V(e.duration),t.type="keyframes",t};const Jn=Ct(.42,0,1,1),Qn=Ct(0,0,.58,1),ti=Ct(.42,0,.58,1),ei={linear:S,easeIn:Jn,easeInOut:ti,easeOut:Qn,circIn:Ot,circInOut:Ut,circOut:It,backIn:Bt,backInOut:jt,backOut:Lt,anticipate:Ft},ni=t=>{if(L(t)){t.length;const[e,n,i,s]=t;return Ct(e,n,i,s)}return"string"==typeof t?ei[t]:t};function ii(t,e,{clamp:n=!0,ease:i,mixer:s}={}){const o=t.length;if(e.length,1===o)return()=>e[0];if(2===o&&e[0]===e[1])return()=>e[1];const r=t[0]===t[1];t[0]>t[o-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=function(t,e,n){const i=[],s=n||Mn,o=t.length-1;for(let n=0;n<o;n++){let o=s(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]||S:e;o=Tn(t,o)}i.push(o)}return i}(e,i,s),l=a.length,u=n=>{if(r&&n<t[0])return e[0];let i=0;if(l>1)for(;i<t.length-2&&!(n<t[i+1]);i++);const s=b(t[i],t[i+1],n);return a[i](s)};return n?e=>u(Wt(t[0],t[o-1],e)):u}function si(t){const e=[0];return function(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const s=b(0,e,i);t.push(pn(n,1,s))}}(e,t.length-1),e}function oi({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const s=(t=>Array.isArray(t)&&"number"!=typeof t[0])(i)?i.map(ni):ni(i),o={done:!1,value:e[0]},r=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:si(e),t),a=ii(r,e,{ease:Array.isArray(s)?s:(l=e,u=s,l.map((()=>u||ti)).splice(0,l.length-1))});var l,u;return{calculatedDuration:t,next:e=>(o.value=a(e),o.done=e>=t,o)}}const ri=t=>{const e=({timestamp:e})=>t(e);return{start:()=>J.update(e,!0),stop:()=>Q(e),now:()=>tt.isProcessing?tt.timestamp:st.now()}},ai={decay:_n,inertia:_n,tween:oi,keyframes:oi,spring:Zn},li=t=>t/100;class ui extends dn{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();const{onStop:t}=this.options;t&&t()};const{name:e,motionValue:n,element:i,keyframes:s}=this.options,o=i?.KeyframeResolver||Ge;this.resolver=new o(s,((t,e)=>this.onKeyframesResolved(t,e)),e,n,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:e="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,r=$(e)?e:ai[e]||oi;let a,l;r!==oi&&"number"!=typeof t[0]&&(a=Tn(li,Mn(t[0],t[1])),t=[0,100]);const u=r({...this.options,keyframes:t});"mirror"===s&&(l=r({...this.options,keyframes:[...t].reverse(),velocity:-o})),null===u.calculatedDuration&&(u.calculatedDuration=K(u));const{calculatedDuration:h}=u,c=h+i;return{generator:u,mirroredGenerator:l,mapPercentToKeyframes:a,calculatedDuration:h,resolvedDuration:c,totalDuration:c*(n+1)-i}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&t?this.state=this.pendingPlayState:this.pause()}tick(t,e=!1){const{resolved:n}=this;if(!n){const{keyframes:t}=this.options;return{done:!0,value:t[t.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:r,keyframes:a,calculatedDuration:l,totalDuration:u,resolvedDuration:h}=n;if(null===this.startTime)return s.next(0);const{delay:c,repeat:d,repeatType:p,repeatDelay:m,onUpdate:f}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-u/this.speed,this.startTime)),e?this.currentTime=t:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const g=this.currentTime-c*(this.speed>=0?1:-1),y=this.speed>=0?g<0:g>u;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=u);let v=this.currentTime,x=s;if(d){const t=Math.min(this.currentTime,u)/h;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,d+1);Boolean(e%2)&&("reverse"===p?(n=1-n,m&&(n-=m/h)):"mirror"===p&&(x=o)),v=Wt(0,1,n)*h}const P=y?{done:!1,value:a[0]}:x.next(v);r&&(P.value=r(P.value));let{done:T}=P;y||null===l||(T=this.speed>=0?this.currentTime>=u:this.currentTime<=0);const w=null===this.holdTime&&("finished"===this.state||"running"===this.state&&T);return w&&void 0!==i&&(P.value=cn(a,this.options,i)),f&&f(P.value),w&&this.finish(),P}get duration(){const{resolved:t}=this;return t?E(t.calculatedDuration):0}get time(){return E(this.currentTime)}set time(t){t=V(t),this.currentTime=t,null!==this.holdTime||0===this.speed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=E(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=ri,onPlay:e,startTime:n}=this.options;this.driver||(this.driver=t((t=>this.tick(t)))),e&&e();const i=this.driver.now();null!==this.holdTime?this.startTime=i-this.holdTime:this.startTime?"finished"===this.state&&(this.startTime=i):this.startTime=n??this.calcStartTime(),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){this._resolved?(this.state="paused",this.holdTime=this.currentTime??0):this.pendingPlayState="paused"}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}get finished(){return this.currentFinishedPromise}}const hi=new Set(["opacity","clipPath","filter","transform"]),ci=w((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));const di={anticipate:Ft,backInOut:jt,circInOut:Ut};class pi extends dn{constructor(t){super(t);const{name:e,motionValue:n,element:i,keyframes:s}=this.options;this.resolver=new an(s,((t,e)=>this.onKeyframesResolved(t,e)),e,n,i),this.resolver.scheduleResolve()}initPlayback(t,e){let{duration:n=300,times:i,ease:s,type:o,motionValue:r,name:a,startTime:l}=this.options;if(!r.owner||!r.owner.current)return!1;var u;if("string"==typeof s&&F()&&s in di&&(s=di[s]),$((u=this.options).type)||"spring"===u.type||!z(u.ease)){const{onComplete:e,onUpdate:r,motionValue:a,element:l,...u}=this.options,h=function(t,e){const n=new ui({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let i={done:!1,value:t[0]};const s=[];let o=0;for(;!i.done&&o<2e4;)i=n.sample(o),s.push(i.value),o+=10;return{times:void 0,keyframes:s,duration:o-10,ease:"linear"}}(t,u);1===(t=h.keyframes).length&&(t[1]=t[0]),n=h.duration,i=h.times,s=h.ease,o="keyframes"}const h=W(r.owner.current,a,t,{...this.options,duration:n,times:i,ease:s});return h.startTime=l??this.calcStartTime(),this.pendingTimeline?(H(h,this.pendingTimeline),this.pendingTimeline=void 0):h.onfinish=()=>{const{onComplete:n}=this.options;r.set(cn(t,this.options,e)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:h,duration:n,times:i,type:o,ease:s,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:e}=t;return E(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return E(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=V(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:e}=t;return e.playbackRate}get finished(){return this.resolved.animation.finished}set speed(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:e}=t;return e.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:e}=t;return e.startTime}attachTimeline(t){if(this._resolved){const{resolved:e}=this;if(!e)return S;const{animation:n}=e;H(n,t)}else this.pendingTimeline=t;return S}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:e}=t;"finished"===e.playState&&this.updateFinishedPromise(),e.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:e}=t;e.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:e,keyframes:n,duration:i,type:s,ease:o,times:r}=t;if("idle"===e.playState||"finished"===e.playState)return;if(this.time){const{motionValue:t,onUpdate:e,onComplete:a,element:l,...u}=this.options,h=new ui({...u,keyframes:n,duration:i,type:s,ease:o,times:r,isGenerator:!0}),c=V(this.time);t.setWithVelocity(h.sample(c-10).value,h.sample(c).value,10)}const{onStop:a}=this.options;a&&a(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:e,name:n,repeatDelay:i,repeatType:s,damping:o,type:r}=t;if(!(e&&e.owner&&e.owner.current instanceof HTMLElement))return!1;const{onUpdate:a,transformTemplate:l}=e.owner.getProps();return ci()&&n&&hi.has(n)&&("transform"!==n||!l)&&!a&&!i&&"mirror"!==s&&0!==o&&"inertia"!==r}}const mi={type:"spring",stiffness:500,damping:25,restSpeed:10},fi={type:"keyframes",duration:.8},gi={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},yi=(t,{keyframes:e})=>e.length>2?fi:Pt.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:mi:gi;const vi=(t,e,n,i={},s,o)=>r=>{const a=Y(i,t)||{},l=a.delay||i.delay||0;let{elapsed:u=0}=i;u-=V(l);let h={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-u,onUpdate:t=>{e.set(t),a.onUpdate&&a.onUpdate(t)},onComplete:()=>{r(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:o?void 0:s};(function({when:t,delay:e,delayChildren:n,staggerChildren:i,staggerDirection:s,repeat:o,repeatType:r,repeatDelay:a,from:l,elapsed:u,...h}){return!!Object.keys(h).length})(a)||(h={...h,...yi(t,h)}),h.duration&&(h.duration=V(h.duration)),h.repeatDelay&&(h.repeatDelay=V(h.repeatDelay)),void 0!==h.from&&(h.keyframes[0]=h.from);let c=!1;if((!1===h.type||0===h.duration&&!h.repeatDelay)&&(h.duration=0,0===h.delay&&(c=!0)),h.allowFlatten=!a.type&&!a.ease,c&&!o&&void 0!==e.get()){const t=cn(h.keyframes,a);if(void 0!==t)return J.update((()=>{h.onUpdate(t),h.onComplete()})),new k([])}return!o&&pi.supports(h)?new pi(h):new ui(h)};function xi({protectedKeys:t,needsAnimating:e},n){const i=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,i}function Pi(t,e,{delay:n=0,transitionOverride:i,type:s}={}){let{transition:o=t.getDefaultTransition(),transitionEnd:r,...a}=e;i&&(o=i);const l=[],u=s&&t.animationState&&t.animationState.getState()[s];for(const e in a){const i=t.getValue(e,t.latestValues[e]??null),s=a[e];if(void 0===s||u&&xi(u,e))continue;const r={delay:n,...Y(o||{},e)};let h=!1;if(window.MotionHandoffAnimation){const n=Mt(t);if(n){const t=window.MotionHandoffAnimation(n,e,J);null!==t&&(r.startTime=t,h=!0)}}At(t,e),i.start(vi(e,i,s,t.shouldReduceMotion&&Tt.has(e)?{type:!1}:r,t,h));const c=i.animation;c&&l.push(c)}return r&&Promise.all(l).then((()=>{J.update((()=>{r&&function(t,e){const n=v(t,e);let{transitionEnd:i={},transition:s={},...o}=n||{};o={...o,...i};for(const e in o)St(t,e,(r=o[e],wt(r)?r[r.length-1]||0:r));var r}(t,r)}))})),l}function Ti(t,e,n={}){const i=v(t,e,"exit"===n.type?t.presenceContext?.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(s=n.transitionOverride);const o=i?()=>Promise.all(Pi(t,i,n)):()=>Promise.resolve(),r=t.variantChildren&&t.variantChildren.size?(i=0)=>{const{delayChildren:o=0,staggerChildren:r,staggerDirection:a}=s;return function(t,e,n=0,i=0,s=1,o){const r=[],a=(t.variantChildren.size-1)*i,l=1===s?(t=0)=>t*i:(t=0)=>a-t*i;return Array.from(t.variantChildren).sort(wi).forEach(((t,i)=>{t.notify("AnimationStart",e),r.push(Ti(t,e,{...o,delay:n+l(i)}).then((()=>t.notify("AnimationComplete",e))))})),Promise.all(r)}(t,e,o+i,r,a,n)}:()=>Promise.resolve(),{when:a}=s;if(a){const[t,e]="beforeChildren"===a?[o,r]:[r,o];return t().then((()=>e()))}return Promise.all([o(),r(n.delay)])}function wi(t,e){return t.sortNodePosition(e)}function Si(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let i=0;i<n;i++)if(e[i]!==t[i])return!1;return!0}function bi(t){return"string"==typeof t||Array.isArray(t)}const Ai=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Vi=["initial",...Ai],Ei=Vi.length;function Mi(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&Mi(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let n=0;n<Ei;n++){const i=Vi[n],s=t.props[i];(bi(s)||!1===s)&&(e[i]=s)}return e}const Di=[...Ai].reverse(),Ci=Ai.length;function ki(t){return e=>Promise.all(e.map((({animation:e,options:n})=>function(t,e,n={}){let i;if(t.notify("AnimationStart",e),Array.isArray(e)){const s=e.map((e=>Ti(t,e,n)));i=Promise.all(s)}else if("string"==typeof e)i=Ti(t,e,n);else{const s="function"==typeof e?v(t,e,n.custom):e;i=Promise.all(Pi(t,s,n))}return i.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function Ri(t){let e=ki(t),n=ji(),i=!0;const s=e=>(n,i)=>{const s=v(t,i,"exit"===e?t.presenceContext?.custom:void 0);if(s){const{transition:t,transitionEnd:e,...i}=s;n={...n,...i,...e}}return n};function o(o){const{props:r}=t,a=Mi(t.parent)||{},l=[],u=new Set;let h={},c=1/0;for(let e=0;e<Ci;e++){const d=Di[e],p=n[d],m=void 0!==r[d]?r[d]:a[d],g=bi(m),y=d===o?p.isActive:null;!1===y&&(c=e);let v=m===a[d]&&m!==r[d]&&g;if(v&&i&&t.manuallyAnimateOnMount&&(v=!1),p.protectedKeys={...h},!p.isActive&&null===y||!m&&!p.prevProp||f(m)||"boolean"==typeof m)continue;const x=Li(p.prevProp,m);let P=x||d===o&&p.isActive&&!v&&g||e>c&&g,T=!1;const w=Array.isArray(m)?m:[m];let S=w.reduce(s(d),{});!1===y&&(S={});const{prevResolvedValues:b={}}=p,A={...b,...S},V=e=>{P=!0,u.has(e)&&(T=!0,u.delete(e)),p.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in A){const e=S[t],n=b[t];if(h.hasOwnProperty(t))continue;let i=!1;i=wt(e)&&wt(n)?!Si(e,n):e!==n,i?null!=e?V(t):u.add(t):void 0!==e&&u.has(t)?V(t):p.protectedKeys[t]=!0}p.prevProp=m,p.prevResolvedValues=S,p.isActive&&(h={...h,...S}),i&&t.blockInitialAnimation&&(P=!1);P&&(!(v&&x)||T)&&l.push(...w.map((t=>({animation:t,options:{type:d}}))))}if(u.size){const e={};if("boolean"!=typeof r.initial){const n=v(t,Array.isArray(r.initial)?r.initial[0]:r.initial);n&&n.transition&&(e.transition=n.transition)}u.forEach((n=>{const i=t.getBaseTarget(n),s=t.getValue(n);s&&(s.liveStyle=!0),e[n]=i??null})),l.push({animation:e})}let d=Boolean(l.length);return!i||!1!==r.initial&&r.initial!==r.animate||t.manuallyAnimateOnMount||(d=!1),i=!1,d?e(l):Promise.resolve()}return{animateChanges:o,setActive:function(e,i){if(n[e].isActive===i)return Promise.resolve();t.variantChildren?.forEach((t=>t.animationState?.setActive(e,i))),n[e].isActive=i;const s=o(e);for(const t in n)n[t].protectedKeys={};return s},setAnimateFunction:function(n){e=n(t)},getState:()=>n,reset:()=>{n=ji(),i=!0}}}function Li(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!Si(e,t)}function Bi(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function ji(){return{animate:Bi(!0),whileInView:Bi(),whileHover:Bi(),whileTap:Bi(),whileDrag:Bi(),whileFocus:Bi(),exit:Bi()}}class Fi{constructor(t){this.isMounted=!1,this.node=t}update(){}}let Oi=0;const Ii={animation:{Feature:class extends Fi{constructor(t){super(t),t.animationState||(t.animationState=Ri(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();f(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends Fi{constructor(){super(...arguments),this.id=Oi++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===n)return;const i=this.node.animationState.setActive("exit",!t);e&&!t&&i.then((()=>{e(this.id)}))}mount(){const{register:t,onExitComplete:e}=this.node.presenceContext||{};e&&e(this.id),t&&(this.unmount=t(this.id))}unmount(){}}}};function Ui(t,e,n,i={passive:!0}){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n)}function Ni(t){return{point:{x:t.pageX,y:t.pageY}}}function Wi(t,e,n,i){return Ui(t,e,(t=>e=>ht(e)&&t(e,Ni(e)))(n),i)}function $i({top:t,left:e,right:n,bottom:i}){return{x:{min:e,max:n},y:{min:t,max:i}}}function Yi(t){return t.max-t.min}function Xi(t,e,n,i=.5){t.origin=i,t.originPoint=pn(e.min,e.max,t.origin),t.scale=Yi(n)/Yi(e),t.translate=pn(n.min,n.max,t.origin)-t.originPoint,(t.scale>=.9999&&t.scale<=1.0001||isNaN(t.scale))&&(t.scale=1),(t.translate>=-.01&&t.translate<=.01||isNaN(t.translate))&&(t.translate=0)}function Ki(t,e,n,i){Xi(t.x,e.x,n.x,i?i.originX:void 0),Xi(t.y,e.y,n.y,i?i.originY:void 0)}function zi(t,e,n){t.min=n.min+e.min,t.max=t.min+Yi(e)}function Hi(t,e,n){t.min=e.min-n.min,t.max=t.min+Yi(e)}function Gi(t,e,n){Hi(t.x,e.x,n.x),Hi(t.y,e.y,n.y)}const qi=()=>({x:{min:0,max:0},y:{min:0,max:0}});function Zi(t){return[t("x"),t("y")]}function _i(t){return void 0===t||1===t}function Ji({scale:t,scaleX:e,scaleY:n}){return!_i(t)||!_i(e)||!_i(n)}function Qi(t){return Ji(t)||ts(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function ts(t){return es(t.x)||es(t.y)}function es(t){return t&&"0%"!==t}function ns(t,e,n){return n+e*(t-n)}function is(t,e,n,i,s){return void 0!==s&&(t=ns(t,s,i)),ns(t,n,i)+e}function ss(t,e=0,n=1,i,s){t.min=is(t.min,e,n,i,s),t.max=is(t.max,e,n,i,s)}function os(t,{x:e,y:n}){ss(t.x,e.translate,e.scale,e.originPoint),ss(t.y,n.translate,n.scale,n.originPoint)}const rs=.999999999999,as=1.0000000000001;function ls(t,e){t.min=t.min+e,t.max=t.max+e}function us(t,e,n,i,s=.5){ss(t,e,n,pn(t.min,t.max,s),i)}function hs(t,e){us(t.x,e.x,e.scaleX,e.scale,e.originX),us(t.y,e.y,e.scaleY,e.scale,e.originY)}function cs(t,e){return $i(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),i=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}(t.getBoundingClientRect(),e))}const ds=({current:t})=>t?t.ownerDocument.defaultView:null;function ps(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const ms=(t,e)=>Math.abs(t-e);class fs{constructor(t,e,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const t=vs(this.lastMoveEventInfo,this.history),e=null!==this.startEvent,n=function(t,e){const n=ms(t.x,e.x),i=ms(t.y,e.y);return Math.sqrt(n**2+i**2)}(t.offset,{x:0,y:0})>=3;if(!e&&!n)return;const{point:i}=t,{timestamp:s}=tt;this.history.push({...i,timestamp:s});const{onStart:o,onMove:r}=this.handlers;e||(o&&o(this.lastMoveEvent,t),this.startEvent=this.lastMoveEvent),r&&r(this.lastMoveEvent,t)},this.handlePointerMove=(t,e)=>{this.lastMoveEvent=t,this.lastMoveEventInfo=gs(e,this.transformPagePoint),J.update(this.updatePoint,!0)},this.handlePointerUp=(t,e)=>{this.end();const{onEnd:n,onSessionEnd:i,resumeAnimation:s}=this.handlers;if(this.dragSnapToOrigin&&s&&s(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const o=vs("pointercancel"===t.type?this.lastMoveEventInfo:gs(e,this.transformPagePoint),this.history);this.startEvent&&n&&n(t,o),i&&i(t,o)},!ht(t))return;this.dragSnapToOrigin=s,this.handlers=e,this.transformPagePoint=n,this.contextWindow=i||window;const o=gs(Ni(t),this.transformPagePoint),{point:r}=o,{timestamp:a}=tt;this.history=[{...r,timestamp:a}];const{onSessionStart:l}=e;l&&l(t,vs(o,this.history)),this.removeListeners=Tn(Wi(this.contextWindow,"pointermove",this.handlePointerMove),Wi(this.contextWindow,"pointerup",this.handlePointerUp),Wi(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Q(this.updatePoint)}}function gs(t,e){return e?{point:e(t.point)}:t}function ys(t,e){return{x:t.x-e.x,y:t.y-e.y}}function vs({point:t},e){return{point:t,delta:ys(t,Ps(e)),offset:ys(t,xs(e)),velocity:Ts(e,.1)}}function xs(t){return t[0]}function Ps(t){return t[t.length-1]}function Ts(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,i=null;const s=Ps(t);for(;n>=0&&(i=t[n],!(s.timestamp-i.timestamp>V(e)));)n--;if(!i)return{x:0,y:0};const o=E(s.timestamp-i.timestamp);if(0===o)return{x:0,y:0};const r={x:(s.x-i.x)/o,y:(s.y-i.y)/