@adriansteffan/reactive 0.1.11 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -78626,7 +78626,7 @@ var Ym;
78626
78626
  i.UTF8 = "utf8", i.ASCII = "ascii", i.UTF16 = "utf16";
78627
78627
  })(Ym || (Ym = {}));
78628
78628
  const Ea = wu("Filesystem", {
78629
- web: () => import("./web-jSsAWdvl.js").then((i) => new i.FilesystemWeb())
78629
+ web: () => import("./web-jzuaNWaD.js").then((i) => new i.FilesystemWeb())
78630
78630
  });
78631
78631
  vi("Upload", async (i, e, t, s) => {
78632
78632
  const r = i.sessionID || `sim_${Date.now()}_${Math.floor(Lt(0, 2176782336)).toString(36)}`, n = EV({
@@ -78884,7 +78884,7 @@ var iw;
78884
78884
  i.None = "NONE", i.Slide = "SLIDE", i.Fade = "FADE";
78885
78885
  })(iw || (iw = {}));
78886
78886
  const e7 = wu("StatusBar"), t7 = wu("ImmersiveMode", {
78887
- web: () => import("./web-mrTTNLP_.js").then((i) => new i.ImmersiveModeWeb())
78887
+ web: () => import("./web-C5bGJ59T.js").then((i) => new i.ImmersiveModeWeb())
78888
78888
  });
78889
78889
  Ai("EnterFullscreen", "session");
78890
78890
  vi("EnterFullscreen", xu, {});
@@ -85761,14 +85761,9 @@ const K4 = fn({
85761
85761
  backKey: a = "ArrowLeft",
85762
85762
  theme: o = "light"
85763
85763
  }) => {
85764
- const [l, u] = rt(0), [h, c] = rt({}), d = fe(), f = fe({}), y = h[l] !== !1, v = fe(y), [m, g] = rt(!1);
85764
+ const [l, u] = rt(0), [h, c] = rt({}), d = fe(), f = fe({}), y = h[l] !== !1, v = fe(y), [m, g] = rt(0);
85765
85765
  lt(() => {
85766
- if (y && !v.current) {
85767
- g(!0);
85768
- const V = setTimeout(() => g(!1), 300);
85769
- return () => clearTimeout(V);
85770
- }
85771
- v.current = y;
85766
+ y && !v.current && g((V) => V + 1), v.current = y;
85772
85767
  }, [y]);
85773
85768
  const b = Xe(
85774
85769
  (V) => {
@@ -85876,11 +85871,12 @@ const K4 = fn({
85876
85871
  onKeyDown: (V) => {
85877
85872
  (V.key === " " || V.key === "Enter") && V.preventDefault();
85878
85873
  },
85879
- animate: { scale: m ? 1.2 : 1 },
85880
- transition: { type: "spring", stiffness: 500, damping: 15 },
85874
+ animate: { scale: [1, 1.2, 1] },
85875
+ transition: { duration: 0.3 },
85881
85876
  className: (y ? Tx : Lye) + (l === e.length - 1 ? " px-8" : ""),
85882
85877
  children: l === e.length - 1 ? s : "→"
85883
- }
85878
+ },
85879
+ m
85884
85880
  ) })
85885
85881
  ]
85886
85882
  }
@@ -1,4 +1,4 @@
1
- import { H as e, C as t, a as i, c as r, d as n, e as o, f as l, Y as m, z as u, M as c, P as p, g as P, h as g, Q as d, R as C, i as D, j as T, F as x, T as h, k, l as E, U as F, X as S, m as f, n as v, o as B, p as R, q as b, r as y, s as I, t as M, u as U, v as w, w as K, x as q, y as A, A as Q, B as Z, D as j, G as z, I as G, J as H, K as J, L, N, O, S as V, V as X, Z as Y, _, $, a0 as W, a1 as aa, a2 as sa, a3 as ea, a4 as ta, a5 as ia, a6 as ra, a7 as na, a8 as oa, a9 as la, aa as ma, ab as ua } from "./mod-DWwiBaRy.js";
1
+ import { H as e, C as t, a as i, c as r, d as n, e as o, f as l, Y as m, z as u, M as c, P as p, g as P, h as g, Q as d, R as C, i as D, j as T, F as x, T as h, k, l as E, U as F, X as S, m as f, n as v, o as B, p as R, q as b, r as y, s as I, t as M, u as U, v as w, w as K, x as q, y as A, A as Q, B as Z, D as j, G as z, I as G, J as H, K as J, L, N, O, S as V, V as X, Z as Y, _, $, a0 as W, a1 as aa, a2 as sa, a3 as ea, a4 as ta, a5 as ia, a6 as ra, a7 as na, a8 as oa, a9 as la, aa as ma, ab as ua } from "./mod-Cu_Zktcq.js";
2
2
  export {
3
3
  e as Bounce,
4
4
  t as CanvasBlock,
@@ -10278,6 +10278,6 @@ Click the button below to add a new entry.`,noEntriesReadonlyText:"No entries",t
10278
10278
  ${x}px !important;
10279
10279
  ${P}px !important;
10280
10280
  }
10281
- `),()=>{var _;(_=o.current)==null||_.removeAttribute("data-motion-pop-id"),R.contains(A)&&R.removeChild(A)}},[e]),L.jsx(Lve,{isPresent:e,childRef:o,sizeRef:l,pop:n,children:n===!1?i:p.cloneElement(i,{ref:c})})}const Dve=({children:i,initial:e,isPresent:t,onExitComplete:s,custom:r,presenceAffectsLayout:n,mode:a,anchorX:o,anchorY:l,root:u})=>{const h=Jg(kve),c=T.useId();let d=!0,f=T.useMemo(()=>(d=!1,{id:c,initial:e,isPresent:t,custom:r,onExitComplete:y=>{h.set(y,!0);for(const v of h.values())if(!v)return;s&&s()},register:y=>(h.set(y,!1),()=>h.delete(y))}),[t,h,s]);return n&&d&&(f={...f}),T.useMemo(()=>{h.forEach((y,v)=>h.set(v,!1))},[t]),p.useEffect(()=>{!t&&!h.size&&s&&s()},[t]),i=L.jsx(_ve,{pop:a==="popLayout",isPresent:t,anchorX:o,anchorY:l,root:u,children:i}),L.jsx(Sd.Provider,{value:f,children:i})};function kve(){return new Map}function X7(i=!0){const e=T.useContext(Sd);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:s,register:r}=e,n=T.useId();T.useEffect(()=>{if(i)return r(n)},[i]);const a=T.useCallback(()=>i&&s&&s(n),[n,s,i]);return!t&&s?[!1,a]:[!0]}const Wd=i=>i.key||"";function e4(i){const e=[];return T.Children.forEach(i,t=>{T.isValidElement(t)&&e.push(t)}),e}const Ove=({children:i,custom:e,initial:t=!0,onExitComplete:s,presenceAffectsLayout:r=!0,mode:n="sync",propagate:a=!1,anchorX:o="left",anchorY:l="top",root:u})=>{const[h,c]=X7(a),d=T.useMemo(()=>e4(i),[i]),f=a&&!h?[]:d.map(Wd),y=T.useRef(!0),v=T.useRef(d),m=Jg(()=>new Map),g=T.useRef(new Set),[b,x]=T.useState(d),[P,A]=T.useState(d);Yg(()=>{y.current=!1,v.current=d;for(let V=0;V<P.length;V++){const k=Wd(P[V]);f.includes(k)?(m.delete(k),g.current.delete(k)):m.get(k)!==!0&&m.set(k,!1)}},[P,f.length,f.join("-")]);const R=[];if(d!==b){let V=[...d];for(let k=0;k<P.length;k++){const q=P[k],B=Wd(q);f.includes(B)||(V.splice(k,0,q),R.push(q))}return n==="wait"&&R.length&&(V=R),A(e4(V)),x(d),null}process.env.NODE_ENV!=="production"&&n==="wait"&&P.length>1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:_}=T.useContext(vu);return L.jsx(L.Fragment,{children:P.map(V=>{const k=Wd(V),q=a&&!h?!1:d===P||f.includes(k),B=()=>{if(g.current.has(k))return;if(m.has(k))g.current.add(k),m.set(k,!0);else return;let U=!0;m.forEach(D=>{D||(U=!1)}),U&&(_==null||_(),A(v.current),a&&(c==null||c()),s&&s())};return L.jsx(Dve,{isPresent:q,initial:!y.current||t?void 0:!1,custom:e,presenceAffectsLayout:r,mode:n,root:u,onExitComplete:q?void 0:B,anchorX:o,anchorY:l,children:V},k)})})},Mve=T.createContext(null);function Nve(){const i=T.useRef(!1);return Yg(()=>(i.current=!0,()=>{i.current=!1}),[]),i}function Fve(){const i=Nve(),[e,t]=T.useState(0),s=T.useCallback(()=>{i.current&&t(e+1)},[e]);return[T.useCallback(()=>Tt.postRender(s),[s]),e]}const t4=i=>i===!0,qve=i=>t4(i===!0)||i==="id",Bve=({children:i,id:e,inherit:t=!0})=>{const s=T.useContext(vu),r=T.useContext(Mve),[n,a]=Fve(),o=T.useRef(null),l=s.id||r;o.current===null&&(qve(t)&&l&&(e=e?l+"-"+e:l),o.current={id:e,group:t4(t)&&s.group||Z7()});const u=T.useMemo(()=>({...o.current,forceRender:n}),[a]);return L.jsx(vu.Provider,{value:u,children:i})},s4=T.createContext({strict:!1}),i4={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let r4=!1;function $ve(){if(r4)return;const i={};for(const e in i4)i[e]={isEnabled:t=>i4[e].some(s=>!!t[s])};Z3(i),r4=!0}function n4(){return $ve(),yge()}function Hve(i){const e=n4();for(const t in i)e[t]={...e[t],...i[t]};Z3(e)}const Qve=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","propagate","ignoreStrict","viewport"]);function Gd(i){return i.startsWith("while")||i.startsWith("drag")&&i!=="draggable"||i.startsWith("layout")||i.startsWith("onTap")||i.startsWith("onPan")||i.startsWith("onLayout")||Qve.has(i)}let a4=i=>!Gd(i);function Uve(i){typeof i=="function"&&(a4=e=>e.startsWith("on")?!Gd(e):i(e))}try{Uve(require("@emotion/is-prop-valid").default)}catch{}function zve(i,e,t){const s={};for(const r in i)r==="values"&&typeof i.values=="object"||ks(i[r])||(a4(r)||t===!0&&Gd(r)||!e&&!Gd(r)||i.draggable&&r.startsWith("onDrag"))&&(s[r]=i[r]);return s}const Kd=T.createContext({});function jve(i,e){if(Bd(i)){const{initial:t,animate:s}=i;return{initial:t===!1||Su(t)?t:void 0,animate:Su(s)?s:void 0}}return i.inherit!==!1?e:{}}function Wve(i){const{initial:e,animate:t}=jve(i,T.useContext(Kd));return T.useMemo(()=>({initial:e,animate:t}),[o4(e),o4(t)])}function o4(i){return Array.isArray(i)?i.join(" "):i}const r0=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function l4(i,e,t){for(const s in e)!ks(e[s])&&!h7(s,t)&&(i[s]=e[s])}function Gve({transformTemplate:i},e){return T.useMemo(()=>{const t=r0();return Zv(t,e,i),Object.assign({},t.vars,t.style)},[e])}function Kve(i,e){const t=i.style||{},s={};return l4(s,t,i),Object.assign(s,Gve(i,e)),s}function Zve(i,e){const t={},s=Kve(i,e);return i.drag&&i.dragListener!==!1&&(t.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=i.drag===!0?"none":`pan-${i.drag==="x"?"y":"x"}`),i.tabIndex===void 0&&(i.onTap||i.onTapStart||i.whileTap)&&(t.tabIndex=0),t.style=s,t}const u4=()=>({...r0(),attrs:{}});function Jve(i,e,t,s){const r=T.useMemo(()=>{const n=u4();return c7(n,e,p7(s),i.transformTemplate,i.style),{...n.attrs,style:{...n.style}}},[e]);if(i.style){const n={};l4(n,i.style,i),r.style={...n,...r.style}}return r}const Yve=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function n0(i){return typeof i!="string"||i.includes("-")?!1:!!(Yve.indexOf(i)>-1||/[A-Z]/u.test(i))}function Xve(i,e,t,{latestValues:s},r,n=!1,a){const l=(a??n0(i)?Jve:Zve)(e,s,r,i),u=zve(e,typeof i=="string",n),h=i!==T.Fragment?{...u,...l,ref:t}:{},{children:c}=e,d=T.useMemo(()=>ks(c)?c.get():c,[c]);return T.createElement(i,{...h,children:d})}function e0e({scrapeMotionValuesFromProps:i,createRenderState:e},t,s,r){return{latestValues:t0e(t,s,r,i),renderState:e()}}function t0e(i,e,t,s){const r={},n=s(i,{});for(const d in n)r[d]=zd(n[d]);let{initial:a,animate:o}=i;const l=Bd(i),u=W3(i);e&&u&&!l&&i.inherit!==!1&&(a===void 0&&(a=e.initial),o===void 0&&(o=e.animate));let h=t?t.initial===!1:!1;h=h||a===!1;const c=h?o:a;if(c&&typeof c!="boolean"&&!qd(c)){const d=Array.isArray(c)?c:[c];for(let f=0;f<d.length;f++){const y=_v(i,d[f]);if(y){const{transitionEnd:v,transition:m,...g}=y;for(const b in g){let x=g[b];if(Array.isArray(x)){const P=h?x.length-1:0;x=x[P]}x!==null&&(r[b]=x)}for(const b in v)r[b]=v[b]}}}return r}const h4=i=>(e,t)=>{const s=T.useContext(Kd),r=T.useContext(Sd),n=()=>e0e(i,e,s,r);return t?n():Jg(n)},s0e=h4({scrapeMotionValuesFromProps:Yv,createRenderState:r0}),i0e=h4({scrapeMotionValuesFromProps:f7,createRenderState:u4}),r0e=Symbol.for("motionComponentSymbol");function n0e(i,e,t){const s=T.useRef(t);T.useInsertionEffect(()=>{s.current=t});const r=T.useRef(null);return T.useCallback(n=>{var o;n&&((o=i.onMount)==null||o.call(i,n));const a=s.current;if(typeof a=="function")if(n){const l=a(n);typeof l=="function"&&(r.current=l)}else r.current?(r.current(),r.current=null):a(n);else a&&(a.current=n);e&&(n?e.mount(n):e.unmount())},[e])}const c4=T.createContext({});function jo(i){return i&&typeof i=="object"&&Object.prototype.hasOwnProperty.call(i,"current")}function a0e(i,e,t,s,r,n){var x,P;const{visualElement:a}=T.useContext(Kd),o=T.useContext(s4),l=T.useContext(Sd),u=T.useContext(i0),h=u.reducedMotion,c=u.skipAnimations,d=T.useRef(null),f=T.useRef(!1);s=s||o.renderer,!d.current&&s&&(d.current=s(i,{visualState:e,parent:a,props:t,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:h,skipAnimations:c,isSVG:n}),f.current&&d.current&&(d.current.manuallyAnimateOnMount=!0));const y=d.current,v=T.useContext(c4);y&&!y.projection&&r&&(y.type==="html"||y.type==="svg")&&o0e(d.current,t,r,v);const m=T.useRef(!1);T.useInsertionEffect(()=>{y&&m.current&&y.update(t,l)});const g=t[T3],b=T.useRef(!!g&&typeof window<"u"&&!((x=window.MotionHandoffIsComplete)!=null&&x.call(window,g))&&((P=window.MotionHasOptimisedAnimation)==null?void 0:P.call(window,g)));return Yg(()=>{f.current=!0,y&&(m.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),y.scheduleRenderMicrotask(),b.current&&y.animationState&&y.animationState.animateChanges())}),T.useEffect(()=>{y&&(!b.current&&y.animationState&&y.animationState.animateChanges(),b.current&&(queueMicrotask(()=>{var A;(A=window.MotionHandoffMarkAsComplete)==null||A.call(window,g)}),b.current=!1),y.enteringChildren=void 0)}),y}function o0e(i,e,t,s){const{layoutId:r,layout:n,drag:a,dragConstraints:o,layoutScroll:l,layoutRoot:u,layoutAnchor:h,layoutCrossfade:c}=e;i.projection=new t(i.latestValues,e["data-framer-portal-id"]?void 0:d4(i.parent)),i.projection.setOptions({layoutId:r,layout:n,alwaysMeasureLayout:!!a||o&&jo(o),visualElement:i,animationType:typeof n=="string"?n:"both",initialPromotionConfig:s,crossfade:c,layoutScroll:l,layoutRoot:u,layoutAnchor:h})}function d4(i){if(i)return i.options.allowProjection!==!1?i.projection:d4(i.parent)}function a0(i,{forwardMotionProps:e=!1,type:t}={},s,r){s&&Hve(s);const n=t?t==="svg":n0(i),a=n?i0e:s0e;function o(u,h){let c;const d={...T.useContext(i0),...u,layoutId:l0e(u)},{isStatic:f}=d,y=Wve(u),v=a(u,f);if(!f&&typeof window<"u"){u0e(d,s);const m=h0e(d);c=m.MeasureLayout,y.visualElement=a0e(i,v,d,r,m.ProjectionNode,n)}return L.jsxs(Kd.Provider,{value:y,children:[c&&y.visualElement?L.jsx(c,{visualElement:y.visualElement,...d}):null,Xve(i,u,n0e(v,y.visualElement,h),v,f,e,n)]})}o.displayName=`motion.${typeof i=="string"?i:`create(${i.displayName??i.name??""})`}`;const l=T.forwardRef(o);return l[r0e]=i,l}function l0e({layoutId:i}){const e=T.useContext(vu).id;return e&&i!==void 0?e+"-"+i:i}function u0e(i,e){const t=T.useContext(s4).strict;if(process.env.NODE_ENV!=="production"&&e&&t){const s="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";i.ignoreStrict?Mo(!1,s,"lazy-strict-mode"):an(!1,s,"lazy-strict-mode")}}function h0e(i){const e=n4(),{drag:t,layout:s}=e;if(!t&&!s)return{};const r={...t,...s};return{MeasureLayout:t!=null&&t.isEnabled(i)||s!=null&&s.isEnabled(i)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function c0e(i,e){if(typeof Proxy>"u")return a0;const t=new Map,s=(n,a)=>a0(n,a,i,e),r=(n,a)=>(process.env.NODE_ENV!=="production"&&sv(!1,"motion() is deprecated. Use motion.create() instead."),s(n,a));return new Proxy(r,{get:(n,a)=>a==="create"?s:(t.has(a)||t.set(a,a0(a,void 0,i,e)),t.get(a))})}const d0e=(i,e)=>e.isSVG??n0(i)?new Oge(e):new Rge(e,{allowProjection:i!==T.Fragment});class p0e extends Zn{constructor(e){super(e),e.animationState||(e.animationState=Bge(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();qd(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let f0e=0;class m0e extends Zn{constructor(){super(...arguments),this.id=f0e++,this.isExitComplete=!1}update(){var n;if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===s)return;if(e&&s===!1){if(this.isExitComplete){const{initial:a,custom:o}=this.node.getProps();if(typeof a=="string"){const l=Da(this.node,a,o);if(l){const{transition:u,transitionEnd:h,...c}=l;for(const d in c)(n=this.node.getValue(d))==null||n.jump(c[d])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const r=this.node.animationState.setActive("exit",!e);t&&!e&&r.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){const{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const g0e={animation:{Feature:p0e},exit:{Feature:m0e}};function Ru(i){return{point:{x:i.pageX,y:i.pageY}}}const v0e=i=>e=>$v(e)&&i(e,Ru(e));function Au(i,e,t,s){return Iu(i,e,v0e(t),s)}const p4=({current:i})=>i?i.ownerDocument.defaultView:null,f4=(i,e)=>Math.abs(i-e);function y0e(i,e){const t=f4(i.x,e.x),s=f4(i.y,e.y);return Math.sqrt(t**2+s**2)}const m4=new Set(["auto","scroll"]);class g4{constructor(e,t,{transformPagePoint:s,contextWindow:r=window,dragSnapToOrigin:n=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=f=>{this.handleScroll(f.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Zd(this.lastRawMoveEventInfo,this.transformPagePoint));const f=o0(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,v=y0e(f.offset,{x:0,y:0})>=this.distanceThreshold;if(!y&&!v)return;const{point:m}=f,{timestamp:g}=Ds;this.history.push({...m,timestamp:g});const{onStart:b,onMove:x}=this.handlers;y||(b&&b(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),x&&x(this.lastMoveEvent,f)},this.handlePointerMove=(f,y)=>{this.lastMoveEvent=f,this.lastRawMoveEventInfo=y,this.lastMoveEventInfo=Zd(y,this.transformPagePoint),Tt.update(this.updatePoint,!0)},this.handlePointerUp=(f,y)=>{this.end();const{onEnd:v,onSessionEnd:m,resumeAnimation:g}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&g&&g(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=o0(f.type==="pointercancel"?this.lastMoveEventInfo:Zd(y,this.transformPagePoint),this.history);this.startEvent&&v&&v(f,b),m&&m(f,b)},!$v(e))return;this.dragSnapToOrigin=n,this.handlers=t,this.transformPagePoint=s,this.distanceThreshold=a,this.contextWindow=r||window;const l=Ru(e),u=Zd(l,this.transformPagePoint),{point:h}=u,{timestamp:c}=Ds;this.history=[{...h,timestamp:c}];const{onSessionStart:d}=t;d&&d(e,o0(u,this.history)),this.removeListeners=yu(Au(this.contextWindow,"pointermove",this.handlePointerMove),Au(this.contextWindow,"pointerup",this.handlePointerUp),Au(this.contextWindow,"pointercancel",this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){const s=getComputedStyle(t);(m4.has(s.overflowX)||m4.has(s.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const t=this.scrollPositions.get(e);if(!t)return;const s=e===window,r=s?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},n={x:r.x-t.x,y:r.y-t.y};n.x===0&&n.y===0||(s?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=n.x,this.lastMoveEventInfo.point.y+=n.y):this.history.length>0&&(this.history[0].x-=n.x,this.history[0].y-=n.y),this.scrollPositions.set(e,r),Tt.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),jn(this.updatePoint)}}function Zd(i,e){return e?{point:e(i.point)}:i}function v4(i,e){return{x:i.x-e.x,y:i.y-e.y}}function o0({point:i},e){return{point:i,delta:v4(i,y4(e)),offset:v4(i,C0e(e)),velocity:b0e(e,.1)}}function C0e(i){return i[0]}function y4(i){return i[i.length-1]}function b0e(i,e){if(i.length<2)return{x:0,y:0};let t=i.length-1,s=null;const r=y4(i);for(;t>=0&&(s=i[t],!(r.timestamp-s.timestamp>di(e)));)t--;if(!s)return{x:0,y:0};s===i[0]&&i.length>2&&r.timestamp-s.timestamp>di(e)*2&&(s=i[1]);const n=Qi(r.timestamp-s.timestamp);if(n===0)return{x:0,y:0};const a={x:(r.x-s.x)/n,y:(r.y-s.y)/n};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function w0e(i,{min:e,max:t},s){return e!==void 0&&i<e?i=s?qt(e,i,s.min):Math.max(i,e):t!==void 0&&i>t&&(i=s?qt(t,i,s.max):Math.min(i,t)),i}function C4(i,e,t){return{min:e!==void 0?i.min+e:void 0,max:t!==void 0?i.max+t-(i.max-i.min):void 0}}function x0e(i,{top:e,left:t,bottom:s,right:r}){return{x:C4(i.x,t,r),y:C4(i.y,e,s)}}function b4(i,e){let t=e.min-i.min,s=e.max-i.max;return e.max-e.min<i.max-i.min&&([t,s]=[s,t]),{min:t,max:s}}function E0e(i,e){return{x:b4(i.x,e.x),y:b4(i.y,e.y)}}function V0e(i,e){let t=.5;const s=Gs(i),r=Gs(e);return r>s?t=Cu(e.min,e.max-s,i.min):s>r&&(t=Cu(i.min,i.max-r,e.min)),Lr(0,1,t)}function S0e(i,e){const t={};return e.min!==void 0&&(t.min=e.min-i.min),e.max!==void 0&&(t.max=e.max-i.min),t}const l0=.35;function T0e(i=l0){return i===!1?i=0:i===!0&&(i=l0),{x:w4(i,"left","right"),y:w4(i,"top","bottom")}}function w4(i,e,t){return{min:x4(i,e),max:x4(i,t)}}function x4(i,e){return typeof i=="number"?i:i[e]||0}const P0e=new WeakMap;class I0e{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ys(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:s}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const n=c=>{t&&this.snapToCursor(Ru(c).point),this.stopAnimation()},a=(c,d)=>{const{drag:f,dragPropagation:y,onDragStart:v}=this.getProps();if(f&&!y&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Gme(f),!this.openDragLock))return;this.latestPointerEvent=c,this.latestPanInfo=d,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),kr(g=>{let b=this.getAxisMotionValue(g).get()||0;if(_r.test(b)){const{projection:x}=this.visualElement;if(x&&x.layout){const P=x.layout.layoutBox[g];P&&(b=Gs(P)*(parseFloat(b)/100))}}this.originPoint[g]=b}),v&&Tt.update(()=>v(c,d),!1,!0),kv(this.visualElement,"transform");const{animationState:m}=this.visualElement;m&&m.setActive("whileDrag",!0)},o=(c,d)=>{this.latestPointerEvent=c,this.latestPanInfo=d;const{dragPropagation:f,dragDirectionLock:y,onDirectionLock:v,onDrag:m}=this.getProps();if(!f&&!this.openDragLock)return;const{offset:g}=d;if(y&&this.currentDirection===null){this.currentDirection=A0e(g),this.currentDirection!==null&&v&&v(this.currentDirection);return}this.updateAxis("x",d.point,g),this.updateAxis("y",d.point,g),this.visualElement.render(),m&&Tt.update(()=>m(c,d),!1,!0)},l=(c,d)=>{this.latestPointerEvent=c,this.latestPanInfo=d,this.stop(c,d),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>{const{dragSnapToOrigin:c}=this.getProps();(c||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:h}=this.getProps();this.panSession=new g4(e,{onSessionStart:n,onStart:a,onMove:o,onSessionEnd:l,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:h,distanceThreshold:s,contextWindow:p4(this.visualElement),element:this.visualElement.current})}stop(e,t){const s=e||this.latestPointerEvent,r=t||this.latestPanInfo,n=this.isDragging;if(this.cancel(),!n||!r||!s)return;const{velocity:a}=r;this.startAnimation(a);const{onDragEnd:o}=this.getProps();o&&Tt.postRender(()=>o(s,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,s){const{drag:r}=this.getProps();if(!s||!Jd(e,r,this.currentDirection))return;const n=this.getAxisMotionValue(e);let a=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(a=w0e(a,this.constraints[e],this.elastic[e])),n.set(a)}resolveConstraints(){var n;const{dragConstraints:e,dragElastic:t}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(n=this.visualElement.projection)==null?void 0:n.layout,r=this.constraints;e&&jo(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&s?this.constraints=x0e(s.layoutBox,e):this.constraints=!1,this.elastic=T0e(t),r!==this.constraints&&!jo(e)&&s&&this.constraints&&!this.hasMutatedConstraints&&kr(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=S0e(s.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!jo(e))return!1;const s=e.current;an(s!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const n=Ege(s,r.root,this.visualElement.getTransformPagePoint());let a=E0e(r.layout.layoutBox,n);if(t){const o=t(bge(a));this.hasMutatedConstraints=!!o,o&&(a=Y3(o))}return a}startAnimation(e){const{drag:t,dragMomentum:s,dragElastic:r,dragTransition:n,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),l=this.constraints||{},u=kr(h=>{if(!Jd(h,t,this.currentDirection))return;let c=l&&l[h]||{};(a===!0||a===h)&&(c={min:0,max:0});const d=r?200:1e6,f=r?40:1e7,y={type:"inertia",velocity:s?e[h]:0,bounceStiffness:d,bounceDamping:f,timeConstant:750,restDelta:1,restSpeed:10,...n,...c};return this.startAxisValueAnimation(h,y)});return Promise.all(u).then(o)}startAxisValueAnimation(e,t){const s=this.getAxisMotionValue(e);return kv(this.visualElement,e),s.start(Lv(e,s,0,t,this.visualElement,!1))}stopAnimation(){kr(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,s=this.visualElement.getProps(),r=s[t];return r||this.visualElement.getValue(e,(s.initial?s.initial[e]:void 0)||0)}snapToCursor(e){kr(t=>{const{drag:s}=this.getProps();if(!Jd(t,s,this.currentDirection))return;const{projection:r}=this.visualElement,n=this.getAxisMotionValue(t);if(r&&r.layout){const{min:a,max:o}=r.layout.layoutBox[t],l=n.get()||0;n.set(e[t]-qt(a,o,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:s}=this.visualElement;if(!jo(t)||!s||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};kr(a=>{const o=this.getAxisMotionValue(a);if(o&&this.constraints!==!1){const l=o.get();r[a]=V0e({min:l,max:l},this.constraints[a])}});const{transformTemplate:n}=this.visualElement.getProps();this.visualElement.current.style.transform=n?n({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.constraints=!1,this.resolveConstraints(),kr(a=>{if(!Jd(a,e,null))return;const o=this.getAxisMotionValue(a),{min:l,max:u}=this.constraints[a];o.set(qt(l,u,r[a]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;P0e.set(this.visualElement,this);const e=this.visualElement.current,t=Au(e,"pointerdown",u=>{const{drag:h,dragListener:c=!0}=this.getProps(),d=u.target,f=d!==e&&ege(d);h&&c&&!f&&this.start(u)});let s;const r=()=>{const{dragConstraints:u}=this.getProps();jo(u)&&u.current&&(this.constraints=this.resolveRefConstraints(),s||(s=R0e(e,u.current,()=>this.scalePositionWithinConstraints())))},{projection:n}=this.visualElement,a=n.addEventListener("measure",r);n&&!n.layout&&(n.root&&n.root.updateScroll(),n.updateLayout()),Tt.read(r);const o=Iu(window,"resize",()=>this.scalePositionWithinConstraints()),l=n.addEventListener("didUpdate",({delta:u,hasLayoutChanged:h})=>{this.isDragging&&h&&(kr(c=>{const d=this.getAxisMotionValue(c);d&&(this.originPoint[c]+=u[c].translate,d.set(d.get()+u[c].translate))}),this.visualElement.render())});return()=>{o(),t(),a(),l&&l(),s&&s()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:s=!1,dragPropagation:r=!1,dragConstraints:n=!1,dragElastic:a=l0,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:s,dragPropagation:r,dragConstraints:n,dragElastic:a,dragMomentum:o}}}function E4(i){let e=!0;return()=>{if(e){e=!1;return}i()}}function R0e(i,e,t){const s=U3(i,E4(t)),r=U3(e,E4(t));return()=>{s(),r()}}function Jd(i,e,t){return(e===!0||e===i)&&(t===null||t===i)}function A0e(i,e=10){let t=null;return Math.abs(i.y)>e?t="y":Math.abs(i.x)>e&&(t="x"),t}class L0e extends Zn{constructor(e){super(e),this.removeGroupControls=Hi,this.removeListeners=Hi,this.controls=new I0e(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Hi}update(){const{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const u0=i=>(e,t)=>{i&&Tt.update(()=>i(e,t),!1,!0)};class _0e extends Zn{constructor(){super(...arguments),this.removePointerDownListener=Hi}onPointerDown(e){this.session=new g4(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:p4(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:s,onPanEnd:r}=this.node.getProps();return{onSessionStart:u0(e),onStart:u0(t),onMove:u0(s),onEnd:(n,a)=>{delete this.session,r&&Tt.postRender(()=>r(n,a))}}}mount(){this.removePointerDownListener=Au(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let h0=!1;class D0e extends T.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:s,layoutId:r}=this.props,{projection:n}=e;n&&(t.group&&t.group.add(n),s&&s.register&&r&&s.register(n),h0&&n.root.didUpdate(),n.addEventListener("animationComplete",()=>{this.safeToRemove()}),n.setOptions({...n.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),jd.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:s,drag:r,isPresent:n}=this.props,{projection:a}=s;return a&&(a.isPresent=n,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),h0=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==n?a.willUpdate():this.safeToRemove(),e.isPresent!==n&&(n?a.promote():a.relegate()||Tt.postRender(()=>{const o=a.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:e,layoutAnchor:t}=this.props,{projection:s}=e;s&&(s.options.layoutAnchor=t,s.root.didUpdate(),Bv.postRender(()=>{!s.currentAnimation&&s.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:s}=this.props,{projection:r}=e;h0=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),s&&s.deregister&&s.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function V4(i){const[e,t]=X7(),s=T.useContext(vu);return L.jsx(D0e,{...i,layoutGroup:s,switchLayoutGroup:T.useContext(c4),isPresent:e,safeToRemove:t})}const k0e={pan:{Feature:_0e},drag:{Feature:L0e,ProjectionNode:J7,MeasureLayout:V4}};function S4(i,e,t){const{props:s}=i;i.animationState&&s.whileHover&&i.animationState.setActive("whileHover",t==="Start");const r="onHover"+t,n=s[r];n&&Tt.postRender(()=>n(e,Ru(e)))}class O0e extends Zn{mount(){const{current:e}=this.node;e&&(this.unmount=Zme(e,(t,s)=>(S4(this.node,s,"Start"),r=>S4(this.node,r,"End"))))}unmount(){}}class M0e extends Zn{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=yu(Iu(this.node.current,"focus",()=>this.onFocus()),Iu(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function T4(i,e,t){const{props:s}=i;if(i.current instanceof HTMLButtonElement&&i.current.disabled)return;i.animationState&&s.whileTap&&i.animationState.setActive("whileTap",t==="Start");const r="onTap"+(t==="End"?"":t),n=s[r];n&&Tt.postRender(()=>n(e,Ru(e)))}class N0e extends Zn{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:t,propagate:s}=this.node.props;this.unmount=sge(e,(r,n)=>(T4(this.node,n,"Start"),(a,{success:o})=>T4(this.node,a,o?"End":"Cancel")),{useGlobalTarget:t,stopPropagation:(s==null?void 0:s.tap)===!1})}unmount(){}}const c0=new WeakMap,d0=new WeakMap,F0e=i=>{const e=c0.get(i.target);e&&e(i)},q0e=i=>{i.forEach(F0e)};function B0e({root:i,...e}){const t=i||document;d0.has(t)||d0.set(t,{});const s=d0.get(t),r=JSON.stringify(e);return s[r]||(s[r]=new IntersectionObserver(q0e,{root:i,...e})),s[r]}function $0e(i,e,t){const s=B0e(e);return c0.set(i,t),s.observe(i),()=>{c0.delete(i),s.unobserve(i)}}const H0e={some:0,all:1};class Q0e extends Zn{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var l;(l=this.stopObserver)==null||l.call(this);const{viewport:e={}}=this.node.getProps(),{root:t,margin:s,amount:r="some",once:n}=e,a={root:t?t.current:void 0,rootMargin:s,threshold:typeof r=="number"?r:H0e[r]},o=u=>{const{isIntersecting:h}=u;if(this.isInView===h||(this.isInView=h,n&&!h&&this.hasEnteredView))return;h&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",h);const{onViewportEnter:c,onViewportLeave:d}=this.node.getProps(),f=h?c:d;f&&f(u)};this.stopObserver=$0e(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(U0e(e,t))&&this.startObserver()}unmount(){var e;(e=this.stopObserver)==null||e.call(this),this.hasEnteredView=!1,this.isInView=!1}}function U0e({viewport:i={}},{viewport:e={}}={}){return t=>i[t]!==e[t]}const z0e={...g0e,...{inView:{Feature:Q0e},tap:{Feature:N0e},focus:{Feature:M0e},hover:{Feature:O0e}},...k0e,...{layout:{ProjectionNode:J7,MeasureLayout:V4}}},P4=c0e(z0e,d0e);ni("Tutorial",null),Qs("Tutorial",(i,e,t,s)=>{var o;const r=((o=i.slides)==null?void 0:o.length)??0,n={};let a=0;for(let l=0;l<r;l++){const u=t.respondToSlide(l,i,s);s=u.participantState,n[l]=u.value??{},a+=u.duration??500}return{responseData:{slides:n},participantState:s,duration:a}},{respondToSlide:(i,e,t)=>({value:{},participantState:t,duration:500})});const I4=T.createContext({setCanProgress:()=>{},autoAdvance:()=>{},setSlideData:()=>{}}),j0e=({locked:i=!1}={})=>{const e=T.useContext(I4),t=T.useRef(!1);return!t.current&&i&&(t.current=!0,e.setCanProgress(!1)),{setData:e.setSlideData,unlock:({autoAdvanceMs:s}={})=>{e.setCanProgress(!0),s!==void 0&&e.autoAdvance(s)}}},R4="px-4 py-3 border-2 border-black font-bold text-lg rounded-xl shadow-[2px_2px_0px_rgba(0,0,0,1)] transition-all duration-100 outline-none focus:outline-none focus:ring-0",A4=R4+" bg-white text-black cursor-pointer hover:translate-x-[2px] hover:translate-y-[2px] hover:shadow-none",W0e=R4+" bg-gray-200 text-gray-400 border-gray-400 shadow-[2px_2px_0px_rgba(156,163,175,1)] cursor-default",L4=({next:i,slides:e,fadeDuration:t=.3,finishText:s="Start",containerClass:r,nextKey:n="ArrowRight",backKey:a="ArrowLeft",theme:o="light"})=>{const[l,u]=T.useState(0),[h,c]=T.useState({}),d=T.useRef(),f=T.useRef({}),y=h[l]!==!1,v=T.useRef(y),[m,g]=T.useState(!1);T.useEffect(()=>{if(y&&!v.current){g(!0);const V=setTimeout(()=>g(!1),300);return()=>clearTimeout(V)}v.current=y},[y]);const b=T.useCallback(V=>{c(k=>({...k,[l]:V}))},[l]),x=T.useCallback(V=>{f.current[l]={...f.current[l],...V}},[l]),P=T.useCallback(()=>{l===e.length-1?i({slides:f.current}):u(V=>V+1)},[l,e.length,i]),A=T.useCallback(()=>{y&&P()},[y,P]),R=T.useCallback((V=0)=>{d.current&&clearTimeout(d.current),d.current=setTimeout(()=>P(),V)},[P]);T.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]);const _=T.useCallback(()=>{l>0&&u(V=>V-1)},[l]);return T.useEffect(()=>{if(n===!1&&a===!1)return;const V=k=>{n&&k.key===n&&A(),a&&k.key===a&&_()};return window.addEventListener("keydown",V),()=>window.removeEventListener("keydown",V)},[n,a,A,_]),L.jsx(Bve,{children:L.jsxs("div",{className:r,style:{width:"100vw",height:"100vh",display:"flex",flexDirection:"column",overflow:"hidden"},children:[L.jsx("div",{style:{flex:1,position:"relative"},children:L.jsx(Ove,{mode:"sync",children:L.jsx(P4.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:t},style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"},children:L.jsx(I4.Provider,{value:{setCanProgress:b,autoAdvance:R,setSlideData:x},children:e[l]})},l)})}),L.jsxs("div",{style:{padding:"1.5rem",display:"grid",gridTemplateColumns:"1fr auto 1fr",alignItems:"center"},children:[L.jsx("div",{style:{justifySelf:"end",marginRight:"1rem"},children:L.jsx("button",{onClick:_,className:A4,tabIndex:-1,onKeyDown:V=>{(V.key===" "||V.key==="Enter")&&V.preventDefault()},style:{visibility:l>0?"visible":"hidden"},children:"←"})}),L.jsx("div",{style:{display:"flex",gap:6},children:e.map((V,k)=>L.jsx("div",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:k===l?o==="dark"?"#fff":"#000":o==="dark"?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.2)",transition:"background-color 0.2s"}},k))}),L.jsx("div",{style:{justifySelf:"start",marginLeft:"1rem"},children:L.jsx(P4.button,{onClick:A,tabIndex:-1,onKeyDown:V=>{(V.key===" "||V.key==="Enter")&&V.preventDefault()},animate:{scale:m?1.2:1},transition:{type:"spring",stiffness:500,damping:15},className:(y?A4:W0e)+(l===e.length-1?" px-8":""),children:l===e.length-1?s:"→"})})]})]})})};ni("RandomDotKinematogram","rdk");const Or={validKeys:[],duration:1e3,responseEndsTrial:!0,dotCount:300,dotSetCount:1,direction:0,coherence:.5,opposite:0,speed:60,dotLifetime:-1,dotRadius:2,dotColor:"white",backgroundColor:"gray",apertureShape:"ellipse",apertureWidth:600,apertureHeight:400,reinsertMode:"opposite",noiseMovement:"randomDirection",fixationTime:500,showFixation:!1,fixationWidth:15,fixationHeight:15,fixationColor:"white",fixationThickness:2,showBorder:!1,borderWidth:1,borderColor:"black"};Qs("RandomDotKinematogram",(i,e,t,s)=>{const r={...Or,...i},n=t.respond(r,s),{rt:a,response:o}=n.value,l=r.fixationTime??Or.fixationTime,u=r.duration??Or.duration,c=(r.responseEndsTrial??Or.responseEndsTrial)&&a!=null?a:u,d=Array.isArray(r.correctResponse)?r.correctResponse.map(f=>f.toLowerCase()):r.correctResponse?[r.correctResponse.toLowerCase()]:null;return{responseData:{...r,rt:a,response:o,correct:o&&d?d.includes(o.toLowerCase()):null,framesDisplayed:0,measuredRefreshRate:null},participantState:n.participantState,duration:l+c}},{respond:(i,e)=>{const t=N2({driftRate:{type:"normal",mean:.005*(i.coherence??Or.coherence),sd:.0012},boundaries:.75,startingPoint:0,noiseLevel:.02,sensoryDelay:{type:"uniform",min:150,max:250},motorDelay:{type:"uniform",min:130,max:210},timeLimit:i.duration??Or.duration,stimOffset:i.stimulusDuration??i.duration??Or.duration,postStimStrategy:{type:"continue"}}),s=F2(t.choice,i.validKeys,i.correctResponse);return{value:{rt:s?t.rt:null,response:s},participantState:e}}});const G0e=10,_4=.1,K0e=(i,e,t,s)=>{const r=Math.floor(i*e),n=Math.floor(i*t),a=[...Array(r).fill("coherent"),...Array(n).fill("opposite"),...Array(i-r-n).fill(s)];return fm(a)},Ma=(i,e)=>i+Math.random()*(e-i),Z0e=(i,e,t,s,r)=>{const n=e/2,a=i==="circle"||i==="square"?n:t/2,o=(l,u)=>{const h=n*2,c=a*2,d=s-n,f=r-a;return[((l-d)%h+h)%h+d,((u-f)%c+c)%c+f]};return i==="circle"||i==="ellipse"?{centerX:s,centerY:r,getRandomPosition(){const l=Ma(-Math.PI,Math.PI),u=Math.sqrt(Math.random());return[Math.cos(l)*u*n+s,Math.sin(l)*u*a+r]},isOutside(l,u,h){const c=n+h,d=a+h,f=(l-s)/c,y=(u-r)/d;return f*f+y*y>1},getOppositePosition(l,u,h){if(u!==void 0&&h!==void 0){const c=u*u+h*h;if(c>1e-10){const d=Math.sqrt(c),f=u/d,y=h/d,v=l.x-s,m=l.y-r,g=n*n,b=a*a,x=f*f/g+y*y/b,P=v*f/g+m*y/b,A=v*v/g+m*m/b-1,R=P*P-x*A;if(R>=0){const _=(P+Math.sqrt(R))/x;if(_>0&&Number.isFinite(_))return[l.x-f*_,l.y-y*_]}}}return this.getOppositePositionSimple(l)},getOppositePositionSimple(l){const u=2*s-l.x,h=2*r-l.y,c=(u-s)/n,d=(h-r)/a,f=Math.sqrt(c*c+d*d);return f>1?[s+c/f*n,r+d/f*a]:[u,h]},wrap:o,clip(l){l.beginPath(),l.ellipse(s,r,n,a,0,0,Math.PI*2),l.clip()},drawBorder(l,u,h){l.strokeStyle=u,l.lineWidth=h,l.beginPath(),l.ellipse(s,r,n+h/2,a+h/2,0,0,Math.PI*2),l.stroke()}}:{centerX:s,centerY:r,getRandomPosition(){return[Ma(s-n,s+n),Ma(r-a,r+a)]},isOutside(l,u,h){const c=n+h,d=a+h;return l<s-c||l>s+c||u<r-d||u>r+d},getOppositePosition(l,u,h){if(u===void 0||h===void 0)return this.getOppositePositionSimple(l);const c=Math.sqrt(u*u+h*h);if(c<1e-10)return this.getOppositePositionSimple(l);const d=-u/c,f=-h/c,y=s-n,v=s+n,m=r-a,g=r+a,b=d!==0?(y-l.x)/d:-1/0,x=d!==0?(v-l.x)/d:-1/0,P=f!==0?(m-l.y)/f:-1/0,A=f!==0?(g-l.y)/f:-1/0,R=Math.max(Math.min(b,x),Math.min(P,A)),_=Math.min(Math.max(b,x),Math.max(P,A));return _>0&&R<=_&&Number.isFinite(_)?[l.x+d*_,l.y+f*_]:this.getOppositePositionSimple(l)},getOppositePositionSimple(l){const u=s-n,h=s+n,c=r-a,d=r+a;let f=l.x,y=l.y;return l.x<u?f=h:l.x>h&&(f=u),l.y<c?y=d:l.y>d&&(y=c),[f,y]},wrap:o,clip(l){l.beginPath(),l.rect(s-n,r-a,n*2,a*2),l.clip()},drawBorder(l,u,h){l.strokeStyle=u,l.lineWidth=h,l.strokeRect(s-n-h/2,r-a-h/2,n*2+h,a*2+h)}}},J0e=(i,e,t)=>{const[s,r]=t.getRandomPosition(),n=i==="randomDirection"?Ma(-Math.PI,Math.PI):0;return{x:s,y:r,randomDirX:n?Math.cos(n):0,randomDirY:n?-Math.sin(n):0,lifeCount:Ma(0,e>0?e:0),assignedMovement:i}},Y0e=(i,e,t,s,r,n,a,o,l)=>{const u={...i};if(u.lifeCount+=t,s>0&&u.lifeCount>=s)return[u.x,u.y]=r.getRandomPosition(),u.lifeCount=0,u;let h=i.assignedMovement;if(l!==void 0&&(h=l,u.assignedMovement=h,h==="randomDirection")){const y=Ma(-Math.PI,Math.PI);u.randomDirX=Math.cos(y),u.randomDirY=-Math.sin(y)}let c=0,d=0;switch(h){case"coherent":c=o[0],d=o[1];break;case"opposite":c=-o[0],d=-o[1];break;case"randomTeleport":return[u.x,u.y]=r.getRandomPosition(),u;case"randomWalk":{const y=Ma(-Math.PI,Math.PI);c=Math.cos(y),d=-Math.sin(y);break}case"randomDirection":c=u.randomDirX,d=u.randomDirY;break}if(u.x+=c*e,u.y+=d*e,r.isOutside(u.x,u.y,a))if(n==="random")[u.x,u.y]=r.getRandomPosition();else if(n==="oppositeSimple")[u.x,u.y]=r.getOppositePositionSimple(u);else if(n==="opposite")[u.x,u.y]=r.getOppositePosition(u,c,d);else if(n==="wrap")[u.x,u.y]=r.wrap(u.x,u.y);else throw new Error(`Unknown reinsertType: ${n}`);return u},D4=T.forwardRef((i,e)=>{const{width:t,height:s,dotCount:r,dotSetCount:n,direction:a,coherence:o,opposite:l,speed:u,dotLifetime:h,updateRate:c,dotRadius:d,dotCharacter:f,dotColor:y,coherentDotColor:v,backgroundColor:m,apertureShape:g,apertureWidth:b,apertureHeight:x,apertureCenterX:P,apertureCenterY:A,reinsertMode:R,noiseMovement:_,reassignEveryMs:V,showFixation:k,fixationWidth:q,fixationHeight:B,fixationColor:U,fixationThickness:D,showBorder:H,borderWidth:Q,borderColor:$,active:W=!0,initialRefreshRate:K,style:oe,className:ee}={...Or,...i},ue=T.useRef(null),ae=T.useRef(),ce=T.useRef(),Ae=T.useRef(),ve=T.useRef(0),ie=T.useRef(0),xe=T.useRef([]),et=T.useRef(null),Xt=T.useRef(!1),jt=P??t/2,Os=A??s/2,Et=T.useMemo(()=>Z0e(g,b,x,jt,Os),[g,b,x,jt,Os]),fs=T.useMemo(()=>{const Oe=(90-a)*Math.PI/180;return[Math.cos(Oe),-Math.sin(Oe)]},[a]),is=T.useRef([]),_e=T.useRef(0);T.useEffect(()=>{const Oe=Math.floor(r*o),Ke=Math.floor(r*l);is.current=Array.from({length:n},()=>Array.from({length:r},(Pe,rs)=>{let Cs;return rs<Oe?Cs="coherent":rs<Oe+Ke?Cs="opposite":Cs=_,J0e(Cs,h,Et)}))},[]),T.useEffect(()=>{typeof K=="number"&&K>=20&&K<=300&&(et.current=1e3/K,Xt.current=!0)},[K]),T.useImperativeHandle(e,()=>({getStats:()=>({framesDisplayed:ie.current,measuredRefreshRate:et.current?Math.round(1e3/et.current):null})}));const tt=T.useCallback((Oe,Ke)=>{Ke.forEach(Pe=>{const rs=v&&Pe.assignedMovement==="coherent"?v:y;if(Oe.fillStyle=rs,f){const Cs=d*2.5;Oe.font=`${Cs}px monospace`,Oe.textAlign="center",Oe.textBaseline="middle",Oe.fillText(f,Pe.x,Pe.y)}else Oe.beginPath(),Oe.arc(Pe.x,Pe.y,d,0,Math.PI*2),Oe.fill()})},[y,v,d,f]),Bt=T.useCallback((Oe,Ke,Pe)=>{k&&(Oe.fillStyle=U,Oe.fillRect(Ke-q,Pe-D/2,q*2,D),Oe.fillRect(Ke-D/2,Pe-B,D,B*2))},[k,U,D,q,B]),Ht=T.useCallback(Oe=>{H&&Et.drawBorder(Oe,$,Q)},[H,$,Q,Et]),gt=T.useCallback(Oe=>{const Ke=ue.current,Pe=Ke==null?void 0:Ke.getContext("2d");if(!Ke||!Pe)return;ce.current===void 0&&(ce.current=Oe),Ae.current===void 0&&(Ae.current=Oe);const rs=Oe-Ae.current;if(Ae.current=Oe,ie.current++,rs>0&&rs<500){if(Xt.current)et.current=_4*rs+(1-_4)*et.current;else if(xe.current.push(rs),xe.current.length>=G0e){const Js=[...xe.current].sort((Ys,ji)=>Ys-ji),zi=Math.floor(Js.length/2);et.current=Js.length%2?Js[zi]:(Js[zi-1]+Js[zi])/2,Xt.current=!0}}const Cs=Oe-(ce.current??Oe),bs=Math.min(Cs,100),un=c&&c>0?1e3/c:0,Zs=!c||c<=0||bs>=un;if(Pe.clearRect(0,0,Ke.width,Ke.height),Pe.save(),Et.clip(Pe),Pe.fillStyle=m,Pe.fillRect(0,0,Ke.width,Ke.height),Pe.restore(),!W)Bt(Pe,Et.centerX,Et.centerY);else{if(Zs){const zi=u*bs/1e3;let Ys=!1;if(V!==void 0)if(V===0)Ys=!0;else{ve.current+=bs;const J=Xt.current&&et.current?et.current*.5:0;Ys=ve.current+J>=V,Ys&&(ve.current%=V)}const ji=Ys?K0e(r,o,l,_):null,ra=is.current[_e.current].map((J,re)=>Y0e(J,zi,bs,h,Et,R,d,fs,ji==null?void 0:ji[re]));is.current[_e.current]=ra,_e.current=(_e.current+1)%n,ce.current=Oe}const Js=is.current[_e.current];Pe.save(),Et.clip(Pe),tt(Pe,Js),Pe.restore(),Pe.save(),Pe.beginPath(),Bt(Pe,Et.centerX,Et.centerY),Ht(Pe),Pe.restore()}ae.current=requestAnimationFrame(gt)},[W,m,_,o,l,r,u,h,Et,R,n,d,fs,c,tt,Bt,Ht,V]);return T.useEffect(()=>(ae.current=requestAnimationFrame(gt),()=>{ae.current&&cancelAnimationFrame(ae.current)}),[gt]),T.useEffect(()=>{const Oe=ue.current;if(!Oe)return;const Ke=window.devicePixelRatio||1;Oe.width=t*Ke,Oe.height=s*Ke,Oe.style.width=`${t}px`,Oe.style.height=`${s}px`;const Pe=Oe.getContext("2d");Pe&&Pe.scale(Ke,Ke)},[t,s]),L.jsx("canvas",{ref:ue,style:{display:"block",...oe},className:ee})}),k4=i=>{const{store:e,stimulusDuration:t,updateRate:s,dotCharacter:r,coherentDotColor:n,apertureCenterX:a=window.innerWidth/2,apertureCenterY:o=window.innerHeight/2,reassignEveryMs:l,responseHint:u,validKeys:h,duration:c,responseEndsTrial:d,dotCount:f,dotSetCount:y,direction:v,coherence:m,opposite:g,speed:b,dotLifetime:x,dotRadius:P,dotColor:A,backgroundColor:R,apertureShape:_,apertureWidth:V,apertureHeight:k,reinsertMode:q,noiseMovement:B,showFixation:U,fixationTime:D,fixationWidth:H,fixationHeight:Q,fixationColor:$,fixationThickness:W,showBorder:K,borderWidth:oe,borderColor:ee}={...Or,...i},ue=T.useRef(i);ue.current=i;const ae=T.useRef(null),ce=T.useRef(performance.now()),Ae=T.useRef(!1),ve=T.useRef(null),ie=T.useRef(null),[xe,et]=T.useState(null),[Xt,jt]=T.useState(D<=0),[Os,Et]=T.useState(!0),fs=e==null?void 0:e._reactiveScreenRefreshRate,is=T.useCallback((_e,tt)=>{var Cs;if(Ae.current)return;Ae.current=!0;const{next:Bt,data:Ht,store:gt,updateStore:Oe,...Ke}=ue.current,Pe=(Cs=ae.current)==null?void 0:Cs.getStats(),rs=Array.isArray(Ke.correctResponse)?Ke.correctResponse.map(bs=>bs.toLowerCase()):Ke.correctResponse?[Ke.correctResponse.toLowerCase()]:null;Bt({...Or,...Ke,rt:tt,response:_e,correct:_e&&rs?rs.includes(_e):null,framesDisplayed:(Pe==null?void 0:Pe.framesDisplayed)??0,measuredRefreshRate:(Pe==null?void 0:Pe.measuredRefreshRate)??null})},[]);return T.useEffect(()=>{if(D<=0)return;const _e=setTimeout(()=>jt(!0),D);return()=>clearTimeout(_e)},[D]),T.useEffect(()=>{const _e=t??c;if(_e<=0)return;const tt=setTimeout(()=>Et(!1),D+_e);return()=>clearTimeout(tt)},[D,t,c]),T.useEffect(()=>{if(c<=0)return;const _e=setTimeout(()=>{is(ve.current,ie.current)},D+c);return()=>clearTimeout(_e)},[D,c,is]),T.useEffect(()=>{const _e=tt=>{if(Ae.current||ve.current)return;const Bt=tt.key.toLowerCase(),Ht=h.length>0?h.map(gt=>gt.toLowerCase()):null;if(!Ht||Ht.includes(Bt)){const gt=performance.now()-ce.current;ve.current=Bt,ie.current=gt,et(Bt),d&&is(Bt,gt)}};return window.addEventListener("keydown",_e),()=>window.removeEventListener("keydown",_e)},[h,d,is]),L.jsxs("div",{style:{width:"100vw",height:"100vh",overflow:"hidden",margin:0,padding:0,backgroundColor:R},children:[L.jsx(D4,{ref:ae,width:window.innerWidth,height:window.innerHeight,active:Xt&&Os,initialRefreshRate:fs,dotCount:f,dotSetCount:y,direction:v,coherence:m,opposite:g,speed:b,dotLifetime:x,updateRate:s,dotRadius:P,dotCharacter:r,dotColor:A,coherentDotColor:n,backgroundColor:R,apertureShape:_,apertureWidth:V,apertureHeight:k,apertureCenterX:a,apertureCenterY:o,reinsertMode:q,noiseMovement:B,reassignEveryMs:l,showFixation:U,fixationWidth:H,fixationHeight:Q,fixationColor:$,fixationThickness:W,showBorder:K,borderWidth:oe,borderColor:ee}),u&&!Os&&!xe&&L.jsx("div",{style:{position:"absolute",top:"60%",width:"100%",textAlign:"center",color:"white",fontSize:"1.25rem"},children:u})]})},X0e={Text:rc,ProlificEnding:H2,EnterFullscreen:iS,ExitFullscreen:rS,Quest:U5,Upload:YV,MicrophoneCheck:G2,PlainInput:$2,RequestFilePermission:yS,CanvasBlock:CS,CheckDevice:bS,StoreUI:zpe,Tutorial:L4,RandomDotKinematogram:k4},e1e={voicerecorder:wne};function p0(i){return typeof i=="object"&&i!==null&&typeof i.type=="string"}function t1e({timeline:i,config:e={showProgressBar:!1},components:t={},questions:s={},hybridParticipant:r}){const n=$pe(),a=T.useMemo(()=>Xh(i),[i]),o=T.useRef((()=>{const B={},U=new URLSearchParams(window.location.search);for(const[$,W]of U.entries())B[$]=W;const D=Yh.getRegistry()||[],H={};for(const[$,W]of Object.entries(B))H[$]={value:W,registered:!1,defaultValue:void 0,type:void 0,description:void 0};for(const $ of D)H[$.name]={value:$.value!==void 0?$.value:B[$.name],registered:!0,defaultValue:$.defaultValue,type:$.type,description:$.description};return[{index:-1,trialNumber:-1,start:Ps(),end:Ps(),duration:0,type:"",name:"",responseData:{userAgent:navigator.userAgent,params:H}}]})()),[l,u]=T.useState(0),h=T.useRef(Ps()),c=T.useRef({}),[d,f]=T.useState(()=>In(a,0,()=>c.current,()=>o.current,B=>{c.current={...c.current,...B}})),y=!n&&ma("hybridSimulation",!1,"boolean")?"hybrid":"none",v=T.useRef(r||{}),m=T.useRef(-1),g={...X0e,...t},b={...e1e,...s},x=T.useMemo(()=>{const B=a.instructions.length;return B>0?d/B:0},[d,a.instructions]);T.useEffect(()=>{window.scrollTo(0,0)},[d]);function P(B){c.current={...c.current,...B}}function A(B,U,D){const H=Ps(),Q=a.instructions[d],$=U!==void 0?U:h.current,W=D!==void 0?D:H;if((Q==null?void 0:Q.type)==="ExecuteContent"){const oe=Q.content;if(p0(oe)){let ee={index:d,trialNumber:l+1,start:$,end:W,duration:W-$,type:oe.type,name:oe.name??"",...oe.csv!==void 0?{csv:oe.csv}:{},responseData:B};ee=ec(ee,oe,o.current,c.current),o.current=[...o.current,ee],u(ue=>ue+1)}else console.log("ExecuteContent finished, but content wasn't standard component format:",oe)}const K=In(a,d+1,()=>c.current,()=>o.current,oe=>P(oe));K<a.instructions.length&&(h.current=Ps()),f(K)}const R=T.useCallback(B=>{let U=0;const D=Ps(),H=2e4;let Q,$=D;const W=1e3,K=()=>{const ae=Ps()-D;return ae>0?Math.round(U*1e3/ae):null},oe=()=>{Q&&cancelAnimationFrame(Q)},ee=ue=>{U++;const ae=ue-D;ue-$>=W&&(B(K()),$=ue),ae<H?Q=requestAnimationFrame(ee):(oe(),B(K()))};return Q=requestAnimationFrame(ee),oe},[]),_=({children:B,collectRefreshRate:U})=>{const D=T.useRef(null),H=T.useRef(null);T.useEffect(()=>{if(D.current=Ps(),U)return R(W=>{H.current=W,P({_reactiveScreenRefreshRate:W})})},[]);const Q=T.Children.map(B,$=>{if(T.isValidElement($)){const W=(K,oe,ee)=>{const ue=Ps(),ae=oe!==void 0?oe:D.current;A(K,ae??void 0,(ee!==void 0?ee:ue)??void 0)};return T.cloneElement($,{...$.props,next:W})}return $});return L.jsx(L.Fragment,{children:Q})},V=a.instructions[d],k=T.useMemo(()=>{if(y==="none"||(V==null?void 0:V.type)!=="ExecuteContent")return!1;const B=V.content;return!p0(B)||B.simulate===!1?!1:!!B.simulate||!!B.simulators},[d,y,V]);T.useEffect(()=>{k&&m.current!==d&&(m.current=d,(async()=>{const B=V.content,{trialProps:U,simulateFn:D,simulators:H}=Cm(B,o.current,c.current),Q=await D(U,{data:o.current,store:c.current},H,v.current);v.current=Q.participantState,Q.storeUpdates&&P(Q.storeUpdates),A(Q.responseData)})())},[k,d]);let q=null;if((V==null?void 0:V.type)==="ExecuteContent"&&!k){const B=V.content;if(p0(B)){const U=g[B.type];if(U){const D=typeof B.props=="function"?B.props(o.current,c.current):B.props||{};q=L.jsx(_,{collectRefreshRate:B.collectRefreshRate,children:L.jsx(U,{next:A,updateStore:P,store:c.current,data:o.current,...B.type==="Quest"?{customQuestions:b}:{},...D})},d)}else console.error(`No component found for type: ${B.type}`),q=L.jsxs("div",{children:['Error: Component type "',B.type,'" not found.']})}else console.warn("ExecuteContent instruction does not contain standard component data:",B),q=L.jsx("div",{children:"Non-component content encountered."})}else d>=a.instructions.length&&(q=L.jsx(L.Fragment,{}));return L.jsxs("div",{className:"w-full h-full",children:[L.jsx("div",{className:` ${e.showProgressBar?"":"hidden "} px-4 mt-4 sm:mt-12 max-w-2xl mx-auto`,children:L.jsx("div",{className:"flex-1 h-6 bg-gray-200 rounded-full overflow-hidden",children:L.jsx("div",{className:`h-full bg-gray-200 rounded-full duration-300 ${x>0?" border-black border-2":""}`,style:{width:`${x*100}%`,backgroundImage:`repeating-linear-gradient(
10281
+ `),()=>{var _;(_=o.current)==null||_.removeAttribute("data-motion-pop-id"),R.contains(A)&&R.removeChild(A)}},[e]),L.jsx(Lve,{isPresent:e,childRef:o,sizeRef:l,pop:n,children:n===!1?i:p.cloneElement(i,{ref:c})})}const Dve=({children:i,initial:e,isPresent:t,onExitComplete:s,custom:r,presenceAffectsLayout:n,mode:a,anchorX:o,anchorY:l,root:u})=>{const h=Jg(kve),c=T.useId();let d=!0,f=T.useMemo(()=>(d=!1,{id:c,initial:e,isPresent:t,custom:r,onExitComplete:y=>{h.set(y,!0);for(const v of h.values())if(!v)return;s&&s()},register:y=>(h.set(y,!1),()=>h.delete(y))}),[t,h,s]);return n&&d&&(f={...f}),T.useMemo(()=>{h.forEach((y,v)=>h.set(v,!1))},[t]),p.useEffect(()=>{!t&&!h.size&&s&&s()},[t]),i=L.jsx(_ve,{pop:a==="popLayout",isPresent:t,anchorX:o,anchorY:l,root:u,children:i}),L.jsx(Sd.Provider,{value:f,children:i})};function kve(){return new Map}function X7(i=!0){const e=T.useContext(Sd);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:s,register:r}=e,n=T.useId();T.useEffect(()=>{if(i)return r(n)},[i]);const a=T.useCallback(()=>i&&s&&s(n),[n,s,i]);return!t&&s?[!1,a]:[!0]}const Wd=i=>i.key||"";function e4(i){const e=[];return T.Children.forEach(i,t=>{T.isValidElement(t)&&e.push(t)}),e}const Ove=({children:i,custom:e,initial:t=!0,onExitComplete:s,presenceAffectsLayout:r=!0,mode:n="sync",propagate:a=!1,anchorX:o="left",anchorY:l="top",root:u})=>{const[h,c]=X7(a),d=T.useMemo(()=>e4(i),[i]),f=a&&!h?[]:d.map(Wd),y=T.useRef(!0),v=T.useRef(d),m=Jg(()=>new Map),g=T.useRef(new Set),[b,x]=T.useState(d),[P,A]=T.useState(d);Yg(()=>{y.current=!1,v.current=d;for(let V=0;V<P.length;V++){const k=Wd(P[V]);f.includes(k)?(m.delete(k),g.current.delete(k)):m.get(k)!==!0&&m.set(k,!1)}},[P,f.length,f.join("-")]);const R=[];if(d!==b){let V=[...d];for(let k=0;k<P.length;k++){const q=P[k],B=Wd(q);f.includes(B)||(V.splice(k,0,q),R.push(q))}return n==="wait"&&R.length&&(V=R),A(e4(V)),x(d),null}process.env.NODE_ENV!=="production"&&n==="wait"&&P.length>1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);const{forceRender:_}=T.useContext(vu);return L.jsx(L.Fragment,{children:P.map(V=>{const k=Wd(V),q=a&&!h?!1:d===P||f.includes(k),B=()=>{if(g.current.has(k))return;if(m.has(k))g.current.add(k),m.set(k,!0);else return;let U=!0;m.forEach(D=>{D||(U=!1)}),U&&(_==null||_(),A(v.current),a&&(c==null||c()),s&&s())};return L.jsx(Dve,{isPresent:q,initial:!y.current||t?void 0:!1,custom:e,presenceAffectsLayout:r,mode:n,root:u,onExitComplete:q?void 0:B,anchorX:o,anchorY:l,children:V},k)})})},Mve=T.createContext(null);function Nve(){const i=T.useRef(!1);return Yg(()=>(i.current=!0,()=>{i.current=!1}),[]),i}function Fve(){const i=Nve(),[e,t]=T.useState(0),s=T.useCallback(()=>{i.current&&t(e+1)},[e]);return[T.useCallback(()=>Tt.postRender(s),[s]),e]}const t4=i=>i===!0,qve=i=>t4(i===!0)||i==="id",Bve=({children:i,id:e,inherit:t=!0})=>{const s=T.useContext(vu),r=T.useContext(Mve),[n,a]=Fve(),o=T.useRef(null),l=s.id||r;o.current===null&&(qve(t)&&l&&(e=e?l+"-"+e:l),o.current={id:e,group:t4(t)&&s.group||Z7()});const u=T.useMemo(()=>({...o.current,forceRender:n}),[a]);return L.jsx(vu.Provider,{value:u,children:i})},s4=T.createContext({strict:!1}),i4={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let r4=!1;function $ve(){if(r4)return;const i={};for(const e in i4)i[e]={isEnabled:t=>i4[e].some(s=>!!t[s])};Z3(i),r4=!0}function n4(){return $ve(),yge()}function Hve(i){const e=n4();for(const t in i)e[t]={...e[t],...i[t]};Z3(e)}const Qve=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","propagate","ignoreStrict","viewport"]);function Gd(i){return i.startsWith("while")||i.startsWith("drag")&&i!=="draggable"||i.startsWith("layout")||i.startsWith("onTap")||i.startsWith("onPan")||i.startsWith("onLayout")||Qve.has(i)}let a4=i=>!Gd(i);function Uve(i){typeof i=="function"&&(a4=e=>e.startsWith("on")?!Gd(e):i(e))}try{Uve(require("@emotion/is-prop-valid").default)}catch{}function zve(i,e,t){const s={};for(const r in i)r==="values"&&typeof i.values=="object"||ks(i[r])||(a4(r)||t===!0&&Gd(r)||!e&&!Gd(r)||i.draggable&&r.startsWith("onDrag"))&&(s[r]=i[r]);return s}const Kd=T.createContext({});function jve(i,e){if(Bd(i)){const{initial:t,animate:s}=i;return{initial:t===!1||Su(t)?t:void 0,animate:Su(s)?s:void 0}}return i.inherit!==!1?e:{}}function Wve(i){const{initial:e,animate:t}=jve(i,T.useContext(Kd));return T.useMemo(()=>({initial:e,animate:t}),[o4(e),o4(t)])}function o4(i){return Array.isArray(i)?i.join(" "):i}const r0=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function l4(i,e,t){for(const s in e)!ks(e[s])&&!h7(s,t)&&(i[s]=e[s])}function Gve({transformTemplate:i},e){return T.useMemo(()=>{const t=r0();return Zv(t,e,i),Object.assign({},t.vars,t.style)},[e])}function Kve(i,e){const t=i.style||{},s={};return l4(s,t,i),Object.assign(s,Gve(i,e)),s}function Zve(i,e){const t={},s=Kve(i,e);return i.drag&&i.dragListener!==!1&&(t.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=i.drag===!0?"none":`pan-${i.drag==="x"?"y":"x"}`),i.tabIndex===void 0&&(i.onTap||i.onTapStart||i.whileTap)&&(t.tabIndex=0),t.style=s,t}const u4=()=>({...r0(),attrs:{}});function Jve(i,e,t,s){const r=T.useMemo(()=>{const n=u4();return c7(n,e,p7(s),i.transformTemplate,i.style),{...n.attrs,style:{...n.style}}},[e]);if(i.style){const n={};l4(n,i.style,i),r.style={...n,...r.style}}return r}const Yve=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function n0(i){return typeof i!="string"||i.includes("-")?!1:!!(Yve.indexOf(i)>-1||/[A-Z]/u.test(i))}function Xve(i,e,t,{latestValues:s},r,n=!1,a){const l=(a??n0(i)?Jve:Zve)(e,s,r,i),u=zve(e,typeof i=="string",n),h=i!==T.Fragment?{...u,...l,ref:t}:{},{children:c}=e,d=T.useMemo(()=>ks(c)?c.get():c,[c]);return T.createElement(i,{...h,children:d})}function e0e({scrapeMotionValuesFromProps:i,createRenderState:e},t,s,r){return{latestValues:t0e(t,s,r,i),renderState:e()}}function t0e(i,e,t,s){const r={},n=s(i,{});for(const d in n)r[d]=zd(n[d]);let{initial:a,animate:o}=i;const l=Bd(i),u=W3(i);e&&u&&!l&&i.inherit!==!1&&(a===void 0&&(a=e.initial),o===void 0&&(o=e.animate));let h=t?t.initial===!1:!1;h=h||a===!1;const c=h?o:a;if(c&&typeof c!="boolean"&&!qd(c)){const d=Array.isArray(c)?c:[c];for(let f=0;f<d.length;f++){const y=_v(i,d[f]);if(y){const{transitionEnd:v,transition:m,...g}=y;for(const b in g){let x=g[b];if(Array.isArray(x)){const P=h?x.length-1:0;x=x[P]}x!==null&&(r[b]=x)}for(const b in v)r[b]=v[b]}}}return r}const h4=i=>(e,t)=>{const s=T.useContext(Kd),r=T.useContext(Sd),n=()=>e0e(i,e,s,r);return t?n():Jg(n)},s0e=h4({scrapeMotionValuesFromProps:Yv,createRenderState:r0}),i0e=h4({scrapeMotionValuesFromProps:f7,createRenderState:u4}),r0e=Symbol.for("motionComponentSymbol");function n0e(i,e,t){const s=T.useRef(t);T.useInsertionEffect(()=>{s.current=t});const r=T.useRef(null);return T.useCallback(n=>{var o;n&&((o=i.onMount)==null||o.call(i,n));const a=s.current;if(typeof a=="function")if(n){const l=a(n);typeof l=="function"&&(r.current=l)}else r.current?(r.current(),r.current=null):a(n);else a&&(a.current=n);e&&(n?e.mount(n):e.unmount())},[e])}const c4=T.createContext({});function jo(i){return i&&typeof i=="object"&&Object.prototype.hasOwnProperty.call(i,"current")}function a0e(i,e,t,s,r,n){var x,P;const{visualElement:a}=T.useContext(Kd),o=T.useContext(s4),l=T.useContext(Sd),u=T.useContext(i0),h=u.reducedMotion,c=u.skipAnimations,d=T.useRef(null),f=T.useRef(!1);s=s||o.renderer,!d.current&&s&&(d.current=s(i,{visualState:e,parent:a,props:t,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:h,skipAnimations:c,isSVG:n}),f.current&&d.current&&(d.current.manuallyAnimateOnMount=!0));const y=d.current,v=T.useContext(c4);y&&!y.projection&&r&&(y.type==="html"||y.type==="svg")&&o0e(d.current,t,r,v);const m=T.useRef(!1);T.useInsertionEffect(()=>{y&&m.current&&y.update(t,l)});const g=t[T3],b=T.useRef(!!g&&typeof window<"u"&&!((x=window.MotionHandoffIsComplete)!=null&&x.call(window,g))&&((P=window.MotionHasOptimisedAnimation)==null?void 0:P.call(window,g)));return Yg(()=>{f.current=!0,y&&(m.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),y.scheduleRenderMicrotask(),b.current&&y.animationState&&y.animationState.animateChanges())}),T.useEffect(()=>{y&&(!b.current&&y.animationState&&y.animationState.animateChanges(),b.current&&(queueMicrotask(()=>{var A;(A=window.MotionHandoffMarkAsComplete)==null||A.call(window,g)}),b.current=!1),y.enteringChildren=void 0)}),y}function o0e(i,e,t,s){const{layoutId:r,layout:n,drag:a,dragConstraints:o,layoutScroll:l,layoutRoot:u,layoutAnchor:h,layoutCrossfade:c}=e;i.projection=new t(i.latestValues,e["data-framer-portal-id"]?void 0:d4(i.parent)),i.projection.setOptions({layoutId:r,layout:n,alwaysMeasureLayout:!!a||o&&jo(o),visualElement:i,animationType:typeof n=="string"?n:"both",initialPromotionConfig:s,crossfade:c,layoutScroll:l,layoutRoot:u,layoutAnchor:h})}function d4(i){if(i)return i.options.allowProjection!==!1?i.projection:d4(i.parent)}function a0(i,{forwardMotionProps:e=!1,type:t}={},s,r){s&&Hve(s);const n=t?t==="svg":n0(i),a=n?i0e:s0e;function o(u,h){let c;const d={...T.useContext(i0),...u,layoutId:l0e(u)},{isStatic:f}=d,y=Wve(u),v=a(u,f);if(!f&&typeof window<"u"){u0e(d,s);const m=h0e(d);c=m.MeasureLayout,y.visualElement=a0e(i,v,d,r,m.ProjectionNode,n)}return L.jsxs(Kd.Provider,{value:y,children:[c&&y.visualElement?L.jsx(c,{visualElement:y.visualElement,...d}):null,Xve(i,u,n0e(v,y.visualElement,h),v,f,e,n)]})}o.displayName=`motion.${typeof i=="string"?i:`create(${i.displayName??i.name??""})`}`;const l=T.forwardRef(o);return l[r0e]=i,l}function l0e({layoutId:i}){const e=T.useContext(vu).id;return e&&i!==void 0?e+"-"+i:i}function u0e(i,e){const t=T.useContext(s4).strict;if(process.env.NODE_ENV!=="production"&&e&&t){const s="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";i.ignoreStrict?Mo(!1,s,"lazy-strict-mode"):an(!1,s,"lazy-strict-mode")}}function h0e(i){const e=n4(),{drag:t,layout:s}=e;if(!t&&!s)return{};const r={...t,...s};return{MeasureLayout:t!=null&&t.isEnabled(i)||s!=null&&s.isEnabled(i)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function c0e(i,e){if(typeof Proxy>"u")return a0;const t=new Map,s=(n,a)=>a0(n,a,i,e),r=(n,a)=>(process.env.NODE_ENV!=="production"&&sv(!1,"motion() is deprecated. Use motion.create() instead."),s(n,a));return new Proxy(r,{get:(n,a)=>a==="create"?s:(t.has(a)||t.set(a,a0(a,void 0,i,e)),t.get(a))})}const d0e=(i,e)=>e.isSVG??n0(i)?new Oge(e):new Rge(e,{allowProjection:i!==T.Fragment});class p0e extends Zn{constructor(e){super(e),e.animationState||(e.animationState=Bge(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();qd(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let f0e=0;class m0e extends Zn{constructor(){super(...arguments),this.id=f0e++,this.isExitComplete=!1}update(){var n;if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===s)return;if(e&&s===!1){if(this.isExitComplete){const{initial:a,custom:o}=this.node.getProps();if(typeof a=="string"){const l=Da(this.node,a,o);if(l){const{transition:u,transitionEnd:h,...c}=l;for(const d in c)(n=this.node.getValue(d))==null||n.jump(c[d])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const r=this.node.animationState.setActive("exit",!e);t&&!e&&r.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){const{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const g0e={animation:{Feature:p0e},exit:{Feature:m0e}};function Ru(i){return{point:{x:i.pageX,y:i.pageY}}}const v0e=i=>e=>$v(e)&&i(e,Ru(e));function Au(i,e,t,s){return Iu(i,e,v0e(t),s)}const p4=({current:i})=>i?i.ownerDocument.defaultView:null,f4=(i,e)=>Math.abs(i-e);function y0e(i,e){const t=f4(i.x,e.x),s=f4(i.y,e.y);return Math.sqrt(t**2+s**2)}const m4=new Set(["auto","scroll"]);class g4{constructor(e,t,{transformPagePoint:s,contextWindow:r=window,dragSnapToOrigin:n=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=f=>{this.handleScroll(f.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Zd(this.lastRawMoveEventInfo,this.transformPagePoint));const f=o0(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,v=y0e(f.offset,{x:0,y:0})>=this.distanceThreshold;if(!y&&!v)return;const{point:m}=f,{timestamp:g}=Ds;this.history.push({...m,timestamp:g});const{onStart:b,onMove:x}=this.handlers;y||(b&&b(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),x&&x(this.lastMoveEvent,f)},this.handlePointerMove=(f,y)=>{this.lastMoveEvent=f,this.lastRawMoveEventInfo=y,this.lastMoveEventInfo=Zd(y,this.transformPagePoint),Tt.update(this.updatePoint,!0)},this.handlePointerUp=(f,y)=>{this.end();const{onEnd:v,onSessionEnd:m,resumeAnimation:g}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&g&&g(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=o0(f.type==="pointercancel"?this.lastMoveEventInfo:Zd(y,this.transformPagePoint),this.history);this.startEvent&&v&&v(f,b),m&&m(f,b)},!$v(e))return;this.dragSnapToOrigin=n,this.handlers=t,this.transformPagePoint=s,this.distanceThreshold=a,this.contextWindow=r||window;const l=Ru(e),u=Zd(l,this.transformPagePoint),{point:h}=u,{timestamp:c}=Ds;this.history=[{...h,timestamp:c}];const{onSessionStart:d}=t;d&&d(e,o0(u,this.history)),this.removeListeners=yu(Au(this.contextWindow,"pointermove",this.handlePointerMove),Au(this.contextWindow,"pointerup",this.handlePointerUp),Au(this.contextWindow,"pointercancel",this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){const s=getComputedStyle(t);(m4.has(s.overflowX)||m4.has(s.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const t=this.scrollPositions.get(e);if(!t)return;const s=e===window,r=s?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},n={x:r.x-t.x,y:r.y-t.y};n.x===0&&n.y===0||(s?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=n.x,this.lastMoveEventInfo.point.y+=n.y):this.history.length>0&&(this.history[0].x-=n.x,this.history[0].y-=n.y),this.scrollPositions.set(e,r),Tt.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),jn(this.updatePoint)}}function Zd(i,e){return e?{point:e(i.point)}:i}function v4(i,e){return{x:i.x-e.x,y:i.y-e.y}}function o0({point:i},e){return{point:i,delta:v4(i,y4(e)),offset:v4(i,C0e(e)),velocity:b0e(e,.1)}}function C0e(i){return i[0]}function y4(i){return i[i.length-1]}function b0e(i,e){if(i.length<2)return{x:0,y:0};let t=i.length-1,s=null;const r=y4(i);for(;t>=0&&(s=i[t],!(r.timestamp-s.timestamp>di(e)));)t--;if(!s)return{x:0,y:0};s===i[0]&&i.length>2&&r.timestamp-s.timestamp>di(e)*2&&(s=i[1]);const n=Qi(r.timestamp-s.timestamp);if(n===0)return{x:0,y:0};const a={x:(r.x-s.x)/n,y:(r.y-s.y)/n};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function w0e(i,{min:e,max:t},s){return e!==void 0&&i<e?i=s?qt(e,i,s.min):Math.max(i,e):t!==void 0&&i>t&&(i=s?qt(t,i,s.max):Math.min(i,t)),i}function C4(i,e,t){return{min:e!==void 0?i.min+e:void 0,max:t!==void 0?i.max+t-(i.max-i.min):void 0}}function x0e(i,{top:e,left:t,bottom:s,right:r}){return{x:C4(i.x,t,r),y:C4(i.y,e,s)}}function b4(i,e){let t=e.min-i.min,s=e.max-i.max;return e.max-e.min<i.max-i.min&&([t,s]=[s,t]),{min:t,max:s}}function E0e(i,e){return{x:b4(i.x,e.x),y:b4(i.y,e.y)}}function V0e(i,e){let t=.5;const s=Gs(i),r=Gs(e);return r>s?t=Cu(e.min,e.max-s,i.min):s>r&&(t=Cu(i.min,i.max-r,e.min)),Lr(0,1,t)}function S0e(i,e){const t={};return e.min!==void 0&&(t.min=e.min-i.min),e.max!==void 0&&(t.max=e.max-i.min),t}const l0=.35;function T0e(i=l0){return i===!1?i=0:i===!0&&(i=l0),{x:w4(i,"left","right"),y:w4(i,"top","bottom")}}function w4(i,e,t){return{min:x4(i,e),max:x4(i,t)}}function x4(i,e){return typeof i=="number"?i:i[e]||0}const P0e=new WeakMap;class I0e{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ys(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:s}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const n=c=>{t&&this.snapToCursor(Ru(c).point),this.stopAnimation()},a=(c,d)=>{const{drag:f,dragPropagation:y,onDragStart:v}=this.getProps();if(f&&!y&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Gme(f),!this.openDragLock))return;this.latestPointerEvent=c,this.latestPanInfo=d,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),kr(g=>{let b=this.getAxisMotionValue(g).get()||0;if(_r.test(b)){const{projection:x}=this.visualElement;if(x&&x.layout){const P=x.layout.layoutBox[g];P&&(b=Gs(P)*(parseFloat(b)/100))}}this.originPoint[g]=b}),v&&Tt.update(()=>v(c,d),!1,!0),kv(this.visualElement,"transform");const{animationState:m}=this.visualElement;m&&m.setActive("whileDrag",!0)},o=(c,d)=>{this.latestPointerEvent=c,this.latestPanInfo=d;const{dragPropagation:f,dragDirectionLock:y,onDirectionLock:v,onDrag:m}=this.getProps();if(!f&&!this.openDragLock)return;const{offset:g}=d;if(y&&this.currentDirection===null){this.currentDirection=A0e(g),this.currentDirection!==null&&v&&v(this.currentDirection);return}this.updateAxis("x",d.point,g),this.updateAxis("y",d.point,g),this.visualElement.render(),m&&Tt.update(()=>m(c,d),!1,!0)},l=(c,d)=>{this.latestPointerEvent=c,this.latestPanInfo=d,this.stop(c,d),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>{const{dragSnapToOrigin:c}=this.getProps();(c||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:h}=this.getProps();this.panSession=new g4(e,{onSessionStart:n,onStart:a,onMove:o,onSessionEnd:l,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:h,distanceThreshold:s,contextWindow:p4(this.visualElement),element:this.visualElement.current})}stop(e,t){const s=e||this.latestPointerEvent,r=t||this.latestPanInfo,n=this.isDragging;if(this.cancel(),!n||!r||!s)return;const{velocity:a}=r;this.startAnimation(a);const{onDragEnd:o}=this.getProps();o&&Tt.postRender(()=>o(s,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,s){const{drag:r}=this.getProps();if(!s||!Jd(e,r,this.currentDirection))return;const n=this.getAxisMotionValue(e);let a=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(a=w0e(a,this.constraints[e],this.elastic[e])),n.set(a)}resolveConstraints(){var n;const{dragConstraints:e,dragElastic:t}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(n=this.visualElement.projection)==null?void 0:n.layout,r=this.constraints;e&&jo(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&s?this.constraints=x0e(s.layoutBox,e):this.constraints=!1,this.elastic=T0e(t),r!==this.constraints&&!jo(e)&&s&&this.constraints&&!this.hasMutatedConstraints&&kr(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=S0e(s.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!jo(e))return!1;const s=e.current;an(s!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const n=Ege(s,r.root,this.visualElement.getTransformPagePoint());let a=E0e(r.layout.layoutBox,n);if(t){const o=t(bge(a));this.hasMutatedConstraints=!!o,o&&(a=Y3(o))}return a}startAnimation(e){const{drag:t,dragMomentum:s,dragElastic:r,dragTransition:n,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),l=this.constraints||{},u=kr(h=>{if(!Jd(h,t,this.currentDirection))return;let c=l&&l[h]||{};(a===!0||a===h)&&(c={min:0,max:0});const d=r?200:1e6,f=r?40:1e7,y={type:"inertia",velocity:s?e[h]:0,bounceStiffness:d,bounceDamping:f,timeConstant:750,restDelta:1,restSpeed:10,...n,...c};return this.startAxisValueAnimation(h,y)});return Promise.all(u).then(o)}startAxisValueAnimation(e,t){const s=this.getAxisMotionValue(e);return kv(this.visualElement,e),s.start(Lv(e,s,0,t,this.visualElement,!1))}stopAnimation(){kr(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,s=this.visualElement.getProps(),r=s[t];return r||this.visualElement.getValue(e,(s.initial?s.initial[e]:void 0)||0)}snapToCursor(e){kr(t=>{const{drag:s}=this.getProps();if(!Jd(t,s,this.currentDirection))return;const{projection:r}=this.visualElement,n=this.getAxisMotionValue(t);if(r&&r.layout){const{min:a,max:o}=r.layout.layoutBox[t],l=n.get()||0;n.set(e[t]-qt(a,o,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:s}=this.visualElement;if(!jo(t)||!s||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};kr(a=>{const o=this.getAxisMotionValue(a);if(o&&this.constraints!==!1){const l=o.get();r[a]=V0e({min:l,max:l},this.constraints[a])}});const{transformTemplate:n}=this.visualElement.getProps();this.visualElement.current.style.transform=n?n({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.constraints=!1,this.resolveConstraints(),kr(a=>{if(!Jd(a,e,null))return;const o=this.getAxisMotionValue(a),{min:l,max:u}=this.constraints[a];o.set(qt(l,u,r[a]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;P0e.set(this.visualElement,this);const e=this.visualElement.current,t=Au(e,"pointerdown",u=>{const{drag:h,dragListener:c=!0}=this.getProps(),d=u.target,f=d!==e&&ege(d);h&&c&&!f&&this.start(u)});let s;const r=()=>{const{dragConstraints:u}=this.getProps();jo(u)&&u.current&&(this.constraints=this.resolveRefConstraints(),s||(s=R0e(e,u.current,()=>this.scalePositionWithinConstraints())))},{projection:n}=this.visualElement,a=n.addEventListener("measure",r);n&&!n.layout&&(n.root&&n.root.updateScroll(),n.updateLayout()),Tt.read(r);const o=Iu(window,"resize",()=>this.scalePositionWithinConstraints()),l=n.addEventListener("didUpdate",({delta:u,hasLayoutChanged:h})=>{this.isDragging&&h&&(kr(c=>{const d=this.getAxisMotionValue(c);d&&(this.originPoint[c]+=u[c].translate,d.set(d.get()+u[c].translate))}),this.visualElement.render())});return()=>{o(),t(),a(),l&&l(),s&&s()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:s=!1,dragPropagation:r=!1,dragConstraints:n=!1,dragElastic:a=l0,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:s,dragPropagation:r,dragConstraints:n,dragElastic:a,dragMomentum:o}}}function E4(i){let e=!0;return()=>{if(e){e=!1;return}i()}}function R0e(i,e,t){const s=U3(i,E4(t)),r=U3(e,E4(t));return()=>{s(),r()}}function Jd(i,e,t){return(e===!0||e===i)&&(t===null||t===i)}function A0e(i,e=10){let t=null;return Math.abs(i.y)>e?t="y":Math.abs(i.x)>e&&(t="x"),t}class L0e extends Zn{constructor(e){super(e),this.removeGroupControls=Hi,this.removeListeners=Hi,this.controls=new I0e(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Hi}update(){const{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const u0=i=>(e,t)=>{i&&Tt.update(()=>i(e,t),!1,!0)};class _0e extends Zn{constructor(){super(...arguments),this.removePointerDownListener=Hi}onPointerDown(e){this.session=new g4(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:p4(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:s,onPanEnd:r}=this.node.getProps();return{onSessionStart:u0(e),onStart:u0(t),onMove:u0(s),onEnd:(n,a)=>{delete this.session,r&&Tt.postRender(()=>r(n,a))}}}mount(){this.removePointerDownListener=Au(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let h0=!1;class D0e extends T.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:s,layoutId:r}=this.props,{projection:n}=e;n&&(t.group&&t.group.add(n),s&&s.register&&r&&s.register(n),h0&&n.root.didUpdate(),n.addEventListener("animationComplete",()=>{this.safeToRemove()}),n.setOptions({...n.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),jd.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:s,drag:r,isPresent:n}=this.props,{projection:a}=s;return a&&(a.isPresent=n,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),h0=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==n?a.willUpdate():this.safeToRemove(),e.isPresent!==n&&(n?a.promote():a.relegate()||Tt.postRender(()=>{const o=a.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:e,layoutAnchor:t}=this.props,{projection:s}=e;s&&(s.options.layoutAnchor=t,s.root.didUpdate(),Bv.postRender(()=>{!s.currentAnimation&&s.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:s}=this.props,{projection:r}=e;h0=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),s&&s.deregister&&s.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function V4(i){const[e,t]=X7(),s=T.useContext(vu);return L.jsx(D0e,{...i,layoutGroup:s,switchLayoutGroup:T.useContext(c4),isPresent:e,safeToRemove:t})}const k0e={pan:{Feature:_0e},drag:{Feature:L0e,ProjectionNode:J7,MeasureLayout:V4}};function S4(i,e,t){const{props:s}=i;i.animationState&&s.whileHover&&i.animationState.setActive("whileHover",t==="Start");const r="onHover"+t,n=s[r];n&&Tt.postRender(()=>n(e,Ru(e)))}class O0e extends Zn{mount(){const{current:e}=this.node;e&&(this.unmount=Zme(e,(t,s)=>(S4(this.node,s,"Start"),r=>S4(this.node,r,"End"))))}unmount(){}}class M0e extends Zn{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=yu(Iu(this.node.current,"focus",()=>this.onFocus()),Iu(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function T4(i,e,t){const{props:s}=i;if(i.current instanceof HTMLButtonElement&&i.current.disabled)return;i.animationState&&s.whileTap&&i.animationState.setActive("whileTap",t==="Start");const r="onTap"+(t==="End"?"":t),n=s[r];n&&Tt.postRender(()=>n(e,Ru(e)))}class N0e extends Zn{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:t,propagate:s}=this.node.props;this.unmount=sge(e,(r,n)=>(T4(this.node,n,"Start"),(a,{success:o})=>T4(this.node,a,o?"End":"Cancel")),{useGlobalTarget:t,stopPropagation:(s==null?void 0:s.tap)===!1})}unmount(){}}const c0=new WeakMap,d0=new WeakMap,F0e=i=>{const e=c0.get(i.target);e&&e(i)},q0e=i=>{i.forEach(F0e)};function B0e({root:i,...e}){const t=i||document;d0.has(t)||d0.set(t,{});const s=d0.get(t),r=JSON.stringify(e);return s[r]||(s[r]=new IntersectionObserver(q0e,{root:i,...e})),s[r]}function $0e(i,e,t){const s=B0e(e);return c0.set(i,t),s.observe(i),()=>{c0.delete(i),s.unobserve(i)}}const H0e={some:0,all:1};class Q0e extends Zn{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var l;(l=this.stopObserver)==null||l.call(this);const{viewport:e={}}=this.node.getProps(),{root:t,margin:s,amount:r="some",once:n}=e,a={root:t?t.current:void 0,rootMargin:s,threshold:typeof r=="number"?r:H0e[r]},o=u=>{const{isIntersecting:h}=u;if(this.isInView===h||(this.isInView=h,n&&!h&&this.hasEnteredView))return;h&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",h);const{onViewportEnter:c,onViewportLeave:d}=this.node.getProps(),f=h?c:d;f&&f(u)};this.stopObserver=$0e(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(U0e(e,t))&&this.startObserver()}unmount(){var e;(e=this.stopObserver)==null||e.call(this),this.hasEnteredView=!1,this.isInView=!1}}function U0e({viewport:i={}},{viewport:e={}}={}){return t=>i[t]!==e[t]}const z0e={...g0e,...{inView:{Feature:Q0e},tap:{Feature:N0e},focus:{Feature:M0e},hover:{Feature:O0e}},...k0e,...{layout:{ProjectionNode:J7,MeasureLayout:V4}}},P4=c0e(z0e,d0e);ni("Tutorial",null),Qs("Tutorial",(i,e,t,s)=>{var o;const r=((o=i.slides)==null?void 0:o.length)??0,n={};let a=0;for(let l=0;l<r;l++){const u=t.respondToSlide(l,i,s);s=u.participantState,n[l]=u.value??{},a+=u.duration??500}return{responseData:{slides:n},participantState:s,duration:a}},{respondToSlide:(i,e,t)=>({value:{},participantState:t,duration:500})});const I4=T.createContext({setCanProgress:()=>{},autoAdvance:()=>{},setSlideData:()=>{}}),j0e=({locked:i=!1}={})=>{const e=T.useContext(I4),t=T.useRef(!1);return!t.current&&i&&(t.current=!0,e.setCanProgress(!1)),{setData:e.setSlideData,unlock:({autoAdvanceMs:s}={})=>{e.setCanProgress(!0),s!==void 0&&e.autoAdvance(s)}}},R4="px-4 py-3 border-2 border-black font-bold text-lg rounded-xl shadow-[2px_2px_0px_rgba(0,0,0,1)] transition-all duration-100 outline-none focus:outline-none focus:ring-0",A4=R4+" bg-white text-black cursor-pointer hover:translate-x-[2px] hover:translate-y-[2px] hover:shadow-none",W0e=R4+" bg-gray-200 text-gray-400 border-gray-400 shadow-[2px_2px_0px_rgba(156,163,175,1)] cursor-default",L4=({next:i,slides:e,fadeDuration:t=.3,finishText:s="Start",containerClass:r,nextKey:n="ArrowRight",backKey:a="ArrowLeft",theme:o="light"})=>{const[l,u]=T.useState(0),[h,c]=T.useState({}),d=T.useRef(),f=T.useRef({}),y=h[l]!==!1,v=T.useRef(y),[m,g]=T.useState(0);T.useEffect(()=>{y&&!v.current&&g(V=>V+1),v.current=y},[y]);const b=T.useCallback(V=>{c(k=>({...k,[l]:V}))},[l]),x=T.useCallback(V=>{f.current[l]={...f.current[l],...V}},[l]),P=T.useCallback(()=>{l===e.length-1?i({slides:f.current}):u(V=>V+1)},[l,e.length,i]),A=T.useCallback(()=>{y&&P()},[y,P]),R=T.useCallback((V=0)=>{d.current&&clearTimeout(d.current),d.current=setTimeout(()=>P(),V)},[P]);T.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]);const _=T.useCallback(()=>{l>0&&u(V=>V-1)},[l]);return T.useEffect(()=>{if(n===!1&&a===!1)return;const V=k=>{n&&k.key===n&&A(),a&&k.key===a&&_()};return window.addEventListener("keydown",V),()=>window.removeEventListener("keydown",V)},[n,a,A,_]),L.jsx(Bve,{children:L.jsxs("div",{className:r,style:{width:"100vw",height:"100vh",display:"flex",flexDirection:"column",overflow:"hidden"},children:[L.jsx("div",{style:{flex:1,position:"relative"},children:L.jsx(Ove,{mode:"sync",children:L.jsx(P4.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:t},style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"},children:L.jsx(I4.Provider,{value:{setCanProgress:b,autoAdvance:R,setSlideData:x},children:e[l]})},l)})}),L.jsxs("div",{style:{padding:"1.5rem",display:"grid",gridTemplateColumns:"1fr auto 1fr",alignItems:"center"},children:[L.jsx("div",{style:{justifySelf:"end",marginRight:"1rem"},children:L.jsx("button",{onClick:_,className:A4,tabIndex:-1,onKeyDown:V=>{(V.key===" "||V.key==="Enter")&&V.preventDefault()},style:{visibility:l>0?"visible":"hidden"},children:"←"})}),L.jsx("div",{style:{display:"flex",gap:6},children:e.map((V,k)=>L.jsx("div",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:k===l?o==="dark"?"#fff":"#000":o==="dark"?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.2)",transition:"background-color 0.2s"}},k))}),L.jsx("div",{style:{justifySelf:"start",marginLeft:"1rem"},children:L.jsx(P4.button,{onClick:A,tabIndex:-1,onKeyDown:V=>{(V.key===" "||V.key==="Enter")&&V.preventDefault()},animate:{scale:[1,1.2,1]},transition:{duration:.3},className:(y?A4:W0e)+(l===e.length-1?" px-8":""),children:l===e.length-1?s:"→"},m)})]})]})})};ni("RandomDotKinematogram","rdk");const Or={validKeys:[],duration:1e3,responseEndsTrial:!0,dotCount:300,dotSetCount:1,direction:0,coherence:.5,opposite:0,speed:60,dotLifetime:-1,dotRadius:2,dotColor:"white",backgroundColor:"gray",apertureShape:"ellipse",apertureWidth:600,apertureHeight:400,reinsertMode:"opposite",noiseMovement:"randomDirection",fixationTime:500,showFixation:!1,fixationWidth:15,fixationHeight:15,fixationColor:"white",fixationThickness:2,showBorder:!1,borderWidth:1,borderColor:"black"};Qs("RandomDotKinematogram",(i,e,t,s)=>{const r={...Or,...i},n=t.respond(r,s),{rt:a,response:o}=n.value,l=r.fixationTime??Or.fixationTime,u=r.duration??Or.duration,c=(r.responseEndsTrial??Or.responseEndsTrial)&&a!=null?a:u,d=Array.isArray(r.correctResponse)?r.correctResponse.map(f=>f.toLowerCase()):r.correctResponse?[r.correctResponse.toLowerCase()]:null;return{responseData:{...r,rt:a,response:o,correct:o&&d?d.includes(o.toLowerCase()):null,framesDisplayed:0,measuredRefreshRate:null},participantState:n.participantState,duration:l+c}},{respond:(i,e)=>{const t=N2({driftRate:{type:"normal",mean:.005*(i.coherence??Or.coherence),sd:.0012},boundaries:.75,startingPoint:0,noiseLevel:.02,sensoryDelay:{type:"uniform",min:150,max:250},motorDelay:{type:"uniform",min:130,max:210},timeLimit:i.duration??Or.duration,stimOffset:i.stimulusDuration??i.duration??Or.duration,postStimStrategy:{type:"continue"}}),s=F2(t.choice,i.validKeys,i.correctResponse);return{value:{rt:s?t.rt:null,response:s},participantState:e}}});const G0e=10,_4=.1,K0e=(i,e,t,s)=>{const r=Math.floor(i*e),n=Math.floor(i*t),a=[...Array(r).fill("coherent"),...Array(n).fill("opposite"),...Array(i-r-n).fill(s)];return fm(a)},Ma=(i,e)=>i+Math.random()*(e-i),Z0e=(i,e,t,s,r)=>{const n=e/2,a=i==="circle"||i==="square"?n:t/2,o=(l,u)=>{const h=n*2,c=a*2,d=s-n,f=r-a;return[((l-d)%h+h)%h+d,((u-f)%c+c)%c+f]};return i==="circle"||i==="ellipse"?{centerX:s,centerY:r,getRandomPosition(){const l=Ma(-Math.PI,Math.PI),u=Math.sqrt(Math.random());return[Math.cos(l)*u*n+s,Math.sin(l)*u*a+r]},isOutside(l,u,h){const c=n+h,d=a+h,f=(l-s)/c,y=(u-r)/d;return f*f+y*y>1},getOppositePosition(l,u,h){if(u!==void 0&&h!==void 0){const c=u*u+h*h;if(c>1e-10){const d=Math.sqrt(c),f=u/d,y=h/d,v=l.x-s,m=l.y-r,g=n*n,b=a*a,x=f*f/g+y*y/b,P=v*f/g+m*y/b,A=v*v/g+m*m/b-1,R=P*P-x*A;if(R>=0){const _=(P+Math.sqrt(R))/x;if(_>0&&Number.isFinite(_))return[l.x-f*_,l.y-y*_]}}}return this.getOppositePositionSimple(l)},getOppositePositionSimple(l){const u=2*s-l.x,h=2*r-l.y,c=(u-s)/n,d=(h-r)/a,f=Math.sqrt(c*c+d*d);return f>1?[s+c/f*n,r+d/f*a]:[u,h]},wrap:o,clip(l){l.beginPath(),l.ellipse(s,r,n,a,0,0,Math.PI*2),l.clip()},drawBorder(l,u,h){l.strokeStyle=u,l.lineWidth=h,l.beginPath(),l.ellipse(s,r,n+h/2,a+h/2,0,0,Math.PI*2),l.stroke()}}:{centerX:s,centerY:r,getRandomPosition(){return[Ma(s-n,s+n),Ma(r-a,r+a)]},isOutside(l,u,h){const c=n+h,d=a+h;return l<s-c||l>s+c||u<r-d||u>r+d},getOppositePosition(l,u,h){if(u===void 0||h===void 0)return this.getOppositePositionSimple(l);const c=Math.sqrt(u*u+h*h);if(c<1e-10)return this.getOppositePositionSimple(l);const d=-u/c,f=-h/c,y=s-n,v=s+n,m=r-a,g=r+a,b=d!==0?(y-l.x)/d:-1/0,x=d!==0?(v-l.x)/d:-1/0,P=f!==0?(m-l.y)/f:-1/0,A=f!==0?(g-l.y)/f:-1/0,R=Math.max(Math.min(b,x),Math.min(P,A)),_=Math.min(Math.max(b,x),Math.max(P,A));return _>0&&R<=_&&Number.isFinite(_)?[l.x+d*_,l.y+f*_]:this.getOppositePositionSimple(l)},getOppositePositionSimple(l){const u=s-n,h=s+n,c=r-a,d=r+a;let f=l.x,y=l.y;return l.x<u?f=h:l.x>h&&(f=u),l.y<c?y=d:l.y>d&&(y=c),[f,y]},wrap:o,clip(l){l.beginPath(),l.rect(s-n,r-a,n*2,a*2),l.clip()},drawBorder(l,u,h){l.strokeStyle=u,l.lineWidth=h,l.strokeRect(s-n-h/2,r-a-h/2,n*2+h,a*2+h)}}},J0e=(i,e,t)=>{const[s,r]=t.getRandomPosition(),n=i==="randomDirection"?Ma(-Math.PI,Math.PI):0;return{x:s,y:r,randomDirX:n?Math.cos(n):0,randomDirY:n?-Math.sin(n):0,lifeCount:Ma(0,e>0?e:0),assignedMovement:i}},Y0e=(i,e,t,s,r,n,a,o,l)=>{const u={...i};if(u.lifeCount+=t,s>0&&u.lifeCount>=s)return[u.x,u.y]=r.getRandomPosition(),u.lifeCount=0,u;let h=i.assignedMovement;if(l!==void 0&&(h=l,u.assignedMovement=h,h==="randomDirection")){const y=Ma(-Math.PI,Math.PI);u.randomDirX=Math.cos(y),u.randomDirY=-Math.sin(y)}let c=0,d=0;switch(h){case"coherent":c=o[0],d=o[1];break;case"opposite":c=-o[0],d=-o[1];break;case"randomTeleport":return[u.x,u.y]=r.getRandomPosition(),u;case"randomWalk":{const y=Ma(-Math.PI,Math.PI);c=Math.cos(y),d=-Math.sin(y);break}case"randomDirection":c=u.randomDirX,d=u.randomDirY;break}if(u.x+=c*e,u.y+=d*e,r.isOutside(u.x,u.y,a))if(n==="random")[u.x,u.y]=r.getRandomPosition();else if(n==="oppositeSimple")[u.x,u.y]=r.getOppositePositionSimple(u);else if(n==="opposite")[u.x,u.y]=r.getOppositePosition(u,c,d);else if(n==="wrap")[u.x,u.y]=r.wrap(u.x,u.y);else throw new Error(`Unknown reinsertType: ${n}`);return u},D4=T.forwardRef((i,e)=>{const{width:t,height:s,dotCount:r,dotSetCount:n,direction:a,coherence:o,opposite:l,speed:u,dotLifetime:h,updateRate:c,dotRadius:d,dotCharacter:f,dotColor:y,coherentDotColor:v,backgroundColor:m,apertureShape:g,apertureWidth:b,apertureHeight:x,apertureCenterX:P,apertureCenterY:A,reinsertMode:R,noiseMovement:_,reassignEveryMs:V,showFixation:k,fixationWidth:q,fixationHeight:B,fixationColor:U,fixationThickness:D,showBorder:H,borderWidth:Q,borderColor:$,active:W=!0,initialRefreshRate:K,style:oe,className:ee}={...Or,...i},ue=T.useRef(null),ae=T.useRef(),ce=T.useRef(),Ae=T.useRef(),ve=T.useRef(0),ie=T.useRef(0),xe=T.useRef([]),et=T.useRef(null),Xt=T.useRef(!1),jt=P??t/2,Os=A??s/2,Et=T.useMemo(()=>Z0e(g,b,x,jt,Os),[g,b,x,jt,Os]),fs=T.useMemo(()=>{const Oe=(90-a)*Math.PI/180;return[Math.cos(Oe),-Math.sin(Oe)]},[a]),is=T.useRef([]),_e=T.useRef(0);T.useEffect(()=>{const Oe=Math.floor(r*o),Ke=Math.floor(r*l);is.current=Array.from({length:n},()=>Array.from({length:r},(Pe,rs)=>{let Cs;return rs<Oe?Cs="coherent":rs<Oe+Ke?Cs="opposite":Cs=_,J0e(Cs,h,Et)}))},[]),T.useEffect(()=>{typeof K=="number"&&K>=20&&K<=300&&(et.current=1e3/K,Xt.current=!0)},[K]),T.useImperativeHandle(e,()=>({getStats:()=>({framesDisplayed:ie.current,measuredRefreshRate:et.current?Math.round(1e3/et.current):null})}));const tt=T.useCallback((Oe,Ke)=>{Ke.forEach(Pe=>{const rs=v&&Pe.assignedMovement==="coherent"?v:y;if(Oe.fillStyle=rs,f){const Cs=d*2.5;Oe.font=`${Cs}px monospace`,Oe.textAlign="center",Oe.textBaseline="middle",Oe.fillText(f,Pe.x,Pe.y)}else Oe.beginPath(),Oe.arc(Pe.x,Pe.y,d,0,Math.PI*2),Oe.fill()})},[y,v,d,f]),Bt=T.useCallback((Oe,Ke,Pe)=>{k&&(Oe.fillStyle=U,Oe.fillRect(Ke-q,Pe-D/2,q*2,D),Oe.fillRect(Ke-D/2,Pe-B,D,B*2))},[k,U,D,q,B]),Ht=T.useCallback(Oe=>{H&&Et.drawBorder(Oe,$,Q)},[H,$,Q,Et]),gt=T.useCallback(Oe=>{const Ke=ue.current,Pe=Ke==null?void 0:Ke.getContext("2d");if(!Ke||!Pe)return;ce.current===void 0&&(ce.current=Oe),Ae.current===void 0&&(Ae.current=Oe);const rs=Oe-Ae.current;if(Ae.current=Oe,ie.current++,rs>0&&rs<500){if(Xt.current)et.current=_4*rs+(1-_4)*et.current;else if(xe.current.push(rs),xe.current.length>=G0e){const Js=[...xe.current].sort((Ys,ji)=>Ys-ji),zi=Math.floor(Js.length/2);et.current=Js.length%2?Js[zi]:(Js[zi-1]+Js[zi])/2,Xt.current=!0}}const Cs=Oe-(ce.current??Oe),bs=Math.min(Cs,100),un=c&&c>0?1e3/c:0,Zs=!c||c<=0||bs>=un;if(Pe.clearRect(0,0,Ke.width,Ke.height),Pe.save(),Et.clip(Pe),Pe.fillStyle=m,Pe.fillRect(0,0,Ke.width,Ke.height),Pe.restore(),!W)Bt(Pe,Et.centerX,Et.centerY);else{if(Zs){const zi=u*bs/1e3;let Ys=!1;if(V!==void 0)if(V===0)Ys=!0;else{ve.current+=bs;const J=Xt.current&&et.current?et.current*.5:0;Ys=ve.current+J>=V,Ys&&(ve.current%=V)}const ji=Ys?K0e(r,o,l,_):null,ra=is.current[_e.current].map((J,re)=>Y0e(J,zi,bs,h,Et,R,d,fs,ji==null?void 0:ji[re]));is.current[_e.current]=ra,_e.current=(_e.current+1)%n,ce.current=Oe}const Js=is.current[_e.current];Pe.save(),Et.clip(Pe),tt(Pe,Js),Pe.restore(),Pe.save(),Pe.beginPath(),Bt(Pe,Et.centerX,Et.centerY),Ht(Pe),Pe.restore()}ae.current=requestAnimationFrame(gt)},[W,m,_,o,l,r,u,h,Et,R,n,d,fs,c,tt,Bt,Ht,V]);return T.useEffect(()=>(ae.current=requestAnimationFrame(gt),()=>{ae.current&&cancelAnimationFrame(ae.current)}),[gt]),T.useEffect(()=>{const Oe=ue.current;if(!Oe)return;const Ke=window.devicePixelRatio||1;Oe.width=t*Ke,Oe.height=s*Ke,Oe.style.width=`${t}px`,Oe.style.height=`${s}px`;const Pe=Oe.getContext("2d");Pe&&Pe.scale(Ke,Ke)},[t,s]),L.jsx("canvas",{ref:ue,style:{display:"block",...oe},className:ee})}),k4=i=>{const{store:e,stimulusDuration:t,updateRate:s,dotCharacter:r,coherentDotColor:n,apertureCenterX:a=window.innerWidth/2,apertureCenterY:o=window.innerHeight/2,reassignEveryMs:l,responseHint:u,validKeys:h,duration:c,responseEndsTrial:d,dotCount:f,dotSetCount:y,direction:v,coherence:m,opposite:g,speed:b,dotLifetime:x,dotRadius:P,dotColor:A,backgroundColor:R,apertureShape:_,apertureWidth:V,apertureHeight:k,reinsertMode:q,noiseMovement:B,showFixation:U,fixationTime:D,fixationWidth:H,fixationHeight:Q,fixationColor:$,fixationThickness:W,showBorder:K,borderWidth:oe,borderColor:ee}={...Or,...i},ue=T.useRef(i);ue.current=i;const ae=T.useRef(null),ce=T.useRef(performance.now()),Ae=T.useRef(!1),ve=T.useRef(null),ie=T.useRef(null),[xe,et]=T.useState(null),[Xt,jt]=T.useState(D<=0),[Os,Et]=T.useState(!0),fs=e==null?void 0:e._reactiveScreenRefreshRate,is=T.useCallback((_e,tt)=>{var Cs;if(Ae.current)return;Ae.current=!0;const{next:Bt,data:Ht,store:gt,updateStore:Oe,...Ke}=ue.current,Pe=(Cs=ae.current)==null?void 0:Cs.getStats(),rs=Array.isArray(Ke.correctResponse)?Ke.correctResponse.map(bs=>bs.toLowerCase()):Ke.correctResponse?[Ke.correctResponse.toLowerCase()]:null;Bt({...Or,...Ke,rt:tt,response:_e,correct:_e&&rs?rs.includes(_e):null,framesDisplayed:(Pe==null?void 0:Pe.framesDisplayed)??0,measuredRefreshRate:(Pe==null?void 0:Pe.measuredRefreshRate)??null})},[]);return T.useEffect(()=>{if(D<=0)return;const _e=setTimeout(()=>jt(!0),D);return()=>clearTimeout(_e)},[D]),T.useEffect(()=>{const _e=t??c;if(_e<=0)return;const tt=setTimeout(()=>Et(!1),D+_e);return()=>clearTimeout(tt)},[D,t,c]),T.useEffect(()=>{if(c<=0)return;const _e=setTimeout(()=>{is(ve.current,ie.current)},D+c);return()=>clearTimeout(_e)},[D,c,is]),T.useEffect(()=>{const _e=tt=>{if(Ae.current||ve.current)return;const Bt=tt.key.toLowerCase(),Ht=h.length>0?h.map(gt=>gt.toLowerCase()):null;if(!Ht||Ht.includes(Bt)){const gt=performance.now()-ce.current;ve.current=Bt,ie.current=gt,et(Bt),d&&is(Bt,gt)}};return window.addEventListener("keydown",_e),()=>window.removeEventListener("keydown",_e)},[h,d,is]),L.jsxs("div",{style:{width:"100vw",height:"100vh",overflow:"hidden",margin:0,padding:0,backgroundColor:R},children:[L.jsx(D4,{ref:ae,width:window.innerWidth,height:window.innerHeight,active:Xt&&Os,initialRefreshRate:fs,dotCount:f,dotSetCount:y,direction:v,coherence:m,opposite:g,speed:b,dotLifetime:x,updateRate:s,dotRadius:P,dotCharacter:r,dotColor:A,coherentDotColor:n,backgroundColor:R,apertureShape:_,apertureWidth:V,apertureHeight:k,apertureCenterX:a,apertureCenterY:o,reinsertMode:q,noiseMovement:B,reassignEveryMs:l,showFixation:U,fixationWidth:H,fixationHeight:Q,fixationColor:$,fixationThickness:W,showBorder:K,borderWidth:oe,borderColor:ee}),u&&!Os&&!xe&&L.jsx("div",{style:{position:"absolute",top:"60%",width:"100%",textAlign:"center",color:"white",fontSize:"1.25rem"},children:u})]})},X0e={Text:rc,ProlificEnding:H2,EnterFullscreen:iS,ExitFullscreen:rS,Quest:U5,Upload:YV,MicrophoneCheck:G2,PlainInput:$2,RequestFilePermission:yS,CanvasBlock:CS,CheckDevice:bS,StoreUI:zpe,Tutorial:L4,RandomDotKinematogram:k4},e1e={voicerecorder:wne};function p0(i){return typeof i=="object"&&i!==null&&typeof i.type=="string"}function t1e({timeline:i,config:e={showProgressBar:!1},components:t={},questions:s={},hybridParticipant:r}){const n=$pe(),a=T.useMemo(()=>Xh(i),[i]),o=T.useRef((()=>{const B={},U=new URLSearchParams(window.location.search);for(const[$,W]of U.entries())B[$]=W;const D=Yh.getRegistry()||[],H={};for(const[$,W]of Object.entries(B))H[$]={value:W,registered:!1,defaultValue:void 0,type:void 0,description:void 0};for(const $ of D)H[$.name]={value:$.value!==void 0?$.value:B[$.name],registered:!0,defaultValue:$.defaultValue,type:$.type,description:$.description};return[{index:-1,trialNumber:-1,start:Ps(),end:Ps(),duration:0,type:"",name:"",responseData:{userAgent:navigator.userAgent,params:H}}]})()),[l,u]=T.useState(0),h=T.useRef(Ps()),c=T.useRef({}),[d,f]=T.useState(()=>In(a,0,()=>c.current,()=>o.current,B=>{c.current={...c.current,...B}})),y=!n&&ma("hybridSimulation",!1,"boolean")?"hybrid":"none",v=T.useRef(r||{}),m=T.useRef(-1),g={...X0e,...t},b={...e1e,...s},x=T.useMemo(()=>{const B=a.instructions.length;return B>0?d/B:0},[d,a.instructions]);T.useEffect(()=>{window.scrollTo(0,0)},[d]);function P(B){c.current={...c.current,...B}}function A(B,U,D){const H=Ps(),Q=a.instructions[d],$=U!==void 0?U:h.current,W=D!==void 0?D:H;if((Q==null?void 0:Q.type)==="ExecuteContent"){const oe=Q.content;if(p0(oe)){let ee={index:d,trialNumber:l+1,start:$,end:W,duration:W-$,type:oe.type,name:oe.name??"",...oe.csv!==void 0?{csv:oe.csv}:{},responseData:B};ee=ec(ee,oe,o.current,c.current),o.current=[...o.current,ee],u(ue=>ue+1)}else console.log("ExecuteContent finished, but content wasn't standard component format:",oe)}const K=In(a,d+1,()=>c.current,()=>o.current,oe=>P(oe));K<a.instructions.length&&(h.current=Ps()),f(K)}const R=T.useCallback(B=>{let U=0;const D=Ps(),H=2e4;let Q,$=D;const W=1e3,K=()=>{const ae=Ps()-D;return ae>0?Math.round(U*1e3/ae):null},oe=()=>{Q&&cancelAnimationFrame(Q)},ee=ue=>{U++;const ae=ue-D;ue-$>=W&&(B(K()),$=ue),ae<H?Q=requestAnimationFrame(ee):(oe(),B(K()))};return Q=requestAnimationFrame(ee),oe},[]),_=({children:B,collectRefreshRate:U})=>{const D=T.useRef(null),H=T.useRef(null);T.useEffect(()=>{if(D.current=Ps(),U)return R(W=>{H.current=W,P({_reactiveScreenRefreshRate:W})})},[]);const Q=T.Children.map(B,$=>{if(T.isValidElement($)){const W=(K,oe,ee)=>{const ue=Ps(),ae=oe!==void 0?oe:D.current;A(K,ae??void 0,(ee!==void 0?ee:ue)??void 0)};return T.cloneElement($,{...$.props,next:W})}return $});return L.jsx(L.Fragment,{children:Q})},V=a.instructions[d],k=T.useMemo(()=>{if(y==="none"||(V==null?void 0:V.type)!=="ExecuteContent")return!1;const B=V.content;return!p0(B)||B.simulate===!1?!1:!!B.simulate||!!B.simulators},[d,y,V]);T.useEffect(()=>{k&&m.current!==d&&(m.current=d,(async()=>{const B=V.content,{trialProps:U,simulateFn:D,simulators:H}=Cm(B,o.current,c.current),Q=await D(U,{data:o.current,store:c.current},H,v.current);v.current=Q.participantState,Q.storeUpdates&&P(Q.storeUpdates),A(Q.responseData)})())},[k,d]);let q=null;if((V==null?void 0:V.type)==="ExecuteContent"&&!k){const B=V.content;if(p0(B)){const U=g[B.type];if(U){const D=typeof B.props=="function"?B.props(o.current,c.current):B.props||{};q=L.jsx(_,{collectRefreshRate:B.collectRefreshRate,children:L.jsx(U,{next:A,updateStore:P,store:c.current,data:o.current,...B.type==="Quest"?{customQuestions:b}:{},...D})},d)}else console.error(`No component found for type: ${B.type}`),q=L.jsxs("div",{children:['Error: Component type "',B.type,'" not found.']})}else console.warn("ExecuteContent instruction does not contain standard component data:",B),q=L.jsx("div",{children:"Non-component content encountered."})}else d>=a.instructions.length&&(q=L.jsx(L.Fragment,{}));return L.jsxs("div",{className:"w-full h-full",children:[L.jsx("div",{className:` ${e.showProgressBar?"":"hidden "} px-4 mt-4 sm:mt-12 max-w-2xl mx-auto`,children:L.jsx("div",{className:"flex-1 h-6 bg-gray-200 rounded-full overflow-hidden",children:L.jsx("div",{className:`h-full bg-gray-200 rounded-full duration-300 ${x>0?" border-black border-2":""}`,style:{width:`${x*100}%`,backgroundImage:`repeating-linear-gradient(
10282
10282
  -45deg, #E5E7EB, #E5E7EB 10px, #D1D5DB 10px, #D1D5DB 20px
10283
10283
  )`,transition:"width 300ms ease-in-out"}})})}),q]})}function O4(i){const e=i.split("/").filter(s=>s!=="."),t=[];return e.forEach(s=>{s===".."&&t.length>0&&t[t.length-1]!==".."?t.pop():t.push(s)}),t.join("/")}function s1e(i,e){i=O4(i),e=O4(e);const t=i.split("/"),s=e.split("/");return i!==e&&t.every((r,n)=>r===s[n])}class Yd extends Zh{constructor(){super(...arguments),this.DB_VERSION=1,this.DB_NAME="Disc",this._writeCmds=["add","put","delete"],this.downloadFile=async e=>{var t,s;const r=V2(e,e.webFetchExtra),n=await fetch(e.url,r);let a;if(!e.progress)a=await n.blob();else if(!(n!=null&&n.body))a=new Blob;else{const l=n.body.getReader();let u=0;const h=[],c=n.headers.get("content-type"),d=parseInt(n.headers.get("content-length")||"0",10);for(;;){const{done:v,value:m}=await l.read();if(v)break;h.push(m),u+=(m==null?void 0:m.length)||0;const g={url:e.url,bytes:u,contentLength:d};this.notifyListeners("progress",g)}const f=new Uint8Array(u);let y=0;for(const v of h)typeof v>"u"||(f.set(v,y),y+=v.length);a=new Blob([f.buffer],{type:c||void 0})}return{path:(await this.writeFile({path:e.path,directory:(t=e.directory)!==null&&t!==void 0?t:void 0,recursive:(s=e.recursive)!==null&&s!==void 0?s:!1,data:a})).uri,blob:a}}}async initDb(){if(this._db!==void 0)return this._db;if(!("indexedDB"in window))throw this.unavailable("This browser doesn't support IndexedDB");return new Promise((e,t)=>{const s=indexedDB.open(this.DB_NAME,this.DB_VERSION);s.onupgradeneeded=Yd.doUpgrade,s.onsuccess=()=>{this._db=s.result,e(s.result)},s.onerror=()=>t(s.error),s.onblocked=()=>{console.warn("db blocked")}})}static doUpgrade(e){const s=e.target.result;switch(e.oldVersion){case 0:case 1:default:s.objectStoreNames.contains("FileStorage")&&s.deleteObjectStore("FileStorage"),s.createObjectStore("FileStorage",{keyPath:"path"}).createIndex("by_folder","folder")}}async dbRequest(e,t){const s=this._writeCmds.indexOf(e)!==-1?"readwrite":"readonly";return this.initDb().then(r=>new Promise((n,a)=>{const u=r.transaction(["FileStorage"],s).objectStore("FileStorage")[e](...t);u.onsuccess=()=>n(u.result),u.onerror=()=>a(u.error)}))}async dbIndexRequest(e,t,s){const r=this._writeCmds.indexOf(t)!==-1?"readwrite":"readonly";return this.initDb().then(n=>new Promise((a,o)=>{const c=n.transaction(["FileStorage"],r).objectStore("FileStorage").index(e)[t](...s);c.onsuccess=()=>a(c.result),c.onerror=()=>o(c.error)}))}getPath(e,t){const s=t!==void 0?t.replace(/^[/]+|[/]+$/g,""):"";let r="";return e!==void 0&&(r+="/"+e),t!==""&&(r+="/"+s),r}async clear(){(await this.initDb()).transaction(["FileStorage"],"readwrite").objectStore("FileStorage").clear()}async readFile(e){const t=this.getPath(e.directory,e.path),s=await this.dbRequest("get",[t]);if(s===void 0)throw Error("File does not exist.");return{data:s.content?s.content:""}}async writeFile(e){const t=this.getPath(e.directory,e.path);let s=e.data;const r=e.encoding,n=e.recursive,a=await this.dbRequest("get",[t]);if(a&&a.type==="directory")throw Error("The supplied path is a directory.");const o=t.substr(0,t.lastIndexOf("/"));if(await this.dbRequest("get",[o])===void 0){const c=o.indexOf("/",1);if(c!==-1){const d=o.substr(c);await this.mkdir({path:d,directory:e.directory,recursive:n})}}if(!r&&!(s instanceof Blob)&&(s=s.indexOf(",")>=0?s.split(",")[1]:s,!this.isBase64String(s)))throw Error("The supplied data is not valid base64 content.");const u=Date.now(),h={path:t,folder:o,type:"file",size:s instanceof Blob?s.size:s.length,ctime:u,mtime:u,content:s};return await this.dbRequest("put",[h]),{uri:h.path}}async appendFile(e){const t=this.getPath(e.directory,e.path);let s=e.data;const r=e.encoding,n=t.substr(0,t.lastIndexOf("/")),a=Date.now();let o=a;const l=await this.dbRequest("get",[t]);if(l&&l.type==="directory")throw Error("The supplied path is a directory.");if(await this.dbRequest("get",[n])===void 0){const c=n.indexOf("/",1);if(c!==-1){const d=n.substr(c);await this.mkdir({path:d,directory:e.directory,recursive:!0})}}if(!r&&!this.isBase64String(s))throw Error("The supplied data is not valid base64 content.");if(l!==void 0){if(l.content instanceof Blob)throw Error("The occupied entry contains a Blob object which cannot be appended to.");l.content!==void 0&&!r?s=btoa(atob(l.content)+atob(s)):s=l.content+s,o=l.ctime}const h={path:t,folder:n,type:"file",size:s.length,ctime:o,mtime:a,content:s};await this.dbRequest("put",[h])}async deleteFile(e){const t=this.getPath(e.directory,e.path);if(await this.dbRequest("get",[t])===void 0)throw Error("File does not exist.");if((await this.dbIndexRequest("by_folder","getAllKeys",[IDBKeyRange.only(t)])).length!==0)throw Error("Folder is not empty.");await this.dbRequest("delete",[t])}async mkdir(e){const t=this.getPath(e.directory,e.path),s=e.recursive,r=t.substr(0,t.lastIndexOf("/")),n=(t.match(/\//g)||[]).length,a=await this.dbRequest("get",[r]),o=await this.dbRequest("get",[t]);if(n===1)throw Error("Cannot create Root directory");if(o!==void 0)throw Error("Current directory does already exist.");if(!s&&n!==2&&a===void 0)throw Error("Parent directory must exist");if(s&&n!==2&&a===void 0){const h=r.substr(r.indexOf("/",1));await this.mkdir({path:h,directory:e.directory,recursive:s})}const l=Date.now(),u={path:t,folder:r,type:"directory",size:0,ctime:l,mtime:l};await this.dbRequest("put",[u])}async rmdir(e){const{path:t,directory:s,recursive:r}=e,n=this.getPath(s,t),a=await this.dbRequest("get",[n]);if(a===void 0)throw Error("Folder does not exist.");if(a.type!=="directory")throw Error("Requested path is not a directory");const o=await this.readdir({path:t,directory:s});if(o.files.length!==0&&!r)throw Error("Folder is not empty");for(const l of o.files){const u=`${t}/${l.name}`;(await this.stat({path:u,directory:s})).type==="file"?await this.deleteFile({path:u,directory:s}):await this.rmdir({path:u,directory:s,recursive:r})}await this.dbRequest("delete",[n])}async readdir(e){const t=this.getPath(e.directory,e.path),s=await this.dbRequest("get",[t]);if(e.path!==""&&s===void 0)throw Error("Folder does not exist.");const r=await this.dbIndexRequest("by_folder","getAllKeys",[IDBKeyRange.only(t)]);return{files:await Promise.all(r.map(async a=>{let o=await this.dbRequest("get",[a]);return o===void 0&&(o=await this.dbRequest("get",[a+"/"])),{name:a.substring(t.length+1),type:o.type,size:o.size,ctime:o.ctime,mtime:o.mtime,uri:o.path}}))}}async getUri(e){const t=this.getPath(e.directory,e.path);let s=await this.dbRequest("get",[t]);return s===void 0&&(s=await this.dbRequest("get",[t+"/"])),{uri:(s==null?void 0:s.path)||t}}async stat(e){const t=this.getPath(e.directory,e.path);let s=await this.dbRequest("get",[t]);if(s===void 0&&(s=await this.dbRequest("get",[t+"/"])),s===void 0)throw Error("Entry does not exist.");return{type:s.type,size:s.size,ctime:s.ctime,mtime:s.mtime,uri:s.path}}async rename(e){await this._copy(e,!0)}async copy(e){return this._copy(e,!1)}async requestPermissions(){return{publicStorage:"granted"}}async checkPermissions(){return{publicStorage:"granted"}}async _copy(e,t=!1){let{toDirectory:s}=e;const{to:r,from:n,directory:a}=e;if(!r||!n)throw Error("Both to and from must be provided");s||(s=a);const o=this.getPath(a,n),l=this.getPath(s,r);if(o===l)return{uri:l};if(s1e(o,l))throw Error("To path cannot contain the from path");let u;try{u=await this.stat({path:r,directory:s})}catch{const y=r.split("/");y.pop();const v=y.join("/");if(y.length>0&&(await this.stat({path:v,directory:s})).type!=="directory")throw new Error("Parent directory of the to path is a file")}if(u&&u.type==="directory")throw new Error("Cannot overwrite a directory with a file");const h=await this.stat({path:n,directory:a}),c=async(f,y,v)=>{const m=this.getPath(s,f),g=await this.dbRequest("get",[m]);g.ctime=y,g.mtime=v,await this.dbRequest("put",[g])},d=h.ctime?h.ctime:Date.now();switch(h.type){case"file":{const f=await this.readFile({path:n,directory:a});t&&await this.deleteFile({path:n,directory:a});let y;!(f.data instanceof Blob)&&!this.isBase64String(f.data)&&(y=yd.UTF8);const v=await this.writeFile({path:r,directory:s,data:f.data,encoding:y});return t&&await c(r,d,h.mtime),v}case"directory":{if(u)throw Error("Cannot move a directory over an existing object");try{await this.mkdir({path:r,directory:s,recursive:!1}),t&&await c(r,d,h.mtime)}catch{}const f=(await this.readdir({path:n,directory:a})).files;for(const y of f)await this._copy({from:`${n}/${y.name}`,to:`${r}/${y.name}`,directory:a,toDirectory:s},t);t&&await this.rmdir({path:n,directory:a})}}return{uri:l}}isBase64String(e){try{return btoa(atob(e))==e}catch{return!1}}}Yd._debug=!0;const i1e=Object.freeze(Object.defineProperty({__proto__:null,FilesystemWeb:Yd},Symbol.toStringTag,{value:"Module"}));class r1e extends Zh{async enable(){console.log("Immersive mode is only available on Android")}async disable(){console.log("Immersive mode is only available on Android")}}const n1e=Object.freeze(Object.defineProperty({__proto__:null,ImmersiveModeWeb:r1e},Symbol.toStringTag,{value:"Module"}));X.Bounce=mS,X.CanvasBlock=CS,X.CheckDevice=bS,X.EnterFullscreen=iS,X.ExitFullscreen=rS,X.ExperimentProvider=Hpe,X.ExperimentRunner=t1e,X.Flip=Npe,X.Icons=Ed,X.MicCheck=G2,X.Param=Yh,X.PlainInput=$2,X.ProlificEnding=H2,X.Quest=U5,X.RDKCanvas=D4,X.RandomDotKinematogram=k4,X.RequestFilePermission=yS,X.Slide=Ope,X.Text=rc,X.ToastContainer=gS,X.Tutorial=L4,X.Upload=YV,X.Zoom=Mpe,X.arrayFlattener=_2,X.canvasCountdown=ene,X.chunk=w2,X.collapseToast=aS,X.cssTransition=fu,X.getBackendUrl=R2,X.getInitialParticipant=L2,X.getParam=ma,X.getPlatform=Dl,X.getSimulation=tne,X.halton=y2,X.isDesktop=Yre,X.isFullscreen=uo,X.mapDDMChoice=F2,X.noopSimulate=ho,X.now=Ps,X.orchestrateSimulation=rne,X.pipe=b2,X.registerArrayExtensions=Ure,X.registerComponentParams=vm,X.registerExperimentParams=T2,X.registerFlattener=ni,X.registerSimulation=Qs,X.resolveSimulation=Cm,X.sample=C2,X.sampleParticipants=Hre,X.seedDistributions=Mre,X.setBackendUrl=sne,X.shuffle=fm,X.simulateDDMTrial=N2,X.simulateParticipant=ine,X.sobol=v2,X.subsetExperimentByParam=Xre,X.toast=_t,X.useToast=pS,X.useToastContainer=dS,X.useTutorialSlide=j0e,Object.defineProperty(X,Symbol.toStringTag,{value:"Module"})});
@@ -1,4 +1,4 @@
1
- import { W as e } from "./mod-DWwiBaRy.js";
1
+ import { W as e } from "./mod-Cu_Zktcq.js";
2
2
  class s extends e {
3
3
  async enable() {
4
4
  console.log("Immersive mode is only available on Android");
@@ -1,4 +1,4 @@
1
- import { W as P, b as x, E } from "./mod-DWwiBaRy.js";
1
+ import { W as P, b as x, E } from "./mod-Cu_Zktcq.js";
2
2
  function m(w) {
3
3
  const e = w.split("/").filter((t) => t !== "."), r = [];
4
4
  return e.forEach((t) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adriansteffan/reactive",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -98,13 +98,9 @@ export const Tutorial = ({
98
98
  const canProgress = progressMap[page] !== false;
99
99
 
100
100
  const prevCanProgress = useRef(canProgress);
101
- const [pulse, setPulse] = useState(false);
101
+ const [pulseKey, setPulseKey] = useState(0);
102
102
  useEffect(() => {
103
- if (canProgress && !prevCanProgress.current) {
104
- setPulse(true);
105
- const timer = setTimeout(() => setPulse(false), 300);
106
- return () => clearTimeout(timer);
107
- }
103
+ if (canProgress && !prevCanProgress.current) setPulseKey((k) => k + 1);
108
104
  prevCanProgress.current = canProgress;
109
105
  }, [canProgress]);
110
106
 
@@ -230,11 +226,12 @@ export const Tutorial = ({
230
226
 
231
227
  <div style={{ justifySelf: 'start', marginLeft: '1rem' }}>
232
228
  <motion.button
229
+ key={pulseKey}
233
230
  onClick={goNextIfCan}
234
231
  tabIndex={-1}
235
232
  onKeyDown={(e) => { if (e.key === ' ' || e.key === 'Enter') e.preventDefault(); }}
236
- animate={{ scale: pulse ? 1.2 : 1 }}
237
- transition={{ type: 'spring', stiffness: 500, damping: 15 }}
233
+ animate={{ scale: [1, 1.2, 1] }}
234
+ transition={{ duration: 0.3 }}
238
235
  className={(canProgress ? NAV_BTN_ACTIVE : NAV_BTN_DISABLED) + (page === slides.length - 1 ? ' px-8' : '')}
239
236
  >
240
237
  {page === slides.length - 1 ? finishText : '→'}