framer-motion
Version:
A simple and powerful JavaScript animation library
1 lines • 144 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Motion={},t.React)}(this,(function(t,e){"use strict";function n(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var i=n(e),s=React,o=Symbol.for("react.element"),r=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,l=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function c(t,e,n){var i,s={},r=null,c=null;for(i in void 0!==n&&(r=""+n),void 0!==e.key&&(r=""+e.key),void 0!==e.ref&&(c=e.ref),e)a.call(e,i)&&!u.hasOwnProperty(i)&&(s[i]=e[i]);if(t&&t.defaultProps)for(i in e=t.defaultProps)void 0===s[i]&&(s[i]=e[i]);return{$$typeof:o,type:t,key:r,ref:c,props:s,_owner:l.current}}const h=r,d=c,p=c,m=e.createContext({});function f(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}const g=t=>Array.isArray(t);function y(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 v(t){return"string"==typeof t||Array.isArray(t)}function x(t){const e=[{},{}];return null==t||t.values.forEach((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()}),e}function w(t,e,n,i){if("function"==typeof e){const[s,o]=x(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]=x(i);e=e(void 0!==n?n:t.custom,s,o)}return e}function P(t,e,n){const i=t.getProps();return w(i,e,void 0!==n?n:i.custom,t)}const S=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],T=["initial",...S],b=t=>t;let A=b,E=b;function M(t){let e;return()=>(void 0===e&&(e=t()),e)}const C=(t,e,n)=>{const i=e-t;return 0===i?1:(n-t)/i},V=t=>1e3*t,R=t=>t/1e3,D=M(()=>void 0!==window.ScrollTimeline);class k extends class{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}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")}}{then(t,e){return Promise.all(this.animations).then(t).catch(e)}}function L(t,e){return t?t[e]||t.default||t:void 0}function B(t){let e=0;let n=t.next(e);for(;!n.done&&e<2e4;)e+=50,n=t.next(e);return e>=2e4?1/0:e}function F(t,e=100,n){const i=n({...t,keyframes:[0,e]}),s=Math.min(B(i),2e4);return{type:"keyframes",ease:t=>i.next(s*t).value/e,duration:R(s)}}function j(t){return"function"==typeof t}function O(t,e){t.timeline=e,t.onfinish=null}const I=t=>Array.isArray(t)&&"number"==typeof t[0],U={linearEasing:void 0};function W(t,e){const n=M(t);return()=>{var t;return null!==(t=U[e])&&void 0!==t?t:n()}}const N=W(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),z=(t,e,n=10)=>{let i="";const s=Math.max(Math.round(e/n),2);for(let e=0;e<s;e++)i+=t(C(0,s-1,e))+", ";return`linear(${i.substring(0,i.length-2)})`};function $(t){return Boolean("function"==typeof t&&N()||!t||"string"==typeof t&&(t in X||N())||I(t)||Array.isArray(t)&&t.every($))}const H=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,X={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:H([0,.65,.55,1]),circOut:H([.55,0,1,.45]),backIn:H([.31,.01,.66,-.59]),backOut:H([.33,1.53,.69,.99])};const Y={x:!1,y:!1};function K(){return Y.x||Y.y}function G(t,e,n){var i;if(t instanceof Element)return[t];if("string"==typeof t){let s=document;e&&(s=e.current);const o=null!==(i=null==n?void 0:n[t])&&void 0!==i?i:s.querySelectorAll(t);return o?Array.from(o):[]}return Array.from(t)}function _(t,e){const n=G(t),i=new AbortController;return[n,{passive:!0,...e,signal:i.signal},()=>i.abort()]}function q(t){return!("touch"===t.pointerType||K())}function Z(t,e,n={}){const[i,s,o]=_(t,n),r=t=>{if(!q(t))return;const{target:n}=t,i=e(n,t);if("function"!=typeof i||!n)return;const o=t=>{q(t)&&(i(t),n.removeEventListener("pointerleave",o))};n.addEventListener("pointerleave",o,s)};return i.forEach(t=>{t.addEventListener("pointerenter",r,s)}),o}const J=(t,e)=>!!e&&(t===e||J(t,e.parentElement)),Q=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,tt=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const et=new WeakSet;function nt(t){return e=>{"Enter"===e.key&&t(e)}}function it(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function st(t){return Q(t)&&!K()}function ot(t,e,n={}){const[i,s,o]=_(t,n),r=t=>{const i=t.currentTarget;if(!st(t)||et.has(i))return;et.add(i);const o=e(i,t),r=(t,e)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",l),st(t)&&et.has(i)&&(et.delete(i),"function"==typeof o&&o(t,{success:e}))},a=t=>{r(t,n.useGlobalTarget||J(i,t.target))},l=t=>{r(t,!1)};window.addEventListener("pointerup",a,s),window.addEventListener("pointercancel",l,s)};return i.forEach(t=>{(function(t){return tt.has(t.tagName)||-1!==t.tabIndex})(t)||null!==t.getAttribute("tabindex")||(t.tabIndex=0);(n.useGlobalTarget?window:t).addEventListener("pointerdown",r,s),t.addEventListener("focus",t=>((t,e)=>{const n=t.currentTarget;if(!n)return;const i=nt(()=>{if(et.has(n))return;it(n,"down");const t=nt(()=>{it(n,"up")});n.addEventListener("keyup",t,e),n.addEventListener("blur",()=>it(n,"cancel"),e)});n.addEventListener("keydown",i,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),e)})(t,s),s)}),o}const rt={skipAnimations:!1,useManualTiming:!1};const at=["read","resolveKeyframes","update","preRender","render","postRender"];function lt(t,e){let n=!1,i=!0;const s={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,r=at.reduce((t,e)=>(t[e]=function(t){let e=new Set,n=new Set,i=!1,s=!1;const o=new WeakSet;let r={delta:0,timestamp:0,isProcessing:!1};function a(e){o.has(e)&&(l.schedule(e),t()),e(r)}const l={schedule:(t,s=!1,r=!1)=>{const a=r&&i?e:n;return s&&o.add(t),a.has(t)||a.add(t),t},cancel:t=>{n.delete(t),o.delete(t)},process:t=>{r=t,i?s=!0:(i=!0,[e,n]=[n,e],e.forEach(a),e.clear(),i=!1,s&&(s=!1,l.process(t)))}};return l}(o),t),{}),{read:a,resolveKeyframes:l,update:u,preRender:c,render:h,postRender:d}=r,p=()=>{const o=rt.useManualTiming?s.timestamp: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),c.process(s),h.process(s),d.process(s),s.isProcessing=!1,n&&e&&(i=!1,t(p))};return{schedule:at.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<at.length;e++)r[at[e]].cancel(t)},state:s,steps:r}}const{schedule:ut,cancel:ct,state:ht,steps:dt}=lt("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:b,!0),pt=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],mt=new Set(pt),ft=new Set(["width","height","top","left","right","bottom",...pt]);let gt;function yt(){gt=void 0}const vt={now:()=>(void 0===gt&&vt.set(ht.isProcessing||rt.useManualTiming?ht.timestamp:performance.now()),gt),set:t=>{gt=t,queueMicrotask(yt)}};function xt(t,e){-1===t.indexOf(e)&&t.push(e)}function wt(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class Pt{constructor(){this.subscriptions=[]}add(t){return xt(this.subscriptions,t),()=>wt(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}}function St(t,e){return e?t*(1e3/e):0}const Tt={current:void 0};class bt{constructor(t,e={}){this.version="12.0.6",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=vt.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=vt.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 Pt);const n=this.events[t].add(e);return"change"===t?()=>{n(),ut.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 Tt.current&&Tt.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=vt.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return St(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 At(t,e){return new bt(t,e)}function Et(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,At(n))}function Mt(t,e){const n=P(t,e);let{transitionEnd:i={},transition:s={},...o}=n||{};o={...o,...i};for(const e in o){Et(t,e,(r=o[e],g(r)?r[r.length-1]||0:r))}var r}const Ct=t=>Boolean(t&&t.getVelocity);function Vt(t,e){const n=t.getValue("willChange");if(i=n,Boolean(Ct(i)&&i.add))return n.add(e);var i}const Rt=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Dt="data-"+Rt("framerAppearId");function kt(t){return t.props[Dt]}const Lt={current:!1},Bt=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function Ft(t,e,n,i){if(t===e&&n===i)return b;const s=e=>function(t,e,n,i,s){let o,r,a=0;do{r=e+(n-e)/2,o=Bt(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:Bt(s(t),e,i)}const jt=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Ot=t=>e=>1-t(1-e),It=Ft(.33,1.53,.69,.99),Ut=Ot(It),Wt=jt(Ut),Nt=t=>(t*=2)<1?.5*Ut(t):.5*(2-Math.pow(2,-10*(t-1))),zt=t=>1-Math.sin(Math.acos(t)),$t=Ot(zt),Ht=jt(zt),Xt=t=>/^0[^.\s]+$/u.test(t);const Yt=(t,e,n)=>n>e?e:n<t?t:n,Kt={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},Gt={...Kt,transform:t=>Yt(0,1,t)},_t={...Kt,default:1},qt=t=>Math.round(1e5*t)/1e5,Zt=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const Jt=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Qt=(t,e)=>n=>Boolean("string"==typeof n&&Jt.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),te=(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}},ee={...Kt,transform:t=>Math.round((t=>Yt(0,255,t))(t))},ne={test:Qt("rgb","red"),parse:te("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+ee.transform(t)+", "+ee.transform(e)+", "+ee.transform(n)+", "+qt(Gt.transform(i))+")"};const ie={test:Qt("#"),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:ne.transform},se=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),oe=se("deg"),re=se("%"),ae=se("px"),le=se("vh"),ue=se("vw"),ce={...re,parse:t=>re.parse(t)/100,transform:t=>re.transform(100*t)},he={test:Qt("hsl","hue"),parse:te("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:i=1})=>"hsla("+Math.round(t)+", "+re.transform(qt(e))+", "+re.transform(qt(n))+", "+qt(Gt.transform(i))+")"},de={test:t=>ne.test(t)||ie.test(t)||he.test(t),parse:t=>ne.test(t)?ne.parse(t):he.test(t)?he.parse(t):ie.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?ne.transform(t):he.transform(t)},pe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const me=/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 fe(t){const e=t.toString(),n=[],i={color:[],number:[],var:[]},s=[];let o=0;const r=e.replace(me,t=>(de.test(t)?(i.color.push(o),s.push("color"),n.push(de.parse(t))):t.startsWith("var(")?(i.var.push(o),s.push("var"),n.push(t)):(i.number.push(o),s.push("number"),n.push(parseFloat(t))),++o,"${}")).split("${}");return{values:n,split:r,indexes:i,types:s}}function ge(t){return fe(t).values}function ye(t){const{split:e,types:n}=fe(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+="number"===e?qt(t[o]):"color"===e?de.transform(t[o]):t[o]}return s}}const ve=t=>"number"==typeof t?0:t;const xe={test:function(t){var e,n;return isNaN(t)&&"string"==typeof t&&((null===(e=t.match(Zt))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(pe))||void 0===n?void 0:n.length)||0)>0},parse:ge,createTransformer:ye,getAnimatableNone:function(t){const e=ge(t);return ye(t)(e.map(ve))}},we=new Set(["brightness","contrast","saturate","opacity"]);function Pe(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=we.has(e)?1:0;return i!==n&&(o*=100),e+"("+o+s+")"}const Se=/\b([a-z-]*)\(.*?\)/gu,Te={...xe,getAnimatableNone:t=>{const e=t.match(Se);return e?e.map(Pe).join(" "):t}},be={borderWidth:ae,borderTopWidth:ae,borderRightWidth:ae,borderBottomWidth:ae,borderLeftWidth:ae,borderRadius:ae,radius:ae,borderTopLeftRadius:ae,borderTopRightRadius:ae,borderBottomRightRadius:ae,borderBottomLeftRadius:ae,width:ae,maxWidth:ae,height:ae,maxHeight:ae,top:ae,right:ae,bottom:ae,left:ae,padding:ae,paddingTop:ae,paddingRight:ae,paddingBottom:ae,paddingLeft:ae,margin:ae,marginTop:ae,marginRight:ae,marginBottom:ae,marginLeft:ae,backgroundPositionX:ae,backgroundPositionY:ae},Ae={rotate:oe,rotateX:oe,rotateY:oe,rotateZ:oe,scale:_t,scaleX:_t,scaleY:_t,scaleZ:_t,skew:oe,skewX:oe,skewY:oe,distance:ae,translateX:ae,translateY:ae,translateZ:ae,x:ae,y:ae,z:ae,perspective:ae,transformPerspective:ae,opacity:Gt,originX:ce,originY:ce,originZ:ae},Ee={...Kt,transform:Math.round},Me={...be,...Ae,zIndex:Ee,size:ae,fillOpacity:Gt,strokeOpacity:Gt,numOctaves:Ee},Ce={...Me,color:de,backgroundColor:de,outlineColor:de,fill:de,stroke:de,borderColor:de,borderTopColor:de,borderRightColor:de,borderBottomColor:de,borderLeftColor:de,filter:Te,WebkitFilter:Te},Ve=t=>Ce[t];function Re(t,e){let n=Ve(t);return n!==Te&&(n=xe),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const De=new Set(["auto","none","0"]);const ke=t=>t===Kt||t===ae,Le=(t,e)=>parseFloat(t.split(", ")[e]),Be=(t,e)=>(n,{transform:i})=>{if("none"===i||!i)return 0;const s=i.match(/^matrix3d\((.+)\)$/u);if(s)return Le(s[1],e);{const e=i.match(/^matrix\((.+)\)$/u);return e?Le(e[1],t):0}},Fe=new Set(["x","y","z"]),je=pt.filter(t=>!Fe.has(t));const Oe={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:Be(4,13),y:Be(5,14)};Oe.translateX=Oe.x,Oe.translateY=Oe.y;const Ie=new Set;let Ue=!1,We=!1;function Ne(){if(We){const t=Array.from(Ie).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 je.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])=>{var i;null===(i=t.getValue(e))||void 0===i||i.set(n)})}),t.forEach(t=>t.measureEndState()),t.forEach(t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)})}We=!1,Ue=!1,Ie.forEach(t=>t.complete()),Ie.clear()}function ze(){Ie.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(We=!0)})}class $e{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?(Ie.add(this),Ue||(Ue=!0,ut.read(ze),ut.resolveKeyframes(Ne))):(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=null==i?void 0: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),Ie.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Ie.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const He=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),Xe=t=>e=>"string"==typeof e&&e.startsWith(t),Ye=Xe("--"),Ke=Xe("var(--"),Ge=t=>!!Ke(t)&&_e.test(t.split("/*")[0].trim()),_e=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,qe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Ze(t,e,n=1){const[i,s]=function(t){const e=qe.exec(t);if(!e)return[,];const[,n,i,s]=e;return["--"+(null!=n?n:i),s]}(t);if(!i)return;const o=window.getComputedStyle(e).getPropertyValue(i);if(o){const t=o.trim();return He(t)?parseFloat(t):t}return Ge(s)?Ze(s,e,n+1):s}const Je=t=>e=>e.test(t),Qe=[Kt,ae,re,oe,ue,le,{test:t=>"auto"===t,parse:t=>t}],tn=t=>Qe.find(Je(t));class en extends $e{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(),Ge(i))){const s=Ze(i,e.current);void 0!==s&&(t[n]=s),n===t.length-1&&(this.finalKeyframe=i)}}if(this.resolveNoneKeyframes(),!ft.has(n)||2!==t.length)return;const[i,s]=t,o=tn(i),r=tn(s);if(o!==r)if(ke(o)&&ke(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||Xt(i))&&n.push(e);var i;n.length&&function(t,e,n){let i=0,s=void 0;for(;i<t.length&&!s;){const e=t[i];"string"==typeof e&&!De.has(e)&&fe(e).values.length&&(s=t[i]),i++}if(s&&n)for(const i of e)t[i]=Re(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=Oe[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(){var t;const{element:e,name:n,unresolvedKeyframes:i}=this;if(!e||!e.current)return;const s=e.getValue(n);s&&s.jump(this.measuredOrigin,!1);const o=i.length-1,r=i[o];i[o]=Oe[n](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==r&&void 0===this.finalKeyframe&&(this.finalKeyframe=r),(null===(t=this.removedTransforms)||void 0===t?void 0:t.length)&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}}const nn=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!xe.test(t)&&"0"!==t||t.startsWith("url(")));function sn(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=nn(s,e),a=nn(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||j(n))&&i)}const on=t=>null!==t;function rn(t,{repeat:e,repeatType:n="loop"},i){const s=t.filter(on),o=e&&"loop"!==n&&e%2==1?0:s.length-1;return o&&void 0!==i?i:s[o]}class an{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=vt.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||(ze(),Ne()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=vt.now(),this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:o,onComplete:r,onUpdate:a,isGenerator:l}=this.options;if(!l&&!sn(t,n,i,s)){if(Lt.current||!o)return a&&a(rn(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.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const ln=(t,e,n)=>t+(e-t)*n;function un(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 cn(t,e){return n=>n>0?e:t}const hn=(t,e,n)=>{const i=t*t,s=n*(e*e-i)+i;return s<0?0:Math.sqrt(s)},dn=[ie,ne,he];function pn(t){const e=(n=t,dn.find(t=>t.test(n)));var n;if(!Boolean(e))return!1;let i=e.parse(t);return e===he&&(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=un(a,i,t+1/3),o=un(a,i,t),r=un(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 mn=(t,e)=>{const n=pn(t),i=pn(e);if(!n||!i)return cn(t,e);const s={...n};return t=>(s.red=hn(n.red,i.red,t),s.green=hn(n.green,i.green,t),s.blue=hn(n.blue,i.blue,t),s.alpha=ln(n.alpha,i.alpha,t),ne.transform(s))},fn=(t,e)=>n=>e(t(n)),gn=(...t)=>t.reduce(fn),yn=new Set(["none","hidden"]);function vn(t,e){return n=>ln(t,e,n)}function xn(t){return"number"==typeof t?vn:"string"==typeof t?Ge(t)?cn:de.test(t)?mn:Sn:Array.isArray(t)?wn:"object"==typeof t?de.test(t)?mn:Pn:cn}function wn(t,e){const n=[...t],i=n.length,s=t.map((t,n)=>xn(t)(t,e[n]));return t=>{for(let e=0;e<i;e++)n[e]=s[e](t);return n}}function Pn(t,e){const n={...t,...e},i={};for(const s in n)void 0!==t[s]&&void 0!==e[s]&&(i[s]=xn(t[s])(t[s],e[s]));return t=>{for(const e in i)n[e]=i[e](t);return n}}const Sn=(t,e)=>{const n=xe.createTransformer(e),i=fe(t),s=fe(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?yn.has(t)&&!s.values.length||yn.has(e)&&!i.values.length?function(t,e){return yn.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):gn(wn(function(t,e){var n;const i=[],s={color:0,var:0,number:0};for(let o=0;o<e.values.length;o++){const r=e.types[o],a=t.indexes[r][s[r]],l=null!==(n=t.values[a])&&void 0!==n?n:0;i[o]=l,s[r]++}return i}(i,s),s.values),n):cn(t,e)};function Tn(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return ln(t,e,n);return xn(t)(t,e)}function bn(t,e,n){const i=Math.max(e-5,0);return St(n-t(i),e-i)}const An=100,En=10,Mn=1,Cn=0,Vn=800,Rn=.3,Dn=.3,kn={granular:.01,default:2},Ln={granular:.005,default:.5},Bn=.01,Fn=10,jn=.05,On=1;function In({duration:t=Vn,bounce:e=Rn,velocity:n=Cn,mass:i=Mn}){let s,o,r=1-e;r=Yt(jn,On,r),t=Yt(Bn,Fn,R(t)),r<1?(s=e=>{const i=e*r,s=i*t;return.001-(i-n)/Un(e,r)*Math.exp(-s)},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=Un(Math.pow(e,2),r);return(.001-s(e)>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<12;n++)i-=t(i)/e(i);return i}(s,o,5/t);if(t=V(t),isNaN(a))return{stiffness:An,damping:En,duration:t};{const e=Math.pow(a,2)*i;return{stiffness:e,damping:2*r*Math.sqrt(i*e),duration:t}}}function Un(t,e){return t*Math.sqrt(1-e*e)}const Wn=["duration","bounce"],Nn=["stiffness","damping","mass"];function zn(t,e){return e.some(e=>void 0!==t[e])}function $n(t=Dn,e=Rn){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:c,duration:h,velocity:d,isResolvedFromDuration:p}=function(t){let e={velocity:Cn,stiffness:An,damping:En,mass:Mn,isResolvedFromDuration:!1,...t};if(!zn(t,Nn)&&zn(t,Wn))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(1.2*n),s=i*i,o=2*Yt(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:Mn,stiffness:s,damping:o}}else{const n=In(t);e={...e,...n,mass:Mn},e.isResolvedFromDuration=!0}return e}({...n,velocity:-R(n.velocity||0)}),m=d||0,f=u/(2*Math.sqrt(l*c)),g=r-o,y=R(Math.sqrt(l/c)),v=Math.abs(g)<5;let x;if(i||(i=v?kn.granular:kn.default),s||(s=v?Ln.granular:Ln.default),f<1){const t=Un(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 w={calculatedDuration:p&&h||null,next:t=>{const e=x(t);if(p)a.done=t>=h;else{let n=0;f<1&&(n=0===t?V(m):bn(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(B(w),2e4),e=z(e=>w.next(t*e).value,t,30);return t+"ms "+e}};return w}function Hn({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:c}){const h=t[0],d={done:!1,value:h},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=h+m,g=void 0===r?f:r(f);g!==f&&(m=g-h);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 w,P;const S=t=>{var e;(e=d.value,void 0!==a&&e<a||void 0!==l&&e>l)&&(w=t,P=$n({keyframes:[d.value,p(d.value)],velocity:bn(v,t,d.value),damping:s,stiffness:o,restDelta:u,restSpeed:c}))};return S(0),{calculatedDuration:null,next:t=>{let e=!1;return P||void 0!==w||(e=!0,x(t),S(t)),void 0!==w&&t>=w?P.next(t-w):(!e&&x(t),d)}}}const Xn=Ft(.42,0,1,1),Yn=Ft(0,0,.58,1),Kn=Ft(.42,0,.58,1),Gn=t=>Array.isArray(t)&&"number"!=typeof t[0],_n={linear:b,easeIn:Xn,easeInOut:Kn,easeOut:Yn,circIn:zt,circInOut:Ht,circOut:$t,backIn:Ut,backInOut:Wt,backOut:It,anticipate:Nt},qn=t=>{if(I(t)){E(4===t.length);const[e,n,i,s]=t;return Ft(e,n,i,s)}return"string"==typeof t?_n[t]:t};function Zn(t,e,{clamp:n=!0,ease:i,mixer:s}={}){const o=t.length;if(E(o===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||Tn,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]||b:e;o=gn(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=C(t[i],t[i+1],n);return a[i](s)};return n?e=>u(Yt(t[0],t[o-1],e)):u}function Jn(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const s=C(0,e,i);t.push(ln(n,1,s))}}function Qn(t){const e=[0];return Jn(e,t.length-1),e}function ti({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const s=Gn(i)?i.map(qn):qn(i),o={done:!1,value:e[0]},r=Zn(function(t,e){return t.map(t=>t*e)}(n&&n.length===e.length?n:Qn(e),t),e,{ease:Array.isArray(s)?s:(a=e,l=s,a.map(()=>l||Kn).splice(0,a.length-1))});var a,l;return{calculatedDuration:t,next:e=>(o.value=r(e),o.done=e>=t,o)}}const ei=t=>{const e=({timestamp:e})=>t(e);return{start:()=>ut.update(e,!0),stop:()=>ct(e),now:()=>ht.isProcessing?ht.timestamp:vt.now()}},ni={decay:Hn,inertia:Hn,tween:ti,keyframes:ti,spring:$n},ii=t=>t/100;class si extends an{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=(null==i?void 0:i.KeyframeResolver)||$e;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=j(e)?e:ni[e]||ti;let a,l;r!==ti&&"number"!=typeof t[0]&&(a=gn(ii,Tn(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=B(u));const{calculatedDuration:c}=u,h=c+i;return{generator:u,mirroredGenerator:l,mapPercentToKeyframes:a,calculatedDuration:c,resolvedDuration:h,totalDuration:h*(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:c}=n;if(null===this.startTime)return s.next(0);const{delay:h,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-h*(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)/c;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/c)):"mirror"===p&&(x=o)),v=Yt(0,1,n)*c}const w=y?{done:!1,value:a[0]}:x.next(v);r&&(w.value=r(w.value));let{done:P}=w;y||null===l||(P=this.speed>=0?this.currentTime>=u:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&P);return S&&void 0!==i&&(w.value=rn(a,this.options,i)),f&&f(w.value),S&&this.finish(),w}get duration(){const{resolved:t}=this;return t?R(t.calculatedDuration):0}get time(){return R(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=R(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=ei,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=null!=n?n:this.calcStartTime(),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;this._resolved?(this.state="paused",this.holdTime=null!==(t=this.currentTime)&&void 0!==t?t: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)}}function oi(t){return new si(t)}const ri=new Set(["opacity","clipPath","filter","transform"]);function ai(t,e,n,{delay:i=0,duration:s=300,repeat:o=0,repeatType:r="loop",ease:a="easeInOut",times:l}={}){const u={[e]:n};l&&(u.offset=l);const c=function t(e,n){return e?"function"==typeof e&&N()?z(e,n):I(e)?H(e):Array.isArray(e)?e.map(e=>t(e,n)||X.easeOut):X[e]:void 0}(a,s);return Array.isArray(c)&&(u.easing=c),t.animate(u,{delay:i,duration:s,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:o+1,direction:"reverse"===r?"alternate":"normal"})}const li=M(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));const ui={anticipate:Nt,backInOut:Wt,circInOut:Ht};class ci extends an{constructor(t){super(t);const{name:e,motionValue:n,element:i,keyframes:s}=this.options;this.resolver=new en(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&&N()&&s in ui&&(s=ui[s]),j((u=this.options).type)||"spring"===u.type||!$(u.ease)){const{onComplete:e,onUpdate:r,motionValue:a,element:l,...u}=this.options,c=function(t,e){const n=new si({...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=c.keyframes).length&&(t[1]=t[0]),n=c.duration,i=c.times,s=c.ease,o="keyframes"}const c=ai(r.owner.current,a,t,{...this.options,duration:n,times:i,ease:s});return c.startTime=null!=l?l:this.calcStartTime(),this.pendingTimeline?(O(c,this.pendingTimeline),this.pendingTimeline=void 0):c.onfinish=()=>{const{onComplete:n}=this.options;r.set(rn(t,this.options,e)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:c,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 R(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return R(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}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 b;const{animation:n}=e;O(n,t)}else this.pendingTimeline=t;return b}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,c=new si({...u,keyframes:n,duration:i,type:s,ease:o,times:r,isGenerator:!0}),h=V(this.time);t.setWithVelocity(c.sample(h-10).value,c.sample(h).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 li()&&n&&ri.has(n)&&!a&&!l&&!i&&"mirror"!==s&&0!==o&&"inertia"!==r}}const hi={type:"spring",stiffness:500,damping:25,restSpeed:10},di={type:"keyframes",duration:.8},pi={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},mi=(t,{keyframes:e})=>e.length>2?di:mt.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:hi:pi;const fi=(t,e,n,i={},s,o)=>r=>{const a=L(i,t)||{},l=a.delay||i.delay||0;let{elapsed:u=0}=i;u-=V(l);let c={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,...c}){return!!Object.keys(c).length})(a)||(c={...c,...mi(t,c)}),c.duration&&(c.duration=V(c.duration)),c.repeatDelay&&(c.repeatDelay=V(c.repeatDelay)),void 0!==c.from&&(c.keyframes[0]=c.from);let h=!1;if((!1===c.type||0===c.duration&&!c.repeatDelay)&&(c.duration=0,0===c.delay&&(h=!0)),(Lt.current||rt.skipAnimations)&&(h=!0,c.duration=0,c.delay=0),h&&!o&&void 0!==e.get()){const t=rn(c.keyframes,a);if(void 0!==t)return ut.update(()=>{c.onUpdate(t),c.onComplete()}),new k([])}return!o&&ci.supports(c)?new ci(c):new si(c)};function gi({protectedKeys:t,needsAnimating:e},n){const i=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,i}function yi(t,e,{delay:n=0,transitionOverride:i,type:s}={}){var o;let{transition:r=t.getDefaultTransition(),transitionEnd:a,...l}=e;i&&(r=i);const u=[],c=s&&t.animationState&&t.animationState.getState()[s];for(const e in l){const i=t.getValue(e,null!==(o=t.latestValues[e])&&void 0!==o?o:null),s=l[e];if(void 0===s||c&&gi(c,e))continue;const a={delay:n,...L(r||{},e)};let h=!1;if(window.MotionHandoffAnimation){const n=kt(t);if(n){const t=window.MotionHandoffAnimation(n,e,ut);null!==t&&(a.startTime=t,h=!0)}}Vt(t,e),i.start(fi(e,i,s,t.shouldReduceMotion&&ft.has(e)?{type:!1}:a,t,h));const d=i.animation;d&&u.push(d)}return a&&Promise.all(u).then(()=>{ut.update(()=>{a&&Mt(t,a)})}),u}function vi(t,e,n={}){var i;const s=P(t,e,"exit"===n.type?null===(i=t.presenceContext)||void 0===i?void 0:i.custom:void 0);let{transition:o=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(o=n.transitionOverride);const r=s?()=>Promise.all(yi(t,s,n)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(i=0)=>{const{delayChildren:s=0,staggerChildren:r,staggerDirection:a}=o;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(xi).forEach((t,i)=>{t.notify("AnimationStart",e),r.push(vi(t,e,{...o,delay:n+l(i)}).then(()=>t.notify("AnimationComplete",e)))}),Promise.all(r)}(t,e,s+i,r,a,n)}:()=>Promise.resolve(),{when:l}=o;if(l){const[t,e]="beforeChildren"===l?[r,a]:[a,r];return t().then(()=>e())}return Promise.all([r(),a(n.delay)])}function xi(t,e){return t.sortNodePosition(e)}function wi(t,e,n={}){let i;if(t.notify("AnimationStart",e),Array.isArray(e)){const s=e.map(e=>vi(t,e,n));i=Promise.all(s)}else if("string"==typeof e)i=vi(t,e,n);else{const s="function"==typeof e?P(t,e,n.custom):e;i=Promise.all(yi(t,s,n))}return i.then(()=>{t.notify("AnimationComplete",e)})}const Pi=T.length;const Si=[...S].reverse(),Ti=S.length;function bi(t){let e=function(t){return e=>Promise.all(e.map(({animation:e,options:n})=>wi(t,e,n)))}(t),n=Mi(),i=!0;const s=e=>(n,i)=>{var s;const o=P(t,i,"exit"===e?null===(s=t.presenceContext)||void 0===s?void 0:s.custom:void 0);if(o){const{transition:t,transitionEnd:e,...i}=o;n={...n,...i,...e}}return n};function o(o){const{props:r}=t,a=function t(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent&&t(e.parent)||{};return void 0!==e.props.initial&&(n.initial=e.props.initial),n}const n={};for(let t=0;t<Pi;t++){const i=T[t],s=e.props[i];(v(s)||!1===s)&&(n[i]=s)}return n}(t.parent)||{},l=[],u=new Set;let c={},h=1/0;for(let e=0;e<Ti;e++){const d=Si[e],p=n[d],m=void 0!==r[d]?r[d]:a[d],x=v(m),w=d===o?p.isActive:null;!1===w&&(h=e);let P=m===a[d]&&m!==r[d]&&x;if(P&&i&&t.manuallyAnimateOnMount&&(P=!1),p.protectedKeys={...c},!p.isActive&&null===w||!m&&!p.prevProp||f(m)||"boolean"==typeof m)continue;const S=Ai(p.prevProp,m);let T=S||d===o&&p.isActive&&!P&&x||e>h&&x,b=!1;const A=Array.isArray(m)?m:[m];let E=A.reduce(s(d),{});!1===w&&(E={});const{prevResolvedValues:M={}}=p,C={...M,...E},V=e=>{T=!0,u.has(e)&&(b=!0,u.delete(e)),p.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in C){const e=E[t],n=M[t];if(c.hasOwnProperty(t))continue;let i=!1;i=g(e)&&g(n)?!y(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=E,p.isActive&&(c={...c,...E}),i&&t.blockInitialAnimation&&(T=!1);const R=!(P&&S)||b;T&&R&&l.push(...A.map(t=>({animation:t,options:{type:d}})))}if(u.size){const e={};u.forEach(n=>{const i=t.getBaseTarget(n),s=t.getValue(n);s&&(s.liveStyle=!0),e[n]=null!=i?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){var s;if(n[e].isActive===i)return Promise.resolve();null===(s=t.variantChildren)||void 0===s||s.forEach(t=>{var n;return null===(n=t.animationState)||void 0===n?void 0:n.setActive(e,i)}),n[e].isActive=i;const r=o(e);for(const t in n)n[t].protectedKeys={};return r},setAnimateFunction:function(n){e=n(t)},getState:()=>n,reset:()=>{n=Mi(),i=!0}}}function Ai(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!y(e,t)}function Ei(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Mi(){return{animate:Ei(!0),whileInView:Ei(),whileHover:Ei(),whileTap:Ei(),whileDrag:Ei(),whileFocus:Ei(),exit:Ei()}}class Ci{constructor(t){this.isMounted=!1,this.node=t}update(){}}let Vi=0;const Ri={animation:{Feature:class extends Ci{constructor(t){super(t),t.animationState||(t.animationState=bi(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(){var t;this.node.animationState.reset(),null===(t=this.unmountControls)||void 0===t||t.call(this)}}},exit:{Feature:class extends Ci{constructor(){super(...arguments),this.id=Vi++}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}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}}},Di=e.createContext({}),ki=()=>({x:{min:0,max:0},y:{min:0,max:0}});function Li(t){return t.max-t.min}function Bi(t,e,n,i=.5){t.origin=i,t.originPoint=ln(e.min,e.max,t.origin),t.scale=Li(n)/Li(e),t.translate=ln(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 Fi(t,e,n,i){Bi(t.x,e.x,n.x,i?i.originX:void 0),Bi(t.y,e.y,n.y,i?i.originY:void 0)}function ji(t,e,n){t.min=n.min+e.min,t.max=t.min+Li(e)}function Oi(t,e,n){t.min=e.min-n.min,t.max=t.min+Li(e)}function Ii(t,e,n){Oi(t.x,e.x,n.x),Oi(t.y,e.y,n.y)}const Ui=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Wi(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Ui.has(t)}let Ni=t=>!Wi(t);function zi(t){t&&(Ni=e=>e.startsWith("on")?!Wi(e):t(e))}try{zi(require("@emotion/is-prop-valid").default)}catch(t){}function $i(t,e,n){const i={};for(const s in t)"values"===s&&"object"==typeof t.values||(Ni(s)||!0===n&&Wi(s)||!e&&!Wi(s)||t.draggable&&s.startsWith("onDrag"))&&(i[s]=t[s]);return i}const Hi=e.createContext(null);function Xi(t){return f(t.animate)||T.some(e=>v(t[e]))}function Yi(t){return Boolean(Xi(t)||t.variants)}function Ki(t){const n=e.useRef(null);return null===n.current&&(n.current=t()),n.current}function Gi(t){const e=Ct(t)?t.get():t;return n=e,Boolean(n&&"object"==typeof n&&n.mix&&n.toValue)?e.toValue():e;var n}const _i=t=>(n,i)=>{const s=e.useContext(Di),o=e.useContext(Hi),r=()=>function({scrapeMotionValuesFromProps:t,createRenderState:e,onUpdate:n},i,s,o){const r={latestValues:qi(i,s,o,t),renderState:e()};return n&&(r.onMount=t=>n({props:i,current:t,...r}),r.onUpdate=t=>n(t)),r}(t,n,s,o);return i?r():Ki(r)};function qi(t,e,n,i){const s={},o=i(t,{});for(const t in o)s[t]=Gi(o[t]);let{initial:r,animate:a}=t;const l=Xi(t),u=Yi(t);e&&u&&!l&&!1!==t.inherit&&(void 0===r&&(r=e.initial),void 0===a&&(a=e.animate));let c=!!n&&!1===n.initial;c=c||!1===r;const h=c?a:r;if(h&&"boolean"!=typeof h&&!f(h)){const e=Array.isArray(h)?h:[h];for(let n=0;n<e.length;n++){const i=w(t,e[n]);if(i){const{transitionEnd:t,transition:e,...n}=i;for(const t in n){let e=n[t];if(Array.isArray(e)){e=e[c?e.length-1:0]}null!==e&&(s[t]=e)}for(const e in t)s[e]=t[e]}}}return s}function Zi(t,e,n,i={passive:!0}){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n)}function Ji(t){return{point:{x:t.pageX,y:t.pageY}}}const Qi=t=>e=>Q(e)&&t(e,Ji(e));function ts(t,e,n,i){return Zi(t,e,Qi(n),i)}const es="undefined"!=typeof window;function ns(t){return e.useEffect(()=>()=>t(),[])}const is=es?e.useLayoutEffect:e.useEffect;function ss(){const t=function(){const t=e.useRef(!1);return is(()=>(t.current=!0,()=>{t.current=!1}),[]),t}(),[n,i]=e.useState(0),s=e.useCallback(()=>{t.current&&i(n+1)},[n]);return[e.useCallback(()=>ut.postRender(s),[s]),n]}const os=e.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class rs extends i.Component{getSnapshotBeforeUpdate(t){const e=this.props.childRef.current;if(e&&t.isPresent&&!this.props.isPresent){const t=e.offsetParent,n=t instanceof HTMLElement&&t.offsetWidth||0,i=this.props.sizeRef.current;i.height=e.offsetHeight||0,i.width=e.offsetWidth||0,i.top=e.offsetTop,i.left=e.offsetLeft,i.right=n-i.width-i.left}return null}componentDidUpdate(){}render(){return this.props.children}}function as({children:t,isPresent:n,anchorX:s}){const o=e.useId(),r=e.useRef(null),a=e.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:l}=e.useContext(os);return e.useInsertionEffect(()=>{const{width:t,height:e,top:i,left:u,right:c}=a.current;if(n||!r.current||!t||!e)return;const h="left"===s?"left: "+u:"right: "+c;r.current.dataset.motionPopId