UNPKG

framer-motion

Version:

A simple and powerful JavaScript animation library

1 lines • 54 kB
import{w as t,q as e,r as n,x as s,y as i,d as r,o,z as a,A as u,B as l,C as h,D as c,E as d,F as p,G as m,H as f,I as v,J as y,K as g,t as b,a as w,L as T,n as A,M as S,N as V,b as M,i as P,m as x,f as C,O as k,P as E,g as F,s as I,u as O,Q as D,R,p as B,h as K,v as N,j as L,k as U}from"./size-rollup-dom-animation-assets.js";import{Fragment as j}from"react";const q={skipAnimations:!1,useManualTiming:!1};function W(t){let e;return()=>(void 0===e&&(e=t()),e)}const $=(t,e,n)=>{const s=e-t;return 0===s?1:(n-t)/s};class z{constructor(){this.subscriptions=[]}add(t){var e,n;return e=this.subscriptions,n=t,-1===e.indexOf(n)&&e.push(n),()=>function(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}(this.subscriptions,t)}notify(t,e,n){const s=this.subscriptions.length;if(s)if(1===s)this.subscriptions[0](t,e,n);else for(let i=0;i<s;i++){const s=this.subscriptions[i];s&&s(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Y=t=>1e3*t,G=t=>t/1e3;function H(t,e){return e?t*(1e3/e):0}const X=W((()=>void 0!==window.ScrollTimeline));class _{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=>X()&&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 Z extends _{then(t,e){return this.finished.finally(t).then((()=>{}))}}const J=t=>Array.isArray(t)&&"number"==typeof t[0],Q={};function tt(t,e){const n=W(t);return()=>Q[e]??n()}const et=tt((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing"),nt=(t,e,n=10)=>{let s="";const i=Math.max(Math.round(e/n),2);for(let e=0;e<i;e++)s+=t(e/(i-1))+", ";return`linear(${s.substring(0,s.length-2)})`},st=([t,e,n,s])=>`cubic-bezier(${t}, ${e}, ${n}, ${s})`,it={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:st([0,.65,.55,1]),circOut:st([.55,0,1,.45]),backIn:st([.31,.01,.66,-.59]),backOut:st([.33,1.53,.69,.99])};function rt(t,e){return t?"function"==typeof t&&et()?nt(t,e):J(t)?st(t):Array.isArray(t)?t.map((t=>rt(t,e)||it.easeOut)):it[t]:void 0}function ot(t,e,n,{delay:s=0,duration:i=300,repeat:r=0,repeatType:o="loop",ease:a="easeInOut",times:u}={},l=void 0){const h={[e]:n};u&&(h.offset=u);const c=rt(a,i);Array.isArray(c)&&(h.easing=c);return t.animate(h,{delay:s,duration:i,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:r+1,direction:"reverse"===o?"alternate":"normal",pseudoElement:l})}function at(t){return"function"==typeof t&&"applyToOptions"in t}function ut(t,e){return t?.[e]??t?.default??t}const lt=2e4;function ht(t){let e=0;let n=t.next(e);for(;!n.done&&e<lt;)e+=50,n=t.next(e);return e>=lt?1/0:e}function ct(t){return Boolean("function"==typeof t&&et()||!t||"string"==typeof t&&(t in it||et())||J(t)||Array.isArray(t)&&t.every(ct))}function dt(t,e){t.timeline=e,t.onfinish=null}let pt;function mt(){pt=void 0}const ft={now:()=>(void 0===pt&&ft.set(t.isProcessing||q.useManualTiming?t.timestamp:performance.now()),pt),set:t=>{pt=t,queueMicrotask(mt)}},vt=!1;function yt(){return vt}function gt(t,e){const n=function(t,e,n){if(t instanceof EventTarget)return[t];if("string"==typeof t){let s=document;e&&(s=e.current);const i=n?.[t]??s.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t)}(t),s=new AbortController;return[n,{passive:!0,...e,signal:s.signal},()=>s.abort()]}function bt(t){return!("touch"===t.pointerType||yt())}const wt=(t,e)=>!!e&&(t===e||wt(t,e.parentElement)),Tt=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const At=new WeakSet;function St(t){return e=>{"Enter"===e.key&&t(e)}}function Vt(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function Mt(t){return(t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary)(t)&&!yt()}function Pt(t,e,n={}){const[s,i,r]=gt(t,n),o=t=>{const s=t.currentTarget;if(!Mt(t)||At.has(s))return;At.add(s);const r=e(s,t),o=(t,e)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",u),Mt(t)&&At.has(s)&&(At.delete(s),"function"==typeof r&&r(t,{success:e}))},a=t=>{o(t,s===window||s===document||n.useGlobalTarget||wt(s,t.target))},u=t=>{o(t,!1)};window.addEventListener("pointerup",a,i),window.addEventListener("pointercancel",u,i)};return s.forEach((t=>{var e;(n.useGlobalTarget?window:t).addEventListener("pointerdown",o,i),t instanceof HTMLElement&&(t.addEventListener("focus",(t=>((t,e)=>{const n=t.currentTarget;if(!n)return;const s=St((()=>{if(At.has(n))return;Vt(n,"down");const t=St((()=>{Vt(n,"up")}));n.addEventListener("keyup",t,e),n.addEventListener("blur",(()=>Vt(n,"cancel")),e)}));n.addEventListener("keydown",s,e),n.addEventListener("blur",(()=>n.removeEventListener("keydown",s)),e)})(t,i))),e=t,Tt.has(e.tagName)||-1!==e.tabIndex||t.hasAttribute("tabindex")||(t.tabIndex=0))})),r}class xt{constructor(t,e={}){this.version="12.7.3",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=ft.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=ft.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,n){this.events[t]||(this.events[t]=new z);const s=this.events[t].add(n);return"change"===t?()=>{s(),e.read((()=>{this.events.change.getSize()||this.stop()}))}:s}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=ft.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return H(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 Ct(t,e){return new xt(t,e)}function kt(t,e,s){const i=t.getProps();return n(i,e,void 0!==s?s:i.custom,t)}const Et=new Set(["width","height","top","left","right","bottom",...s]);function Ft(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Ct(n))}function It(t,e){const n=t.getValue("willChange");if(s=n,Boolean(r(s)&&s.add))return n.add(e);if(!n&&q.WillChange){const n=new q.WillChange("auto");t.addValue("willChange",n),n.add(e)}var s}function Ot(t){return t.props[o]}const Dt=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function Rt(t,e,n,s){if(t===e&&n===s)return a;const i=e=>function(t,e,n,s,i){let r,o,a=0;do{o=e+(n-e)/2,r=Dt(o,s,i)-t,r>0?n=o:e=o}while(Math.abs(r)>1e-7&&++a<12);return o}(e,0,1,t,n);return t=>0===t||1===t?t:Dt(i(t),e,s)}const Bt=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Kt=t=>e=>1-t(1-e),Nt=Rt(.33,1.53,.69,.99),Lt=Kt(Nt),Ut=Bt(Lt),jt=t=>(t*=2)<1?.5*Lt(t):.5*(2-Math.pow(2,-10*(t-1))),qt=t=>1-Math.sin(Math.acos(t)),Wt=Kt(qt),$t=Bt(qt),zt=t=>/^0[^.\s]+$/u.test(t);const Yt=t=>Math.round(1e5*t)/1e5,Gt=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const Ht=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Xt=(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)),_t=(t,e,n)=>s=>{if("string"!=typeof s)return s;const[i,r,o,a]=s.match(Gt);return{[t]:parseFloat(i),[e]:parseFloat(r),[n]:parseFloat(o),alpha:void 0!==a?parseFloat(a):1}},Zt={...u,transform:t=>Math.round((t=>h(0,255,t))(t))},Jt={test:Xt("rgb","red"),parse:_t("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:s=1})=>"rgba("+Zt.transform(t)+", "+Zt.transform(e)+", "+Zt.transform(n)+", "+Yt(l.transform(s))+")"};const Qt={test:Xt("#"),parse:function(t){let e="",n="",s="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,s+=s,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}},transform:Jt.transform},te={test:Xt("hsl","hue"),parse:_t("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:s=1})=>"hsla("+Math.round(t)+", "+c.transform(Yt(e))+", "+c.transform(Yt(n))+", "+Yt(l.transform(s))+")"},ee={test:t=>Jt.test(t)||Qt.test(t)||te.test(t),parse:t=>Jt.test(t)?Jt.parse(t):te.test(t)?te.parse(t):Qt.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?Jt.transform(t):te.transform(t)},ne=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const se="number",ie="color",re=/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 oe(t){const e=t.toString(),n=[],s={color:[],number:[],var:[]},i=[];let r=0;const o=e.replace(re,(t=>(ee.test(t)?(s.color.push(r),i.push(ie),n.push(ee.parse(t))):t.startsWith("var(")?(s.var.push(r),i.push("var"),n.push(t)):(s.number.push(r),i.push(se),n.push(parseFloat(t))),++r,"${}"))).split("${}");return{values:n,split:o,indexes:s,types:i}}function ae(t){return oe(t).values}function ue(t){const{split:e,types:n}=oe(t),s=e.length;return t=>{let i="";for(let r=0;r<s;r++)if(i+=e[r],void 0!==t[r]){const e=n[r];i+=e===se?Yt(t[r]):e===ie?ee.transform(t[r]):t[r]}return i}}const le=t=>"number"==typeof t?0:t;const he={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match(Gt)?.length||0)+(t.match(ne)?.length||0)>0},parse:ae,createTransformer:ue,getAnimatableNone:function(t){const e=ae(t);return ue(t)(e.map(le))}},ce=new Set(["brightness","contrast","saturate","opacity"]);function de(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[s]=n.match(Gt)||[];if(!s)return t;const i=n.replace(s,"");let r=ce.has(e)?1:0;return s!==n&&(r*=100),e+"("+r+i+")"}const pe=/\b([a-z-]*)\(.*?\)/gu,me={...he,getAnimatableNone:t=>{const e=t.match(pe);return e?e.map(de).join(" "):t}},fe={...d,color:ee,backgroundColor:ee,outlineColor:ee,fill:ee,stroke:ee,borderColor:ee,borderTopColor:ee,borderRightColor:ee,borderBottomColor:ee,borderLeftColor:ee,filter:me,WebkitFilter:me},ve=t=>fe[t];function ye(t,e){let n=ve(t);return n!==me&&(n=he),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const ge=new Set(["auto","none","0"]);const be=t=>180*t/Math.PI,we=t=>{const e=be(Math.atan2(t[1],t[0]));return Ae(e)},Te={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:we,rotateZ:we,skewX:t=>be(Math.atan(t[1])),skewY:t=>be(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Ae=t=>((t%=360)<0&&(t+=360),t),Se=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Ve=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),Me={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Se,scaleY:Ve,scale:t=>(Se(t)+Ve(t))/2,rotateX:t=>Ae(be(Math.atan2(t[6],t[5]))),rotateY:t=>Ae(be(Math.atan2(-t[2],t[0]))),rotateZ:we,rotate:we,skewX:t=>be(Math.atan(t[4])),skewY:t=>be(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Pe(t){return t.includes("scale")?1:0}function xe(t,e){if(!t||"none"===t)return Pe(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,i;if(n)s=Me,i=n;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=Te,i=e}if(!i)return Pe(e);const r=s[e],o=i[1].split(",").map(Ce);return"function"==typeof r?r(o):o[r]}function Ce(t){return parseFloat(t.trim())}const ke=t=>t===u||t===p,Ee=new Set(["x","y","z"]),Fe=s.filter((t=>!Ee.has(t)));const Ie={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})=>xe(e,"x"),y:(t,{transform:e})=>xe(e,"y")};Ie.translateX=Ie.x,Ie.translateY=Ie.y;const Oe=new Set;let De=!1,Re=!1;function Be(){if(Re){const t=Array.from(Oe).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 Fe.forEach((n=>{const s=t.getValue(n);void 0!==s&&(e.push([n,s.get()]),s.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)}))}Re=!1,De=!1,Oe.forEach((t=>t.complete())),Oe.clear()}function Ke(){Oe.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(Re=!0)}))}class Ne{constructor(t,e,n,s,i,r=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=s,this.element=i,this.isAsync=r}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Oe.add(this),De||(De=!0,e.read(Ke),e.resolveKeyframes(Be))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:s}=this;for(let i=0;i<t.length;i++)if(null===t[i])if(0===i){const i=s?.get(),r=t[t.length-1];if(void 0!==i)t[0]=i;else if(n&&e){const s=n.readValue(e,r);null!=s&&(t[0]=s)}void 0===t[0]&&(t[0]=r),s&&void 0===i&&s.set(t[0])}else t[i]=t[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Oe.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Oe.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Le=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),Ue=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function je(t,e,n=1){const[s,i]=function(t){const e=Ue.exec(t);if(!e)return[,];const[,n,s,i]=e;return[`--${n??s}`,i]}(t);if(!s)return;const r=window.getComputedStyle(e).getPropertyValue(s);if(r){const t=r.trim();return Le(t)?parseFloat(t):t}return m(i)?je(i,e,n+1):i}const qe=t=>e=>e.test(t),We=[u,p,c,f,v,y,{test:t=>"auto"===t,parse:t=>t}],$e=t=>We.find(qe(t));class ze extends Ne{constructor(t,e,n,s,i){super(t,e,n,s,i,!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 s=t[n];if("string"==typeof s&&(s=s.trim(),m(s))){const i=je(s,e.current);void 0!==i&&(t[n]=i),n===t.length-1&&(this.finalKeyframe=s)}}if(this.resolveNoneKeyframes(),!Et.has(n)||2!==t.length)return;const[s,i]=t,r=$e(s),o=$e(i);if(r!==o)if(ke(r)&&ke(o))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(s=t[e])?0===s:null===s||"none"===s||"0"===s||zt(s))&&n.push(e);var s;n.length&&function(t,e,n){let s,i=0;for(;i<t.length&&!s;){const e=t[i];"string"==typeof e&&!ge.has(e)&&oe(e).values.length&&(s=t[i]),i++}if(s&&n)for(const i of e)t[i]=ye(n,s)}(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=Ie[n](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const s=e[e.length-1];void 0!==s&&t.getValue(n,s).jump(s,!1)}measureEndState(){const{element:t,name:e,unresolvedKeyframes:n}=this;if(!t||!t.current)return;const s=t.getValue(e);s&&s.jump(this.measuredOrigin,!1);const i=n.length-1,r=n[i];n[i]=Ie[e](t.measureViewportBox(),window.getComputedStyle(t.current)),null!==r&&void 0===this.finalKeyframe&&(this.finalKeyframe=r),this.removedTransforms?.length&&this.removedTransforms.forEach((([e,n])=>{t.getValue(e).set(n)})),this.resolveNoneKeyframes()}}const Ye=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!he.test(t)&&"0"!==t||t.startsWith("url(")));function Ge(t,e,n,s){const i=t[0];if(null===i)return!1;if("display"===e||"visibility"===e)return!0;const r=t[t.length-1],o=Ye(i,e),a=Ye(r,e);return!(!o||!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||at(n))&&s)}const He=t=>null!==t;function Xe(t,{repeat:e,repeatType:n="loop"},s){const i=t.filter(He),r=e&&"loop"!==n&&e%2==1?0:i.length-1;return r&&void 0!==s?s:i[r]}class _e{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:r="loop",...o}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=ft.now(),this.options={autoplay:t,delay:e,type:n,repeat:s,repeatDelay:i,repeatType:r,...o},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(Ke(),Be()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=ft.now(),this.hasAttemptedResolve=!0;const{name:n,type:s,velocity:i,delay:r,onComplete:o,onUpdate:a,isGenerator:u}=this.options;if(!u&&!Ge(t,n,s,i)){if(!r)return a&&a(Xe(t,this.options,e)),o&&o(),void this.resolveFinishedPromise();this.options.duration=0}const l=this.initPlayback(t,e);!1!==l&&(this._resolved={keyframes:t,finalKeyframe:e,...l},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 Ze=(t,e,n)=>t+(e-t)*n;function Je(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 Qe(t,e){return n=>n>0?e:t}const tn=(t,e,n)=>{const s=t*t,i=n*(e*e-s)+s;return i<0?0:Math.sqrt(i)},en=[Qt,Jt,te];function nn(t){const e=(n=t,en.find((t=>t.test(n))));var n;if(!Boolean(e))return!1;let s=e.parse(t);return e===te&&(s=function({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,n/=100;let i=0,r=0,o=0;if(e/=100){const s=n<.5?n*(1+e):n+e-n*e,a=2*n-s;i=Je(a,s,t+1/3),r=Je(a,s,t),o=Je(a,s,t-1/3)}else i=r=o=n;return{red:Math.round(255*i),green:Math.round(255*r),blue:Math.round(255*o),alpha:s}}(s)),s}const sn=(t,e)=>{const n=nn(t),s=nn(e);if(!n||!s)return Qe(t,e);const i={...n};return t=>(i.red=tn(n.red,s.red,t),i.green=tn(n.green,s.green,t),i.blue=tn(n.blue,s.blue,t),i.alpha=Ze(n.alpha,s.alpha,t),Jt.transform(i))},rn=(t,e)=>n=>e(t(n)),on=(...t)=>t.reduce(rn),an=new Set(["none","hidden"]);function un(t,e){return n=>Ze(t,e,n)}function ln(t){return"number"==typeof t?un:"string"==typeof t?m(t)?Qe:ee.test(t)?sn:dn:Array.isArray(t)?hn:"object"==typeof t?ee.test(t)?sn:cn:Qe}function hn(t,e){const n=[...t],s=n.length,i=t.map(((t,n)=>ln(t)(t,e[n])));return t=>{for(let e=0;e<s;e++)n[e]=i[e](t);return n}}function cn(t,e){const n={...t,...e},s={};for(const i in n)void 0!==t[i]&&void 0!==e[i]&&(s[i]=ln(t[i])(t[i],e[i]));return t=>{for(const e in s)n[e]=s[e](t);return n}}const dn=(t,e)=>{const n=he.createTransformer(e),s=oe(t),i=oe(e);return s.indexes.var.length===i.indexes.var.length&&s.indexes.color.length===i.indexes.color.length&&s.indexes.number.length>=i.indexes.number.length?an.has(t)&&!i.values.length||an.has(e)&&!s.values.length?function(t,e){return an.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):on(hn(function(t,e){const n=[],s={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const r=e.types[i],o=t.indexes[r][s[r]],a=t.values[o]??0;n[i]=a,s[r]++}return n}(s,i),i.values),n):Qe(t,e)};function pn(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return Ze(t,e,n);return ln(t)(t,e)}function mn(t,e,n){const s=Math.max(e-5,0);return H(n-t(s),e-s)}const fn=100,vn=10,yn=1,gn=0,bn=800,wn=.3,Tn=.3,An={granular:.01,default:2},Sn={granular:.005,default:.5},Vn=.01,Mn=10,Pn=.05,xn=1,Cn=.001;function kn({duration:t=bn,bounce:e=wn,velocity:n=gn,mass:s=yn}){let i,r,o=1-e;o=h(Pn,xn,o),t=h(Vn,Mn,G(t)),o<1?(i=e=>{const s=e*o,i=s*t,r=s-n,a=Fn(e,o),u=Math.exp(-i);return Cn-r/a*u},r=e=>{const s=e*o*t,r=s*n+n,a=Math.pow(o,2)*Math.pow(e,2)*t,u=Math.exp(-s),l=Fn(Math.pow(e,2),o);return(-i(e)+Cn>0?-1:1)*((r-a)*u)/l}):(i=e=>Math.exp(-e*t)*((e-n)*t+1)-.001,r=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let s=n;for(let n=1;n<En;n++)s-=t(s)/e(s);return s}(i,r,5/t);if(t=Y(t),isNaN(a))return{stiffness:fn,damping:vn,duration:t};{const e=Math.pow(a,2)*s;return{stiffness:e,damping:2*o*Math.sqrt(s*e),duration:t}}}const En=12;function Fn(t,e){return t*Math.sqrt(1-e*e)}const In=["duration","bounce"],On=["stiffness","damping","mass"];function Dn(t,e){return e.some((e=>void 0!==t[e]))}function Rn(t=Tn,e=wn){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:s,restDelta:i}=n;const r=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:r},{stiffness:u,damping:l,mass:c,duration:d,velocity:p,isResolvedFromDuration:m}=function(t){let e={velocity:gn,stiffness:fn,damping:vn,mass:yn,isResolvedFromDuration:!1,...t};if(!Dn(t,On)&&Dn(t,In))if(t.visualDuration){const n=t.visualDuration,s=2*Math.PI/(1.2*n),i=s*s,r=2*h(.05,1,1-(t.bounce||0))*Math.sqrt(i);e={...e,mass:yn,stiffness:i,damping:r}}else{const n=kn(t);e={...e,...n,mass:yn},e.isResolvedFromDuration=!0}return e}({...n,velocity:-G(n.velocity||0)}),f=p||0,v=l/(2*Math.sqrt(u*c)),y=o-r,g=G(Math.sqrt(u/c)),b=Math.abs(y)<5;let w;if(s||(s=b?An.granular:An.default),i||(i=b?Sn.granular:Sn.default),v<1){const t=Fn(g,v);w=e=>{const n=Math.exp(-v*g*e);return o-n*((f+v*g*y)/t*Math.sin(t*e)+y*Math.cos(t*e))}}else if(1===v)w=t=>o-Math.exp(-g*t)*(y+(f+g*y)*t);else{const t=g*Math.sqrt(v*v-1);w=e=>{const n=Math.exp(-v*g*e),s=Math.min(t*e,300);return o-n*((f+v*g*y)*Math.sinh(s)+t*y*Math.cosh(s))/t}}const T={calculatedDuration:m&&d||null,next:t=>{const e=w(t);if(m)a.done=t>=d;else{let n=0;v<1&&(n=0===t?Y(f):mn(w,t,e));const r=Math.abs(n)<=s,u=Math.abs(o-e)<=i;a.done=r&&u}return a.value=a.done?o:e,a},toString:()=>{const t=Math.min(ht(T),lt),e=nt((e=>T.next(t*e).value),t,30);return t+"ms "+e},toTransition:()=>{}};return T}function Bn({keyframes:t,velocity:e=0,power:n=.8,timeConstant:s=325,bounceDamping:i=10,bounceStiffness:r=500,modifyTarget:o,min:a,max:u,restDelta:l=.5,restSpeed:h}){const c=t[0],d={done:!1,value:c},p=t=>void 0===a?u:void 0===u||Math.abs(a-t)<Math.abs(u-t)?a:u;let m=n*e;const f=c+m,v=void 0===o?f:o(f);v!==f&&(m=v-c);const y=t=>-m*Math.exp(-t/s),g=t=>v+y(t),b=t=>{const e=y(t),n=g(t);d.done=Math.abs(e)<=l,d.value=d.done?v:n};let w,T;const A=t=>{var e;(e=d.value,void 0!==a&&e<a||void 0!==u&&e>u)&&(w=t,T=Rn({keyframes:[d.value,p(d.value)],velocity:mn(g,t,d.value),damping:i,stiffness:r,restDelta:l,restSpeed:h}))};return A(0),{calculatedDuration:null,next:t=>{let e=!1;return T||void 0!==w||(e=!0,b(t),A(t)),void 0!==w&&t>=w?T.next(t-w):(!e&&b(t),d)}}}Rn.applyToOptions=t=>{const e=function(t,e=100,n){const s=n({...t,keyframes:[0,e]}),i=Math.min(ht(s),lt);return{type:"keyframes",ease:t=>s.next(i*t).value/e,duration:G(i)}}(t,100,Rn);return t.ease=et()?e.ease:"easeOut",t.duration=Y(e.duration),t.type="keyframes",t};const Kn=Rt(.42,0,1,1),Nn=Rt(0,0,.58,1),Ln=Rt(.42,0,.58,1),Un={linear:a,easeIn:Kn,easeInOut:Ln,easeOut:Nn,circIn:qt,circInOut:$t,circOut:Wt,backIn:Lt,backInOut:Ut,backOut:Nt,anticipate:jt},jn=t=>{if(J(t)){t.length;const[e,n,s,i]=t;return Rt(e,n,s,i)}return"string"==typeof t?Un[t]:t};function qn(t,e,{clamp:n=!0,ease:s,mixer:i}={}){const r=t.length;if(e.length,1===r)return()=>e[0];if(2===r&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[r-1]&&(t=[...t].reverse(),e=[...e].reverse());const u=function(t,e,n){const s=[],i=n||pn,r=t.length-1;for(let n=0;n<r;n++){let r=i(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]||a:e;r=on(t,r)}s.push(r)}return s}(e,s,i),l=u.length,c=n=>{if(o&&n<t[0])return e[0];let s=0;if(l>1)for(;s<t.length-2&&!(n<t[s+1]);s++);const i=$(t[s],t[s+1],n);return u[s](i)};return n?e=>c(h(t[0],t[r-1],e)):c}function Wn(t){const e=[0];return function(t,e){const n=t[t.length-1];for(let s=1;s<=e;s++){const i=$(0,e,s);t.push(Ze(n,1,i))}}(e,t.length-1),e}function $n({duration:t=300,keyframes:e,times:n,ease:s="easeInOut"}){const i=(t=>Array.isArray(t)&&"number"!=typeof t[0])(s)?s.map(jn):jn(s),r={done:!1,value:e[0]},o=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:Wn(e),t),a=qn(o,e,{ease:Array.isArray(i)?i:(u=e,l=i,u.map((()=>l||Ln)).splice(0,u.length-1))});var u,l;return{calculatedDuration:t,next:e=>(r.value=a(e),r.done=e>=t,r)}}const zn=n=>{const s=({timestamp:t})=>n(t);return{start:()=>e.update(s,!0),stop:()=>g(s),now:()=>t.isProcessing?t.timestamp:ft.now()}},Yn={decay:Bn,inertia:Bn,tween:$n,keyframes:$n,spring:Rn},Gn=t=>t/100;class Hn extends _e{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:s,keyframes:i}=this.options,r=s?.KeyframeResolver||Ne;this.resolver=new r(i,((t,e)=>this.onKeyframesResolved(t,e)),e,n,s),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:s=0,repeatType:i,velocity:r=0}=this.options,o=at(e)?e:Yn[e]||$n;let a,u;o!==$n&&"number"!=typeof t[0]&&(a=on(Gn,pn(t[0],t[1])),t=[0,100]);const l=o({...this.options,keyframes:t});"mirror"===i&&(u=o({...this.options,keyframes:[...t].reverse(),velocity:-r})),null===l.calculatedDuration&&(l.calculatedDuration=ht(l));const{calculatedDuration:h}=l,c=h+s;return{generator:l,mirroredGenerator:u,mapPercentToKeyframes:a,calculatedDuration:h,resolvedDuration:c,totalDuration:c*(n+1)-s}}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:s,generator:i,mirroredGenerator:r,mapPercentToKeyframes:o,keyframes:a,calculatedDuration:u,totalDuration:l,resolvedDuration:c}=n;if(null===this.startTime)return i.next(0);const{delay:d,repeat:p,repeatType:m,repeatDelay:f,onUpdate:v}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-l/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 y=this.currentTime-d*(this.speed>=0?1:-1),g=this.speed>=0?y<0:y>l;this.currentTime=Math.max(y,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=l);let b=this.currentTime,w=i;if(p){const t=Math.min(this.currentTime,l)/c;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,p+1);Boolean(e%2)&&("reverse"===m?(n=1-n,f&&(n-=f/c)):"mirror"===m&&(w=r)),b=h(0,1,n)*c}const T=g?{done:!1,value:a[0]}:w.next(b);o&&(T.value=o(T.value));let{done:A}=T;g||null===u||(A=this.speed>=0?this.currentTime>=l:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&A);return S&&void 0!==s&&(T.value=Xe(a,this.options,s)),v&&v(T.value),S&&this.finish(),T}get duration(){const{resolved:t}=this;return t?G(t.calculatedDuration):0}get time(){return G(this.currentTime)}set time(t){t=Y(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=G(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=zn,onPlay:e,startTime:n}=this.options;this.driver||(this.driver=t((t=>this.tick(t)))),e&&e();const s=this.driver.now();null!==this.holdTime?this.startTime=s-this.holdTime:this.startTime?"finished"===this.state&&(this.startTime=s):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 Xn=new Set(["opacity","clipPath","filter","transform"]),_n=W((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));const Zn={anticipate:jt,backInOut:Ut,circInOut:$t};class Jn extends _e{constructor(t){super(t);const{name:e,motionValue:n,element:s,keyframes:i}=this.options;this.resolver=new ze(i,((t,e)=>this.onKeyframesResolved(t,e)),e,n,s),this.resolver.scheduleResolve()}initPlayback(t,e){let{duration:n=300,times:s,ease:i,type:r,motionValue:o,name:a,startTime:u}=this.options;if(!o.owner||!o.owner.current)return!1;var l;if("string"==typeof i&&et()&&i in Zn&&(i=Zn[i]),at((l=this.options).type)||"spring"===l.type||!ct(l.ease)){const{onComplete:e,onUpdate:o,motionValue:a,element:u,...l}=this.options,h=function(t,e){const n=new Hn({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let s={done:!1,value:t[0]};const i=[];let r=0;for(;!s.done&&r<2e4;)s=n.sample(r),i.push(s.value),r+=10;return{times:void 0,keyframes:i,duration:r-10,ease:"linear"}}(t,l);1===(t=h.keyframes).length&&(t[1]=t[0]),n=h.duration,s=h.times,i=h.ease,r="keyframes"}const h=ot(o.owner.current,a,t,{...this.options,duration:n,times:s,ease:i});return h.startTime=u??this.calcStartTime(),this.pendingTimeline?(dt(h,this.pendingTimeline),this.pendingTimeline=void 0):h.onfinish=()=>{const{onComplete:n}=this.options;o.set(Xe(t,this.options,e)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:h,duration:n,times:s,type:r,ease:i,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:e}=t;return G(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return G(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=Y(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 a;const{animation:n}=e;dt(n,t)}else this.pendingTimeline=t;return a}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:s,type:i,ease:r,times:o}=t;if("idle"===e.playState||"finished"===e.playState)return;if(this.time){const{motionValue:t,onUpdate:e,onComplete:a,element:u,...l}=this.options,h=new Hn({...l,keyframes:n,duration:s,type:i,ease:r,times:o,isGenerator:!0}),c=Y(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:s,repeatType:i,damping:r,type:o}=t;if(!(e&&e.owner&&e.owner.current instanceof HTMLElement))return!1;const{onUpdate:a,transformTemplate:u}=e.owner.getProps();return _n()&&n&&Xn.has(n)&&("transform"!==n||!u)&&!a&&!s&&"mirror"!==i&&0!==r&&"inertia"!==o}}const Qn={type:"spring",stiffness:500,damping:25,restSpeed:10},ts={type:"keyframes",duration:.8},es={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},ns=(t,{keyframes:e})=>e.length>2?ts:b.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:Qn:es;const ss=(t,n,s,i={},r,o)=>a=>{const u=ut(i,t)||{},l=u.delay||i.delay||0;let{elapsed:h=0}=i;h-=Y(l);let c={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:n.getVelocity(),...u,delay:-h,onUpdate:t=>{n.set(t),u.onUpdate&&u.onUpdate(t)},onComplete:()=>{a(),u.onComplete&&u.onComplete()},name:t,motionValue:n,element:o?void 0:r};(function({when:t,delay:e,delayChildren:n,staggerChildren:s,staggerDirection:i,repeat:r,repeatType:o,repeatDelay:a,from:u,elapsed:l,...h}){return!!Object.keys(h).length})(u)||(c={...c,...ns(t,c)}),c.duration&&(c.duration=Y(c.duration)),c.repeatDelay&&(c.repeatDelay=Y(c.repeatDelay)),void 0!==c.from&&(c.keyframes[0]=c.from);let d=!1;if((!1===c.type||0===c.duration&&!c.repeatDelay)&&(c.duration=0,0===c.delay&&(d=!0)),c.allowFlatten=!u.type&&!u.ease,d&&!o&&void 0!==n.get()){const t=Xe(c.keyframes,u);if(void 0!==t)return e.update((()=>{c.onUpdate(t),c.onComplete()})),new Z([])}return!o&&Jn.supports(c)?new Jn(c):new Hn(c)};function is({protectedKeys:t,needsAnimating:e},n){const s=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,s}function rs(t,n,{delay:s=0,transitionOverride:r,type:o}={}){let{transition:a=t.getDefaultTransition(),transitionEnd:u,...l}=n;r&&(a=r);const h=[],c=o&&t.animationState&&t.animationState.getState()[o];for(const n in l){const i=t.getValue(n,t.latestValues[n]??null),r=l[n];if(void 0===r||c&&is(c,n))continue;const o={delay:s,...ut(a||{},n)};let u=!1;if(window.MotionHandoffAnimation){const s=Ot(t);if(s){const t=window.MotionHandoffAnimation(s,n,e);null!==t&&(o.startTime=t,u=!0)}}It(t,n),i.start(ss(n,i,r,t.shouldReduceMotion&&Et.has(n)?{type:!1}:o,t,u));const d=i.animation;d&&h.push(d)}return u&&Promise.all(h).then((()=>{e.update((()=>{u&&function(t,e){const n=kt(t,e);let{transitionEnd:s={},transition:r={},...o}=n||{};o={...o,...s};for(const e in o)Ft(t,e,i(o[e]))}(t,u)}))})),h}function os(t,e,n={}){const s=kt(t,e,"exit"===n.type?t.presenceContext?.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const r=s?()=>Promise.all(rs(t,s,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(s=0)=>{const{delayChildren:r=0,staggerChildren:o,staggerDirection:a}=i;return function(t,e,n=0,s=0,i=1,r){const o=[],a=(t.variantChildren.size-1)*s,u=1===i?(t=0)=>t*s:(t=0)=>a-t*s;return Array.from(t.variantChildren).sort(as).forEach(((t,s)=>{t.notify("AnimationStart",e),o.push(os(t,e,{...r,delay:n+u(s)}).then((()=>t.notify("AnimationComplete",e))))})),Promise.all(o)}(t,e,r+s,o,a,n)}:()=>Promise.resolve(),{when:a}=i;if(a){const[t,e]="beforeChildren"===a?[r,o]:[o,r];return t().then((()=>e()))}return Promise.all([r(),o(n.delay)])}function as(t,e){return t.sortNodePosition(e)}function us(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let s=0;s<n;s++)if(e[s]!==t[s])return!1;return!0}const ls=T.length;function hs(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&hs(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let n=0;n<ls;n++){const s=T[n],i=t.props[s];(w(i)||!1===i)&&(e[s]=i)}return e}const cs=[...V].reverse(),ds=V.length;function ps(t){return e=>Promise.all(e.map((({animation:e,options:n})=>function(t,e,n={}){let s;if(t.notify("AnimationStart",e),Array.isArray(e)){const i=e.map((e=>os(t,e,n)));s=Promise.all(i)}else if("string"==typeof e)s=os(t,e,n);else{const i="function"==typeof e?kt(t,e,n.custom):e;s=Promise.all(rs(t,i,n))}return s.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function ms(t){let e=ps(t),n=ys(),s=!0;const i=e=>(n,s)=>{const i=kt(t,s,"exit"===e?t.presenceContext?.custom:void 0);if(i){const{transition:t,transitionEnd:e,...s}=i;n={...n,...s,...e}}return n};function r(r){const{props:o}=t,a=hs(t.parent)||{},u=[],l=new Set;let h={},c=1/0;for(let e=0;e<ds;e++){const d=cs[e],p=n[d],m=void 0!==o[d]?o[d]:a[d],f=w(m),v=d===r?p.isActive:null;!1===v&&(c=e);let y=m===a[d]&&m!==o[d]&&f;if(y&&s&&t.manuallyAnimateOnMount&&(y=!1),p.protectedKeys={...h},!p.isActive&&null===v||!m&&!p.prevProp||A(m)||"boolean"==typeof m)continue;const g=fs(p.prevProp,m);let b=g||d===r&&p.isActive&&!y&&f||e>c&&f,T=!1;const V=Array.isArray(m)?m:[m];let M=V.reduce(i(d),{});!1===v&&(M={});const{prevResolvedValues:P={}}=p,x={...P,...M},C=e=>{b=!0,l.has(e)&&(T=!0,l.delete(e)),p.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in x){const e=M[t],n=P[t];if(h.hasOwnProperty(t))continue;let s=!1;s=S(e)&&S(n)?!us(e,n):e!==n,s?null!=e?C(t):l.add(t):void 0!==e&&l.has(t)?C(t):p.protectedKeys[t]=!0}p.prevProp=m,p.prevResolvedValues=M,p.isActive&&(h={...h,...M}),s&&t.blockInitialAnimation&&(b=!1);b&&(!(y&&g)||T)&&u.push(...V.map((t=>({animation:t,options:{type:d}}))))}if(l.size){const e={};if("boolean"!=typeof o.initial){const n=kt(t,Array.isArray(o.initial)?o.initial[0]:o.initial);n&&n.transition&&(e.transition=n.transition)}l.forEach((n=>{const s=t.getBaseTarget(n),i=t.getValue(n);i&&(i.liveStyle=!0),e[n]=s??null})),u.push({animation:e})}let d=Boolean(u.length);return!s||!1!==o.initial&&o.initial!==o.animate||t.manuallyAnimateOnMount||(d=!1),s=!1,d?e(u):Promise.resolve()}return{animateChanges:r,setActive:function(e,s){if(n[e].isActive===s)return Promise.resolve();t.variantChildren?.forEach((t=>t.animationState?.setActive(e,s))),n[e].isActive=s;const i=r(e);for(const t in n)n[t].protectedKeys={};return i},setAnimateFunction:function(n){e=n(t)},getState:()=>n,reset:()=>{n=ys(),s=!0}}}function fs(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!us(e,t)}function vs(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function ys(){return{animate:vs(!0),whileInView:vs(),whileHover:vs(),whileTap:vs(),whileDrag:vs(),whileFocus:vs(),exit:vs()}}class gs{constructor(t){this.isMounted=!1,this.node=t}update(){}}let bs=0;const ws={animation:{Feature:class extends gs{constructor(t){super(t),t.animationState||(t.animationState=ms(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();A(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 gs{constructor(){super(...arguments),this.id=bs++}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 s=this.node.animationState.setActive("exit",!t);e&&!t&&s.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 Ts(t){return{point:{x:t.pageX,y:t.pageY}}}function As(t,n,s){const{props:i}=t;t.animationState&&i.whileHover&&t.animationState.setActive("whileHover","Start"===s);const r=i["onHover"+s];r&&e.postRender((()=>r(n,Ts(n))))}function Ss(t,e,n,s={passive:!0}){return t.addEventListener(e,n,s),()=>t.removeEventListener(e,n)}function Vs(t,n,s){const{props:i}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&i.whileTap&&t.animationState.setActive("whileTap","Start"===s);const r=i["onTap"+("End"===s?"":s)];r&&e.postRender((()=>r(n,Ts(n))))}const Ms=new WeakMap,Ps=new WeakMap,xs=t=>{const e=Ms.get(t.target);e&&e(t)},Cs=t=>{t.forEach(xs)};function ks(t,e,n){const s=function({root:t,...e}){const n=t||document;Ps.has(n)||Ps.set(n,{});const s=Ps.get(n),i=JSON.stringify(e);return s[i]||(s[i]=new IntersectionObserver(Cs,{root:t,...e})),s[i]}(e);return Ms.set(t,n),s.observe(t),()=>{Ms.delete(t),s.unobserve(t)}}const Es={some:0,all:1};const Fs={inView:{Feature:class extends gs{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:e,margin:n,amount:s="some",once:i}=t,r={root:e?e.current:void 0,rootMargin:n,threshold:"number"==typeof s?s:Es[s]};return ks(this.node.current,r,(t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,i&&!e&&this.hasEnteredView)return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",e);const{onViewportEnter:n,onViewportLeave:s}=this.node.getProps(),r=e?n:s;r&&r(t)}))}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:t,prevProps:e}=this.node;["amount","margin","root"].some(function({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}(t,e))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends gs{mount(){const{current:t}=this.node;t&&(this.unmount=Pt(t,((t,e)=>(Vs(this.node,e,"Start"),(t,{success:e})=>Vs(this.node,t,e?"End":"Cancel"))),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends gs{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch(e){t=!0}t&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=on(Ss(this.node.current,"focus",(()=>this.onFocus())),Ss(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends gs{mount(){const{current:t}=this.node;t&&(this.unmount=function(t,e,n={}){const[s,i,r]=gt(t,n),o=t=>{if(!bt(t))return;const{target:n}=t,s=e(n,t);if("function"!=typeof s||!n)return;const r=t=>{bt(t)&&(s(t),n.removeEventListener("pointerleave",r))};n.addEventListener("pointerleave",r,i)};return s.forEach((t=>{t.addEventListener("pointerenter",o,i)})),r}(t,((t,e)=>(As(this.node,e,"Start"),t=>As(this.node,t,"End")))))}unmount(){}}}};const Is=()=>({x:{min:0,max:0},y:{min:0,max:0}}),Os={current:null},Ds={current:!1};const Rs=[...We,ee,he],Bs=new WeakMap;const Ks=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Ns{scrapeMotionValuesFromProps(t,e,n){return{}}constructor({parent:t,props:n,presenceContext:s,reducedMotionConfig:i,blockInitialAnimation:o,visualState:a},u={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Ne,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=ft.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,e.render(this.render,!1,!0))};const{latestValues:l,renderState:h,onUpdate:c}=a;this.onUpdate=c,this.latestValues=l,this.baseTarget={...l},this.initialValues=n.initial?{...l}:{},this.renderState=h,this.parent=t,this.props=n,this.presenceContext=s,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.options=u,this.blockInitialAnimation=Boolean(o),this.isControllingVariants=P(n),this.isVariantNode=x(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:d,...p}=this.scrapeMotionValuesFromProps(n,{},this);for(const t in p){const e=p[t];void 0!==l[t]&&r(e)&&e.set(l[t],!1)}}mount(t){this.current=t,Bs.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach(((t,e)=>this.bindToMotionValue(e,t))),Ds.current||function(){if(Ds.current=!0,M)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Os.current=t.matches;t.addListener(e),e()}else Os.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||Os.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),g(this.notifyUpdate),g(this.render),this.valueSubscriptions.forEach((t=>t())),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const s=b.has(t);s&&this.onBindTransform&&this.onBindTransform();const i=n.on("change",(n=>{this.latestValues[t]=n,this.props.onUpdate&&e.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0)})),r=n.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,(()=>{i(),r(),o&&o(),n.owner&&n.stop()}))}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in C){const e=C[t];if(!e)continue;const{isEnabled:n,Feature:s}=e;if(!this.features[t]&&s&&n(this.props)&&(this.features[t]=new s(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<Ks.length;e++){const n=Ks[e];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const s=t["on"+n];s&&(this.propEventSubscriptions[n]=this.on(n,s))}this.prevMotionValues=function(t,e,n){for(const s in e){const i=e[s],o=n[s];if(r(i))t.addValue(s,i);else if(r(o))t.addValue(s,Ct(i,{owner:t}));else if(o!==i)if(t.hasValue(s)){const e=t.getValue(s);!0===e.liveStyle?e.jump(i):e.hasAnimated||e.set(i)}else{const e=t.getStaticValue(s);t.addValue(s,Ct(void 0!==e?e:i,{owner:t}))}}for(const s in n)void 0===e[s]&&t.removeValue(s);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return