UNPKG

@naisutech/react-tree

Version:

a hierarchical tree component for React written in Typescript

1 lines 113 kB
import*as t from"react";import e,{createContext as n,useContext as o,useLayoutEffect as i,useEffect as r,useRef as s,useCallback as a,useMemo as l,forwardRef as c,createElement as u,useId as d,useState as h}from"react";import m,{useTheme as p,ThemeProvider as f}from"styled-components";var g=function(){return g=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},g.apply(this,arguments)};function v(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(o=Object.getOwnPropertySymbols(t);i<o.length;i++)e.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(t,o[i])&&(n[o[i]]=t[o[i]])}return n}function y(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)s.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return s}function x(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}const b=n({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),w=n({});const S=n(null),E="undefined"!=typeof document,T=E?i:r,A=n({strict:!1});function C(t,e,n,i){const a=o(w).visualElement,l=o(A),c=o(S),u=o(b).reducedMotion,d=s(void 0);i=i||l.renderer,!d.current&&i&&(d.current=i(t,{visualState:e,parent:a,props:n,presenceId:c?c.id:void 0,blockInitialAnimation:!!c&&!1===c.initial,reducedMotionConfig:u}));const h=d.current;return T((()=>{h&&h.syncRender()})),r((()=>{h&&h.animationState&&h.animationState.animateChanges()})),T((()=>()=>h&&h.notifyUnmount()),[]),h}function P(t){return"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}function V(t){return"string"==typeof t||Array.isArray(t)}function L(t){return"object"==typeof t&&"function"==typeof t.start}const M=["initial","animate","exit","whileHover","whileDrag","whileTap","whileFocus","whileInView"];function O(t){return L(t.animate)||M.some((e=>V(t[e])))}function R(t){return Boolean(O(t)||t.variants)}function k(t){const{initial:e,animate:n}=function(t,e){if(O(t)){const{initial:e,animate:n}=t;return{initial:!1===e||V(e)?e:void 0,animate:V(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,o(w));return l((()=>({initial:e,animate:n})),[D(e),D(n)])}function D(t){return Array.isArray(t)?t.join(" "):t}const I=t=>({isEnabled:e=>t.some((t=>!!e[t]))}),$={measureLayout:I(["layout","layoutId","drag"]),animation:I(["animate","exit","variants","whileHover","whileTap","whileFocus","whileDrag","whileInView"]),exit:I(["exit"]),drag:I(["drag","dragControls"]),focus:I(["whileFocus"]),hover:I(["whileHover","onHoverStart","onHoverEnd"]),tap:I(["whileTap","onTap","onTapStart","onTapCancel"]),pan:I(["onPan","onPanStart","onPanSessionStart","onPanEnd"]),inView:I(["whileInView","onViewportEnter","onViewportLeave"])};function j(t){for(const e in t)"projectionNodeConstructor"===e?$.projectionNodeConstructor=t[e]:$[e].Component=t[e]}function N(t){const e=s(null);return null===e.current&&(e.current=t()),e.current}const F={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let B=1;const U=n({});class z extends e.Component{getSnapshotBeforeUpdate(){const{visualElement:t,props:e}=this.props;return t&&t.setProps(e),null}componentDidUpdate(){}render(){return this.props.children}}const H=n({}),Y=Symbol.for("motionComponentSymbol");function W({preloadedFeatures:e,createVisualElement:n,projectionNodeConstructor:i,useRender:r,useVisualState:s,Component:l}){e&&j(e);const u=c((function(c,u){const d={...o(b),...c,layoutId:X(c)},{isStatic:h}=d;let m=null;const p=k(c),f=h?void 0:N((()=>{if(F.hasEverUpdated)return B++})),g=s(c,h);if(!h&&E){p.visualElement=C(l,g,d,n);const t=o(A).strict,r=o(H);p.visualElement&&(m=p.visualElement.loadFeatures(d,t,e,f,i||$.projectionNodeConstructor,r))}return t.createElement(z,{visualElement:p.visualElement,props:d},m,t.createElement(w.Provider,{value:p},r(l,c,f,function(t,e,n){return a((o=>{o&&t.mount&&t.mount(o),e&&(o?e.mount(o):e.unmount()),n&&("function"==typeof n?n(o):P(n)&&(n.current=o))}),[e])}(g,p.visualElement,u),g,h,p.visualElement)))}));return u[Y]=l,u}function X({layoutId:t}){const e=o(U).id;return e&&void 0!==t?e+"-"+t:t}function G(t){function e(e,n={}){return W(t(e,n))}if("undefined"==typeof Proxy)return e;const n=new Map;return new Proxy(e,{get:(t,o)=>(n.has(o)||n.set(o,e(o)),n.get(o))})}const q=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","svg","switch","symbol","text","tspan","use","view"];function K(t){return"string"==typeof t&&!t.includes("-")&&!!(q.indexOf(t)>-1||/[A-Z]/.test(t))}const Z={};const _=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],J=new Set(_);function Q(t,{layout:e,layoutId:n}){return J.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!Z[t]||"opacity"===t)}const tt=t=>!!(null==t?void 0:t.getVelocity),et={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},nt=(t,e)=>_.indexOf(t)-_.indexOf(e);function ot(t){return t.startsWith("--")}const it=(t,e)=>e&&"number"==typeof t?e.transform(t):t,rt=(t,e)=>n=>Math.max(Math.min(n,e),t),st=t=>t%1?Number(t.toFixed(5)):t,at=/(-)?([\d]*\.?[\d])+/g,lt=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,ct=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function ut(t){return"string"==typeof t}const dt={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},ht=Object.assign(Object.assign({},dt),{transform:rt(0,1)}),mt=Object.assign(Object.assign({},dt),{default:1}),pt=t=>({test:e=>ut(e)&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),ft=pt("deg"),gt=pt("%"),vt=pt("px"),yt=pt("vh"),xt=pt("vw"),bt=Object.assign(Object.assign({},gt),{parse:t=>gt.parse(t)/100,transform:t=>gt.transform(100*t)}),wt=(t,e)=>n=>Boolean(ut(n)&&ct.test(n)&&n.startsWith(t)||e&&Object.prototype.hasOwnProperty.call(n,e)),St=(t,e,n)=>o=>{if(!ut(o))return o;const[i,r,s,a]=o.match(at);return{[t]:parseFloat(i),[e]:parseFloat(r),[n]:parseFloat(s),alpha:void 0!==a?parseFloat(a):1}},Et={test:wt("hsl","hue"),parse:St("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:o=1})=>"hsla("+Math.round(t)+", "+gt.transform(st(e))+", "+gt.transform(st(n))+", "+st(ht.transform(o))+")"},Tt=rt(0,255),At=Object.assign(Object.assign({},dt),{transform:t=>Math.round(Tt(t))}),Ct={test:wt("rgb","red"),parse:St("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:o=1})=>"rgba("+At.transform(t)+", "+At.transform(e)+", "+At.transform(n)+", "+st(ht.transform(o))+")"};const Pt={test:wt("#"),parse:function(t){let e="",n="",o="",i="";return t.length>5?(e=t.substr(1,2),n=t.substr(3,2),o=t.substr(5,2),i=t.substr(7,2)):(e=t.substr(1,1),n=t.substr(2,1),o=t.substr(3,1),i=t.substr(4,1),e+=e,n+=n,o+=o,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(o,16),alpha:i?parseInt(i,16)/255:1}},transform:Ct.transform},Vt={test:t=>Ct.test(t)||Pt.test(t)||Et.test(t),parse:t=>Ct.test(t)?Ct.parse(t):Et.test(t)?Et.parse(t):Pt.parse(t),transform:t=>ut(t)?t:t.hasOwnProperty("red")?Ct.transform(t):Et.transform(t)};function Lt(t){"number"==typeof t&&(t=`${t}`);const e=[];let n=0;const o=t.match(lt);o&&(n=o.length,t=t.replace(lt,"${c}"),e.push(...o.map(Vt.parse)));const i=t.match(at);return i&&(t=t.replace(at,"${n}"),e.push(...i.map(dt.parse))),{values:e,numColors:n,tokenised:t}}function Mt(t){return Lt(t).values}function Ot(t){const{values:e,numColors:n,tokenised:o}=Lt(t),i=e.length;return t=>{let e=o;for(let o=0;o<i;o++)e=e.replace(o<n?"${c}":"${n}",o<n?Vt.transform(t[o]):st(t[o]));return e}}const Rt=t=>"number"==typeof t?0:t;const kt={test:function(t){var e,n,o,i;return isNaN(t)&&ut(t)&&(null!==(n=null===(e=t.match(at))||void 0===e?void 0:e.length)&&void 0!==n?n:0)+(null!==(i=null===(o=t.match(lt))||void 0===o?void 0:o.length)&&void 0!==i?i:0)>0},parse:Mt,createTransformer:Ot,getAnimatableNone:function(t){const e=Mt(t);return Ot(t)(e.map(Rt))}},Dt=new Set(["brightness","contrast","saturate","opacity"]);function It(t){let[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[o]=n.match(at)||[];if(!o)return t;const i=n.replace(o,"");let r=Dt.has(e)?1:0;return o!==n&&(r*=100),e+"("+r+i+")"}const $t=/([a-z-]*)\(.*?\)/g,jt=Object.assign(Object.assign({},kt),{getAnimatableNone:t=>{const e=t.match($t);return e?e.map(It).join(" "):t}}),Nt={...dt,transform:Math.round},Ft={borderWidth:vt,borderTopWidth:vt,borderRightWidth:vt,borderBottomWidth:vt,borderLeftWidth:vt,borderRadius:vt,radius:vt,borderTopLeftRadius:vt,borderTopRightRadius:vt,borderBottomRightRadius:vt,borderBottomLeftRadius:vt,width:vt,maxWidth:vt,height:vt,maxHeight:vt,size:vt,top:vt,right:vt,bottom:vt,left:vt,padding:vt,paddingTop:vt,paddingRight:vt,paddingBottom:vt,paddingLeft:vt,margin:vt,marginTop:vt,marginRight:vt,marginBottom:vt,marginLeft:vt,rotate:ft,rotateX:ft,rotateY:ft,rotateZ:ft,scale:mt,scaleX:mt,scaleY:mt,scaleZ:mt,skew:ft,skewX:ft,skewY:ft,distance:vt,translateX:vt,translateY:vt,translateZ:vt,x:vt,y:vt,z:vt,perspective:vt,transformPerspective:vt,opacity:ht,originX:bt,originY:bt,originZ:vt,zIndex:Nt,fillOpacity:ht,strokeOpacity:ht,numOctaves:Nt};function Bt(t,e,n,o){const{style:i,vars:r,transform:s,transformKeys:a,transformOrigin:l}=t;a.length=0;let c=!1,u=!1,d=!0;for(const t in e){const n=e[t];if(ot(t)){r[t]=n;continue}const o=Ft[t],h=it(n,o);if(J.has(t)){if(c=!0,s[t]=h,a.push(t),!d)continue;n!==(o.default||0)&&(d=!1)}else t.startsWith("origin")?(u=!0,l[t]=h):i[t]=h}if(e.transform||(c||o?i.transform=function({transform:t,transformKeys:e},{enableHardwareAcceleration:n=!0,allowTransformNone:o=!0},i,r){let s="";e.sort(nt);for(const n of e)s+=`${et[n]||n}(${t[n]}) `;return n&&!t.z&&(s+="translateZ(0)"),s=s.trim(),r?s=r(t,i?"":s):o&&i&&(s="none"),s}(t,n,d,o):i.transform&&(i.transform="none")),u){const{originX:t="50%",originY:e="50%",originZ:n=0}=l;i.transformOrigin=`${t} ${e} ${n}`}}const Ut=()=>({style:{},transform:{},transformKeys:[],transformOrigin:{},vars:{}});function zt(t,e,n){for(const o in e)tt(e[o])||Q(o,n)||(t[o]=e[o])}function Ht(t,e,n){const o={};return zt(o,t.style||{},t),Object.assign(o,function({transformTemplate:t},e,n){return l((()=>{const o={style:{},transform:{},transformKeys:[],transformOrigin:{},vars:{}};return Bt(o,e,{enableHardwareAcceleration:!n},t),Object.assign({},o.vars,o.style)}),[e])}(t,e,n)),t.transformValues?t.transformValues(o):o}function Yt(t,e,n){const o={},i=Ht(t,e,n);return t.drag&&!1!==t.dragListener&&(o.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=!0===t.drag?"none":"pan-"+("x"===t.drag?"y":"x")),o.style=i,o}const Wt=new Set(["initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","layout","layoutId","layoutDependency","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","drag","dragControls","dragListener","dragConstraints","dragDirectionLock","dragSnapToOrigin","_dragX","_dragY","dragElastic","dragMomentum","dragPropagation","dragTransition","onHoverStart","onHoverEnd","layoutScroll","whileInView","onViewportEnter","onViewportLeave","viewport","whileTap","onTap","onTapStart","onTapCancel","animate","exit","variants","whileHover","whileTap","whileFocus","whileDrag","whileInView","onPan","onPanStart","onPanSessionStart","onPanEnd"]);function Xt(t){return Wt.has(t)}let Gt=t=>!Xt(t);try{(qt=require("@emotion/is-prop-valid").default)&&(Gt=t=>t.startsWith("on")?!Xt(t):qt(t))}catch(t){}var qt;function Kt(t,e,n){return"string"==typeof t?t:vt.transform(e+n*t)}const Zt={offset:"stroke-dashoffset",array:"stroke-dasharray"},_t={offset:"strokeDashoffset",array:"strokeDasharray"};function Jt(t,{attrX:e,attrY:n,originX:o,originY:i,pathLength:r,pathSpacing:s=1,pathOffset:a=0,...l},c,u){Bt(t,l,c,u),t.attrs=t.style,t.style={};const{attrs:d,style:h,dimensions:m}=t;d.transform&&(m&&(h.transform=d.transform),delete d.transform),m&&(void 0!==o||void 0!==i||h.transform)&&(h.transformOrigin=function(t,e,n){return`${Kt(e,t.x,t.width)} ${Kt(n,t.y,t.height)}`}(m,void 0!==o?o:.5,void 0!==i?i:.5)),void 0!==e&&(d.x=e),void 0!==n&&(d.y=n),void 0!==r&&function(t,e,n=1,o=0,i=!0){t.pathLength=1;const r=i?Zt:_t;t[r.offset]=vt.transform(-o);const s=vt.transform(e),a=vt.transform(n);t[r.array]=`${s} ${a}`}(d,r,s,a,!1)}const Qt=()=>({style:{},transform:{},transformKeys:[],transformOrigin:{},vars:{},attrs:{}});function te(t,e){const n=l((()=>{const n={style:{},transform:{},transformKeys:[],transformOrigin:{},vars:{},attrs:{}};return Jt(n,e,{enableHardwareAcceleration:!1},t.transformTemplate),{...n.attrs,style:{...n.style}}}),[e]);if(t.style){const e={};zt(e,t.style,t),n.style={...e,...n.style}}return n}function ee(t=!1){return(e,n,o,i,{latestValues:r},s)=>{const a=(K(e)?te:Yt)(n,r,s),l=function(t,e,n){const o={};for(const i in t)(Gt(i)||!0===n&&Xt(i)||!e&&!Xt(i)||t.draggable&&i.startsWith("onDrag"))&&(o[i]=t[i]);return o}(n,"string"==typeof e,t),c={...l,...a,ref:i};return o&&(c["data-projection-id"]=o),u(e,c)}}const ne=t=>t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function oe(t,{style:e,vars:n},o,i){Object.assign(t.style,e,i&&i.getProjectionStyles(o));for(const e in n)t.style.setProperty(e,n[e])}const ie=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength"]);function re(t,e,n,o){oe(t,e,void 0,o);for(const n in e.attrs)t.setAttribute(ie.has(n)?n:ne(n),e.attrs[n])}function se(t){const{style:e}=t,n={};for(const o in e)(tt(e[o])||Q(o,t))&&(n[o]=e[o]);return n}function ae(t){const e=se(t);for(const n in t)if(tt(t[n])){e["x"===n||"y"===n?"attr"+n.toUpperCase():n]=t[n]}return e}function le(t,e,n,o={},i={}){return"function"==typeof e&&(e=e(void 0!==n?n:t.custom,o,i)),"string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e&&(e=e(void 0!==n?n:t.custom,o,i)),e}const ce=t=>Array.isArray(t),ue=t=>ce(t)?t[t.length-1]||0:t;function de(t){const e=tt(t)?t.get():t;return n=e,Boolean(n&&"object"==typeof n&&n.mix&&n.toValue)?e.toValue():e;var n}const he=t=>(e,n)=>{const i=o(w),r=o(S),s=()=>function({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:n},o,i,r){const s={latestValues:me(o,i,r,t),renderState:e()};return n&&(s.mount=t=>n(o,t,s)),s}(t,e,i,r);return n?s():N(s)};function me(t,e,n,o){const i={},r=o(t);for(const t in r)i[t]=de(r[t]);let{initial:s,animate:a}=t;const l=O(t),c=R(t);e&&c&&!l&&!1!==t.inherit&&(void 0===s&&(s=e.initial),void 0===a&&(a=e.animate));let u=!!n&&!1===n.initial;u=u||!1===s;const d=u?a:s;if(d&&"boolean"!=typeof d&&!L(d)){(Array.isArray(d)?d:[d]).forEach((e=>{const n=le(t,e);if(!n)return;const{transitionEnd:o,transition:r,...s}=n;for(const t in s){let e=s[t];if(Array.isArray(e)){e=e[u?e.length-1:0]}null!==e&&(i[t]=e)}for(const t in o)i[t]=o[t]}))}return i}const pe={useVisualState:he({scrapeMotionValuesFromProps:ae,createRenderState:Qt,onMount:(t,e,{renderState:n,latestValues:o})=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(t){n.dimensions={x:0,y:0,width:0,height:0}}Jt(n,o,{enableHardwareAcceleration:!1},t.transformTemplate),re(e,n)}})},fe={useVisualState:he({scrapeMotionValuesFromProps:se,createRenderState:Ut})};var ge;function ve(t,e,n,o={passive:!0}){return t.addEventListener(e,n,o),()=>t.removeEventListener(e,n)}function ye(t,e,n,o){r((()=>{const i=t.current;if(n&&i)return ve(i,e,n,o)}),[t,e,n,o])}function xe(t){return"undefined"!=typeof PointerEvent&&t instanceof PointerEvent?!("mouse"!==t.pointerType):t instanceof MouseEvent}function be(t){return!!t.touches}!function(t){t.Animate="animate",t.Hover="whileHover",t.Tap="whileTap",t.Drag="whileDrag",t.Focus="whileFocus",t.InView="whileInView",t.Exit="exit"}(ge||(ge={}));const we={pageX:0,pageY:0};function Se(t,e="page"){const n=t.touches[0]||t.changedTouches[0]||we;return{x:n[e+"X"],y:n[e+"Y"]}}function Ee(t,e="page"){return{x:t[e+"X"],y:t[e+"Y"]}}function Te(t,e="page"){return{point:be(t)?Se(t,e):Ee(t,e)}}const Ae=(t,e=!1)=>{const n=e=>t(e,Te(e));return e?(o=n,t=>{const e=t instanceof MouseEvent;(!e||e&&0===t.button)&&o(t)}):n;var o},Ce={pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointercancel:"mousecancel",pointerover:"mouseover",pointerout:"mouseout",pointerenter:"mouseenter",pointerleave:"mouseleave"},Pe={pointerdown:"touchstart",pointermove:"touchmove",pointerup:"touchend",pointercancel:"touchcancel"};function Ve(t){return E&&null===window.onpointerdown?t:E&&null===window.ontouchstart?Pe[t]:E&&null===window.onmousedown?Ce[t]:t}function Le(t,e,n,o){return ve(t,Ve(e),Ae(n,"pointerdown"===e),o)}function Me(t,e,n,o){return ye(t,Ve(e),n&&Ae(n,"pointerdown"===e),o)}function Oe(t){let e=null;return()=>{const n=()=>{e=null};return null===e&&(e=t,n)}}const Re=Oe("dragHorizontal"),ke=Oe("dragVertical");function De(t){let e=!1;if("y"===t)e=ke();else if("x"===t)e=Re();else{const t=Re(),n=ke();t&&n?e=()=>{t(),n()}:(t&&t(),n&&n())}return e}function Ie(){const t=De(!0);return!t||(t(),!1)}function $e(t,e,n){return(o,i)=>{xe(o)&&!Ie()&&(t.animationState&&t.animationState.setActive(ge.Hover,e),n&&n(o,i))}}const je=(t,e)=>!!e&&(t===e||je(t,e.parentElement));function Ne(t){return r((()=>()=>t()),[])}var Fe=function(){},Be=function(){};"production"!==process.env.NODE_ENV&&(Fe=function(t,e){t||"undefined"==typeof console||console.warn(e)},Be=function(t,e){if(!t)throw new Error(e)});const Ue=(t,e,n)=>Math.min(Math.max(n,t),e);function ze({duration:t=800,bounce:e=.25,velocity:n=0,mass:o=1}){let i,r;Fe(t<=1e4,"Spring duration must be 10 seconds or less");let s=1-e;s=Ue(.05,1,s),t=Ue(.01,10,t/1e3),s<1?(i=e=>{const o=e*s,i=o*t;return.001-(o-n)/He(e,s)*Math.exp(-i)},r=e=>{const o=e*s*t,r=o*n+n,a=Math.pow(s,2)*Math.pow(e,2)*t,l=Math.exp(-o),c=He(Math.pow(e,2),s);return(.001-i(e)>0?-1:1)*((r-a)*l)/c}):(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 o=n;for(let n=1;n<12;n++)o-=t(o)/e(o);return o}(i,r,5/t);if(t*=1e3,isNaN(a))return{stiffness:100,damping:10,duration:t};{const e=Math.pow(a,2)*o;return{stiffness:e,damping:2*s*Math.sqrt(o*e),duration:t}}}function He(t,e){return t*Math.sqrt(1-e*e)}const Ye=["duration","bounce"],We=["stiffness","damping","mass"];function Xe(t,e){return e.some((e=>void 0!==t[e]))}function Ge(t){var{from:e=0,to:n=1,restSpeed:o=2,restDelta:i}=t,r=v(t,["from","to","restSpeed","restDelta"]);const s={done:!1,value:e};let{stiffness:a,damping:l,mass:c,velocity:u,duration:d,isResolvedFromDuration:h}=function(t){let e=Object.assign({velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1},t);if(!Xe(t,We)&&Xe(t,Ye)){const n=ze(t);e=Object.assign(Object.assign(Object.assign({},e),n),{velocity:0,mass:1}),e.isResolvedFromDuration=!0}return e}(r),m=qe,p=qe;function f(){const t=u?-u/1e3:0,o=n-e,r=l/(2*Math.sqrt(a*c)),s=Math.sqrt(a/c)/1e3;if(void 0===i&&(i=Math.min(Math.abs(n-e)/100,.4)),r<1){const e=He(s,r);m=i=>{const a=Math.exp(-r*s*i);return n-a*((t+r*s*o)/e*Math.sin(e*i)+o*Math.cos(e*i))},p=n=>{const i=Math.exp(-r*s*n);return r*s*i*(Math.sin(e*n)*(t+r*s*o)/e+o*Math.cos(e*n))-i*(Math.cos(e*n)*(t+r*s*o)-e*o*Math.sin(e*n))}}else if(1===r)m=e=>n-Math.exp(-s*e)*(o+(t+s*o)*e);else{const e=s*Math.sqrt(r*r-1);m=i=>{const a=Math.exp(-r*s*i),l=Math.min(e*i,300);return n-a*((t+r*s*o)*Math.sinh(l)+e*o*Math.cosh(l))/e}}}return f(),{next:t=>{const e=m(t);if(h)s.done=t>=d;else{const r=1e3*p(t),a=Math.abs(r)<=o,l=Math.abs(n-e)<=i;s.done=a&&l}return s.value=s.done?n:e,s},flipTarget:()=>{u=-u,[e,n]=[n,e],f()}}}Ge.needsInterpolation=(t,e)=>"string"==typeof t||"string"==typeof e;const qe=t=>0,Ke=(t,e,n)=>{const o=e-t;return 0===o?1:(n-t)/o},Ze=(t,e,n)=>-n*t+n*e+t;function _e(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 Je({hue:t,saturation:e,lightness:n,alpha:o}){t/=360,n/=100;let i=0,r=0,s=0;if(e/=100){const o=n<.5?n*(1+e):n+e-n*e,a=2*n-o;i=_e(a,o,t+1/3),r=_e(a,o,t),s=_e(a,o,t-1/3)}else i=r=s=n;return{red:Math.round(255*i),green:Math.round(255*r),blue:Math.round(255*s),alpha:o}}const Qe=(t,e,n)=>{const o=t*t,i=e*e;return Math.sqrt(Math.max(0,n*(i-o)+o))},tn=[Pt,Ct,Et],en=t=>tn.find((e=>e.test(t))),nn=t=>`'${t}' is not an animatable color. Use the equivalent color code instead.`,on=(t,e)=>{let n=en(t),o=en(e);Be(!!n,nn(t)),Be(!!o,nn(e));let i=n.parse(t),r=o.parse(e);n===Et&&(i=Je(i),n=Ct),o===Et&&(r=Je(r),o=Ct);const s=Object.assign({},i);return t=>{for(const e in s)"alpha"!==e&&(s[e]=Qe(i[e],r[e],t));return s.alpha=Ze(i.alpha,r.alpha,t),n.transform(s)}},rn=t=>"number"==typeof t,sn=(t,e)=>n=>e(t(n)),an=(...t)=>t.reduce(sn);function ln(t,e){return rn(t)?n=>Ze(t,e,n):Vt.test(t)?on(t,e):hn(t,e)}const cn=(t,e)=>{const n=[...t],o=n.length,i=t.map(((t,n)=>ln(t,e[n])));return t=>{for(let e=0;e<o;e++)n[e]=i[e](t);return n}},un=(t,e)=>{const n=Object.assign(Object.assign({},t),e),o={};for(const i in n)void 0!==t[i]&&void 0!==e[i]&&(o[i]=ln(t[i],e[i]));return t=>{for(const e in o)n[e]=o[e](t);return n}};function dn(t){const e=kt.parse(t),n=e.length;let o=0,i=0,r=0;for(let t=0;t<n;t++)o||"number"==typeof e[t]?o++:void 0!==e[t].hue?r++:i++;return{parsed:e,numNumbers:o,numRGB:i,numHSL:r}}const hn=(t,e)=>{const n=kt.createTransformer(e),o=dn(t),i=dn(e);return o.numHSL===i.numHSL&&o.numRGB===i.numRGB&&o.numNumbers>=i.numNumbers?an(cn(o.parsed,i.parsed),n):(Fe(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),n=>`${n>0?e:t}`)},mn=(t,e)=>n=>Ze(t,e,n);function pn(t,e,n){const o=[],i=n||("number"==typeof(r=t[0])?mn:"string"==typeof r?Vt.test(r)?on:hn:Array.isArray(r)?cn:"object"==typeof r?un:void 0);var r;const s=t.length-1;for(let n=0;n<s;n++){let r=i(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]:e;r=an(t,r)}o.push(r)}return o}function fn(t,e,{clamp:n=!0,ease:o,mixer:i}={}){const r=t.length;Be(r===e.length,"Both input and output ranges must be the same length"),Be(!o||!Array.isArray(o)||o.length===r-1,"Array of easing functions must be of length `input.length - 1`, as it applies to the transitions **between** the defined values."),t[0]>t[r-1]&&(t=[].concat(t),e=[].concat(e),t.reverse(),e.reverse());const s=pn(e,o,i),a=2===r?function([t,e],[n]){return o=>n(Ke(t,e,o))}(t,s):function(t,e){const n=t.length,o=n-1;return i=>{let r=0,s=!1;if(i<=t[0]?s=!0:i>=t[o]&&(r=o-1,s=!0),!s){let e=1;for(;e<n&&!(t[e]>i||e===o);e++);r=e-1}const a=Ke(t[r],t[r+1],i);return e[r](a)}}(t,s);return n?e=>a(Ue(t[0],t[r-1],e)):a}const gn=t=>e=>1-t(1-e),vn=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,yn=t=>e=>e*e*((t+1)*e-t),xn=t=>t,bn=(wn=2,t=>Math.pow(t,wn));var wn;const Sn=gn(bn),En=vn(bn),Tn=t=>1-Math.sin(Math.acos(t)),An=gn(Tn),Cn=vn(An),Pn=yn(1.525),Vn=gn(Pn),Ln=vn(Pn),Mn=(t=>{const e=yn(t);return t=>(t*=2)<1?.5*e(t):.5*(2-Math.pow(2,-10*(t-1)))})(1.525),On=t=>{if(1===t||0===t)return t;const e=t*t;return t<.36363636363636365?7.5625*e:t<.7272727272727273?9.075*e-9.9*t+3.4:t<.9?12.066481994459833*e-19.63545706371191*t+8.898060941828255:10.8*t*t-20.52*t+10.72},Rn=gn(On);function kn(t,e){return t.map((()=>e||En)).splice(0,t.length-1)}function Dn({from:t=0,to:e=1,ease:n,offset:o,duration:i=300}){const r={done:!1,value:t},s=Array.isArray(e)?e:[t,e],a=function(t,e){return t.map((t=>t*e))}(o&&o.length===s.length?o:function(t){const e=t.length;return t.map(((t,n)=>0!==n?n/(e-1):0))}(s),i);function l(){return fn(a,s,{ease:Array.isArray(n)?n:kn(s,n)})}let c=l();return{next:t=>(r.value=c(t),r.done=t>=i,r),flipTarget:()=>{s.reverse(),c=l()}}}const In={keyframes:Dn,spring:Ge,decay:function({velocity:t=0,from:e=0,power:n=.8,timeConstant:o=350,restDelta:i=.5,modifyTarget:r}){const s={done:!1,value:e};let a=n*t;const l=e+a,c=void 0===r?l:r(l);return c!==l&&(a=c-e),{next:t=>{const e=-a*Math.exp(-t/o);return s.done=!(e>i||e<-i),s.value=s.done?c:c+e,s},flipTarget:()=>{}}}};const $n="undefined"!=typeof performance?()=>performance.now():()=>Date.now(),jn="undefined"!=typeof window?t=>window.requestAnimationFrame(t):t=>setTimeout((()=>t($n())),16.666666666666668);let Nn=!0,Fn=!1,Bn=!1;const Un={delta:0,timestamp:0},zn=["read","update","preRender","render","postRender"],Hn=zn.reduce(((t,e)=>(t[e]=function(t){let e=[],n=[],o=0,i=!1,r=!1;const s=new WeakSet,a={schedule:(t,r=!1,a=!1)=>{const l=a&&i,c=l?e:n;return r&&s.add(t),-1===c.indexOf(t)&&(c.push(t),l&&i&&(o=e.length)),t},cancel:t=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1),s.delete(t)},process:l=>{if(i)r=!0;else{if(i=!0,[e,n]=[n,e],n.length=0,o=e.length,o)for(let n=0;n<o;n++){const o=e[n];o(l),s.has(o)&&(a.schedule(o),t())}i=!1,r&&(r=!1,a.process(l))}}};return a}((()=>Fn=!0)),t)),{}),Yn=zn.reduce(((t,e)=>{const n=Hn[e];return t[e]=(t,e=!1,o=!1)=>(Fn||Kn(),n.schedule(t,e,o)),t}),{}),Wn=zn.reduce(((t,e)=>(t[e]=Hn[e].cancel,t)),{}),Xn=zn.reduce(((t,e)=>(t[e]=()=>Hn[e].process(Un),t)),{}),Gn=t=>Hn[t].process(Un),qn=t=>{Fn=!1,Un.delta=Nn?16.666666666666668:Math.max(Math.min(t-Un.timestamp,40),1),Un.timestamp=t,Bn=!0,zn.forEach(Gn),Bn=!1,Fn&&(Nn=!1,jn(qn))},Kn=()=>{Fn=!0,Nn=!0,Bn||jn(qn)},Zn=()=>Un;function _n(t,e,n=0){return t-e-n}const Jn=t=>{const e=({delta:e})=>t(e);return{start:()=>Yn.update(e,!0),stop:()=>Wn.update(e)}};function Qn(t){var e,n,{from:o,autoplay:i=!0,driver:r=Jn,elapsed:s=0,repeat:a=0,repeatType:l="loop",repeatDelay:c=0,onPlay:u,onStop:d,onComplete:h,onRepeat:m,onUpdate:p}=t,f=v(t,["from","autoplay","driver","elapsed","repeat","repeatType","repeatDelay","onPlay","onStop","onComplete","onRepeat","onUpdate"]);let g,y,x,{to:b}=f,w=0,S=f.duration,E=!1,T=!0;const A=function(t){if(Array.isArray(t.to))return Dn;if(In[t.type])return In[t.type];const e=new Set(Object.keys(t));return e.has("ease")||e.has("duration")&&!e.has("dampingRatio")?Dn:e.has("dampingRatio")||e.has("stiffness")||e.has("mass")||e.has("damping")||e.has("restSpeed")||e.has("restDelta")?Ge:Dn}(f);(null===(n=(e=A).needsInterpolation)||void 0===n?void 0:n.call(e,o,b))&&(x=fn([0,100],[o,b],{clamp:!1}),o=0,b=100);const C=A(Object.assign(Object.assign({},f),{from:o,to:b}));function P(){w++,"reverse"===l?(T=w%2==0,s=function(t,e,n=0,o=!0){return o?_n(e+-t,e,n):e-(t-e)+n}(s,S,c,T)):(s=_n(s,S,c),"mirror"===l&&C.flipTarget()),E=!1,m&&m()}function V(t){if(T||(t=-t),s+=t,!E){const t=C.next(Math.max(0,s));y=t.value,x&&(y=x(y)),E=T?t.done:s<=0}null==p||p(y),E&&(0===w&&(null!=S||(S=s)),w<a?function(t,e,n,o){return o?t>=e+n:t<=-n}(s,S,c,T)&&P():(g.stop(),h&&h()))}return i&&(null==u||u(),g=r(V),g.start()),{stop:()=>{null==d||d(),g.stop()}}}function to(t,e){return e?t*(1e3/e):0}const eo=t=>t.hasOwnProperty("x")&&t.hasOwnProperty("y"),no=t=>eo(t)&&t.hasOwnProperty("z"),oo=(t,e)=>Math.abs(t-e);function io(t,e){if(rn(t)&&rn(e))return oo(t,e);if(eo(t)&&eo(e)){const n=oo(t.x,e.x),o=oo(t.y,e.y),i=no(t)&&no(e)?oo(t.z,e.z):0;return Math.sqrt(Math.pow(n,2)+Math.pow(o,2)+Math.pow(i,2))}}const ro=(t,e)=>1-3*e+3*t,so=(t,e)=>3*e-6*t,ao=t=>3*t,lo=(t,e,n)=>((ro(e,n)*t+so(e,n))*t+ao(e))*t,co=(t,e,n)=>3*ro(e,n)*t*t+2*so(e,n)*t+ao(e);function uo(t,e,n,o){if(t===e&&n===o)return xn;const i=new Float32Array(11);for(let e=0;e<11;++e)i[e]=lo(.1*e,t,n);function r(e){let o=0,r=1;for(;10!==r&&i[r]<=e;++r)o+=.1;--r;const s=o+.1*((e-i[r])/(i[r+1]-i[r])),a=co(s,t,n);return a>=.001?function(t,e,n,o){for(let i=0;i<8;++i){const i=co(e,n,o);if(0===i)return e;e-=(lo(e,n,o)-t)/i}return e}(e,s,t,n):0===a?s:function(t,e,n,o,i){let r,s,a=0;do{s=e+(n-e)/2,r=lo(s,o,i)-t,r>0?n=s:e=s}while(Math.abs(r)>1e-7&&++a<10);return s}(e,o,o+.1,t,n)}return t=>0===t||1===t?t:lo(r(t),e,o)}const ho="undefined"==typeof process||void 0===process.env?"production":process.env.NODE_ENV||"production",mo=new Set;function po(t,e,n){t||mo.has(e)||(console.warn(e),n&&console.warn(n),mo.add(e))}const fo=new WeakMap,go=new WeakMap,vo=t=>{const e=fo.get(t.target);e&&e(t)},yo=t=>{t.forEach(vo)};function xo(t,e,n){const o=function({root:t,...e}){const n=t||document;go.has(n)||go.set(n,{});const o=go.get(n),i=JSON.stringify(e);return o[i]||(o[i]=new IntersectionObserver(yo,{root:t,...e})),o[i]}(e);return fo.set(t,n),o.observe(t),()=>{fo.delete(t),o.unobserve(t)}}const bo={some:0,all:1};function wo(t,e,n,{root:o,margin:i,amount:s="some",once:a}){r((()=>{if(!t)return;const r={root:null==o?void 0:o.current,rootMargin:i,threshold:"number"==typeof s?s:bo[s]};return xo(n.getInstance(),r,(t=>{const{isIntersecting:o}=t;if(e.isInView===o)return;if(e.isInView=o,a&&!o&&e.hasEnteredView)return;o&&(e.hasEnteredView=!0),n.animationState&&n.animationState.setActive(ge.InView,o);const i=n.getProps(),r=o?i.onViewportEnter:i.onViewportLeave;r&&r(t)}))}),[t,o,i,s])}function So(t,e,n,{fallback:o=!0}){r((()=>{t&&o&&("production"!==ho&&po(!1,"IntersectionObserver not available on this device. whileInView animations will trigger on mount."),requestAnimationFrame((()=>{e.hasEnteredView=!0;const{onViewportEnter:t}=n.getProps();t&&t(null),n.animationState&&n.animationState.setActive(ge.InView,!0)})))}),[t])}const Eo=t=>e=>(t(e),null),To={inView:Eo((function({visualElement:t,whileInView:e,onViewportEnter:n,onViewportLeave:o,viewport:i={}}){const r=s({hasEnteredView:!1,isInView:!1});let a=Boolean(e||n||o);i.once&&r.current.hasEnteredView&&(a=!1),("undefined"==typeof IntersectionObserver?So:wo)(a,r.current,t,i)})),tap:Eo((function({onTap:t,onTapStart:e,onTapCancel:n,whileTap:o,visualElement:i}){const r=t||e||n||o,a=s(!1),l=s(null),c={passive:!(e||t||n||p)};function u(){l.current&&l.current(),l.current=null}function d(){return u(),a.current=!1,i.animationState&&i.animationState.setActive(ge.Tap,!1),!Ie()}function h(e,o){d()&&(je(i.getInstance(),e.target)?t&&t(e,o):n&&n(e,o))}function m(t,e){d()&&n&&n(t,e)}function p(t,n){u(),a.current||(a.current=!0,l.current=an(Le(window,"pointerup",h,c),Le(window,"pointercancel",m,c)),i.animationState&&i.animationState.setActive(ge.Tap,!0),e&&e(t,n))}Me(i,"pointerdown",r?p:void 0,c),Ne(u)})),focus:Eo((function({whileFocus:t,visualElement:e}){const{animationState:n}=e;ye(e,"focus",t?()=>{n&&n.setActive(ge.Focus,!0)}:void 0),ye(e,"blur",t?()=>{n&&n.setActive(ge.Focus,!1)}:void 0)})),hover:Eo((function({onHoverStart:t,onHoverEnd:e,whileHover:n,visualElement:o}){Me(o,"pointerenter",t||n?$e(o,!0,t):void 0,{passive:!t}),Me(o,"pointerleave",e||n?$e(o,!1,e):void 0,{passive:!e})}))};function Ao(){const t=o(S);if(null===t)return[!0,null];const{isPresent:e,onExitComplete:n,register:i}=t,s=d();r((()=>i(s)),[]);return!e&&n?[!1,()=>n&&n(s)]:[!0]}function Co(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let o=0;o<n;o++)if(e[o]!==t[o])return!1;return!0}const Po=t=>1e3*t,Vo={linear:xn,easeIn:bn,easeInOut:En,easeOut:Sn,circIn:Tn,circInOut:Cn,circOut:An,backIn:Pn,backInOut:Ln,backOut:Vn,anticipate:Mn,bounceIn:Rn,bounceInOut:t=>t<.5?.5*(1-On(1-2*t)):.5*On(2*t-1)+.5,bounceOut:On},Lo=t=>{if(Array.isArray(t)){Be(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,o,i]=t;return uo(e,n,o,i)}return"string"==typeof t?(Be(void 0!==Vo[t],`Invalid easing type '${t}'`),Vo[t]):t},Mo=(t,e)=>"zIndex"!==t&&(!("number"!=typeof e&&!Array.isArray(e))||!("string"!=typeof e||!kt.test(e)||e.startsWith("url("))),Oo=()=>({type:"spring",stiffness:500,damping:25,restSpeed:10}),Ro=t=>({type:"spring",stiffness:550,damping:0===t?2*Math.sqrt(550):30,restSpeed:10}),ko=()=>({type:"keyframes",ease:"linear",duration:.3}),Do=t=>({type:"keyframes",duration:.8,values:t}),Io={x:Oo,y:Oo,z:Oo,rotate:Oo,rotateX:Oo,rotateY:Oo,rotateZ:Oo,scaleX:Ro,scaleY:Ro,scale:Ro,opacity:ko,backgroundColor:ko,color:ko,default:Ro},$o=(t,e)=>{let n;return n=ce(e)?Do:Io[t]||Io.default,{to:e,...n(e)}},jo={...Ft,color:Vt,backgroundColor:Vt,outlineColor:Vt,fill:Vt,stroke:Vt,borderColor:Vt,borderTopColor:Vt,borderRightColor:Vt,borderBottomColor:Vt,borderLeftColor:Vt,filter:jt,WebkitFilter:jt},No=t=>jo[t];function Fo(t,e){var n;let o=No(t);return o!==jt&&(o=kt),null===(n=o.getAnimatableNone)||void 0===n?void 0:n.call(o,e)}const Bo=!1;let Uo=!1;function zo({ease:t,times:e,yoyo:n,flip:o,loop:i,...r}){const s={...r};return e&&(s.offset=e),r.duration&&(s.duration=Po(r.duration)),r.repeatDelay&&(s.repeatDelay=Po(r.repeatDelay)),t&&(s.ease=(t=>Array.isArray(t)&&"number"!=typeof t[0])(t)?t.map(Lo):Lo(t)),"tween"===r.type&&(s.type="keyframes"),(n||i||o)&&(Fe(!Uo,"yoyo, loop and flip have been removed from the API. Replace with repeat and repeatType options."),Uo=!0,n?s.repeatType="reverse":i?s.repeatType="loop":o&&(s.repeatType="mirror"),s.repeat=i||n||o||r.repeat),"spring"!==r.type&&(s.type="keyframes"),s}function Ho(t,e,n){return Array.isArray(e.to)&&void 0===t.duration&&(t.duration=.8),function(t){Array.isArray(t.to)&&null===t.to[0]&&(t.to=[...t.to],t.to[0]=t.from)}(e),function({when:t,delay:e,delayChildren:n,staggerChildren:o,staggerDirection:i,repeat:r,repeatType:s,repeatDelay:a,from:l,...c}){return!!Object.keys(c).length}(t)||(t={...t,...$o(n,e.to)}),{...e,...zo(t)}}function Yo(t,e,n,o,i){const r=Go(o,t)||{};let s=void 0!==r.from?r.from:e.get();const a=Mo(t,n);"none"===s&&a&&"string"==typeof n?s=Fo(t,n):Wo(s)&&"string"==typeof n?s=Xo(n):!Array.isArray(n)&&Wo(n)&&"string"==typeof s&&(n=Xo(s));const l=Mo(t,s);return Fe(l===a,`You are trying to animate ${t} from "${s}" to "${n}". ${s} is not an animatable value - to enable this animation set ${s} to a value animatable to ${n} via the \`style\` property.`),l&&a&&!1!==r.type?function(){const o={from:s,to:n,velocity:e.getVelocity(),onComplete:i,onUpdate:t=>e.set(t)};return"inertia"===r.type||"decay"===r.type?function({from:t=0,velocity:e=0,min:n,max:o,power:i=.8,timeConstant:r=750,bounceStiffness:s=500,bounceDamping:a=10,restDelta:l=1,modifyTarget:c,driver:u,onUpdate:d,onComplete:h,onStop:m}){let p;function f(t){return void 0!==n&&t<n||void 0!==o&&t>o}function g(t){return void 0===n?o:void 0===o||Math.abs(n-t)<Math.abs(o-t)?n:o}function v(t){null==p||p.stop(),p=Qn(Object.assign(Object.assign({},t),{driver:u,onUpdate:e=>{var n;null==d||d(e),null===(n=t.onUpdate)||void 0===n||n.call(t,e)},onComplete:h,onStop:m}))}function y(t){v(Object.assign({type:"spring",stiffness:s,damping:a,restDelta:l},t))}if(f(t))y({from:t,velocity:e,to:g(t)});else{let o=i*e+t;void 0!==c&&(o=c(o));const s=g(o),a=s===n?-1:1;let u,d;const h=t=>{u=d,d=t,e=to(t-u,Zn().delta),(1===a&&t>s||-1===a&&t<s)&&y({from:t,to:s,velocity:e})};v({type:"decay",from:t,velocity:e,timeConstant:r,power:i,restDelta:l,modifyTarget:c,onUpdate:f(o)?h:void 0})}return{stop:()=>null==p?void 0:p.stop()}}({...o,...r}):Qn({...Ho(r,o,t),onUpdate:t=>{o.onUpdate(t),r.onUpdate&&r.onUpdate(t)},onComplete:()=>{o.onComplete(),r.onComplete&&r.onComplete()}})}:function(){const t=ue(n);return e.set(t),i(),r.onUpdate&&r.onUpdate(t),r.onComplete&&r.onComplete(),{stop:()=>{}}}}function Wo(t){return 0===t||"string"==typeof t&&0===parseFloat(t)&&-1===t.indexOf(" ")}function Xo(t){return"number"==typeof t?0:Fo("",t)}function Go(t,e){return t[e]||t.default||t}function qo(t,e,n,o={}){return Bo&&(o={type:!1}),e.start((i=>{let r,s;const a=Yo(t,e,n,o,i),l=function(t,e){var n,o;return null!==(o=null!==(n=(Go(t,e)||{}).delay)&&void 0!==n?n:t.delay)&&void 0!==o?o:0}(o,t),c=()=>s=a();return l?r=window.setTimeout(c,Po(l)):c(),()=>{clearTimeout(r),s&&s.stop()}}))}const Ko=t=>/^0[^.\s]+$/.test(t);function Zo(t,e){-1===t.indexOf(e)&&t.push(e)}function _o(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class Jo{constructor(){this.subscriptions=[]}add(t){return Zo(this.subscriptions,t),()=>_o(this.subscriptions,t)}notify(t,e,n){const o=this.subscriptions.length;if(o)if(1===o)this.subscriptions[0](t,e,n);else for(let i=0;i<o;i++){const o=this.subscriptions[i];o&&o(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}class Qo{constructor(t){var e;this.version="7.5.0",this.timeDelta=0,this.lastUpdated=0,this.updateSubscribers=new Jo,this.velocityUpdateSubscribers=new Jo,this.renderSubscribers=new Jo,this.canTrackVelocity=!1,this.updateAndNotify=(t,e=!0)=>{this.prev=this.current,this.current=t;const{delta:n,timestamp:o}=Zn();this.lastUpdated!==o&&(this.timeDelta=n,this.lastUpdated=o,Yn.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.updateSubscribers.notify(this.current),this.velocityUpdateSubscribers.getSize()&&this.velocityUpdateSubscribers.notify(this.getVelocity()),e&&this.renderSubscribers.notify(this.current)},this.scheduleVelocityCheck=()=>Yn.postRender(this.velocityCheck),this.velocityCheck=({timestamp:t})=>{t!==this.lastUpdated&&(this.prev=this.current,this.velocityUpdateSubscribers.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e)))}onChange(t){return this.updateSubscribers.add(t)}clearListeners(){this.updateSubscribers.clear()}onRenderRequest(t){return t(this.get()),this.renderSubscribers.add(t)}attach(t){this.passiveEffect=t}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?to(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise((e=>{this.hasAnimated=!0,this.stopAnimation=t(e)})).then((()=>this.clearAnimation()))}stop(){this.stopAnimation&&this.stopAnimation(),this.clearAnimation()}isAnimating(){return!!this.stopAnimation}clearAnimation(){this.stopAnimation=null}destroy(){this.updateSubscribers.clear(),this.renderSubscribers.clear(),this.stop()}}function ti(t){return new Qo(t)}const ei=t=>e=>e.test(t),ni=[dt,vt,gt,ft,xt,yt,{test:t=>"auto"===t,parse:t=>t}],oi=t=>ni.find(ei(t)),ii=[...ni,Vt,kt],ri=t=>ii.find(ei(t));function si(t,e,n){const o=t.getProps();return le(o,e,void 0!==n?n:o.custom,function(t){const e={};return t.forEachValue(((t,n)=>e[n]=t.get())),e}(t),function(t){const e={};return t.forEachValue(((t,n)=>e[n]=t.getVelocity())),e}(t))}function ai(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,ti(n))}function li(t,e){if(!e)return;return(e[t]||e.default||e).from}function ci(t){return Boolean(tt(t)&&t.add)}function ui(t,e,n={}){var o;const i=si(t,e,n.custom);let{transition:r=t.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(r=n.transitionOverride);const s=i?()=>di(t,i,n):()=>Promise.resolve(),a=(null===(o=t.variantChildren)||void 0===o?void 0:o.size)?(o=0)=>{const{delayChildren:i=0,staggerChildren:s,staggerDirection:a}=r;return function(t,e,n=0,o=0,i=1,r){const s=[],a=(t.variantChildren.size-1)*o,l=1===i?(t=0)=>t*o:(t=0)=>a-t*o;return Array.from(t.variantChildren).sort(hi).forEach(((t,o)=>{s.push(ui(t,e,{...r,delay:n+l(o)}).then((()=>t.notifyAnimationComplete(e))))})),Promise.all(s)}(t,e,i+o,s,a,n)}:()=>Promise.resolve(),{when:l}=r;if(l){const[t,e]="beforeChildren"===l?[s,a]:[a,s];return t().then(e)}return Promise.all([s(),a(n.delay)])}function di(t,e,{delay:n=0,transitionOverride:o,type:i}={}){var r;let{transition:s=t.getDefaultTransition(),transitionEnd:a,...l}=t.makeTargetAnimatable(e);const c=t.getValue("willChange");o&&(s=o);const u=[],d=i&&(null===(r=t.animationState)||void 0===r?void 0:r.getState()[i]);for(const e in l){const o=t.getValue(e),i=l[e];if(!o||void 0===i||d&&mi(d,e))continue;let r={delay:n,...s};t.shouldReduceMotion&&J.has(e)&&(r={...r,type:!1,delay:0});let a=qo(e,o,i,r);ci(c)&&(c.add(e),a=a.then((()=>c.remove(e)))),u.push(a)}return Promise.all(u).then((()=>{a&&function(t,e){const n=si(t,e);let{transitionEnd:o={},transition:i={},...r}=n?t.makeTargetAnimatable(n,!1):{};r={...r,...o};for(const e in r)ai(t,e,ue(r[e]))}(t,a)}))}function hi(t,e){return t.sortNodePosition(e)}function mi({protectedKeys:t,needsAnimating:e},n){const o=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,o}const pi=[ge.Animate,ge.InView,ge.Focus,ge.Hover,ge.Tap,ge.Drag,ge.Exit],fi=[...pi].reverse(),gi=pi.length;function vi(t){return e=>Promise.all(e.map((({animation:e,options:n})=>function(t,e,n={}){let o;if(t.notifyAnimationStart(e),Array.isArray(e)){const i=e.map((e=>ui(t,e,n)));o=Promise.all(i)}else if("string"==typeof e)o=ui(t,e,n);else{const i="function"==typeof e?si(t,e,n.custom):e;o=di(t,i,n)}return o.then((()=>t.notifyAnimationComplete(e)))}(t,e,n))))}function yi(t){let e=vi(t);const n={[ge.Animate]:bi(!0),[ge.InView]:bi(),[ge.Hover]:bi(),[ge.Tap]:bi(),[ge.Drag]:bi(),[ge.Focus]:bi(),[ge.Exit]:bi()};let o=!0;const i=(e,n)=>{const o=si(t,n);if(o){const{transition:t,transitionEnd:n,...i}=o;e={...e,...i,...n}}return e};function r(r,s){var a;const l=t.getProps(),c=t.getVariantContext(!0)||{},u=[],d=new Set;let h={},m=1/0;for(let e=0;e<gi;e++){const p=fi[e],f=n[p],g=null!==(a=l[p])&&void 0!==a?a:c[p],v=V(g),y=p===s?f.isActive:null;!1===y&&(m=e);let x=g===c[p]&&g!==l[p]&&v;if(x&&o&&t.manuallyAnimateOnMount&&(x=!1),f.protectedKeys={...h},!f.isActive&&null===y||!g&&!f.prevProp||L(g)||"boolean"==typeof g)continue;const b=xi(f.prevProp,g);let w=b||p===s&&f.isActive&&!x&&v||e>m&&v;const S=Array.isArray(g)?g:[g];let E=S.reduce(i,{});!1===y&&(E={});const{prevResolvedValues:T={}}=f,A={...T,...E},C=t=>{w=!0,d.delete(t),f.needsAnimating[t]=!0};for(const t in A){const e=E[t],n=T[t];h.hasOwnProperty(t)||(e!==n?ce(e)&&ce(n)?!Co(e,n)||b?C(t):f.protectedKeys[t]=!0:void 0!==e?C(t):d.add(t):void 0!==e&&d.has(t)?C(t):f.protectedKeys[t]=!0)}f.prevProp=g,f.prevResolvedValues=E,f.isActive&&(h={...h,...E}),o&&t.blockInitialAnimation&&(w=!1),w&&!x&&u.push(...S.map((t=>({animation:t,options:{type:p,...r}}))))}if(d.size){const e={};d.forEach((n=>{const o=t.getBaseTarget(n);void 0!==o&&(e[n]=o)})),u.push({animation:e})}let p=Boolean(u.length);return o&&!1===l.initial&&!t.manuallyAnimateOnMount&&(p=!1),o=!1,p?e(u):Promise.resolve()}return{animateChanges:r,setActive:function(e,o,i){var s;if(n[e].isActive===o)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,o)})),n[e].isActive=o;const a=r(i,e);for(const t in n)n[t].protectedKeys={};return a},setAnimateFunction:function(n){e=n(t)},getState:()=>n}}function xi(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!Co(e,t)}function bi(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}const wi={animation:Eo((({visualElement:t,animate:e})=>{t.animationState||(t.animationState=yi(t)),L(e)&&r((()=>e.subscribe(t)),[e])})),exit:Eo((t=>{const{custom:e,visualElement:n}=t,[i,s]=Ao(),a=o(S);r((()=>{n.isPresent=i;const t=n.animationState&&n.animationState.setActive(ge.Exit,!i,{custom:a&&a.custom||e});t&&!i&&t.then(s)}),[i])}))};class Si{constructor(t,e,{transformPagePoint:n}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const t=Ai(this.lastMoveEventInfo,this.history),e=null!==this.startEvent,n=io(t.offset,{x:0,y:0})>=3;if(!e&&!n)return;const{point:o}=t,{timestamp:i}=Zn();this.history.push({...o,timestamp:i});const{onStart:r,onMove:s}=this.handlers;e||(r&&r(this.lastMoveEvent,t),this.startEvent=this.lastMoveEvent),s&&s(this.lastMoveEvent,t)},this.handlePointerMove=(t,e)=>{this.lastMoveEvent=t,this.lastMoveEventInfo=Ei(e,this.transformPagePoint),xe(t)&&0===t.buttons?this.handlePointerUp(t,e):Yn.update(this.updatePoint,!0)},this.handlePointerUp=(t,e)=>{this.end();const{onEnd:n,onSessionEnd:o}=this.handlers,i=Ai(Ei(e,this.transformPagePoint),this.history);this.startEvent&&n&&n(t,i),o&&o(t,i)},be(t)&&t.touches.length>1)return;this.handlers=e,this.transformPagePoint=n;const o=Ei(Te(t),this.transformPagePoint),{point:i}=o,{timestamp:r}=Zn();this.history=[{...i,timestamp:r}];const{onSessionStart:s}=e;s&&s(t,Ai(o,this.history)),this.removeListeners=an(Le(window,"pointermove",this.handlePointerMove),Le(window,"pointerup",this.handlePointerUp),Le(window,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Wn.update(this.updatePoint)}}function Ei(t,e){return e?{point:e(t.point)}:t}function Ti(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Ai({point:t},e){return{point:t,delta:Ti(t,Pi(e)),offset:Ti(t,Ci(e)),velocity:Vi(e,.1)}}function Ci(t){return t[0]}function Pi(t){return t[t.length-1]}function Vi(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,o=null;const i=Pi(t);for(;n>=0&&(o=t[n],!(i.timestamp-o.timestamp>Po(e)));)n--;if(!o)return{x:0,y:0};const r=(i.timestamp-o.timestamp)/1e3;if(0===r)return{x:0,y:0};const s={x:(i.x-o.x)/r,y:(i.y-o.y)/r};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function Li(t){return t.max-t.min}function Mi(t,e=0,n=.01){return io(t,e)<n}function Oi(t,e,n,o=.5){t.origin=o,t.originPoint=Ze(e.min,e.max,t.origin),t.scale=Li(n)/Li(e),(Mi(t.scale,1,1e-4)||isNaN(t.scale))&&(t.scale=1),t.translate=Ze(n.min,n.max,t.origin)-t.originPoint,(Mi(t.translate)||isNaN(t.translate))&&(t.translate=0)}function Ri(t,e,n,o){Oi(t.x,e.x,n.x,null==o?void 0:o.originX),Oi(t.y,e.y,n.y,null==o?void 0:o.originY)}function ki(t,e,n){t.min=n.min+e.min,t.max=t.min+Li(e)}function Di(t,e,n){t.min=e.min-n.min,t.max=t.min+Li(e)}function Ii(t,e,n){Di(t.x,e.x,n.x),Di(t.y,e.y,n.y)}function $i(t,e,n){return{min:void 0!==e?t.min+e:void 0,max:void 0!==n?t.max+n-(t.max-t.min):void 0}}function ji(t,e){let n=e.min-t.min,o=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,o]=[o,n]),{min:n,max:o}}const Ni=.35;function Fi(t,e,n){return{min:Bi(t,e),max:Bi(t,n)}}function Bi(t,e){var n;return"number"==typeof t?t:null!==(n=t[e])&&void 0!==n?n:0}function Ui(t){return[t("x"),t("y")]}function zi({top:t,left:e,right:n,bottom:o}){return{x:{min:e,max:n},y:{min:t,max:o}}}function Hi(t){return void 0===t||1===t}function Yi({scale:t,scaleX:e,scaleY:n}){return!Hi(t)||!Hi(e)||!Hi(n)}function Wi(t){return Yi(t)||Xi(t.x)||Xi(t.y)||t.z||t.rotate||t.rotateX||t.rotateY}function Xi(t){return t&&"0%"!==t}function Gi(t,e,n){return n+e*(t-n)}function qi(t,e,n,o,i){return void 0!==i&&(t=Gi(t,i,o)),Gi(t,n,o)+e}function Ki(t,e=0,n=1,o,i){t.min=qi(t.min,e,n,o,i),t.max=qi(t.max,e,n,o,i)}function Zi(t,{x:e,y:n}){Ki(t.x,e.translate,e.scale,e.originPoint),Ki(t.y,n.translate,n.scale,n.originPoint)}function _i(t,e){t.min=t.min+e,t.max=t.max+e}function Ji(t,e,[n,o,i]){const r=void 0!==e[i]?e[i]:.5,s=Ze(t.min,t.max,r);Ki(t,e[n],e[o],s,e.scale)}const Qi=["x","scaleX","originX"],tr=["y","scaleY","originY"];function er(t,e){Ji(t.x,e,Qi),Ji(t.y,e,tr)}function nr(t,e){return zi(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),o=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:o.y,right:o.x}}(t.getBoundingClientRect(),e))}const or=new WeakMap;class ir{constructor(t){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic={x:{min:0,max:0},y:{min:0,max:0}},this.visualElement=t}start(t,{snapToCursor:e=!1}={}){if(!1===this.visualElement.isPresent)return;this.panSession=new Si(t,{onSessionStart:t=>{this.stopAnimation(),e&&this.snapToCursor(Te(t,"page").point)},onStart:(t,e)=>{var n;const{drag:o,dragPropagation:i,onDragStart:r}=this.getProps();(!o||i||(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=De(o),this.openGlobalLock))&&(this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ui((t=>{var e,n;let o=this.getAxisMotionValue(t).get()||0;if(gt.test(o)){const i=null===(n=null===(e=this.visualElement.projection)||void 0===e?void 0:e.layout)||void 0===n?void 0:n.actual[t];if(i){o=Li(i)*(parseFloat(o)/100)}}this.originPoint[t]=o})),null==r||r(t,e),null===(n=this.visualElement.animationState)||void 0===n||n.setActive(ge.Drag,!0))},onMove:(t,e)=>{const{dragPropagation:n,dragDirectionLock:o,onDirectionLock:i,onDrag:r}=this.getProps();if(!n&&!this.openGlobalLock)return;const{offset:s}=e;if(o&&null===this.currentDirection)return this.currentDirection=function(t,e=10){let n=null;Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x");return n}(s),void(null!==this.currentDirection&&(null==i||i(this.currentDirection)));this.updateAxis("x",e.point,s),this.updateAxis("y",e.point,s),this.visualElement.syncRender(),null==r||r(t,e)},onSessionEnd:(t,e)=>this.stop(t,e)},{transformPagePoint:this.visualElement.getTransformPagePoint()})}stop(t,e){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:o}=e;this.startAnimation(o);const{onDragEnd:i}=this.getProps();null==i||i(t,e)}cancel(){var t,e;this.isDragging=!1,this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!1),null===(t=this.panSession)||void 0===t||t.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),null===(e=this.visualElement.animationState)||void 0===e||e.setActive(ge.Drag,!1)}updateAxis(t,e,n){const{drag:o}=this.getProps();if(!n||!rr(t,o,this.currentDirection))return;const i=this.getAxisMotionValue(t);let r=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(r=function(t,{min:e,max:n},o){return void 0!==e&&t<e?t=o?Ze(e,t,o.min):Math.max(t,e):void 0!==n&&t>n&&(t=o?Ze(n,t,o.max):Math.min(t,n)),t}(r,this.constraints[t],this.elastic[t])),i.set(r)}resolveConstraints()