@adriansteffan/reactive 0.2.2 → 0.2.3

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.
@@ -16829,12 +16829,13 @@ function AV(i, e) {
16829
16829
  RV[i] = e;
16830
16830
  }
16831
16831
  function RCe(i, e = {}) {
16832
- if (Oae(i), Mm.length = 0, i.forEach((n) => {
16832
+ if (Oae(i), !e.subset) return i;
16833
+ Mm.length = 0, i.forEach((n) => {
16833
16834
  Mm.push({
16834
16835
  type: n.type ?? "NoTypeSpecified",
16835
16836
  name: n.name
16836
16837
  });
16837
- }), !e.subset) return i;
16838
+ });
16838
16839
  const t = ia("includeSubset", void 0), s = ia("excludeSubset", void 0);
16839
16840
  let r = [...i];
16840
16841
  if (t) {
@@ -79109,7 +79110,7 @@ var rg;
79109
79110
  i.UTF8 = "utf8", i.ASCII = "ascii", i.UTF16 = "utf16";
79110
79111
  })(rg || (rg = {}));
79111
79112
  const Ia = Su("Filesystem", {
79112
- web: () => import("./web-Ce2dHghr.js").then((i) => new i.FilesystemWeb())
79113
+ web: () => import("./web-Cng80F8T.js").then((i) => new i.FilesystemWeb())
79113
79114
  });
79114
79115
  ai("Upload", async (i, e, t, s) => {
79115
79116
  const r = i.sessionID || `sim_${Date.now()}_${Math.floor(At(0, 2176782336)).toString(36)}`, n = OV({
@@ -79363,7 +79364,7 @@ var mw;
79363
79364
  i.None = "NONE", i.Slide = "SLIDE", i.Fade = "FADE";
79364
79365
  })(mw || (mw = {}));
79365
79366
  const v7 = Su("StatusBar"), y7 = Su("ImmersiveMode", {
79366
- web: () => import("./web-BVQpCNK1.js").then((i) => new i.ImmersiveModeWeb())
79367
+ web: () => import("./web-BDKz297R.js").then((i) => new i.ImmersiveModeWeb())
79367
79368
  });
79368
79369
  xi("EnterFullscreen", "session");
79369
79370
  ai("EnterFullscreen", Tu, {});
@@ -1,4 +1,4 @@
1
- import { A as e, H as t, C as i, a as o, D as r, c as n, d as l, e as m, f as u, g as c, h as p, Y as D, z as d, L as T, M as g, P as C, i as P, j as S, Q as A, R as h, k as v, l as x, F as _, T as k, m as B, n as E, o as M, p as f, U as F, V as I, X as L, q as R, r as U, s as b, t as G, u as K, v as w, w as q, x as y, y as H, B as O, G as j, I as N, J as Q, K as V, N as Y, O as Z, S as z, Z as J, _ as W, $ as X, a0 as $, a1 as aa, a2 as sa, a3 as ea, a4 as ta, a5 as ia, a6 as oa, a7 as ra, a8 as na, a9 as la, aa as ma, ab as ua, ac as ca, ad as pa, ae as Da, af as da, ag as Ta, ah as ga, ai as Ca, aj as Pa, ak as Sa, al as Aa, am as ha, an as va, ao as xa, ap as _a, aq as ka, ar as Ba, as as Ea, at as Ma } from "./mod-CZYkml9p.js";
1
+ import { A as e, H as t, C as i, a as o, D as r, c as n, d as l, e as m, f as u, g as c, h as p, Y as D, z as d, L as T, M as g, P as C, i as P, j as S, Q as A, R as h, k as v, l as x, F as _, T as k, m as B, n as E, o as M, p as f, U as F, V as I, X as L, q as R, r as U, s as b, t as G, u as K, v as w, w as q, x as y, y as H, B as O, G as j, I as N, J as Q, K as V, N as Y, O as Z, S as z, Z as J, _ as W, $ as X, a0 as $, a1 as aa, a2 as sa, a3 as ea, a4 as ta, a5 as ia, a6 as oa, a7 as ra, a8 as na, a9 as la, aa as ma, ab as ua, ac as ca, ad as pa, ae as Da, af as da, ag as Ta, ah as ga, ai as Ca, aj as Pa, ak as Sa, al as Aa, am as ha, an as va, ao as xa, ap as _a, aq as ka, ar as Ba, as as Ea, at as Ma } from "./mod-kduyZSvT.js";
2
2
  export {
3
3
  e as AudioDeviceContext,
4
4
  t as Bounce,
@@ -10145,7 +10145,7 @@
10145
10145
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10146
10146
  * See the License for the specific language governing permissions and
10147
10147
  * limitations under the License.
10148
- */var Yre=st,w2=Qre,Xre=Jre;Yre(w2,"factory",Xre);var ene=w2;const tne=Ga(ene),Rs=new Uint32Array(1);function sne(i){return Rs[0]=i,Rs[0]=(Rs[0]<<16|Rs[0]>>16)>>>0,Rs[0]=(Rs[0]&1431655765)<<1|(Rs[0]&2863311530)>>>1>>>0,Rs[0]=(Rs[0]&858993459)<<2|(Rs[0]&3435973836)>>>2>>>0,Rs[0]=(Rs[0]&252645135)<<4|(Rs[0]&4042322160)>>>4>>>0,Rs[0]=(Rs[0]&16711935)<<8|(Rs[0]&4278255360)>>>8>>>0,Rs[0]*23283064365386963e-26}function ine(i,e){let t=1,s=0;for(;i>0;)t/=e,s+=t*(i%e),i=~~(i/e);return s}const rne=(i,e=[2,3])=>Array.from({length:i},(t,s)=>e.map(r=>r===2?sne(s):ine(s,r)));K.normal=GC,K.poisson=wb,K.uniform=Db;function nne(i){const e=t$.factory({seed:i});K.normal=GC.factory({prng:e.normalized}),K.poisson=wb.factory({prng:e.normalized}),K.uniform=Db.factory({prng:e.normalized}),Math.random=()=>K.uniform(0,1)}function x2(i){return Math.max(1e-10,Math.min(1-1e-10,i))}function bm(i){switch(i.distribution){case"uniform":return e=>i.min+e*(i.max-i.min);case"normal":return e=>fZ(x2(e),i.mean,i.sd);case"poisson":return e=>tne(x2(e),i.mean);case"integer":return e=>Math.floor(i.min+e*(i.max-i.min+1));case"discrete":{const e=i.outcomes.reduce((s,r)=>s+r.weight,0),t=i.outcomes.map((()=>{let s=0;return r=>(s+=r.weight/e,s)})());return s=>{for(let r=0;r<t.length;r++)if(s<t[r])return i.outcomes[r].value;return i.outcomes[i.outcomes.length-1].value}}}}function E2(i,e){const t=e.map(bm);return e.length===1?i.map(s=>t[0](s[0])):i.map(s=>s.map((r,n)=>t[n](r)))}const ane=[[1,0,[1]],[2,1,[1,1]],[3,1,[1,3,7]],[3,2,[1,1,5]],[4,1,[1,3,1,1]],[4,4,[1,1,3,7]],[5,2,[1,3,3,9,9]],[5,13,[1,3,7,13,3]],[5,7,[1,1,5,11,27]],[5,14,[1,3,5,1,15]],[5,11,[1,1,7,3,29]],[5,4,[1,3,7,7,21]],[6,1,[1,1,1,9,23,37]],[6,16,[1,3,3,5,19,33]],[6,13,[1,1,3,13,11,7]],[6,22,[1,1,7,13,25,5]],[6,19,[1,3,5,11,7,11]],[6,25,[1,1,1,3,13,39]],[7,1,[1,3,1,15,17,63,13]],[7,32,[1,1,5,5,1,59,33]]],ho=32,one=2**ho;function lne(i){const e=new Uint32Array(ho);if(i===0){for(let n=0;n<ho;n++)e[n]=1<<ho-1-n;return e}const[t,s,r]=ane[i-1];for(let n=0;n<t;n++)e[n]=r[n]<<ho-1-n;for(let n=t;n<ho;n++){e[n]=e[n-t]^e[n-t]>>>t;for(let a=1;a<t;a++)s>>>t-1-a&1&&(e[n]^=e[n-a])}return e}function une(i,e){if(e<1||e>21)throw new RangeError("sobol() supports 1-21 dimensions");const t=Array.from({length:e},(n,a)=>lne(a)),s=new Uint32Array(e),r=[new Array(e).fill(0)];for(let n=1;n<i;n++){let a=0,o=n-1;for(;(o&1)===1;)o>>>=1,a++;for(let l=0;l<e;l++)s[l]^=t[l][a];r.push(Array.from(s,l=>l/one))}return r}const hne=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73],V2=6;function S2(i,e){const t=une(i+1,e.length).slice(1);return E2(t,e)}function T2(i,e){e.length>V2&&console.warn(`Halton sequence quality degrades above ${V2} dimensions. Consider using sobol() instead.`);const t=hne.slice(0,e.length),s=rne(i+1,t).slice(1);return E2(s,e)}function cne(i,e,t){const s=Object.keys(t),r=s.map(a=>t[a]);let n;switch(i){case"sobol":n=S2(e,r);break;case"halton":n=T2(e,r);break;case"random":n=dne(e,r);break}return Array.from({length:e},(a,o)=>{const l=s.length===1?[n[o]]:n[o];return{index:o,...Object.fromEntries(s.map((u,h)=>[u,l[h]]))}})}function dne(i,e){const t=e.map(bm);return e.length===1?Array.from({length:i},()=>t[0](K.uniform(0,1))):Array.from({length:i},()=>t.map(s=>s(K.uniform(0,1))))}function pne(i){return bm(i)(K.uniform(0,1))}function P2(i,e=1,t={}){const{replace:s=!0}=t;if(i.length===0)return[];if(s){const a=[];for(let o=0;o<e;o++){const l=Math.floor(K.uniform(0,1)*i.length);a.push(i[l])}return a}const r=[];let n=[];for(let a=0;a<e;a++)n.length===0&&(n=sc(i)),r.push(n.pop());return r}function sc(i){const e=[...i];for(let t=e.length-1;t>=0;t--){const s=Math.floor(K.uniform(0,1)*(t+1));[e[t],e[s]]=[e[s],e[t]]}return e}function I2(i,e){return e(i)}function R2(i,e){const t=Math.ceil(i.length/e);return Array.from({length:Math.ceil(i.length/t)},(s,r)=>i.slice(r*t,r*t+t))}function A2(i){return i.length===0?0:i.reduce((e,t)=>e+t,0)/i.length}function L2(i){return i.reduce((e,t)=>e+t,0)}function fne(){typeof Array.prototype.sample!="function"&&(Array.prototype.sample=function(i,e){return P2(this,i,e)}),typeof Array.prototype.shuffle!="function"&&(Array.prototype.shuffle=function(){return sc(this)}),typeof Array.prototype.pipe!="function"&&(Array.prototype.pipe=function(i){return I2(this,i)}),typeof Array.prototype.mean!="function"&&(Array.prototype.mean=function(){return A2(this)}),typeof Array.prototype.sum!="function"&&(Array.prototype.sum=function(){return L2(this)}),typeof Array.prototype.chunk!="function"&&(Array.prototype.chunk=function(i){return R2(this,i)})}/*! Capacitor: https://capacitorjs.com/ - MIT License */var co;(function(i){i.Unimplemented="UNIMPLEMENTED",i.Unavailable="UNAVAILABLE"})(co||(co={}));class wm extends Error{constructor(e,t,s){super(e),this.message=e,this.code=t,this.data=s}}const mne=i=>{var e,t;return i!=null&&i.androidBridge?"android":!((t=(e=i==null?void 0:i.webkit)===null||e===void 0?void 0:e.messageHandlers)===null||t===void 0)&&t.bridge?"ios":"web"},gne=i=>{const e=i.CapacitorCustomPlatform||null,t=i.Capacitor||{},s=t.Plugins=t.Plugins||{},r=()=>e!==null?e.name:mne(i),n=()=>r()!=="web",a=c=>{const d=u.get(c);return!!(d!=null&&d.platforms.has(r())||o(c))},o=c=>{var d;return(d=t.PluginHeaders)===null||d===void 0?void 0:d.find(f=>f.name===c)},l=c=>i.console.error(c),u=new Map,h=(c,d={})=>{const f=u.get(c);if(f)return console.warn(`Capacitor plugin "${c}" already registered. Cannot register plugins twice.`),f.proxy;const y=r(),v=o(c);let m;const g=async()=>(!m&&y in d?m=typeof d[y]=="function"?m=await d[y]():m=d[y]:e!==null&&!m&&"web"in d&&(m=typeof d.web=="function"?m=await d.web():m=d.web),m),b=(P,O)=>{var D,$;if(v){const Q=v==null?void 0:v.methods.find(_=>O===_.name);if(Q)return Q.rtype==="promise"?_=>t.nativePromise(c,O.toString(),_):(_,B)=>t.nativeCallback(c,O.toString(),_,B);if(P)return(D=P[O])===null||D===void 0?void 0:D.bind(P)}else{if(P)return($=P[O])===null||$===void 0?void 0:$.bind(P);throw new wm(`"${c}" plugin is not implemented on ${y}`,co.Unimplemented)}},x=P=>{let O;const D=(...$)=>{const Q=g().then(_=>{const B=b(_,P);if(B){const H=B(...$);return O=H==null?void 0:H.remove,H}else throw new wm(`"${c}.${P}()" is not implemented on ${y}`,co.Unimplemented)});return P==="addListener"&&(Q.remove=async()=>O()),Q};return D.toString=()=>`${P.toString()}() { [capacitor code] }`,Object.defineProperty(D,"name",{value:P,writable:!1,configurable:!1}),D},I=x("addListener"),L=x("removeListener"),A=(P,O)=>{const D=I({eventName:P},O),$=async()=>{const _=await D;L({eventName:P,callbackId:_},O)},Q=new Promise(_=>D.then(()=>_({remove:$})));return Q.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await $()},Q},k=new Proxy({},{get(P,O){switch(O){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return v?A:I;case"removeListener":return L;default:return x(O)}}});return s[c]=k,u.set(c,{name:c,proxy:k,platforms:new Set([...Object.keys(d),...v?[y]:[]])}),k};return t.convertFileSrc||(t.convertFileSrc=c=>c),t.getPlatform=r,t.handleError=l,t.isNativePlatform=n,t.isPluginAvailable=a,t.registerPlugin=h,t.Exception=wm,t.DEBUG=!!t.DEBUG,t.isLoggingEnabled=!!t.isLoggingEnabled,t},Ca=(i=>i.Capacitor=gne(i))(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),Ol=Ca.registerPlugin;class ic{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(e,t){let s=!1;this.listeners[e]||(this.listeners[e]=[],s=!0),this.listeners[e].push(t);const n=this.windowListeners[e];n&&!n.registered&&this.addWindowListener(n),s&&this.sendRetainedArgumentsForEvent(e);const a=async()=>this.removeListener(e,t);return Promise.resolve({remove:a})}async removeAllListeners(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}}notifyListeners(e,t,s){const r=this.listeners[e];if(!r){if(s){let n=this.retainedEventArguments[e];n||(n=[]),n.push(t),this.retainedEventArguments[e]=n}return}r.forEach(n=>n(t))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,t){this.windowListeners[t]={registered:!1,windowEventName:e,pluginEventName:t,handler:s=>{this.notifyListeners(t,s)}}}unimplemented(e="not implemented"){return new Ca.Exception(e,co.Unimplemented)}unavailable(e="not available"){return new Ca.Exception(e,co.Unavailable)}async removeListener(e,t){const s=this.listeners[e];if(!s)return;const r=s.indexOf(t);this.listeners[e].splice(r,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}sendRetainedArgumentsForEvent(e){const t=this.retainedEventArguments[e];t&&(delete this.retainedEventArguments[e],t.forEach(s=>{this.notifyListeners(e,s)}))}}const _2=i=>encodeURIComponent(i).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),D2=i=>i.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class vne extends ic{async getCookies(){const e=document.cookie,t={};return e.split(";").forEach(s=>{if(s.length<=0)return;let[r,n]=s.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");r=D2(r).trim(),n=D2(n).trim(),t[r]=n}),t}async setCookie(e){try{const t=_2(e.key),s=_2(e.value),r=`; expires=${(e.expires||"").replace("expires=","")}`,n=(e.path||"/").replace("path=",""),a=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${t}=${s||""}${r}; path=${n}; ${a};`}catch(t){return Promise.reject(t)}}async deleteCookie(e){try{document.cookie=`${e.key}=; Max-Age=0`}catch(t){return Promise.reject(t)}}async clearCookies(){try{const e=document.cookie.split(";")||[];for(const t of e)document.cookie=t.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}}async clearAllCookies(){try{await this.clearCookies()}catch(e){return Promise.reject(e)}}}Ol("CapacitorCookies",{web:()=>new vne});const yne=async i=>new Promise((e,t)=>{const s=new FileReader;s.onload=()=>{const r=s.result;e(r.indexOf(",")>=0?r.split(",")[1]:r)},s.onerror=r=>t(r),s.readAsDataURL(i)}),Cne=(i={})=>{const e=Object.keys(i);return Object.keys(i).map(r=>r.toLocaleLowerCase()).reduce((r,n,a)=>(r[n]=i[e[a]],r),{})},bne=(i,e=!0)=>i?Object.entries(i).reduce((s,r)=>{const[n,a]=r;let o,l;return Array.isArray(a)?(l="",a.forEach(u=>{o=e?encodeURIComponent(u):u,l+=`${n}=${o}&`}),l.slice(0,-1)):(o=e?encodeURIComponent(a):a,l=`${n}=${o}`),`${s}&${l}`},"").substr(1):null,k2=(i,e={})=>{const t=Object.assign({method:i.method||"GET",headers:i.headers},e),r=Cne(i.headers)["content-type"]||"";if(typeof i.data=="string")t.body=i.data;else if(r.includes("application/x-www-form-urlencoded")){const n=new URLSearchParams;for(const[a,o]of Object.entries(i.data||{}))n.set(a,o);t.body=n.toString()}else if(r.includes("multipart/form-data")||i.data instanceof FormData){const n=new FormData;if(i.data instanceof FormData)i.data.forEach((o,l)=>{n.append(l,o)});else for(const o of Object.keys(i.data))n.append(o,i.data[o]);t.body=n;const a=new Headers(t.headers);a.delete("content-type"),t.headers=a}else(r.includes("application/json")||typeof i.data=="object")&&(t.body=JSON.stringify(i.data));return t};class wne extends ic{async request(e){const t=k2(e,e.webFetchExtra),s=bne(e.params,e.shouldEncodeUrlParams),r=s?`${e.url}?${s}`:e.url,n=await fetch(r,t),a=n.headers.get("content-type")||"";let{responseType:o="text"}=n.ok?e:{};a.includes("application/json")&&(o="json");let l,u;switch(o){case"arraybuffer":case"blob":u=await n.blob(),l=await yne(u);break;case"json":l=await n.json();break;case"document":case"text":default:l=await n.text()}const h={};return n.headers.forEach((c,d)=>{h[d]=c}),{data:l,headers:h,status:n.status,url:n.url}}async get(e){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))}async post(e){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))}async put(e){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))}async patch(e){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))}async delete(e){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))}}Ol("CapacitorHttp",{web:()=>new wne});function As(){return Math.round(performance.now())}function po(){return!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)}function xne(){return window.electronAPI!==void 0}function Ene(i,e){if(!e)return i.at(-1);for(let t=i.length-1;t>=0;t--)if(i[t].type===e)return i[t]}const Ml=[];function en(i,e,t="string",s,r){let n=Ml.find(d=>d.name===i);n||(n={name:i,defaultValue:r!==void 0?r:e,type:t,description:s,value:void 0},Ml.push(n));const a={string:d=>d,number:d=>{const f=Number(d);return isNaN(f)?e:f},boolean:d=>d.toLowerCase()==="true",array:d=>{try{return JSON.parse(d)}catch{return e}},json:d=>{try{return JSON.parse(d)}catch{return e}}},o=d=>t==="string"&&typeof d=="string"||t==="number"&&typeof d=="number"||t==="boolean"&&typeof d=="boolean"||t==="array"&&Array.isArray(d)||t==="json"&&typeof d=="object"&&d!==null?d:typeof d=="string"?d.toLowerCase()==="undefined"?e:a[t](d):e,l=typeof window<"u"?new URLSearchParams(window.location.search):new URLSearchParams,u=l.get("_b");if(u)try{const d=atob(u),f=JSON.parse(d);if(i in f){const y=o(f[i]);return n.value=y,y}}catch{}const h=l.get(i);if(h==null)return e;const c=o(h);return n.value=c,c}const xm=[];class Nl{static getRegistry(){return[...Ml]}static getTimelineRepresentation(){return[...xm]}}const Fl=()=>window.electronAPI?"desktop":Ca.isNativePlatform()?"mobile":"web",O2={};function M2(i){i.forEach(e=>{const t=O2[e.type];if(t)for(const s of t)(!e.hideSettings||e.hideSettings!==!0&&!e.hideSettings.includes(s.name))&&(Ml.some(r=>r.name===s.name)||Ml.push(s))})}function Em(i,e){O2[i]=e}function Vne(i,e={}){if(M2(i),xm.length=0,i.forEach(n=>{xm.push({type:n.type??"NoTypeSpecified",name:n.name})}),!e.subset)return i;const t=en("includeSubset",void 0),s=en("excludeSubset",void 0);let r=[...i];if(t){const n=t.split(",");r=r.filter((a,o)=>{const l=n.some(h=>{const c=parseInt(h,10);return!isNaN(c)&&c-1===o}),u=a.name&&n.includes(a.name);return l||u})}if(s){const n=s.split(",");r=r.filter((a,o)=>{const l=n.some(h=>{const c=parseInt(h,10);return!isNaN(c)&&c-1===o}),u=a.name&&n.includes(a.name);return!(l||u)})}return r}function Sne(i){return i<=0?[]:Array.from({length:i},(e,t)=>{const s=i-t;return{draw:(r,n,a)=>{r.save(),r.fillStyle="black",r.font=`bold ${Math.min(n,a)*.02*2}px sans-serif`,r.textAlign="center",r.textBaseline="middle",r.fillText(s.toString(),n/2,a/2),r.restore()},displayDuration:1e3,ignoreData:!0}})}function N2(i){return`user_${i}`}function rc(i){const e=[],t={};let s=0;function r(l){return`${l}_auto_${s++}`}function n(l){return(u,h)=>l(h,u)}function a(l){return(u,h)=>{const c=l(h,u);return typeof c=="object"&&c!==null?{...u,...c}:(console.warn("Store update function did not return an object. Store remains unchanged.",{data:h,store:u}),u)}}function o(l){for(const u of l){let h=!1;if(typeof u=="object"&&u!==null&&"type"in u)switch(u.type){case"MARKER":{const d=u;t[N2(d.id)]=e.length,h=!0;break}case"IF_GOTO":{const d=u,f=n(d.cond);e.push({type:"IfGoto",cond:f,marker:N2(d.marker)}),h=!0;break}case"UPDATE_STORE":{const f=a(u.fun);e.push({type:"UpdateStore",fun:f}),h=!0;break}case"IF_BLOCK":{const d=u,f=r("if_end"),y=n(d.cond);e.push({type:"IfGoto",cond:(v,m)=>!y(v,m),marker:f}),o(d.timeline),t[f]=e.length,h=!0;break}case"WHILE_BLOCK":{const d=u,f=r("while_start"),y=r("while_end"),v=n(d.cond);t[f]=e.length,e.push({type:"IfGoto",cond:(m,g)=>!v(m,g),marker:y}),o(d.timeline),e.push({type:"IfGoto",cond:()=>!0,marker:f}),t[y]=e.length,h=!0;break}}h||e.push({type:"ExecuteContent",content:u})}}return o(i),{instructions:e,markers:t}}function nc(i,e,t,s){const r=typeof e.metadata=="function"?e.metadata(t,s):e.metadata;return e.nestMetadata?{...i,metadata:r}:r?{...r,...i}:i}function Dn(i,e,t,s,r){let n=e;for(;n<i.instructions.length;){const a=i.instructions[n];switch(a.type){case"ExecuteContent":return n;case"IfGoto":if(a.cond(t(),s())){const o=i.markers[a.marker];if(o!==void 0){n=o;continue}}n++;break;case"UpdateStore":r(a.fun(t(),s())),n++;break;default:n++}}return n}const Vm={};function $s(i,e,t){Vm[i]={simulate:e,defaultSimulators:t}}function Tne(i){return Vm[i]}const fo=(i,e,t,s)=>({responseData:{},participantState:s});function Sm(i,e,t){const s=typeof i.props=="function"?i.props(e,t):i.props||{},r=Vm[i.type],n=typeof i.simulate=="function"?i.simulate:r==null?void 0:r.simulate;if(!n)throw new Error(`No simulation registered for trial type '${i.type}' (name: '${i.name??"unnamed"}'). Register one with registerSimulation() or add a simulate function to the timeline item.`);const a={...r==null?void 0:r.defaultSimulators,...i.simulators};return{trialProps:s,simulateFn:n,simulators:a}}let F2="http://localhost:8001/backend";function Pne(i){F2=i}function q2(){return F2}let B2;function $2(){return B2}async function Ine(i,e){B2={...e};let t={...e};const s=rc(i);let r={};const n=[{index:-1,trialNumber:-1,start:0,end:0,duration:0,type:"",name:"",responseData:{userAgent:"simulated",params:Object.fromEntries((Nl.getRegistry()||[]).map(d=>[d.name,{value:d.value!==void 0?d.value:d.defaultValue,registered:!0,defaultValue:d.defaultValue,type:d.type,description:d.description}]))}}],a=()=>r,o=()=>n,l=d=>{r=d};let u=0,h=0,c=Dn(s,0,a,o,l);for(;c<s.instructions.length;){const d=s.instructions[c].content;if(typeof d!="object"||d===null||typeof d.type!="string"){c=Dn(s,c+1,a,o,l);continue}const{trialProps:f,simulateFn:y,simulators:v}=Sm(d,n,r),m=await y(f,{data:n,store:r},v,t);t=m.participantState,m.storeUpdates&&(r={...r,...m.storeUpdates}),u++;const g=m.duration??0,b=h;h+=g;let x={index:c,trialNumber:u,start:b,end:h,duration:g,type:d.type,name:d.name??"",...d.csv!==void 0?{csv:d.csv}:{},responseData:m.responseData};n.push(nc(x,d,n,r)),c=Dn(s,c+1,a,o,l)}return n}async function Rne(i,e){const{spawn:t}=await import("child_process"),s=i.backendPort??8001,r=`http://localhost:${s}/backend`,n=typeof i.participants=="function"?i.participants().length:Array.isArray(i.participants)?i.participants.length:i.participants.count,a=t("node",["src/backend.ts"],{cwd:"./backend",stdio:["ignore","pipe","pipe"]});await new Promise((o,l)=>{var u,h;a.on("error",l),(u=a.stdout)==null||u.on("data",c=>{c.toString().includes("REACTIVE_BACKEND_READY")&&o()}),(h=a.stderr)==null||h.on("data",c=>{console.error(`[backend] ${c.toString().trim()}`)}),setTimeout(()=>l(new Error("Backend did not start within 10 seconds")),1e4)}),console.log(`Backend running on port ${s}`);try{const o=i.concurrency??(await import("os")).cpus().length;console.log(`Simulating ${n} participants (concurrency: ${o})...`);let l=0;const u=[],h=()=>{const f=Math.min(100,Math.round(l/n*100)),y=Math.floor(f/2),v="█".repeat(y)+"░".repeat(50-y);process.stdout.write(`\r ${v} ${l}/${n} (${f}%)`)},c=f=>new Promise(y=>{var g;let v="";const m=t("node",[e],{env:{...process.env,_REACTIVE_WORKER_INDEX:String(f),_REACTIVE_BACKEND_URL:r,...i.seed!==void 0?{_REACTIVE_SIMULATION_SEED:String(i.seed)}:{}},stdio:["ignore","pipe","pipe"]});(g=m.stderr)==null||g.on("data",b=>{v+=b.toString()}),m.on("close",b=>{b!==0&&u.push({index:f,error:v.trim()||`exited with code ${b}`}),l++,h(),y()}),m.on("error",b=>{u.push({index:f,error:b.message}),l++,h(),y()})});h();let d=0;if(await new Promise(f=>{const y=()=>{if(d>=n){l>=n&&f();return}const v=d++;c(v).then(y)};for(let v=0;v<Math.min(o,n);v++)y()}),process.stdout.write(`
10148
+ */var Yre=st,w2=Qre,Xre=Jre;Yre(w2,"factory",Xre);var ene=w2;const tne=Ga(ene),Rs=new Uint32Array(1);function sne(i){return Rs[0]=i,Rs[0]=(Rs[0]<<16|Rs[0]>>16)>>>0,Rs[0]=(Rs[0]&1431655765)<<1|(Rs[0]&2863311530)>>>1>>>0,Rs[0]=(Rs[0]&858993459)<<2|(Rs[0]&3435973836)>>>2>>>0,Rs[0]=(Rs[0]&252645135)<<4|(Rs[0]&4042322160)>>>4>>>0,Rs[0]=(Rs[0]&16711935)<<8|(Rs[0]&4278255360)>>>8>>>0,Rs[0]*23283064365386963e-26}function ine(i,e){let t=1,s=0;for(;i>0;)t/=e,s+=t*(i%e),i=~~(i/e);return s}const rne=(i,e=[2,3])=>Array.from({length:i},(t,s)=>e.map(r=>r===2?sne(s):ine(s,r)));K.normal=GC,K.poisson=wb,K.uniform=Db;function nne(i){const e=t$.factory({seed:i});K.normal=GC.factory({prng:e.normalized}),K.poisson=wb.factory({prng:e.normalized}),K.uniform=Db.factory({prng:e.normalized}),Math.random=()=>K.uniform(0,1)}function x2(i){return Math.max(1e-10,Math.min(1-1e-10,i))}function bm(i){switch(i.distribution){case"uniform":return e=>i.min+e*(i.max-i.min);case"normal":return e=>fZ(x2(e),i.mean,i.sd);case"poisson":return e=>tne(x2(e),i.mean);case"integer":return e=>Math.floor(i.min+e*(i.max-i.min+1));case"discrete":{const e=i.outcomes.reduce((s,r)=>s+r.weight,0),t=i.outcomes.map((()=>{let s=0;return r=>(s+=r.weight/e,s)})());return s=>{for(let r=0;r<t.length;r++)if(s<t[r])return i.outcomes[r].value;return i.outcomes[i.outcomes.length-1].value}}}}function E2(i,e){const t=e.map(bm);return e.length===1?i.map(s=>t[0](s[0])):i.map(s=>s.map((r,n)=>t[n](r)))}const ane=[[1,0,[1]],[2,1,[1,1]],[3,1,[1,3,7]],[3,2,[1,1,5]],[4,1,[1,3,1,1]],[4,4,[1,1,3,7]],[5,2,[1,3,3,9,9]],[5,13,[1,3,7,13,3]],[5,7,[1,1,5,11,27]],[5,14,[1,3,5,1,15]],[5,11,[1,1,7,3,29]],[5,4,[1,3,7,7,21]],[6,1,[1,1,1,9,23,37]],[6,16,[1,3,3,5,19,33]],[6,13,[1,1,3,13,11,7]],[6,22,[1,1,7,13,25,5]],[6,19,[1,3,5,11,7,11]],[6,25,[1,1,1,3,13,39]],[7,1,[1,3,1,15,17,63,13]],[7,32,[1,1,5,5,1,59,33]]],ho=32,one=2**ho;function lne(i){const e=new Uint32Array(ho);if(i===0){for(let n=0;n<ho;n++)e[n]=1<<ho-1-n;return e}const[t,s,r]=ane[i-1];for(let n=0;n<t;n++)e[n]=r[n]<<ho-1-n;for(let n=t;n<ho;n++){e[n]=e[n-t]^e[n-t]>>>t;for(let a=1;a<t;a++)s>>>t-1-a&1&&(e[n]^=e[n-a])}return e}function une(i,e){if(e<1||e>21)throw new RangeError("sobol() supports 1-21 dimensions");const t=Array.from({length:e},(n,a)=>lne(a)),s=new Uint32Array(e),r=[new Array(e).fill(0)];for(let n=1;n<i;n++){let a=0,o=n-1;for(;(o&1)===1;)o>>>=1,a++;for(let l=0;l<e;l++)s[l]^=t[l][a];r.push(Array.from(s,l=>l/one))}return r}const hne=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73],V2=6;function S2(i,e){const t=une(i+1,e.length).slice(1);return E2(t,e)}function T2(i,e){e.length>V2&&console.warn(`Halton sequence quality degrades above ${V2} dimensions. Consider using sobol() instead.`);const t=hne.slice(0,e.length),s=rne(i+1,t).slice(1);return E2(s,e)}function cne(i,e,t){const s=Object.keys(t),r=s.map(a=>t[a]);let n;switch(i){case"sobol":n=S2(e,r);break;case"halton":n=T2(e,r);break;case"random":n=dne(e,r);break}return Array.from({length:e},(a,o)=>{const l=s.length===1?[n[o]]:n[o];return{index:o,...Object.fromEntries(s.map((u,h)=>[u,l[h]]))}})}function dne(i,e){const t=e.map(bm);return e.length===1?Array.from({length:i},()=>t[0](K.uniform(0,1))):Array.from({length:i},()=>t.map(s=>s(K.uniform(0,1))))}function pne(i){return bm(i)(K.uniform(0,1))}function P2(i,e=1,t={}){const{replace:s=!0}=t;if(i.length===0)return[];if(s){const a=[];for(let o=0;o<e;o++){const l=Math.floor(K.uniform(0,1)*i.length);a.push(i[l])}return a}const r=[];let n=[];for(let a=0;a<e;a++)n.length===0&&(n=sc(i)),r.push(n.pop());return r}function sc(i){const e=[...i];for(let t=e.length-1;t>=0;t--){const s=Math.floor(K.uniform(0,1)*(t+1));[e[t],e[s]]=[e[s],e[t]]}return e}function I2(i,e){return e(i)}function R2(i,e){const t=Math.ceil(i.length/e);return Array.from({length:Math.ceil(i.length/t)},(s,r)=>i.slice(r*t,r*t+t))}function A2(i){return i.length===0?0:i.reduce((e,t)=>e+t,0)/i.length}function L2(i){return i.reduce((e,t)=>e+t,0)}function fne(){typeof Array.prototype.sample!="function"&&(Array.prototype.sample=function(i,e){return P2(this,i,e)}),typeof Array.prototype.shuffle!="function"&&(Array.prototype.shuffle=function(){return sc(this)}),typeof Array.prototype.pipe!="function"&&(Array.prototype.pipe=function(i){return I2(this,i)}),typeof Array.prototype.mean!="function"&&(Array.prototype.mean=function(){return A2(this)}),typeof Array.prototype.sum!="function"&&(Array.prototype.sum=function(){return L2(this)}),typeof Array.prototype.chunk!="function"&&(Array.prototype.chunk=function(i){return R2(this,i)})}/*! Capacitor: https://capacitorjs.com/ - MIT License */var co;(function(i){i.Unimplemented="UNIMPLEMENTED",i.Unavailable="UNAVAILABLE"})(co||(co={}));class wm extends Error{constructor(e,t,s){super(e),this.message=e,this.code=t,this.data=s}}const mne=i=>{var e,t;return i!=null&&i.androidBridge?"android":!((t=(e=i==null?void 0:i.webkit)===null||e===void 0?void 0:e.messageHandlers)===null||t===void 0)&&t.bridge?"ios":"web"},gne=i=>{const e=i.CapacitorCustomPlatform||null,t=i.Capacitor||{},s=t.Plugins=t.Plugins||{},r=()=>e!==null?e.name:mne(i),n=()=>r()!=="web",a=c=>{const d=u.get(c);return!!(d!=null&&d.platforms.has(r())||o(c))},o=c=>{var d;return(d=t.PluginHeaders)===null||d===void 0?void 0:d.find(f=>f.name===c)},l=c=>i.console.error(c),u=new Map,h=(c,d={})=>{const f=u.get(c);if(f)return console.warn(`Capacitor plugin "${c}" already registered. Cannot register plugins twice.`),f.proxy;const y=r(),v=o(c);let m;const g=async()=>(!m&&y in d?m=typeof d[y]=="function"?m=await d[y]():m=d[y]:e!==null&&!m&&"web"in d&&(m=typeof d.web=="function"?m=await d.web():m=d.web),m),b=(P,O)=>{var D,$;if(v){const Q=v==null?void 0:v.methods.find(_=>O===_.name);if(Q)return Q.rtype==="promise"?_=>t.nativePromise(c,O.toString(),_):(_,B)=>t.nativeCallback(c,O.toString(),_,B);if(P)return(D=P[O])===null||D===void 0?void 0:D.bind(P)}else{if(P)return($=P[O])===null||$===void 0?void 0:$.bind(P);throw new wm(`"${c}" plugin is not implemented on ${y}`,co.Unimplemented)}},x=P=>{let O;const D=(...$)=>{const Q=g().then(_=>{const B=b(_,P);if(B){const H=B(...$);return O=H==null?void 0:H.remove,H}else throw new wm(`"${c}.${P}()" is not implemented on ${y}`,co.Unimplemented)});return P==="addListener"&&(Q.remove=async()=>O()),Q};return D.toString=()=>`${P.toString()}() { [capacitor code] }`,Object.defineProperty(D,"name",{value:P,writable:!1,configurable:!1}),D},I=x("addListener"),L=x("removeListener"),A=(P,O)=>{const D=I({eventName:P},O),$=async()=>{const _=await D;L({eventName:P,callbackId:_},O)},Q=new Promise(_=>D.then(()=>_({remove:$})));return Q.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await $()},Q},k=new Proxy({},{get(P,O){switch(O){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return v?A:I;case"removeListener":return L;default:return x(O)}}});return s[c]=k,u.set(c,{name:c,proxy:k,platforms:new Set([...Object.keys(d),...v?[y]:[]])}),k};return t.convertFileSrc||(t.convertFileSrc=c=>c),t.getPlatform=r,t.handleError=l,t.isNativePlatform=n,t.isPluginAvailable=a,t.registerPlugin=h,t.Exception=wm,t.DEBUG=!!t.DEBUG,t.isLoggingEnabled=!!t.isLoggingEnabled,t},Ca=(i=>i.Capacitor=gne(i))(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),Ol=Ca.registerPlugin;class ic{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(e,t){let s=!1;this.listeners[e]||(this.listeners[e]=[],s=!0),this.listeners[e].push(t);const n=this.windowListeners[e];n&&!n.registered&&this.addWindowListener(n),s&&this.sendRetainedArgumentsForEvent(e);const a=async()=>this.removeListener(e,t);return Promise.resolve({remove:a})}async removeAllListeners(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}}notifyListeners(e,t,s){const r=this.listeners[e];if(!r){if(s){let n=this.retainedEventArguments[e];n||(n=[]),n.push(t),this.retainedEventArguments[e]=n}return}r.forEach(n=>n(t))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,t){this.windowListeners[t]={registered:!1,windowEventName:e,pluginEventName:t,handler:s=>{this.notifyListeners(t,s)}}}unimplemented(e="not implemented"){return new Ca.Exception(e,co.Unimplemented)}unavailable(e="not available"){return new Ca.Exception(e,co.Unavailable)}async removeListener(e,t){const s=this.listeners[e];if(!s)return;const r=s.indexOf(t);this.listeners[e].splice(r,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}sendRetainedArgumentsForEvent(e){const t=this.retainedEventArguments[e];t&&(delete this.retainedEventArguments[e],t.forEach(s=>{this.notifyListeners(e,s)}))}}const _2=i=>encodeURIComponent(i).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),D2=i=>i.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class vne extends ic{async getCookies(){const e=document.cookie,t={};return e.split(";").forEach(s=>{if(s.length<=0)return;let[r,n]=s.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");r=D2(r).trim(),n=D2(n).trim(),t[r]=n}),t}async setCookie(e){try{const t=_2(e.key),s=_2(e.value),r=`; expires=${(e.expires||"").replace("expires=","")}`,n=(e.path||"/").replace("path=",""),a=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${t}=${s||""}${r}; path=${n}; ${a};`}catch(t){return Promise.reject(t)}}async deleteCookie(e){try{document.cookie=`${e.key}=; Max-Age=0`}catch(t){return Promise.reject(t)}}async clearCookies(){try{const e=document.cookie.split(";")||[];for(const t of e)document.cookie=t.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}}async clearAllCookies(){try{await this.clearCookies()}catch(e){return Promise.reject(e)}}}Ol("CapacitorCookies",{web:()=>new vne});const yne=async i=>new Promise((e,t)=>{const s=new FileReader;s.onload=()=>{const r=s.result;e(r.indexOf(",")>=0?r.split(",")[1]:r)},s.onerror=r=>t(r),s.readAsDataURL(i)}),Cne=(i={})=>{const e=Object.keys(i);return Object.keys(i).map(r=>r.toLocaleLowerCase()).reduce((r,n,a)=>(r[n]=i[e[a]],r),{})},bne=(i,e=!0)=>i?Object.entries(i).reduce((s,r)=>{const[n,a]=r;let o,l;return Array.isArray(a)?(l="",a.forEach(u=>{o=e?encodeURIComponent(u):u,l+=`${n}=${o}&`}),l.slice(0,-1)):(o=e?encodeURIComponent(a):a,l=`${n}=${o}`),`${s}&${l}`},"").substr(1):null,k2=(i,e={})=>{const t=Object.assign({method:i.method||"GET",headers:i.headers},e),r=Cne(i.headers)["content-type"]||"";if(typeof i.data=="string")t.body=i.data;else if(r.includes("application/x-www-form-urlencoded")){const n=new URLSearchParams;for(const[a,o]of Object.entries(i.data||{}))n.set(a,o);t.body=n.toString()}else if(r.includes("multipart/form-data")||i.data instanceof FormData){const n=new FormData;if(i.data instanceof FormData)i.data.forEach((o,l)=>{n.append(l,o)});else for(const o of Object.keys(i.data))n.append(o,i.data[o]);t.body=n;const a=new Headers(t.headers);a.delete("content-type"),t.headers=a}else(r.includes("application/json")||typeof i.data=="object")&&(t.body=JSON.stringify(i.data));return t};class wne extends ic{async request(e){const t=k2(e,e.webFetchExtra),s=bne(e.params,e.shouldEncodeUrlParams),r=s?`${e.url}?${s}`:e.url,n=await fetch(r,t),a=n.headers.get("content-type")||"";let{responseType:o="text"}=n.ok?e:{};a.includes("application/json")&&(o="json");let l,u;switch(o){case"arraybuffer":case"blob":u=await n.blob(),l=await yne(u);break;case"json":l=await n.json();break;case"document":case"text":default:l=await n.text()}const h={};return n.headers.forEach((c,d)=>{h[d]=c}),{data:l,headers:h,status:n.status,url:n.url}}async get(e){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))}async post(e){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))}async put(e){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))}async patch(e){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))}async delete(e){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))}}Ol("CapacitorHttp",{web:()=>new wne});function As(){return Math.round(performance.now())}function po(){return!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)}function xne(){return window.electronAPI!==void 0}function Ene(i,e){if(!e)return i.at(-1);for(let t=i.length-1;t>=0;t--)if(i[t].type===e)return i[t]}const Ml=[];function en(i,e,t="string",s,r){let n=Ml.find(d=>d.name===i);n||(n={name:i,defaultValue:r!==void 0?r:e,type:t,description:s,value:void 0},Ml.push(n));const a={string:d=>d,number:d=>{const f=Number(d);return isNaN(f)?e:f},boolean:d=>d.toLowerCase()==="true",array:d=>{try{return JSON.parse(d)}catch{return e}},json:d=>{try{return JSON.parse(d)}catch{return e}}},o=d=>t==="string"&&typeof d=="string"||t==="number"&&typeof d=="number"||t==="boolean"&&typeof d=="boolean"||t==="array"&&Array.isArray(d)||t==="json"&&typeof d=="object"&&d!==null?d:typeof d=="string"?d.toLowerCase()==="undefined"?e:a[t](d):e,l=typeof window<"u"?new URLSearchParams(window.location.search):new URLSearchParams,u=l.get("_b");if(u)try{const d=atob(u),f=JSON.parse(d);if(i in f){const y=o(f[i]);return n.value=y,y}}catch{}const h=l.get(i);if(h==null)return e;const c=o(h);return n.value=c,c}const xm=[];class Nl{static getRegistry(){return[...Ml]}static getTimelineRepresentation(){return[...xm]}}const Fl=()=>window.electronAPI?"desktop":Ca.isNativePlatform()?"mobile":"web",O2={};function M2(i){i.forEach(e=>{const t=O2[e.type];if(t)for(const s of t)(!e.hideSettings||e.hideSettings!==!0&&!e.hideSettings.includes(s.name))&&(Ml.some(r=>r.name===s.name)||Ml.push(s))})}function Em(i,e){O2[i]=e}function Vne(i,e={}){if(M2(i),!e.subset)return i;xm.length=0,i.forEach(n=>{xm.push({type:n.type??"NoTypeSpecified",name:n.name})});const t=en("includeSubset",void 0),s=en("excludeSubset",void 0);let r=[...i];if(t){const n=t.split(",");r=r.filter((a,o)=>{const l=n.some(h=>{const c=parseInt(h,10);return!isNaN(c)&&c-1===o}),u=a.name&&n.includes(a.name);return l||u})}if(s){const n=s.split(",");r=r.filter((a,o)=>{const l=n.some(h=>{const c=parseInt(h,10);return!isNaN(c)&&c-1===o}),u=a.name&&n.includes(a.name);return!(l||u)})}return r}function Sne(i){return i<=0?[]:Array.from({length:i},(e,t)=>{const s=i-t;return{draw:(r,n,a)=>{r.save(),r.fillStyle="black",r.font=`bold ${Math.min(n,a)*.02*2}px sans-serif`,r.textAlign="center",r.textBaseline="middle",r.fillText(s.toString(),n/2,a/2),r.restore()},displayDuration:1e3,ignoreData:!0}})}function N2(i){return`user_${i}`}function rc(i){const e=[],t={};let s=0;function r(l){return`${l}_auto_${s++}`}function n(l){return(u,h)=>l(h,u)}function a(l){return(u,h)=>{const c=l(h,u);return typeof c=="object"&&c!==null?{...u,...c}:(console.warn("Store update function did not return an object. Store remains unchanged.",{data:h,store:u}),u)}}function o(l){for(const u of l){let h=!1;if(typeof u=="object"&&u!==null&&"type"in u)switch(u.type){case"MARKER":{const d=u;t[N2(d.id)]=e.length,h=!0;break}case"IF_GOTO":{const d=u,f=n(d.cond);e.push({type:"IfGoto",cond:f,marker:N2(d.marker)}),h=!0;break}case"UPDATE_STORE":{const f=a(u.fun);e.push({type:"UpdateStore",fun:f}),h=!0;break}case"IF_BLOCK":{const d=u,f=r("if_end"),y=n(d.cond);e.push({type:"IfGoto",cond:(v,m)=>!y(v,m),marker:f}),o(d.timeline),t[f]=e.length,h=!0;break}case"WHILE_BLOCK":{const d=u,f=r("while_start"),y=r("while_end"),v=n(d.cond);t[f]=e.length,e.push({type:"IfGoto",cond:(m,g)=>!v(m,g),marker:y}),o(d.timeline),e.push({type:"IfGoto",cond:()=>!0,marker:f}),t[y]=e.length,h=!0;break}}h||e.push({type:"ExecuteContent",content:u})}}return o(i),{instructions:e,markers:t}}function nc(i,e,t,s){const r=typeof e.metadata=="function"?e.metadata(t,s):e.metadata;return e.nestMetadata?{...i,metadata:r}:r?{...r,...i}:i}function Dn(i,e,t,s,r){let n=e;for(;n<i.instructions.length;){const a=i.instructions[n];switch(a.type){case"ExecuteContent":return n;case"IfGoto":if(a.cond(t(),s())){const o=i.markers[a.marker];if(o!==void 0){n=o;continue}}n++;break;case"UpdateStore":r(a.fun(t(),s())),n++;break;default:n++}}return n}const Vm={};function $s(i,e,t){Vm[i]={simulate:e,defaultSimulators:t}}function Tne(i){return Vm[i]}const fo=(i,e,t,s)=>({responseData:{},participantState:s});function Sm(i,e,t){const s=typeof i.props=="function"?i.props(e,t):i.props||{},r=Vm[i.type],n=typeof i.simulate=="function"?i.simulate:r==null?void 0:r.simulate;if(!n)throw new Error(`No simulation registered for trial type '${i.type}' (name: '${i.name??"unnamed"}'). Register one with registerSimulation() or add a simulate function to the timeline item.`);const a={...r==null?void 0:r.defaultSimulators,...i.simulators};return{trialProps:s,simulateFn:n,simulators:a}}let F2="http://localhost:8001/backend";function Pne(i){F2=i}function q2(){return F2}let B2;function $2(){return B2}async function Ine(i,e){B2={...e};let t={...e};const s=rc(i);let r={};const n=[{index:-1,trialNumber:-1,start:0,end:0,duration:0,type:"",name:"",responseData:{userAgent:"simulated",params:Object.fromEntries((Nl.getRegistry()||[]).map(d=>[d.name,{value:d.value!==void 0?d.value:d.defaultValue,registered:!0,defaultValue:d.defaultValue,type:d.type,description:d.description}]))}}],a=()=>r,o=()=>n,l=d=>{r=d};let u=0,h=0,c=Dn(s,0,a,o,l);for(;c<s.instructions.length;){const d=s.instructions[c].content;if(typeof d!="object"||d===null||typeof d.type!="string"){c=Dn(s,c+1,a,o,l);continue}const{trialProps:f,simulateFn:y,simulators:v}=Sm(d,n,r),m=await y(f,{data:n,store:r},v,t);t=m.participantState,m.storeUpdates&&(r={...r,...m.storeUpdates}),u++;const g=m.duration??0,b=h;h+=g;let x={index:c,trialNumber:u,start:b,end:h,duration:g,type:d.type,name:d.name??"",...d.csv!==void 0?{csv:d.csv}:{},responseData:m.responseData};n.push(nc(x,d,n,r)),c=Dn(s,c+1,a,o,l)}return n}async function Rne(i,e){const{spawn:t}=await import("child_process"),s=i.backendPort??8001,r=`http://localhost:${s}/backend`,n=typeof i.participants=="function"?i.participants().length:Array.isArray(i.participants)?i.participants.length:i.participants.count,a=t("node",["src/backend.ts"],{cwd:"./backend",stdio:["ignore","pipe","pipe"]});await new Promise((o,l)=>{var u,h;a.on("error",l),(u=a.stdout)==null||u.on("data",c=>{c.toString().includes("REACTIVE_BACKEND_READY")&&o()}),(h=a.stderr)==null||h.on("data",c=>{console.error(`[backend] ${c.toString().trim()}`)}),setTimeout(()=>l(new Error("Backend did not start within 10 seconds")),1e4)}),console.log(`Backend running on port ${s}`);try{const o=i.concurrency??(await import("os")).cpus().length;console.log(`Simulating ${n} participants (concurrency: ${o})...`);let l=0;const u=[],h=()=>{const f=Math.min(100,Math.round(l/n*100)),y=Math.floor(f/2),v="█".repeat(y)+"░".repeat(50-y);process.stdout.write(`\r ${v} ${l}/${n} (${f}%)`)},c=f=>new Promise(y=>{var g;let v="";const m=t("node",[e],{env:{...process.env,_REACTIVE_WORKER_INDEX:String(f),_REACTIVE_BACKEND_URL:r,...i.seed!==void 0?{_REACTIVE_SIMULATION_SEED:String(i.seed)}:{}},stdio:["ignore","pipe","pipe"]});(g=m.stderr)==null||g.on("data",b=>{v+=b.toString()}),m.on("close",b=>{b!==0&&u.push({index:f,error:v.trim()||`exited with code ${b}`}),l++,h(),y()}),m.on("error",b=>{u.push({index:f,error:b.message}),l++,h(),y()})});h();let d=0;if(await new Promise(f=>{const y=()=>{if(d>=n){l>=n&&f();return}const v=d++;c(v).then(y)};for(let v=0;v<Math.min(o,n);v++)y()}),process.stdout.write(`
10149
10149
  `),u.length>0){console.error(`
10150
10150
  ${u.length} participant(s) failed:`);for(const{index:f,error:y}of u)console.error(` Participant ${f}: ${y}`)}console.log(`Simulation complete. ${l-u.length}/${n} participants simulated successfully.`)}finally{a.kill(),console.log("Backend stopped.")}}const ac={};function Zs(i,e,t){ac[i]||(ac[i]=[]),ac[i].push({csv:e,flatten:t})}function H2(i){const e=i.responseData;return Array.isArray(e)?e.map(t=>({block:i.name,...t})):[]}function Q2(i){if(i==null)return"";const e=typeof i=="object"?JSON.stringify(i):String(i);return e.includes(",")||e.includes('"')||e.includes(`
10151
10151
  `)?`"${e.replace(/"/g,'""')}"`:e}function oc(i){if(!i||i.length===0)return"";const e=new Set;i.forEach(n=>{Object.keys(n).forEach(a=>{e.add(a)})});const t=Array.from(e),s=t.map(n=>Q2(n)).join(","),r=i.map(n=>t.map(a=>{const o=n[a];return Q2(o)}).join(","));return[s,...r].join(`
@@ -1,4 +1,4 @@
1
- import { W as e } from "./mod-CZYkml9p.js";
1
+ import { W as e } from "./mod-kduyZSvT.js";
2
2
  class s extends e {
3
3
  async enable() {
4
4
  console.log("Immersive mode is only available on Android");
@@ -1,4 +1,4 @@
1
- import { W as P, b as x, E } from "./mod-CZYkml9p.js";
1
+ import { W as P, b as x, E } from "./mod-kduyZSvT.js";
2
2
  function m(w) {
3
3
  const e = w.split("/").filter((t) => t !== "."), r = [];
4
4
  return e.forEach((t) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adriansteffan/reactive",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -216,6 +216,8 @@ export function registerComponentParams(
216
216
  export function prepareTimeline(experiment: any[], options: { subset?: boolean } = {}): any[] {
217
217
  registerExperimentParams(experiment);
218
218
 
219
+ if (!options.subset) return experiment;
220
+
219
221
  timelineRepresentation.length = 0;
220
222
  experiment.forEach((item) => {
221
223
  timelineRepresentation.push({
@@ -224,8 +226,6 @@ export function prepareTimeline(experiment: any[], options: { subset?: boolean }
224
226
  });
225
227
  });
226
228
 
227
- if (!options.subset) return experiment;
228
-
229
229
  const include = getParam('includeSubset', undefined);
230
230
  const exclude = getParam('excludeSubset', undefined);
231
231