@adriansteffan/reactive 0.1.7 → 0.1.8
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.
- package/dist/{mod-1ywzhVpK.js → mod-mnMF_iBn.js} +5 -5
- package/dist/reactive.es.js +1 -1
- package/dist/reactive.umd.js +1 -1
- package/dist/{web-CBs3GYkE.js → web-BOQjjxqz.js} +1 -1
- package/dist/{web-DB83W6nu.js → web-C8o1fEqF.js} +1 -1
- package/package.json +1 -1
- package/src/components/randomdotkinetogram.tsx +3 -3
|
@@ -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-
|
|
78629
|
+
web: () => import("./web-C8o1fEqF.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 = xV({
|
|
@@ -78884,7 +78884,7 @@ var iw;
|
|
|
78884
78884
|
i.None = "NONE", i.Slide = "SLIDE", i.Fade = "FADE";
|
|
78885
78885
|
})(iw || (iw = {}));
|
|
78886
78886
|
const X3 = wu("StatusBar"), e7 = wu("ImmersiveMode", {
|
|
78887
|
-
web: () => import("./web-
|
|
78887
|
+
web: () => import("./web-BOQjjxqz.js").then((i) => new i.ImmersiveModeWeb())
|
|
78888
78888
|
});
|
|
78889
78889
|
Ai("EnterFullscreen", "session");
|
|
78890
78890
|
vi("EnterFullscreen", xu, {});
|
|
@@ -85919,10 +85919,10 @@ vi("RandomDotKinematogram", (i, e, t, s) => {
|
|
|
85919
85919
|
}, {
|
|
85920
85920
|
respond: (i, e) => {
|
|
85921
85921
|
const t = Vae({
|
|
85922
|
-
driftRate:
|
|
85923
|
-
boundaries: 0.
|
|
85922
|
+
driftRate: { type: "normal", mean: 5e-3 * (i.coherence ?? xr.coherence), sd: 12e-4 },
|
|
85923
|
+
boundaries: 0.75,
|
|
85924
85924
|
startingPoint: 0,
|
|
85925
|
-
noiseLevel:
|
|
85925
|
+
noiseLevel: 0.02,
|
|
85926
85926
|
sensoryDelay: { type: "uniform", min: 150, max: 250 },
|
|
85927
85927
|
motorDelay: { type: "uniform", min: 130, max: 210 },
|
|
85928
85928
|
timeLimit: i.duration ?? xr.duration,
|
package/dist/reactive.es.js
CHANGED
|
@@ -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-
|
|
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-mnMF_iBn.js";
|
|
2
2
|
export {
|
|
3
3
|
e as Bounce,
|
|
4
4
|
t as CanvasBlock,
|
package/dist/reactive.umd.js
CHANGED
|
@@ -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"),A.contains(R)&&A.removeChild(R)}},[e]),L.jsx(Ave,{isPresent:e,childRef:o,sizeRef:l,pop:n,children:n===!1?i:p.cloneElement(i,{ref:c})})}const _ve=({children:i,initial:e,isPresent:t,onExitComplete:s,custom:r,presenceAffectsLayout:n,mode:a,anchorX:o,anchorY:l,root:u})=>{const h=Jg(Dve),c=S.useId();let d=!0,f=S.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}),S.useMemo(()=>{h.forEach((y,v)=>h.set(v,!1))},[t]),p.useEffect(()=>{!t&&!h.size&&s&&s()},[t]),i=L.jsx(Lve,{pop:a==="popLayout",isPresent:t,anchorX:o,anchorY:l,root:u,children:i}),L.jsx(Sd.Provider,{value:f,children:i})};function Dve(){return new Map}function X7(i=!0){const e=S.useContext(Sd);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:s,register:r}=e,n=S.useId();S.useEffect(()=>{if(i)return r(n)},[i]);const a=S.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 S.Children.forEach(i,t=>{S.isValidElement(t)&&e.push(t)}),e}const kve=({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=S.useMemo(()=>e4(i),[i]),f=a&&!h?[]:d.map(Wd),y=S.useRef(!0),v=S.useRef(d),m=Jg(()=>new Map),g=S.useRef(new Set),[b,x]=S.useState(d),[P,R]=S.useState(d);Yg(()=>{y.current=!1,v.current=d;for(let T=0;T<P.length;T++){const k=Wd(P[T]);f.includes(k)?(m.delete(k),g.current.delete(k)):m.get(k)!==!0&&m.set(k,!1)}},[P,f.length,f.join("-")]);const A=[];if(d!==b){let T=[...d];for(let k=0;k<P.length;k++){const q=P[k],B=Wd(q);f.includes(B)||(T.splice(k,0,q),A.push(q))}return n==="wait"&&A.length&&(T=A),R(e4(T)),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:_}=S.useContext(vu);return L.jsx(L.Fragment,{children:P.map(T=>{const k=Wd(T),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||_(),R(v.current),a&&(c==null||c()),s&&s())};return L.jsx(_ve,{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:T},k)})})},Ove=S.createContext(null);function Mve(){const i=S.useRef(!1);return Yg(()=>(i.current=!0,()=>{i.current=!1}),[]),i}function Nve(){const i=Mve(),[e,t]=S.useState(0),s=S.useCallback(()=>{i.current&&t(e+1)},[e]);return[S.useCallback(()=>Tt.postRender(s),[s]),e]}const t4=i=>i===!0,Fve=i=>t4(i===!0)||i==="id",qve=({children:i,id:e,inherit:t=!0})=>{const s=S.useContext(vu),r=S.useContext(Ove),[n,a]=Nve(),o=S.useRef(null),l=s.id||r;o.current===null&&(Fve(t)&&l&&(e=e?l+"-"+e:l),o.current={id:e,group:t4(t)&&s.group||Z7()});const u=S.useMemo(()=>({...o.current,forceRender:n}),[a]);return L.jsx(vu.Provider,{value:u,children:i})},s4=S.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 Bve(){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 Bve(),vge()}function $ve(i){const e=n4();for(const t in i)e[t]={...e[t],...i[t]};Z3(e)}const Hve=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")||Hve.has(i)}let a4=i=>!Gd(i);function Qve(i){typeof i=="function"&&(a4=e=>e.startsWith("on")?!Gd(e):i(e))}try{Qve(require("@emotion/is-prop-valid").default)}catch{}function Uve(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=S.createContext({});function zve(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 jve(i){const{initial:e,animate:t}=zve(i,S.useContext(Kd));return S.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 Wve({transformTemplate:i},e){return S.useMemo(()=>{const t=r0();return Zv(t,e,i),Object.assign({},t.vars,t.style)},[e])}function Gve(i,e){const t=i.style||{},s={};return l4(s,t,i),Object.assign(s,Wve(i,e)),s}function Kve(i,e){const t={},s=Gve(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 Zve(i,e,t,s){const r=S.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 Jve=["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:!!(Jve.indexOf(i)>-1||/[A-Z]/u.test(i))}function Yve(i,e,t,{latestValues:s},r,n=!1,a){const l=(a??n0(i)?Zve:Kve)(e,s,r,i),u=Uve(e,typeof i=="string",n),h=i!==S.Fragment?{...u,...l,ref:t}:{},{children:c}=e,d=S.useMemo(()=>ks(c)?c.get():c,[c]);return S.createElement(i,{...h,children:d})}function Xve({scrapeMotionValuesFromProps:i,createRenderState:e},t,s,r){return{latestValues:e0e(t,s,r,i),renderState:e()}}function e0e(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=S.useContext(Kd),r=S.useContext(Sd),n=()=>Xve(i,e,s,r);return t?n():Jg(n)},t0e=h4({scrapeMotionValuesFromProps:Yv,createRenderState:r0}),s0e=h4({scrapeMotionValuesFromProps:f7,createRenderState:u4}),i0e=Symbol.for("motionComponentSymbol");function r0e(i,e,t){const s=S.useRef(t);S.useInsertionEffect(()=>{s.current=t});const r=S.useRef(null);return S.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=S.createContext({});function jo(i){return i&&typeof i=="object"&&Object.prototype.hasOwnProperty.call(i,"current")}function n0e(i,e,t,s,r,n){var x,P;const{visualElement:a}=S.useContext(Kd),o=S.useContext(s4),l=S.useContext(Sd),u=S.useContext(i0),h=u.reducedMotion,c=u.skipAnimations,d=S.useRef(null),f=S.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=S.useContext(c4);y&&!y.projection&&r&&(y.type==="html"||y.type==="svg")&&a0e(d.current,t,r,v);const m=S.useRef(!1);S.useInsertionEffect(()=>{y&&m.current&&y.update(t,l)});const g=t[T3],b=S.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())}),S.useEffect(()=>{y&&(!b.current&&y.animationState&&y.animationState.animateChanges(),b.current&&(queueMicrotask(()=>{var R;(R=window.MotionHandoffMarkAsComplete)==null||R.call(window,g)}),b.current=!1),y.enteringChildren=void 0)}),y}function a0e(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&&$ve(s);const n=t?t==="svg":n0(i),a=n?s0e:t0e;function o(u,h){let c;const d={...S.useContext(i0),...u,layoutId:o0e(u)},{isStatic:f}=d,y=jve(u),v=a(u,f);if(!f&&typeof window<"u"){l0e(d,s);const m=u0e(d);c=m.MeasureLayout,y.visualElement=n0e(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,Yve(i,u,r0e(v,y.visualElement,h),v,f,e,n)]})}o.displayName=`motion.${typeof i=="string"?i:`create(${i.displayName??i.name??""})`}`;const l=S.forwardRef(o);return l[i0e]=i,l}function o0e({layoutId:i}){const e=S.useContext(vu).id;return e&&i!==void 0?e+"-"+i:i}function l0e(i,e){const t=S.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 u0e(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 h0e(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 c0e=(i,e)=>e.isSVG??n0(i)?new kge(e):new Ige(e,{allowProjection:i!==S.Fragment});class d0e extends Zn{constructor(e){super(e),e.animationState||(e.animationState=qge(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 p0e=0;class f0e extends Zn{constructor(){super(...arguments),this.id=p0e++,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 m0e={animation:{Feature:d0e},exit:{Feature:f0e}};function Ru(i){return{point:{x:i.pageX,y:i.pageY}}}const g0e=i=>e=>$v(e)&&i(e,Ru(e));function Au(i,e,t,s){return Iu(i,e,g0e(t),s)}const p4=({current:i})=>i?i.ownerDocument.defaultView:null,f4=(i,e)=>Math.abs(i-e);function v0e(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=v0e(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,y0e(e)),velocity:C0e(e,.1)}}function y0e(i){return i[0]}function y4(i){return i[i.length-1]}function C0e(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 b0e(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 w0e(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 x0e(i,e){return{x:b4(i.x,e.x),y:b4(i.y,e.y)}}function E0e(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 V0e(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 S0e(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 T0e=new WeakMap;class P0e{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=Wme(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=R0e(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=b0e(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=w0e(s.layoutBox,e):this.constraints=!1,this.elastic=S0e(t),r!==this.constraints&&!jo(e)&&s&&this.constraints&&!this.hasMutatedConstraints&&kr(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=V0e(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=xge(s,r.root,this.visualElement.getTransformPagePoint());let a=x0e(r.layout.layoutBox,n);if(t){const o=t(Cge(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]=E0e({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;T0e.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&&Xme(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=I0e(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 I0e(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 R0e(i,e=10){let t=null;return Math.abs(i.y)>e?t="y":Math.abs(i.x)>e&&(t="x"),t}class A0e extends Zn{constructor(e){super(e),this.removeGroupControls=Hi,this.removeListeners=Hi,this.controls=new P0e(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 L0e 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 _0e extends S.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=S.useContext(vu);return L.jsx(_0e,{...i,layoutGroup:s,switchLayoutGroup:S.useContext(c4),isPresent:e,safeToRemove:t})}const D0e={pan:{Feature:L0e},drag:{Feature:A0e,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 k0e extends Zn{mount(){const{current:e}=this.node;e&&(this.unmount=Kme(e,(t,s)=>(S4(this.node,s,"Start"),r=>S4(this.node,r,"End"))))}unmount(){}}class O0e 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 M0e extends Zn{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:t,propagate:s}=this.node.props;this.unmount=tge(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,N0e=i=>{const e=c0.get(i.target);e&&e(i)},F0e=i=>{i.forEach(N0e)};function q0e({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(F0e,{root:i,...e})),s[r]}function B0e(i,e,t){const s=q0e(e);return c0.set(i,t),s.observe(i),()=>{c0.delete(i),s.unobserve(i)}}const $0e={some:0,all:1};class H0e 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:$0e[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=B0e(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(Q0e(e,t))&&this.startObserver()}unmount(){var e;(e=this.stopObserver)==null||e.call(this),this.hasEnteredView=!1,this.isInView=!1}}function Q0e({viewport:i={}},{viewport:e={}}={}){return t=>i[t]!==e[t]}const U0e={...m0e,...{inView:{Feature:H0e},tap:{Feature:M0e},focus:{Feature:O0e},hover:{Feature:k0e}},...D0e,...{layout:{ProjectionNode:J7,MeasureLayout:V4}}},z0e=h0e(U0e,c0e);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 P4=S.createContext({setCanProgress:()=>{},autoAdvance:()=>{},setSlideData:()=>{}}),j0e=({locked:i=!1}={})=>{const e=S.useContext(P4),t=S.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)}}},I4="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",R4=I4+" bg-white text-black cursor-pointer hover:translate-x-[2px] hover:translate-y-[2px] hover:shadow-none",W0e=I4+" bg-gray-200 text-gray-400 border-gray-400 shadow-[2px_2px_0px_rgba(156,163,175,1)] cursor-default",A4=({next:i,slides:e,fadeDuration:t=.3,finishText:s="Start",containerClass:r,nextKey:n="ArrowRight",backKey:a="ArrowLeft",theme:o="light"})=>{const[l,u]=S.useState(0),[h,c]=S.useState({}),d=S.useRef(),f=S.useRef({}),y=h[l]!==!1,v=S.useCallback(R=>{c(A=>({...A,[l]:R}))},[l]),m=S.useCallback(R=>{f.current[l]={...f.current[l],...R}},[l]),g=S.useCallback(()=>{l===e.length-1?i({slides:f.current}):u(R=>R+1)},[l,e.length,i]),b=S.useCallback(()=>{y&&g()},[y,g]),x=S.useCallback((R=0)=>{d.current&&clearTimeout(d.current),d.current=setTimeout(()=>g(),R)},[g]);S.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]);const P=S.useCallback(()=>{l>0&&u(R=>R-1)},[l]);return S.useEffect(()=>{if(n===!1&&a===!1)return;const R=A=>{n&&A.key===n&&b(),a&&A.key===a&&P()};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[n,a,b,P]),L.jsx(qve,{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(kve,{mode:"sync",children:L.jsx(z0e.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(P4.Provider,{value:{setCanProgress:v,autoAdvance:x,setSlideData:m},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:P,className:R4,tabIndex:-1,style:{visibility:l>0?"visible":"hidden"},children:"←"})}),L.jsx("div",{style:{display:"flex",gap:6},children:e.map((R,A)=>L.jsx("div",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:A===l?o==="dark"?"#fff":"#000":o==="dark"?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.2)",transition:"background-color 0.2s"}},A))}),L.jsx("div",{style:{justifySelf:"start",marginLeft:"1rem"},children:L.jsx("button",{onClick:b,tabIndex:-1,className:(y?R4: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:74e-5*(i.coherence??Or.coherence),boundaries:.0555,startingPoint:0,noiseLevel:.00316,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,L4=.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,R=v*v/g+m*m/b-1,A=P*P-x*R;if(A>=0){const _=(P+Math.sqrt(A))/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,R=f!==0?(g-l.y)/f:-1/0,A=Math.max(Math.min(b,x),Math.min(P,R)),_=Math.min(Math.max(b,x),Math.max(P,R));return _>0&&A<=_&&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},_4=S.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:R,reinsertMode:A,noiseMovement:_,reassignEveryMs:T,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=S.useRef(null),ae=S.useRef(),ce=S.useRef(),Ae=S.useRef(),ve=S.useRef(0),ie=S.useRef(0),xe=S.useRef([]),et=S.useRef(null),Xt=S.useRef(!1),jt=P??t/2,Os=R??s/2,Et=S.useMemo(()=>Z0e(g,b,x,jt,Os),[g,b,x,jt,Os]),fs=S.useMemo(()=>{const Oe=(90-a)*Math.PI/180;return[Math.cos(Oe),-Math.sin(Oe)]},[a]),is=S.useRef([]),_e=S.useRef(0);S.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)}))},[]),S.useEffect(()=>{typeof K=="number"&&K>=20&&K<=300&&(et.current=1e3/K,Xt.current=!0)},[K]),S.useImperativeHandle(e,()=>({getStats:()=>({framesDisplayed:ie.current,measuredRefreshRate:et.current?Math.round(1e3/et.current):null})}));const tt=S.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=S.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=S.useCallback(Oe=>{H&&Et.drawBorder(Oe,$,Q)},[H,$,Q,Et]),gt=S.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=L4*rs+(1-L4)*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(T!==void 0)if(T===0)Ys=!0;else{ve.current+=bs;const J=Xt.current&&et.current?et.current*.5:0;Ys=ve.current+J>=T,Ys&&(ve.current%=T)}const ji=Ys?K0e(r,o,l,_):null,ra=is.current[_e.current].map((J,re)=>Y0e(J,zi,bs,h,Et,A,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,A,n,d,fs,c,tt,Bt,Ht,T]);return S.useEffect(()=>(ae.current=requestAnimationFrame(gt),()=>{ae.current&&cancelAnimationFrame(ae.current)}),[gt]),S.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})}),D4=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:R,backgroundColor:A,apertureShape:_,apertureWidth:T,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=S.useRef(i);ue.current=i;const ae=S.useRef(null),ce=S.useRef(performance.now()),Ae=S.useRef(!1),ve=S.useRef(null),ie=S.useRef(null),[xe,et]=S.useState(null),[Xt,jt]=S.useState(D<=0),[Os,Et]=S.useState(!0),fs=e==null?void 0:e._reactiveScreenRefreshRate,is=S.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 S.useEffect(()=>{if(D<=0)return;const _e=setTimeout(()=>jt(!0),D);return()=>clearTimeout(_e)},[D]),S.useEffect(()=>{const _e=t??c;if(_e<=0)return;const tt=setTimeout(()=>Et(!1),D+_e);return()=>clearTimeout(tt)},[D,t,c]),S.useEffect(()=>{if(c<=0)return;const _e=setTimeout(()=>{is(ve.current,ie.current)},D+c);return()=>clearTimeout(_e)},[D,c,is]),S.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:A},children:[L.jsx(_4,{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:R,coherentDotColor:n,backgroundColor:A,apertureShape:_,apertureWidth:T,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:Upe,Tutorial:A4,RandomDotKinematogram:D4},e1e={voicerecorder:bne};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=Bpe(),a=S.useMemo(()=>Xh(i),[i]),o=S.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]=S.useState(0),h=S.useRef(Ps()),c=S.useRef({}),[d,f]=S.useState(()=>In(a,0,()=>c.current,()=>o.current,B=>{c.current={...c.current,...B}})),y=!n&&ma("hybridSimulation",!1,"boolean")?"hybrid":"none",v=S.useRef(r||{}),m=S.useRef(-1),g={...X0e,...t},b={...e1e,...s},x=S.useMemo(()=>{const B=a.instructions.length;return B>0?d/B:0},[d,a.instructions]);S.useEffect(()=>{window.scrollTo(0,0)},[d]);function P(B){c.current={...c.current,...B}}function R(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 A=S.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=S.useRef(null),H=S.useRef(null);S.useEffect(()=>{if(D.current=Ps(),U)return A(W=>{H.current=W,P({_reactiveScreenRefreshRate:W})})},[]);const Q=S.Children.map(B,$=>{if(S.isValidElement($)){const W=(K,oe,ee)=>{const ue=Ps(),ae=oe!==void 0?oe:D.current;R(K,ae??void 0,(ee!==void 0?ee:ue)??void 0)};return S.cloneElement($,{...$.props,next:W})}return $});return L.jsx(L.Fragment,{children:Q})},T=a.instructions[d],k=S.useMemo(()=>{if(y==="none"||(T==null?void 0:T.type)!=="ExecuteContent")return!1;const B=T.content;return!p0(B)||B.simulate===!1?!1:!!B.simulate||!!B.simulators},[d,y,T]);S.useEffect(()=>{k&&m.current!==d&&(m.current=d,(async()=>{const B=T.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),R(Q.responseData)})())},[k,d]);let q=null;if((T==null?void 0:T.type)==="ExecuteContent"&&!k){const B=T.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:R,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"),A.contains(R)&&A.removeChild(R)}},[e]),L.jsx(Ave,{isPresent:e,childRef:o,sizeRef:l,pop:n,children:n===!1?i:p.cloneElement(i,{ref:c})})}const _ve=({children:i,initial:e,isPresent:t,onExitComplete:s,custom:r,presenceAffectsLayout:n,mode:a,anchorX:o,anchorY:l,root:u})=>{const h=Jg(Dve),c=S.useId();let d=!0,f=S.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}),S.useMemo(()=>{h.forEach((y,v)=>h.set(v,!1))},[t]),p.useEffect(()=>{!t&&!h.size&&s&&s()},[t]),i=L.jsx(Lve,{pop:a==="popLayout",isPresent:t,anchorX:o,anchorY:l,root:u,children:i}),L.jsx(Sd.Provider,{value:f,children:i})};function Dve(){return new Map}function X7(i=!0){const e=S.useContext(Sd);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:s,register:r}=e,n=S.useId();S.useEffect(()=>{if(i)return r(n)},[i]);const a=S.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 S.Children.forEach(i,t=>{S.isValidElement(t)&&e.push(t)}),e}const kve=({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=S.useMemo(()=>e4(i),[i]),f=a&&!h?[]:d.map(Wd),y=S.useRef(!0),v=S.useRef(d),m=Jg(()=>new Map),g=S.useRef(new Set),[b,x]=S.useState(d),[P,R]=S.useState(d);Yg(()=>{y.current=!1,v.current=d;for(let T=0;T<P.length;T++){const k=Wd(P[T]);f.includes(k)?(m.delete(k),g.current.delete(k)):m.get(k)!==!0&&m.set(k,!1)}},[P,f.length,f.join("-")]);const A=[];if(d!==b){let T=[...d];for(let k=0;k<P.length;k++){const q=P[k],B=Wd(q);f.includes(B)||(T.splice(k,0,q),A.push(q))}return n==="wait"&&A.length&&(T=A),R(e4(T)),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:_}=S.useContext(vu);return L.jsx(L.Fragment,{children:P.map(T=>{const k=Wd(T),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||_(),R(v.current),a&&(c==null||c()),s&&s())};return L.jsx(_ve,{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:T},k)})})},Ove=S.createContext(null);function Mve(){const i=S.useRef(!1);return Yg(()=>(i.current=!0,()=>{i.current=!1}),[]),i}function Nve(){const i=Mve(),[e,t]=S.useState(0),s=S.useCallback(()=>{i.current&&t(e+1)},[e]);return[S.useCallback(()=>Tt.postRender(s),[s]),e]}const t4=i=>i===!0,Fve=i=>t4(i===!0)||i==="id",qve=({children:i,id:e,inherit:t=!0})=>{const s=S.useContext(vu),r=S.useContext(Ove),[n,a]=Nve(),o=S.useRef(null),l=s.id||r;o.current===null&&(Fve(t)&&l&&(e=e?l+"-"+e:l),o.current={id:e,group:t4(t)&&s.group||Z7()});const u=S.useMemo(()=>({...o.current,forceRender:n}),[a]);return L.jsx(vu.Provider,{value:u,children:i})},s4=S.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 Bve(){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 Bve(),vge()}function $ve(i){const e=n4();for(const t in i)e[t]={...e[t],...i[t]};Z3(e)}const Hve=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")||Hve.has(i)}let a4=i=>!Gd(i);function Qve(i){typeof i=="function"&&(a4=e=>e.startsWith("on")?!Gd(e):i(e))}try{Qve(require("@emotion/is-prop-valid").default)}catch{}function Uve(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=S.createContext({});function zve(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 jve(i){const{initial:e,animate:t}=zve(i,S.useContext(Kd));return S.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 Wve({transformTemplate:i},e){return S.useMemo(()=>{const t=r0();return Zv(t,e,i),Object.assign({},t.vars,t.style)},[e])}function Gve(i,e){const t=i.style||{},s={};return l4(s,t,i),Object.assign(s,Wve(i,e)),s}function Kve(i,e){const t={},s=Gve(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 Zve(i,e,t,s){const r=S.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 Jve=["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:!!(Jve.indexOf(i)>-1||/[A-Z]/u.test(i))}function Yve(i,e,t,{latestValues:s},r,n=!1,a){const l=(a??n0(i)?Zve:Kve)(e,s,r,i),u=Uve(e,typeof i=="string",n),h=i!==S.Fragment?{...u,...l,ref:t}:{},{children:c}=e,d=S.useMemo(()=>ks(c)?c.get():c,[c]);return S.createElement(i,{...h,children:d})}function Xve({scrapeMotionValuesFromProps:i,createRenderState:e},t,s,r){return{latestValues:e0e(t,s,r,i),renderState:e()}}function e0e(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=S.useContext(Kd),r=S.useContext(Sd),n=()=>Xve(i,e,s,r);return t?n():Jg(n)},t0e=h4({scrapeMotionValuesFromProps:Yv,createRenderState:r0}),s0e=h4({scrapeMotionValuesFromProps:f7,createRenderState:u4}),i0e=Symbol.for("motionComponentSymbol");function r0e(i,e,t){const s=S.useRef(t);S.useInsertionEffect(()=>{s.current=t});const r=S.useRef(null);return S.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=S.createContext({});function jo(i){return i&&typeof i=="object"&&Object.prototype.hasOwnProperty.call(i,"current")}function n0e(i,e,t,s,r,n){var x,P;const{visualElement:a}=S.useContext(Kd),o=S.useContext(s4),l=S.useContext(Sd),u=S.useContext(i0),h=u.reducedMotion,c=u.skipAnimations,d=S.useRef(null),f=S.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=S.useContext(c4);y&&!y.projection&&r&&(y.type==="html"||y.type==="svg")&&a0e(d.current,t,r,v);const m=S.useRef(!1);S.useInsertionEffect(()=>{y&&m.current&&y.update(t,l)});const g=t[T3],b=S.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())}),S.useEffect(()=>{y&&(!b.current&&y.animationState&&y.animationState.animateChanges(),b.current&&(queueMicrotask(()=>{var R;(R=window.MotionHandoffMarkAsComplete)==null||R.call(window,g)}),b.current=!1),y.enteringChildren=void 0)}),y}function a0e(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&&$ve(s);const n=t?t==="svg":n0(i),a=n?s0e:t0e;function o(u,h){let c;const d={...S.useContext(i0),...u,layoutId:o0e(u)},{isStatic:f}=d,y=jve(u),v=a(u,f);if(!f&&typeof window<"u"){l0e(d,s);const m=u0e(d);c=m.MeasureLayout,y.visualElement=n0e(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,Yve(i,u,r0e(v,y.visualElement,h),v,f,e,n)]})}o.displayName=`motion.${typeof i=="string"?i:`create(${i.displayName??i.name??""})`}`;const l=S.forwardRef(o);return l[i0e]=i,l}function o0e({layoutId:i}){const e=S.useContext(vu).id;return e&&i!==void 0?e+"-"+i:i}function l0e(i,e){const t=S.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 u0e(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 h0e(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 c0e=(i,e)=>e.isSVG??n0(i)?new kge(e):new Ige(e,{allowProjection:i!==S.Fragment});class d0e extends Zn{constructor(e){super(e),e.animationState||(e.animationState=qge(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 p0e=0;class f0e extends Zn{constructor(){super(...arguments),this.id=p0e++,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 m0e={animation:{Feature:d0e},exit:{Feature:f0e}};function Ru(i){return{point:{x:i.pageX,y:i.pageY}}}const g0e=i=>e=>$v(e)&&i(e,Ru(e));function Au(i,e,t,s){return Iu(i,e,g0e(t),s)}const p4=({current:i})=>i?i.ownerDocument.defaultView:null,f4=(i,e)=>Math.abs(i-e);function v0e(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=v0e(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,y0e(e)),velocity:C0e(e,.1)}}function y0e(i){return i[0]}function y4(i){return i[i.length-1]}function C0e(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 b0e(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 w0e(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 x0e(i,e){return{x:b4(i.x,e.x),y:b4(i.y,e.y)}}function E0e(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 V0e(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 S0e(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 T0e=new WeakMap;class P0e{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=Wme(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=R0e(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=b0e(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=w0e(s.layoutBox,e):this.constraints=!1,this.elastic=S0e(t),r!==this.constraints&&!jo(e)&&s&&this.constraints&&!this.hasMutatedConstraints&&kr(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=V0e(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=xge(s,r.root,this.visualElement.getTransformPagePoint());let a=x0e(r.layout.layoutBox,n);if(t){const o=t(Cge(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]=E0e({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;T0e.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&&Xme(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=I0e(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 I0e(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 R0e(i,e=10){let t=null;return Math.abs(i.y)>e?t="y":Math.abs(i.x)>e&&(t="x"),t}class A0e extends Zn{constructor(e){super(e),this.removeGroupControls=Hi,this.removeListeners=Hi,this.controls=new P0e(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 L0e 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 _0e extends S.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=S.useContext(vu);return L.jsx(_0e,{...i,layoutGroup:s,switchLayoutGroup:S.useContext(c4),isPresent:e,safeToRemove:t})}const D0e={pan:{Feature:L0e},drag:{Feature:A0e,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 k0e extends Zn{mount(){const{current:e}=this.node;e&&(this.unmount=Kme(e,(t,s)=>(S4(this.node,s,"Start"),r=>S4(this.node,r,"End"))))}unmount(){}}class O0e 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 M0e extends Zn{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:t,propagate:s}=this.node.props;this.unmount=tge(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,N0e=i=>{const e=c0.get(i.target);e&&e(i)},F0e=i=>{i.forEach(N0e)};function q0e({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(F0e,{root:i,...e})),s[r]}function B0e(i,e,t){const s=q0e(e);return c0.set(i,t),s.observe(i),()=>{c0.delete(i),s.unobserve(i)}}const $0e={some:0,all:1};class H0e 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:$0e[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=B0e(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(Q0e(e,t))&&this.startObserver()}unmount(){var e;(e=this.stopObserver)==null||e.call(this),this.hasEnteredView=!1,this.isInView=!1}}function Q0e({viewport:i={}},{viewport:e={}}={}){return t=>i[t]!==e[t]}const U0e={...m0e,...{inView:{Feature:H0e},tap:{Feature:M0e},focus:{Feature:O0e},hover:{Feature:k0e}},...D0e,...{layout:{ProjectionNode:J7,MeasureLayout:V4}}},z0e=h0e(U0e,c0e);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 P4=S.createContext({setCanProgress:()=>{},autoAdvance:()=>{},setSlideData:()=>{}}),j0e=({locked:i=!1}={})=>{const e=S.useContext(P4),t=S.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)}}},I4="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",R4=I4+" bg-white text-black cursor-pointer hover:translate-x-[2px] hover:translate-y-[2px] hover:shadow-none",W0e=I4+" bg-gray-200 text-gray-400 border-gray-400 shadow-[2px_2px_0px_rgba(156,163,175,1)] cursor-default",A4=({next:i,slides:e,fadeDuration:t=.3,finishText:s="Start",containerClass:r,nextKey:n="ArrowRight",backKey:a="ArrowLeft",theme:o="light"})=>{const[l,u]=S.useState(0),[h,c]=S.useState({}),d=S.useRef(),f=S.useRef({}),y=h[l]!==!1,v=S.useCallback(R=>{c(A=>({...A,[l]:R}))},[l]),m=S.useCallback(R=>{f.current[l]={...f.current[l],...R}},[l]),g=S.useCallback(()=>{l===e.length-1?i({slides:f.current}):u(R=>R+1)},[l,e.length,i]),b=S.useCallback(()=>{y&&g()},[y,g]),x=S.useCallback((R=0)=>{d.current&&clearTimeout(d.current),d.current=setTimeout(()=>g(),R)},[g]);S.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]);const P=S.useCallback(()=>{l>0&&u(R=>R-1)},[l]);return S.useEffect(()=>{if(n===!1&&a===!1)return;const R=A=>{n&&A.key===n&&b(),a&&A.key===a&&P()};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[n,a,b,P]),L.jsx(qve,{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(kve,{mode:"sync",children:L.jsx(z0e.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(P4.Provider,{value:{setCanProgress:v,autoAdvance:x,setSlideData:m},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:P,className:R4,tabIndex:-1,style:{visibility:l>0?"visible":"hidden"},children:"←"})}),L.jsx("div",{style:{display:"flex",gap:6},children:e.map((R,A)=>L.jsx("div",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:A===l?o==="dark"?"#fff":"#000":o==="dark"?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.2)",transition:"background-color 0.2s"}},A))}),L.jsx("div",{style:{justifySelf:"start",marginLeft:"1rem"},children:L.jsx("button",{onClick:b,tabIndex:-1,className:(y?R4: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,L4=.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,R=v*v/g+m*m/b-1,A=P*P-x*R;if(A>=0){const _=(P+Math.sqrt(A))/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,R=f!==0?(g-l.y)/f:-1/0,A=Math.max(Math.min(b,x),Math.min(P,R)),_=Math.min(Math.max(b,x),Math.max(P,R));return _>0&&A<=_&&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},_4=S.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:R,reinsertMode:A,noiseMovement:_,reassignEveryMs:T,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=S.useRef(null),ae=S.useRef(),ce=S.useRef(),Ae=S.useRef(),ve=S.useRef(0),ie=S.useRef(0),xe=S.useRef([]),et=S.useRef(null),Xt=S.useRef(!1),jt=P??t/2,Os=R??s/2,Et=S.useMemo(()=>Z0e(g,b,x,jt,Os),[g,b,x,jt,Os]),fs=S.useMemo(()=>{const Oe=(90-a)*Math.PI/180;return[Math.cos(Oe),-Math.sin(Oe)]},[a]),is=S.useRef([]),_e=S.useRef(0);S.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)}))},[]),S.useEffect(()=>{typeof K=="number"&&K>=20&&K<=300&&(et.current=1e3/K,Xt.current=!0)},[K]),S.useImperativeHandle(e,()=>({getStats:()=>({framesDisplayed:ie.current,measuredRefreshRate:et.current?Math.round(1e3/et.current):null})}));const tt=S.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=S.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=S.useCallback(Oe=>{H&&Et.drawBorder(Oe,$,Q)},[H,$,Q,Et]),gt=S.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=L4*rs+(1-L4)*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(T!==void 0)if(T===0)Ys=!0;else{ve.current+=bs;const J=Xt.current&&et.current?et.current*.5:0;Ys=ve.current+J>=T,Ys&&(ve.current%=T)}const ji=Ys?K0e(r,o,l,_):null,ra=is.current[_e.current].map((J,re)=>Y0e(J,zi,bs,h,Et,A,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,A,n,d,fs,c,tt,Bt,Ht,T]);return S.useEffect(()=>(ae.current=requestAnimationFrame(gt),()=>{ae.current&&cancelAnimationFrame(ae.current)}),[gt]),S.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})}),D4=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:R,backgroundColor:A,apertureShape:_,apertureWidth:T,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=S.useRef(i);ue.current=i;const ae=S.useRef(null),ce=S.useRef(performance.now()),Ae=S.useRef(!1),ve=S.useRef(null),ie=S.useRef(null),[xe,et]=S.useState(null),[Xt,jt]=S.useState(D<=0),[Os,Et]=S.useState(!0),fs=e==null?void 0:e._reactiveScreenRefreshRate,is=S.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 S.useEffect(()=>{if(D<=0)return;const _e=setTimeout(()=>jt(!0),D);return()=>clearTimeout(_e)},[D]),S.useEffect(()=>{const _e=t??c;if(_e<=0)return;const tt=setTimeout(()=>Et(!1),D+_e);return()=>clearTimeout(tt)},[D,t,c]),S.useEffect(()=>{if(c<=0)return;const _e=setTimeout(()=>{is(ve.current,ie.current)},D+c);return()=>clearTimeout(_e)},[D,c,is]),S.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:A},children:[L.jsx(_4,{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:R,coherentDotColor:n,backgroundColor:A,apertureShape:_,apertureWidth:T,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:Upe,Tutorial:A4,RandomDotKinematogram:D4},e1e={voicerecorder:bne};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=Bpe(),a=S.useMemo(()=>Xh(i),[i]),o=S.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]=S.useState(0),h=S.useRef(Ps()),c=S.useRef({}),[d,f]=S.useState(()=>In(a,0,()=>c.current,()=>o.current,B=>{c.current={...c.current,...B}})),y=!n&&ma("hybridSimulation",!1,"boolean")?"hybrid":"none",v=S.useRef(r||{}),m=S.useRef(-1),g={...X0e,...t},b={...e1e,...s},x=S.useMemo(()=>{const B=a.instructions.length;return B>0?d/B:0},[d,a.instructions]);S.useEffect(()=>{window.scrollTo(0,0)},[d]);function P(B){c.current={...c.current,...B}}function R(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 A=S.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=S.useRef(null),H=S.useRef(null);S.useEffect(()=>{if(D.current=Ps(),U)return A(W=>{H.current=W,P({_reactiveScreenRefreshRate:W})})},[]);const Q=S.Children.map(B,$=>{if(S.isValidElement($)){const W=(K,oe,ee)=>{const ue=Ps(),ae=oe!==void 0?oe:D.current;R(K,ae??void 0,(ee!==void 0?ee:ue)??void 0)};return S.cloneElement($,{...$.props,next:W})}return $});return L.jsx(L.Fragment,{children:Q})},T=a.instructions[d],k=S.useMemo(()=>{if(y==="none"||(T==null?void 0:T.type)!=="ExecuteContent")return!1;const B=T.content;return!p0(B)||B.simulate===!1?!1:!!B.simulate||!!B.simulators},[d,y,T]);S.useEffect(()=>{k&&m.current!==d&&(m.current=d,(async()=>{const B=T.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),R(Q.responseData)})())},[k,d]);let q=null;if((T==null?void 0:T.type)==="ExecuteContent"&&!k){const B=T.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:R,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 k4(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=k4(i),e=k4(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=$pe,X.ExperimentRunner=t1e,X.Flip=Mpe,X.Icons=Ed,X.MicCheck=G2,X.Param=Yh,X.PlainInput=$2,X.ProlificEnding=H2,X.Quest=U5,X.RDKCanvas=_4,X.RandomDotKinematogram=D4,X.RequestFilePermission=yS,X.Slide=kpe,X.Text=rc,X.ToastContainer=gS,X.Tutorial=A4,X.Upload=YV,X.Zoom=Ope,X.arrayFlattener=_2,X.canvasCountdown=Xre,X.chunk=w2,X.collapseToast=aS,X.cssTransition=fu,X.getBackendUrl=R2,X.getInitialParticipant=L2,X.getParam=ma,X.getPlatform=Dl,X.getSimulation=ene,X.halton=y2,X.isDesktop=Jre,X.isFullscreen=uo,X.mapDDMChoice=F2,X.noopSimulate=ho,X.now=Ps,X.orchestrateSimulation=ine,X.pipe=b2,X.registerArrayExtensions=Qre,X.registerComponentParams=vm,X.registerExperimentParams=T2,X.registerFlattener=ni,X.registerSimulation=Qs,X.resolveSimulation=Cm,X.sample=C2,X.sampleParticipants=$re,X.seedDistributions=Ore,X.setBackendUrl=tne,X.shuffle=fm,X.simulateDDMTrial=N2,X.simulateParticipant=sne,X.sobol=v2,X.subsetExperimentByParam=Yre,X.toast=_t,X.useToast=pS,X.useToastContainer=dS,X.useTutorialSlide=j0e,Object.defineProperty(X,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -76,10 +76,10 @@ registerSimulation('RandomDotKinematogram', (trialProps, _experimentState, simul
|
|
|
76
76
|
}, {
|
|
77
77
|
respond: (trialProps: any, participant: any) => {
|
|
78
78
|
const ddm = simulateDDMTrial({
|
|
79
|
-
driftRate: 0.
|
|
80
|
-
boundaries: 0.
|
|
79
|
+
driftRate: { type: 'normal', mean: 0.005 * (trialProps.coherence ?? RDK_DEFAULTS.coherence), sd: 0.0012 },
|
|
80
|
+
boundaries: 0.75,
|
|
81
81
|
startingPoint: 0,
|
|
82
|
-
noiseLevel: 0.
|
|
82
|
+
noiseLevel: 0.02,
|
|
83
83
|
sensoryDelay: { type: 'uniform', min: 150, max: 250 },
|
|
84
84
|
motorDelay: { type: 'uniform', min: 130, max: 210 },
|
|
85
85
|
timeLimit: trialProps.duration ?? RDK_DEFAULTS.duration,
|