@slopit/adapter-jspsych 0.1.0 → 0.2.0

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.
@@ -0,0 +1 @@
1
+ "use strict";var SlopitJsPsych=(()=>{var Xt=Object.create;var Oe=Object.defineProperty;var Qt=Object.getOwnPropertyDescriptor;var en=Object.getOwnPropertyNames;var tn=Object.getPrototypeOf,nn=Object.prototype.hasOwnProperty;var sn=(t,e,n)=>e in t?Oe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var rn=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var q=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),lt=(t,e)=>{for(var n in e)Oe(t,n,{get:e[n],enumerable:!0})},ct=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of en(e))!nn.call(t,r)&&r!==n&&Oe(t,r,{get:()=>e[r],enumerable:!(s=Qt(e,r))||s.enumerable});return t};var Ze=(t,e,n)=>(n=t!=null?Xt(tn(t)):{},ct(e||!t||!t.__esModule?Oe(n,"default",{value:t,enumerable:!0}):n,t)),an=t=>ct(Oe({},"__esModule",{value:!0}),t);var v=(t,e,n)=>sn(t,typeof e!="symbol"?e+"":e,n);var Dt=q((di,Pt)=>{"use strict";var tr=t=>{let e=new Set;do for(let n of Reflect.ownKeys(t))e.add([t,n]);while((t=Reflect.getPrototypeOf(t))&&t!==Object.prototype);return e};Pt.exports=(t,{include:e,exclude:n}={})=>{let s=r=>{let i=o=>typeof o=="string"?r===o:o.test(r);return e?e.some(i):n?!n.some(i):!0};for(let[r,i]of tr(t.constructor.prototype)){if(i==="constructor"||!s(i))continue;let o=Reflect.getOwnPropertyDescriptor(r,i);o&&typeof o.value=="function"&&(t[i]=t[i].bind(t))}return t}});var tt=q((Rt,et)=>{"use strict";(function(t,e,n){function s(a){var l=this,c=o();l.next=function(){var u=2091639*l.s0+l.c*23283064365386963e-26;return l.s0=l.s1,l.s1=l.s2,l.s2=u-(l.c=u|0)},l.c=1,l.s0=c(" "),l.s1=c(" "),l.s2=c(" "),l.s0-=c(a),l.s0<0&&(l.s0+=1),l.s1-=c(a),l.s1<0&&(l.s1+=1),l.s2-=c(a),l.s2<0&&(l.s2+=1),c=null}function r(a,l){return l.c=a.c,l.s0=a.s0,l.s1=a.s1,l.s2=a.s2,l}function i(a,l){var c=new s(a),u=l&&l.state,h=c.next;return h.int32=function(){return c.next()*4294967296|0},h.double=function(){return h()+(h()*2097152|0)*11102230246251565e-32},h.quick=h,u&&(typeof u=="object"&&r(u,c),h.state=function(){return r(c,{})}),h}function o(){var a=4022871197,l=function(c){c=String(c);for(var u=0;u<c.length;u++){a+=c.charCodeAt(u);var h=.02519603282416938*a;a=h>>>0,h-=a,h*=a,a=h>>>0,h-=a,a+=h*4294967296}return(a>>>0)*23283064365386963e-26};return l}e&&e.exports?e.exports=i:n&&n.amd?n(function(){return i}):this.alea=i})(Rt,typeof et=="object"&&et,typeof define=="function"&&define)});var jt=q((Ot,nt)=>{"use strict";(function(t,e,n){function s(o){var a=this,l="";a.x=0,a.y=0,a.z=0,a.w=0,a.next=function(){var u=a.x^a.x<<11;return a.x=a.y,a.y=a.z,a.z=a.w,a.w^=a.w>>>19^u^u>>>8},o===(o|0)?a.x=o:l+=o;for(var c=0;c<l.length+64;c++)a.x^=l.charCodeAt(c)|0,a.next()}function r(o,a){return a.x=o.x,a.y=o.y,a.z=o.z,a.w=o.w,a}function i(o,a){var l=new s(o),c=a&&a.state,u=function(){return(l.next()>>>0)/4294967296};return u.double=function(){do var h=l.next()>>>11,p=(l.next()>>>0)/4294967296,m=(h+p)/(1<<21);while(m===0);return m},u.int32=l.next,u.quick=u,c&&(typeof c=="object"&&r(c,l),u.state=function(){return r(l,{})}),u}e&&e.exports?e.exports=i:n&&n.amd?n(function(){return i}):this.xor128=i})(Ot,typeof nt=="object"&&nt,typeof define=="function"&&define)});var Vt=q((Nt,st)=>{"use strict";(function(t,e,n){function s(o){var a=this,l="";a.next=function(){var u=a.x^a.x>>>2;return a.x=a.y,a.y=a.z,a.z=a.w,a.w=a.v,(a.d=a.d+362437|0)+(a.v=a.v^a.v<<4^(u^u<<1))|0},a.x=0,a.y=0,a.z=0,a.w=0,a.v=0,o===(o|0)?a.x=o:l+=o;for(var c=0;c<l.length+64;c++)a.x^=l.charCodeAt(c)|0,c==l.length&&(a.d=a.x<<10^a.x>>>4),a.next()}function r(o,a){return a.x=o.x,a.y=o.y,a.z=o.z,a.w=o.w,a.v=o.v,a.d=o.d,a}function i(o,a){var l=new s(o),c=a&&a.state,u=function(){return(l.next()>>>0)/4294967296};return u.double=function(){do var h=l.next()>>>11,p=(l.next()>>>0)/4294967296,m=(h+p)/(1<<21);while(m===0);return m},u.int32=l.next,u.quick=u,c&&(typeof c=="object"&&r(c,l),u.state=function(){return r(l,{})}),u}e&&e.exports?e.exports=i:n&&n.amd?n(function(){return i}):this.xorwow=i})(Nt,typeof st=="object"&&st,typeof define=="function"&&define)});var Bt=q((Kt,rt)=>{"use strict";(function(t,e,n){function s(o){var a=this;a.next=function(){var c=a.x,u=a.i,h,p,m;return h=c[u],h^=h>>>7,p=h^h<<24,h=c[u+1&7],p^=h^h>>>10,h=c[u+3&7],p^=h^h>>>3,h=c[u+4&7],p^=h^h<<7,h=c[u+7&7],h=h^h<<13,p^=h^h<<9,c[u]=p,a.i=u+1&7,p};function l(c,u){var h,p,m=[];if(u===(u|0))p=m[0]=u;else for(u=""+u,h=0;h<u.length;++h)m[h&7]=m[h&7]<<15^u.charCodeAt(h)+m[h+1&7]<<13;for(;m.length<8;)m.push(0);for(h=0;h<8&&m[h]===0;++h);for(h==8?p=m[7]=-1:p=m[h],c.x=m,c.i=0,h=256;h>0;--h)c.next()}l(a,o)}function r(o,a){return a.x=o.x.slice(),a.i=o.i,a}function i(o,a){o==null&&(o=+new Date);var l=new s(o),c=a&&a.state,u=function(){return(l.next()>>>0)/4294967296};return u.double=function(){do var h=l.next()>>>11,p=(l.next()>>>0)/4294967296,m=(h+p)/(1<<21);while(m===0);return m},u.int32=l.next,u.quick=u,c&&(c.x&&r(c,l),u.state=function(){return r(l,{})}),u}e&&e.exports?e.exports=i:n&&n.amd?n(function(){return i}):this.xorshift7=i})(Kt,typeof rt=="object"&&rt,typeof define=="function"&&define)});var $t=q((Ft,it)=>{"use strict";(function(t,e,n){function s(o){var a=this;a.next=function(){var c=a.w,u=a.X,h=a.i,p,m;return a.w=c=c+1640531527|0,m=u[h+34&127],p=u[h=h+1&127],m^=m<<13,p^=p<<17,m^=m>>>15,p^=p>>>12,m=u[h]=m^p,a.i=h,m+(c^c>>>16)|0};function l(c,u){var h,p,m,I,j,P=[],Pe=128;for(u===(u|0)?(p=u,u=null):(u=u+"\0",p=0,Pe=Math.max(Pe,u.length)),m=0,I=-32;I<Pe;++I)u&&(p^=u.charCodeAt((I+32)%u.length)),I===0&&(j=p),p^=p<<10,p^=p>>>15,p^=p<<4,p^=p>>>13,I>=0&&(j=j+1640531527|0,h=P[I&127]^=p+j,m=h==0?m+1:0);for(m>=128&&(P[(u&&u.length||0)&127]=-1),m=127,I=512;I>0;--I)p=P[m+34&127],h=P[m=m+1&127],p^=p<<13,h^=h<<17,p^=p>>>15,h^=h>>>12,P[m]=p^h;c.w=j,c.X=P,c.i=m}l(a,o)}function r(o,a){return a.i=o.i,a.w=o.w,a.X=o.X.slice(),a}function i(o,a){o==null&&(o=+new Date);var l=new s(o),c=a&&a.state,u=function(){return(l.next()>>>0)/4294967296};return u.double=function(){do var h=l.next()>>>11,p=(l.next()>>>0)/4294967296,m=(h+p)/(1<<21);while(m===0);return m},u.int32=l.next,u.quick=u,c&&(c.X&&r(c,l),u.state=function(){return r(l,{})}),u}e&&e.exports?e.exports=i:n&&n.amd?n(function(){return i}):this.xor4096=i})(Ft,typeof it=="object"&&it,typeof define=="function"&&define)});var Ht=q((zt,at)=>{"use strict";(function(t,e,n){function s(o){var a=this,l="";a.next=function(){var u=a.b,h=a.c,p=a.d,m=a.a;return u=u<<25^u>>>7^h,h=h-p|0,p=p<<24^p>>>8^m,m=m-u|0,a.b=u=u<<20^u>>>12^h,a.c=h=h-p|0,a.d=p<<16^h>>>16^m,a.a=m-u|0},a.a=0,a.b=0,a.c=-1640531527,a.d=1367130551,o===Math.floor(o)?(a.a=o/4294967296|0,a.b=o|0):l+=o;for(var c=0;c<l.length+20;c++)a.b^=l.charCodeAt(c)|0,a.next()}function r(o,a){return a.a=o.a,a.b=o.b,a.c=o.c,a.d=o.d,a}function i(o,a){var l=new s(o),c=a&&a.state,u=function(){return(l.next()>>>0)/4294967296};return u.double=function(){do var h=l.next()>>>11,p=(l.next()>>>0)/4294967296,m=(h+p)/(1<<21);while(m===0);return m},u.int32=l.next,u.quick=u,c&&(typeof c=="object"&&r(c,l),u.state=function(){return r(l,{})}),u}e&&e.exports?e.exports=i:n&&n.amd?n(function(){return i}):this.tychei=i})(zt,typeof at=="object"&&at,typeof define=="function"&&define)});var Ut=q((qt,Ue)=>{"use strict";(function(t,e,n){var s=256,r=6,i=52,o="random",a=n.pow(s,r),l=n.pow(2,i),c=l*2,u=s-1,h;function p(E,C,D){var M=[];C=C==!0?{entropy:!0}:C||{};var S=P(j(C.entropy?[E,De(e)]:E??Pe(),3),M),N=new m(M),$=function(){for(var V=N.g(r),G=a,H=0;V<l;)V=(V+H)*s,G*=s,H=N.g(1);for(;V>=c;)V/=2,G/=2,H>>>=1;return(V+H)/G};return $.int32=function(){return N.g(4)|0},$.quick=function(){return N.g(4)/4294967296},$.double=$,P(De(N.S),e),(C.pass||D||function(V,G,H,te){return te&&(te.S&&I(te,N),V.state=function(){return I(N,{})}),H?(n[o]=V,G):V})($,S,"global"in C?C.global:this==n,C.state)}function m(E){var C,D=E.length,M=this,S=0,N=M.i=M.j=0,$=M.S=[];for(D||(E=[D++]);S<s;)$[S]=S++;for(S=0;S<s;S++)$[S]=$[N=u&N+E[S%D]+(C=$[S])],$[N]=C;(M.g=function(V){for(var G,H=0,te=M.i,Be=M.j,Re=M.S;V--;)G=Re[te=u&te+1],H=H*s+Re[u&(Re[te]=Re[Be=u&Be+G])+(Re[Be]=G)];return M.i=te,M.j=Be,H})(s)}function I(E,C){return C.i=E.i,C.j=E.j,C.S=E.S.slice(),C}function j(E,C){var D=[],M=typeof E,S;if(C&&M=="object")for(S in E)try{D.push(j(E[S],C-1))}catch{}return D.length?D:M=="string"?E:E+"\0"}function P(E,C){for(var D=E+"",M,S=0;S<D.length;)C[u&S]=u&(M^=C[u&S]*19)+D.charCodeAt(S++);return De(C)}function Pe(){try{var E;return h&&(E=h.randomBytes)?E=E(s):(E=new Uint8Array(s),(t.crypto||t.msCrypto).getRandomValues(E)),De(E)}catch{var C=t.navigator,D=C&&C.plugins;return[+new Date,t,D,t.screen,De(e)]}}function De(E){return String.fromCharCode.apply(0,E)}if(P(n.random(),e),typeof Ue=="object"&&Ue.exports){Ue.exports=p;try{h=rn("crypto")}catch{}}else typeof define=="function"&&define.amd?define(function(){return p}):n["seed"+o]=p})(typeof self<"u"?self:qt,[],Math)});var Wt=q((hi,Zt)=>{"use strict";var nr=tt(),sr=jt(),rr=Vt(),ir=Bt(),ar=$t(),or=Ht(),_e=Ut();_e.alea=nr;_e.xor128=sr;_e.xorwow=rr;_e.xorshift7=ir;_e.xor4096=ar;_e.tychei=or;Zt.exports=_e});var Jt=q((fi,Yt)=>{"use strict";var lr=Wt(),ot=["ability","able","aboard","about","above","accept","accident","according","account","accurate","acres","across","act","action","active","activity","actual","actually","add","addition","additional","adjective","adult","adventure","advice","affect","afraid","after","afternoon","again","against","age","ago","agree","ahead","aid","air","airplane","alike","alive","all","allow","almost","alone","along","aloud","alphabet","already","also","although","am","among","amount","ancient","angle","angry","animal","announced","another","answer","ants","any","anybody","anyone","anything","anyway","anywhere","apart","apartment","appearance","apple","applied","appropriate","are","area","arm","army","around","arrange","arrangement","arrive","arrow","art","article","as","aside","ask","asleep","at","ate","atmosphere","atom","atomic","attached","attack","attempt","attention","audience","author","automobile","available","average","avoid","aware","away","baby","back","bad","badly","bag","balance","ball","balloon","band","bank","bar","bare","bark","barn","base","baseball","basic","basis","basket","bat","battle","be","bean","bear","beat","beautiful","beauty","became","because","become","becoming","bee","been","before","began","beginning","begun","behavior","behind","being","believed","bell","belong","below","belt","bend","beneath","bent","beside","best","bet","better","between","beyond","bicycle","bigger","biggest","bill","birds","birth","birthday","bit","bite","black","blank","blanket","blew","blind","block","blood","blow","blue","board","boat","body","bone","book","border","born","both","bottle","bottom","bound","bow","bowl","box","boy","brain","branch","brass","brave","bread","break","breakfast","breath","breathe","breathing","breeze","brick","bridge","brief","bright","bring","broad","broke","broken","brother","brought","brown","brush","buffalo","build","building","built","buried","burn","burst","bus","bush","business","busy","but","butter","buy","by","cabin","cage","cake","call","calm","came","camera","camp","can","canal","cannot","cap","capital","captain","captured","car","carbon","card","care","careful","carefully","carried","carry","case","cast","castle","cat","catch","cattle","caught","cause","cave","cell","cent","center","central","century","certain","certainly","chain","chair","chamber","chance","change","changing","chapter","character","characteristic","charge","chart","check","cheese","chemical","chest","chicken","chief","child","children","choice","choose","chose","chosen","church","circle","circus","citizen","city","class","classroom","claws","clay","clean","clear","clearly","climate","climb","clock","close","closely","closer","cloth","clothes","clothing","cloud","club","coach","coal","coast","coat","coffee","cold","collect","college","colony","color","column","combination","combine","come","comfortable","coming","command","common","community","company","compare","compass","complete","completely","complex","composed","composition","compound","concerned","condition","congress","connected","consider","consist","consonant","constantly","construction","contain","continent","continued","contrast","control","conversation","cook","cookies","cool","copper","copy","corn","corner","correct","correctly","cost","cotton","could","count","country","couple","courage","course","court","cover","cow","cowboy","crack","cream","create","creature","crew","crop","cross","crowd","cry","cup","curious","current","curve","customs","cut","cutting","daily","damage","dance","danger","dangerous","dark","darkness","date","daughter","dawn","day","dead","deal","dear","death","decide","declared","deep","deeply","deer","definition","degree","depend","depth","describe","desert","design","desk","detail","determine","develop","development","diagram","diameter","did","die","differ","difference","different","difficult","difficulty","dig","dinner","direct","direction","directly","dirt","dirty","disappear","discover","discovery","discuss","discussion","disease","dish","distance","distant","divide","division","do","doctor","does","dog","doing","doll","dollar","done","donkey","door","dot","double","doubt","down","dozen","draw","drawn","dream","dress","drew","dried","drink","drive","driven","driver","driving","drop","dropped","drove","dry","duck","due","dug","dull","during","dust","duty","each","eager","ear","earlier","early","earn","earth","easier","easily","east","easy","eat","eaten","edge","education","effect","effort","egg","eight","either","electric","electricity","element","elephant","eleven","else","empty","end","enemy","energy","engine","engineer","enjoy","enough","enter","entire","entirely","environment","equal","equally","equator","equipment","escape","especially","essential","establish","even","evening","event","eventually","ever","every","everybody","everyone","everything","everywhere","evidence","exact","exactly","examine","example","excellent","except","exchange","excited","excitement","exciting","exclaimed","exercise","exist","expect","experience","experiment","explain","explanation","explore","express","expression","extra","eye","face","facing","fact","factor","factory","failed","fair","fairly","fall","fallen","familiar","family","famous","far","farm","farmer","farther","fast","fastened","faster","fat","father","favorite","fear","feathers","feature","fed","feed","feel","feet","fell","fellow","felt","fence","few","fewer","field","fierce","fifteen","fifth","fifty","fight","fighting","figure","fill","film","final","finally","find","fine","finest","finger","finish","fire","fireplace","firm","first","fish","five","fix","flag","flame","flat","flew","flies","flight","floating","floor","flow","flower","fly","fog","folks","follow","food","foot","football","for","force","foreign","forest","forget","forgot","forgotten","form","former","fort","forth","forty","forward","fought","found","four","fourth","fox","frame","free","freedom","frequently","fresh","friend","friendly","frighten","frog","from","front","frozen","fruit","fuel","full","fully","fun","function","funny","fur","furniture","further","future","gain","game","garage","garden","gas","gasoline","gate","gather","gave","general","generally","gentle","gently","get","getting","giant","gift","girl","give","given","giving","glad","glass","globe","go","goes","gold","golden","gone","good","goose","got","government","grabbed","grade","gradually","grain","grandfather","grandmother","graph","grass","gravity","gray","great","greater","greatest","greatly","green","grew","ground","group","grow","grown","growth","guard","guess","guide","gulf","gun","habit","had","hair","half","halfway","hall","hand","handle","handsome","hang","happen","happened","happily","happy","harbor","hard","harder","hardly","has","hat","have","having","hay","he","headed","heading","health","heard","hearing","heart","heat","heavy","height","held","hello","help","helpful","her","herd","here","herself","hidden","hide","high","higher","highest","highway","hill","him","himself","his","history","hit","hold","hole","hollow","home","honor","hope","horn","horse","hospital","hot","hour","house","how","however","huge","human","hundred","hung","hungry","hunt","hunter","hurried","hurry","hurt","husband","ice","idea","identity","if","ill","image","imagine","immediately","importance","important","impossible","improve","in","inch","include","including","income","increase","indeed","independent","indicate","individual","industrial","industry","influence","information","inside","instance","instant","instead","instrument","interest","interior","into","introduced","invented","involved","iron","is","island","it","its","itself","jack","jar","jet","job","join","joined","journey","joy","judge","jump","jungle","just","keep","kept","key","kids","kill","kind","kitchen","knew","knife","know","knowledge","known","label","labor","lack","lady","laid","lake","lamp","land","language","large","larger","largest","last","late","later","laugh","law","lay","layers","lead","leader","leaf","learn","least","leather","leave","leaving","led","left","leg","length","lesson","let","letter","level","library","lie","life","lift","light","like","likely","limited","line","lion","lips","liquid","list","listen","little","live","living","load","local","locate","location","log","lonely","long","longer","look","loose","lose","loss","lost","lot","loud","love","lovely","low","lower","luck","lucky","lunch","lungs","lying","machine","machinery","mad","made","magic","magnet","mail","main","mainly","major","make","making","man","managed","manner","manufacturing","many","map","mark","market","married","mass","massage","master","material","mathematics","matter","may","maybe","me","meal","mean","means","meant","measure","meat","medicine","meet","melted","member","memory","men","mental","merely","met","metal","method","mice","middle","might","mighty","mile","military","milk","mill","mind","mine","minerals","minute","mirror","missing","mission","mistake","mix","mixture","model","modern","molecular","moment","money","monkey","month","mood","moon","more","morning","most","mostly","mother","motion","motor","mountain","mouse","mouth","move","movement","movie","moving","mud","muscle","music","musical","must","my","myself","mysterious","nails","name","nation","national","native","natural","naturally","nature","near","nearby","nearer","nearest","nearly","necessary","neck","needed","needle","needs","negative","neighbor","neighborhood","nervous","nest","never","new","news","newspaper","next","nice","night","nine","no","nobody","nodded","noise","none","noon","nor","north","nose","not","note","noted","nothing","notice","noun","now","number","numeral","nuts","object","observe","obtain","occasionally","occur","ocean","of","off","offer","office","officer","official","oil","old","older","oldest","on","once","one","only","onto","open","operation","opinion","opportunity","opposite","or","orange","orbit","order","ordinary","organization","organized","origin","original","other","ought","our","ourselves","out","outer","outline","outside","over","own","owner","oxygen","pack","package","page","paid","pain","paint","pair","palace","pale","pan","paper","paragraph","parallel","parent","park","part","particles","particular","particularly","partly","parts","party","pass","passage","past","path","pattern","pay","peace","pen","pencil","people","per","percent","perfect","perfectly","perhaps","period","person","personal","pet","phrase","physical","piano","pick","picture","pictured","pie","piece","pig","pile","pilot","pine","pink","pipe","pitch","place","plain","plan","plane","planet","planned","planning","plant","plastic","plate","plates","play","pleasant","please","pleasure","plenty","plural","plus","pocket","poem","poet","poetry","point","pole","police","policeman","political","pond","pony","pool","poor","popular","population","porch","port","position","positive","possible","possibly","post","pot","potatoes","pound","pour","powder","power","powerful","practical","practice","prepare","present","president","press","pressure","pretty","prevent","previous","price","pride","primitive","principal","principle","printed","private","prize","probably","problem","process","produce","product","production","program","progress","promised","proper","properly","property","protection","proud","prove","provide","public","pull","pupil","pure","purple","purpose","push","put","putting","quarter","queen","question","quick","quickly","quiet","quietly","quite","rabbit","race","radio","railroad","rain","raise","ran","ranch","range","rapidly","rate","rather","raw","rays","reach","read","reader","ready","real","realize","rear","reason","recall","receive","recent","recently","recognize","record","red","refer","refused","region","regular","related","relationship","religious","remain","remarkable","remember","remove","repeat","replace","replied","report","represent","require","research","respect","rest","result","return","review","rhyme","rhythm","rice","rich","ride","riding","right","ring","rise","rising","river","road","roar","rock","rocket","rocky","rod","roll","roof","room","root","rope","rose","rough","round","route","row","rubbed","rubber","rule","ruler","run","running","rush","sad","saddle","safe","safety","said","sail","sale","salmon","salt","same","sand","sang","sat","satellites","satisfied","save","saved","saw","say","scale","scared","scene","school","science","scientific","scientist","score","screen","sea","search","season","seat","second","secret","section","see","seed","seeing","seems","seen","seldom","select","selection","sell","send","sense","sent","sentence","separate","series","serious","serve","service","sets","setting","settle","settlers","seven","several","shade","shadow","shake","shaking","shall","shallow","shape","share","sharp","she","sheep","sheet","shelf","shells","shelter","shine","shinning","ship","shirt","shoe","shoot","shop","shore","short","shorter","shot","should","shoulder","shout","show","shown","shut","sick","sides","sight","sign","signal","silence","silent","silk","silly","silver","similar","simple","simplest","simply","since","sing","single","sink","sister","sit","sitting","situation","six","size","skill","skin","sky","slabs","slave","sleep","slept","slide","slight","slightly","slip","slipped","slope","slow","slowly","small","smaller","smallest","smell","smile","smoke","smooth","snake","snow","so","soap","social","society","soft","softly","soil","solar","sold","soldier","solid","solution","solve","some","somebody","somehow","someone","something","sometime","somewhere","son","song","soon","sort","sound","source","south","southern","space","speak","special","species","specific","speech","speed","spell","spend","spent","spider","spin","spirit","spite","split","spoken","sport","spread","spring","square","stage","stairs","stand","standard","star","stared","start","state","statement","station","stay","steady","steam","steel","steep","stems","step","stepped","stick","stiff","still","stock","stomach","stone","stood","stop","stopped","store","storm","story","stove","straight","strange","stranger","straw","stream","street","strength","stretch","strike","string","strip","strong","stronger","struck","structure","struggle","stuck","student","studied","studying","subject","substance","success","successful","such","sudden","suddenly","sugar","suggest","suit","sum","summer","sun","sunlight","supper","supply","support","suppose","sure","surface","surprise","surrounded","swam","sweet","swept","swim","swimming","swing","swung","syllable","symbol","system","table","tail","take","taken","tales","talk","tall","tank","tape","task","taste","taught","tax","tea","teach","teacher","team","tears","teeth","telephone","television","tell","temperature","ten","tent","term","terrible","test","than","thank","that","thee","them","themselves","then","theory","there","therefore","these","they","thick","thin","thing","think","third","thirty","this","those","thou","though","thought","thousand","thread","three","threw","throat","through","throughout","throw","thrown","thumb","thus","thy","tide","tie","tight","tightly","till","time","tin","tiny","tip","tired","title","to","tobacco","today","together","told","tomorrow","tone","tongue","tonight","too","took","tool","top","topic","torn","total","touch","toward","tower","town","toy","trace","track","trade","traffic","trail","train","transportation","trap","travel","treated","tree","triangle","tribe","trick","tried","trip","troops","tropical","trouble","truck","trunk","truth","try","tube","tune","turn","twelve","twenty","twice","two","type","typical","uncle","under","underline","understanding","unhappy","union","unit","universe","unknown","unless","until","unusual","up","upon","upper","upward","us","use","useful","using","usual","usually","valley","valuable","value","vapor","variety","various","vast","vegetable","verb","vertical","very","vessels","victory","view","village","visit","visitor","voice","volume","vote","vowel","voyage","wagon","wait","walk","wall","want","war","warm","warn","was","wash","waste","watch","water","wave","way","we","weak","wealth","wear","weather","week","weigh","weight","welcome","well","went","were","west","western","wet","whale","what","whatever","wheat","wheel","when","whenever","where","wherever","whether","which","while","whispered","whistle","white","who","whole","whom","whose","why","wide","widely","wife","wild","will","willing","win","wind","window","wing","winter","wire","wise","wish","with","within","without","wolf","women","won","wonder","wonderful","wood","wooden","wool","word","wore","work","worker","world","worried","worry","worse","worth","would","wrapped","write","writer","writing","written","wrong","wrote","yard","year","yellow","yes","yesterday","yet","you","young","younger","your","yourself","youth","zero","zebra","zipper","zoo","zulu"];function Gt(t){let e=t?.seed?new lr(t.seed):null;function n(){return t&&t.maxLength>1?s():r()}function s(){for(var h=!1,p;!h;)p=r(),p.length<=t.maxLength&&(h=!0);return p}function r(){return ot[i(ot.length)]}function i(h){let p=e?e():Math.random();return Math.floor(p*h)}if(typeof t>"u")return n();typeof t=="number"&&(t={exactly:t}),t.exactly&&(t.min=t.exactly,t.max=t.exactly),typeof t.wordsPerString!="number"&&(t.wordsPerString=1),typeof t.formatter!="function"&&(t.formatter=h=>h),typeof t.separator!="string"&&(t.separator=" ");for(var o=t.min+i(t.max+1-t.min),a=[],l="",c=0,u=0;u<o*t.wordsPerString;u++)c===t.wordsPerString-1?l+=t.formatter(n(),c):l+=t.formatter(n(),c)+t.separator,c++,(u+1)%t.wordsPerString===0&&(a.push(l),l="",c=0);return typeof t.join=="string"&&(a=a.join(t.join)),a}Yt.exports=Gt;Gt.wordList=ot});var fr={};lt(fr,{SlopitExtension:()=>Ke,responseControlsSchemaVersion:()=>hr});var d={};lt(d,{BRAND:()=>Pn,DIRTY:()=>ae,EMPTY_PATH:()=>un,INVALID:()=>w,NEVER:()=>gs,OK:()=>A,ParseStatus:()=>L,Schema:()=>k,ZodAny:()=>re,ZodArray:()=>Q,ZodBigInt:()=>le,ZodBoolean:()=>ce,ZodBranded:()=>Ne,ZodCatch:()=>we,ZodDate:()=>ue,ZodDefault:()=>be,ZodDiscriminatedUnion:()=>ze,ZodEffects:()=>F,ZodEnum:()=>ve,ZodError:()=>R,ZodFirstPartyTypeKind:()=>x,ZodFunction:()=>qe,ZodIntersection:()=>pe,ZodIssueCode:()=>f,ZodLazy:()=>me,ZodLiteral:()=>ge,ZodMap:()=>Ie,ZodNaN:()=>Le,ZodNativeEnum:()=>ye,ZodNever:()=>z,ZodNull:()=>he,ZodNullable:()=>W,ZodNumber:()=>oe,ZodObject:()=>O,ZodOptional:()=>K,ZodParsedType:()=>y,ZodPipeline:()=>Ve,ZodPromise:()=>ie,ZodReadonly:()=>xe,ZodRecord:()=>He,ZodSchema:()=>k,ZodSet:()=>Me,ZodString:()=>se,ZodSymbol:()=>Ce,ZodTransformer:()=>F,ZodTuple:()=>Z,ZodType:()=>k,ZodUndefined:()=>de,ZodUnion:()=>fe,ZodUnknown:()=>X,ZodVoid:()=>Se,addIssueToContext:()=>g,any:()=>Fn,array:()=>qn,bigint:()=>jn,boolean:()=>wt,coerce:()=>ms,custom:()=>vt,date:()=>Nn,datetimeRegex:()=>mt,defaultErrorMap:()=>Y,discriminatedUnion:()=>Gn,effect:()=>os,enum:()=>rs,function:()=>ts,getErrorMap:()=>ke,getParsedType:()=>U,instanceof:()=>Rn,intersection:()=>Yn,isAborted:()=>Fe,isAsync:()=>Te,isDirty:()=>$e,isValid:()=>ne,late:()=>Dn,lazy:()=>ns,literal:()=>ss,makeIssue:()=>je,map:()=>Qn,nan:()=>On,nativeEnum:()=>is,never:()=>zn,null:()=>Bn,nullable:()=>cs,number:()=>bt,object:()=>Un,objectUtil:()=>We,oboolean:()=>ps,onumber:()=>fs,optional:()=>ls,ostring:()=>hs,pipeline:()=>ds,preprocess:()=>us,promise:()=>as,quotelessJson:()=>on,record:()=>Xn,set:()=>es,setErrorMap:()=>cn,strictObject:()=>Zn,string:()=>yt,symbol:()=>Vn,transformer:()=>os,tuple:()=>Jn,undefined:()=>Kn,union:()=>Wn,unknown:()=>$n,util:()=>T,void:()=>Hn});var T;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function n(r){throw new Error}t.assertNever=n,t.arrayToEnum=r=>{let i={};for(let o of r)i[o]=o;return i},t.getValidEnumValues=r=>{let i=t.objectKeys(r).filter(a=>typeof r[r[a]]!="number"),o={};for(let a of i)o[a]=r[a];return t.objectValues(o)},t.objectValues=r=>t.objectKeys(r).map(function(i){return r[i]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let i=[];for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&i.push(o);return i},t.find=(r,i)=>{for(let o of r)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,i=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=s,t.jsonStringifyReplacer=(r,i)=>typeof i=="bigint"?i.toString():i})(T||(T={}));var We;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(We||(We={}));var y=T.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),U=t=>{switch(typeof t){case"undefined":return y.undefined;case"string":return y.string;case"number":return Number.isNaN(t)?y.nan:y.number;case"boolean":return y.boolean;case"function":return y.function;case"bigint":return y.bigint;case"symbol":return y.symbol;case"object":return Array.isArray(t)?y.array:t===null?y.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?y.promise:typeof Map<"u"&&t instanceof Map?y.map:typeof Set<"u"&&t instanceof Set?y.set:typeof Date<"u"&&t instanceof Date?y.date:y.object;default:return y.unknown}};var f=T.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),on=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),R=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(i){return i.message},s={_errors:[]},r=i=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)s._errors.push(n(o));else{let a=s,l=0;for(;l<o.path.length;){let c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return r(this),s}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,T.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},s=[];for(let r of this.issues)if(r.path.length>0){let i=r.path[0];n[i]=n[i]||[],n[i].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:n}}get formErrors(){return this.flatten()}};R.create=t=>new R(t);var ln=(t,e)=>{let n;switch(t.code){case f.invalid_type:t.received===y.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case f.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,T.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:n=`Unrecognized key(s) in object: ${T.joinValues(t.keys,", ")}`;break;case f.invalid_union:n="Invalid input";break;case f.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${T.joinValues(t.options)}`;break;case f.invalid_enum_value:n=`Invalid enum value. Expected ${T.joinValues(t.options)}, received '${t.received}'`;break;case f.invalid_arguments:n="Invalid function arguments";break;case f.invalid_return_type:n="Invalid function return type";break;case f.invalid_date:n="Invalid date";break;case f.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:T.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case f.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case f.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case f.custom:n="Invalid input";break;case f.invalid_intersection_types:n="Intersection results could not be merged";break;case f.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case f.not_finite:n="Number must be finite";break;default:n=e.defaultError,T.assertNever(t)}return{message:n}},Y=ln;var ut=Y;function cn(t){ut=t}function ke(){return ut}var je=t=>{let{data:e,path:n,errorMaps:s,issueData:r}=t,i=[...n,...r.path||[]],o={...r,path:i};if(r.message!==void 0)return{...r,path:i,message:r.message};let a="",l=s.filter(c=>!!c).slice().reverse();for(let c of l)a=c(o,{data:e,defaultError:a}).message;return{...r,path:i,message:a}},un=[];function g(t,e){let n=ke(),s=je({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Y?void 0:Y].filter(r=>!!r)});t.common.issues.push(s)}var L=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let s=[];for(let r of n){if(r.status==="aborted")return w;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,n){let s=[];for(let r of n){let i=await r.key,o=await r.value;s.push({key:i,value:o})}return t.mergeObjectSync(e,s)}static mergeObjectSync(e,n){let s={};for(let r of n){let{key:i,value:o}=r;if(i.status==="aborted"||o.status==="aborted")return w;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(s[i.value]=o.value)}return{status:e.value,value:s}}},w=Object.freeze({status:"aborted"}),ae=t=>({status:"dirty",value:t}),A=t=>({status:"valid",value:t}),Fe=t=>t.status==="aborted",$e=t=>t.status==="dirty",ne=t=>t.status==="valid",Te=t=>typeof Promise<"u"&&t instanceof Promise;var b;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(b||(b={}));var B=class{constructor(e,n,s,r){this._cachedPath=[],this.parent=e,this.data=n,this._path=s,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},dt=(t,e)=>{if(ne(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new R(t.common.issues);return this._error=n,this._error}}};function _(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:s,description:r}=t;if(e&&(n||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,a)=>{let{message:l}=t;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??s??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:r}}var k=class{get description(){return this._def.description}_getType(e){return U(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:U(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new L,ctx:{common:e.parent.common,data:e.data,parsedType:U(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Te(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let s=this.safeParse(e,n);if(s.success)return s.data;throw s.error}safeParse(e,n){let s={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:U(e)},r=this._parseSync({data:e,path:s.path,parent:s});return dt(s,r)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:U(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:n});return ne(s)?{value:s.value}:{issues:n.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(s=>ne(s)?{value:s.value}:{issues:n.common.issues})}async parseAsync(e,n){let s=await this.safeParseAsync(e,n);if(s.success)return s.data;throw s.error}async safeParseAsync(e,n){let s={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:U(e)},r=this._parse({data:e,path:s.path,parent:s}),i=await(Te(r)?r:Promise.resolve(r));return dt(s,i)}refine(e,n){let s=r=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(r):n;return this._refinement((r,i)=>{let o=e(r),a=()=>i.addIssue({code:f.custom,...s(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,n){return this._refinement((s,r)=>e(s)?!0:(r.addIssue(typeof n=="function"?n(s,r):n),!1))}_refinement(e){return new F({schema:this,typeName:x.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return K.create(this,this._def)}nullable(){return W.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Q.create(this)}promise(){return ie.create(this,this._def)}or(e){return fe.create([this,e],this._def)}and(e){return pe.create(this,e,this._def)}transform(e){return new F({..._(this._def),schema:this,typeName:x.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new be({..._(this._def),innerType:this,defaultValue:n,typeName:x.ZodDefault})}brand(){return new Ne({typeName:x.ZodBranded,type:this,..._(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new we({..._(this._def),innerType:this,catchValue:n,typeName:x.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Ve.create(this,e)}readonly(){return xe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},dn=/^c[^\s-]{8,}$/i,hn=/^[0-9a-z]+$/,fn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,pn=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,mn=/^[a-z0-9_-]{21}$/i,gn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,vn=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,yn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-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1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Tn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,En=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ft="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Cn=new RegExp(`^${ft}$`);function pt(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function Sn(t){return new RegExp(`^${pt(t)}$`)}function mt(t){let e=`${ft}T${pt(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function In(t,e){return!!((e==="v4"||!e)&&wn.test(t)||(e==="v6"||!e)&&_n.test(t))}function Mn(t,e){if(!gn.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let s=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function Ln(t,e){return!!((e==="v4"||!e)&&xn.test(t)||(e==="v6"||!e)&&kn.test(t))}var se=class t extends k{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==y.string){let i=this._getOrReturnCtx(e);return g(i,{code:f.invalid_type,expected:y.string,received:i.parsedType}),w}let s=new L,r;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(r=this._getOrReturnCtx(e,r),g(r,{code:f.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="max")e.data.length>i.value&&(r=this._getOrReturnCtx(e,r),g(r,{code:f.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="length"){let o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(r=this._getOrReturnCtx(e,r),o?g(r,{code:f.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&g(r,{code:f.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),s.dirty())}else if(i.kind==="email")yn.test(e.data)||(r=this._getOrReturnCtx(e,r),g(r,{validation:"email",code:f.invalid_string,message:i.message}),s.dirty());else if(i.kind==="emoji")Ge||(Ge=new RegExp(bn,"u")),Ge.test(e.data)||(r=this._getOrReturnCtx(e,r),g(r,{validation:"emoji",code:f.invalid_string,message:i.message}),s.dirty());else if(i.kind==="uuid")pn.test(e.data)||(r=this._getOrReturnCtx(e,r),g(r,{validation:"uuid",code:f.invalid_string,message:i.message}),s.dirty());else if(i.kind==="nanoid")mn.test(e.data)||(r=this._getOrReturnCtx(e,r),g(r,{validation:"nanoid",code:f.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid")dn.test(e.data)||(r=this._getOrReturnCtx(e,r),g(r,{validation:"cuid",code:f.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid2")hn.test(e.data)||(r=this._getOrReturnCtx(e,r),g(r,{validation:"cuid2",code:f.invalid_string,message:i.message}),s.dirty());else if(i.kind==="ulid")fn.test(e.data)||(r=this._getOrReturnCtx(e,r),g(r,{validation:"ulid",code:f.invalid_string,message:i.message}),s.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),g(r,{validation:"url",code:f.invalid_string,message:i.message}),s.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),g(r,{validation:"regex",code:f.invalid_string,message:i.message}),s.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(r=this._getOrReturnCtx(e,r),g(r,{code:f.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),s.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(r=this._getOrReturnCtx(e,r),g(r,{code:f.invalid_string,validation:{startsWith:i.value},message:i.message}),s.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(r=this._getOrReturnCtx(e,r),g(r,{code:f.invalid_string,validation:{endsWith:i.value},message:i.message}),s.dirty()):i.kind==="datetime"?mt(i).test(e.data)||(r=this._getOrReturnCtx(e,r),g(r,{code:f.invalid_string,validation:"datetime",message:i.message}),s.dirty()):i.kind==="date"?Cn.test(e.data)||(r=this._getOrReturnCtx(e,r),g(r,{code:f.invalid_string,validation:"date",message:i.message}),s.dirty()):i.kind==="time"?Sn(i).test(e.data)||(r=this._getOrReturnCtx(e,r),g(r,{code:f.invalid_string,validation:"time",message:i.message}),s.dirty()):i.kind==="duration"?vn.test(e.data)||(r=this._getOrReturnCtx(e,r),g(r,{validation:"duration",code:f.invalid_string,message:i.message}),s.dirty()):i.kind==="ip"?In(e.data,i.version)||(r=this._getOrReturnCtx(e,r),g(r,{validation:"ip",code:f.invalid_string,message:i.message}),s.dirty()):i.kind==="jwt"?Mn(e.data,i.alg)||(r=this._getOrReturnCtx(e,r),g(r,{validation:"jwt",code:f.invalid_string,message:i.message}),s.dirty()):i.kind==="cidr"?Ln(e.data,i.version)||(r=this._getOrReturnCtx(e,r),g(r,{validation:"cidr",code:f.invalid_string,message:i.message}),s.dirty()):i.kind==="base64"?Tn.test(e.data)||(r=this._getOrReturnCtx(e,r),g(r,{validation:"base64",code:f.invalid_string,message:i.message}),s.dirty()):i.kind==="base64url"?En.test(e.data)||(r=this._getOrReturnCtx(e,r),g(r,{validation:"base64url",code:f.invalid_string,message:i.message}),s.dirty()):T.assertNever(i);return{status:s.value,value:e.data}}_regex(e,n,s){return this.refinement(r=>e.test(r),{validation:n,code:f.invalid_string,...b.errToObj(s)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...b.errToObj(e)})}url(e){return this._addCheck({kind:"url",...b.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...b.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...b.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...b.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...b.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...b.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...b.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...b.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...b.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...b.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...b.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...b.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...b.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...b.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...b.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...b.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...b.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...b.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...b.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...b.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...b.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...b.errToObj(n)})}nonempty(e){return this.min(1,b.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};se.create=t=>new se({checks:[],typeName:x.ZodString,coerce:t?.coerce??!1,..._(t)});function An(t,e){let n=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,r=n>s?n:s,i=Number.parseInt(t.toFixed(r).replace(".","")),o=Number.parseInt(e.toFixed(r).replace(".",""));return i%o/10**r}var oe=class t extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==y.number){let i=this._getOrReturnCtx(e);return g(i,{code:f.invalid_type,expected:y.number,received:i.parsedType}),w}let s,r=new L;for(let i of this._def.checks)i.kind==="int"?T.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),g(s,{code:f.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(s=this._getOrReturnCtx(e,s),g(s,{code:f.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),g(s,{code:f.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="multipleOf"?An(e.data,i.value)!==0&&(s=this._getOrReturnCtx(e,s),g(s,{code:f.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),g(s,{code:f.not_finite,message:i.message}),r.dirty()):T.assertNever(i);return{status:r.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,b.toString(n))}gt(e,n){return this.setLimit("min",e,!1,b.toString(n))}lte(e,n){return this.setLimit("max",e,!0,b.toString(n))}lt(e,n){return this.setLimit("max",e,!1,b.toString(n))}setLimit(e,n,s,r){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:s,message:b.toString(r)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:b.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:b.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:b.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:b.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:b.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:b.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:b.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:b.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:b.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&T.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(n===null||s.value>n)&&(n=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(n)&&Number.isFinite(e)}};oe.create=t=>new oe({checks:[],typeName:x.ZodNumber,coerce:t?.coerce||!1,..._(t)});var le=class t extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==y.bigint)return this._getInvalidInput(e);let s,r=new L;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(s=this._getOrReturnCtx(e,s),g(s,{code:f.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),g(s,{code:f.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),g(s,{code:f.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):T.assertNever(i);return{status:r.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return g(n,{code:f.invalid_type,expected:y.bigint,received:n.parsedType}),w}gte(e,n){return this.setLimit("min",e,!0,b.toString(n))}gt(e,n){return this.setLimit("min",e,!1,b.toString(n))}lte(e,n){return this.setLimit("max",e,!0,b.toString(n))}lt(e,n){return this.setLimit("max",e,!1,b.toString(n))}setLimit(e,n,s,r){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:s,message:b.toString(r)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:b.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:b.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:b.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:b.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:b.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};le.create=t=>new le({checks:[],typeName:x.ZodBigInt,coerce:t?.coerce??!1,..._(t)});var ce=class extends k{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==y.boolean){let s=this._getOrReturnCtx(e);return g(s,{code:f.invalid_type,expected:y.boolean,received:s.parsedType}),w}return A(e.data)}};ce.create=t=>new ce({typeName:x.ZodBoolean,coerce:t?.coerce||!1,..._(t)});var ue=class t extends k{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==y.date){let i=this._getOrReturnCtx(e);return g(i,{code:f.invalid_type,expected:y.date,received:i.parsedType}),w}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return g(i,{code:f.invalid_date}),w}let s=new L,r;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(r=this._getOrReturnCtx(e,r),g(r,{code:f.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),s.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(r=this._getOrReturnCtx(e,r),g(r,{code:f.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),s.dirty()):T.assertNever(i);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:b.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:b.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};ue.create=t=>new ue({checks:[],coerce:t?.coerce||!1,typeName:x.ZodDate,..._(t)});var Ce=class extends k{_parse(e){if(this._getType(e)!==y.symbol){let s=this._getOrReturnCtx(e);return g(s,{code:f.invalid_type,expected:y.symbol,received:s.parsedType}),w}return A(e.data)}};Ce.create=t=>new Ce({typeName:x.ZodSymbol,..._(t)});var de=class extends k{_parse(e){if(this._getType(e)!==y.undefined){let s=this._getOrReturnCtx(e);return g(s,{code:f.invalid_type,expected:y.undefined,received:s.parsedType}),w}return A(e.data)}};de.create=t=>new de({typeName:x.ZodUndefined,..._(t)});var he=class extends k{_parse(e){if(this._getType(e)!==y.null){let s=this._getOrReturnCtx(e);return g(s,{code:f.invalid_type,expected:y.null,received:s.parsedType}),w}return A(e.data)}};he.create=t=>new he({typeName:x.ZodNull,..._(t)});var re=class extends k{constructor(){super(...arguments),this._any=!0}_parse(e){return A(e.data)}};re.create=t=>new re({typeName:x.ZodAny,..._(t)});var X=class extends k{constructor(){super(...arguments),this._unknown=!0}_parse(e){return A(e.data)}};X.create=t=>new X({typeName:x.ZodUnknown,..._(t)});var z=class extends k{_parse(e){let n=this._getOrReturnCtx(e);return g(n,{code:f.invalid_type,expected:y.never,received:n.parsedType}),w}};z.create=t=>new z({typeName:x.ZodNever,..._(t)});var Se=class extends k{_parse(e){if(this._getType(e)!==y.undefined){let s=this._getOrReturnCtx(e);return g(s,{code:f.invalid_type,expected:y.void,received:s.parsedType}),w}return A(e.data)}};Se.create=t=>new Se({typeName:x.ZodVoid,..._(t)});var Q=class t extends k{_parse(e){let{ctx:n,status:s}=this._processInputParams(e),r=this._def;if(n.parsedType!==y.array)return g(n,{code:f.invalid_type,expected:y.array,received:n.parsedType}),w;if(r.exactLength!==null){let o=n.data.length>r.exactLength.value,a=n.data.length<r.exactLength.value;(o||a)&&(g(n,{code:o?f.too_big:f.too_small,minimum:a?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),s.dirty())}if(r.minLength!==null&&n.data.length<r.minLength.value&&(g(n,{code:f.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),s.dirty()),r.maxLength!==null&&n.data.length>r.maxLength.value&&(g(n,{code:f.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>r.type._parseAsync(new B(n,o,n.path,a)))).then(o=>L.mergeArray(s,o));let i=[...n.data].map((o,a)=>r.type._parseSync(new B(n,o,n.path,a)));return L.mergeArray(s,i)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:b.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:b.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:b.toString(n)}})}nonempty(e){return this.min(1,e)}};Q.create=(t,e)=>new Q({type:t,minLength:null,maxLength:null,exactLength:null,typeName:x.ZodArray,..._(e)});function Ee(t){if(t instanceof O){let e={};for(let n in t.shape){let s=t.shape[n];e[n]=K.create(Ee(s))}return new O({...t._def,shape:()=>e})}else return t instanceof Q?new Q({...t._def,type:Ee(t.element)}):t instanceof K?K.create(Ee(t.unwrap())):t instanceof W?W.create(Ee(t.unwrap())):t instanceof Z?Z.create(t.items.map(e=>Ee(e))):t}var O=class t extends k{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=T.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==y.object){let c=this._getOrReturnCtx(e);return g(c,{code:f.invalid_type,expected:y.object,received:c.parsedType}),w}let{status:s,ctx:r}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof z&&this._def.unknownKeys==="strip"))for(let c in r.data)o.includes(c)||a.push(c);let l=[];for(let c of o){let u=i[c],h=r.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new B(r,h,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof z){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:r.data[u]}});else if(c==="strict")a.length>0&&(g(r,{code:f.unrecognized_keys,keys:a}),s.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of a){let h=r.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new B(r,h,r.path,u)),alwaysSet:u in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let h=await u.key,p=await u.value;c.push({key:h,value:p,alwaysSet:u.alwaysSet})}return c}).then(c=>L.mergeObjectSync(s,c)):L.mergeObjectSync(s,l)}get shape(){return this._def.shape()}strict(e){return b.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,s)=>{let r=this._def.errorMap?.(n,s).message??s.defaultError;return n.code==="unrecognized_keys"?{message:b.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:x.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let s of T.objectKeys(e))e[s]&&this.shape[s]&&(n[s]=this.shape[s]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let s of T.objectKeys(this.shape))e[s]||(n[s]=this.shape[s]);return new t({...this._def,shape:()=>n})}deepPartial(){return Ee(this)}partial(e){let n={};for(let s of T.objectKeys(this.shape)){let r=this.shape[s];e&&!e[s]?n[s]=r:n[s]=r.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let s of T.objectKeys(this.shape))if(e&&!e[s])n[s]=this.shape[s];else{let i=this.shape[s];for(;i instanceof K;)i=i._def.innerType;n[s]=i}return new t({...this._def,shape:()=>n})}keyof(){return gt(T.objectKeys(this.shape))}};O.create=(t,e)=>new O({shape:()=>t,unknownKeys:"strip",catchall:z.create(),typeName:x.ZodObject,..._(e)});O.strictCreate=(t,e)=>new O({shape:()=>t,unknownKeys:"strict",catchall:z.create(),typeName:x.ZodObject,..._(e)});O.lazycreate=(t,e)=>new O({shape:t,unknownKeys:"strip",catchall:z.create(),typeName:x.ZodObject,..._(e)});var fe=class extends k{_parse(e){let{ctx:n}=this._processInputParams(e),s=this._def.options;function r(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(a=>new R(a.ctx.common.issues));return g(n,{code:f.invalid_union,unionErrors:o}),w}if(n.common.async)return Promise.all(s.map(async i=>{let o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(r);{let i,o=[];for(let l of s){let c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let a=o.map(l=>new R(l));return g(n,{code:f.invalid_union,unionErrors:a}),w}}get options(){return this._def.options}};fe.create=(t,e)=>new fe({options:t,typeName:x.ZodUnion,..._(e)});var J=t=>t instanceof me?J(t.schema):t instanceof F?J(t.innerType()):t instanceof ge?[t.value]:t instanceof ve?t.options:t instanceof ye?T.objectValues(t.enum):t instanceof be?J(t._def.innerType):t instanceof de?[void 0]:t instanceof he?[null]:t instanceof K?[void 0,...J(t.unwrap())]:t instanceof W?[null,...J(t.unwrap())]:t instanceof Ne||t instanceof xe?J(t.unwrap()):t instanceof we?J(t._def.innerType):[],ze=class t extends k{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==y.object)return g(n,{code:f.invalid_type,expected:y.object,received:n.parsedType}),w;let s=this.discriminator,r=n.data[s],i=this.optionsMap.get(r);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(g(n,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),w)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,s){let r=new Map;for(let i of n){let o=J(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of o){if(r.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);r.set(a,i)}}return new t({typeName:x.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:r,..._(s)})}};function Ye(t,e){let n=U(t),s=U(e);if(t===e)return{valid:!0,data:t};if(n===y.object&&s===y.object){let r=T.objectKeys(e),i=T.objectKeys(t).filter(a=>r.indexOf(a)!==-1),o={...t,...e};for(let a of i){let l=Ye(t[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===y.array&&s===y.array){if(t.length!==e.length)return{valid:!1};let r=[];for(let i=0;i<t.length;i++){let o=t[i],a=e[i],l=Ye(o,a);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return n===y.date&&s===y.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var pe=class extends k{_parse(e){let{status:n,ctx:s}=this._processInputParams(e),r=(i,o)=>{if(Fe(i)||Fe(o))return w;let a=Ye(i.value,o.value);return a.valid?(($e(i)||$e(o))&&n.dirty(),{status:n.value,value:a.data}):(g(s,{code:f.invalid_intersection_types}),w)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([i,o])=>r(i,o)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};pe.create=(t,e,n)=>new pe({left:t,right:e,typeName:x.ZodIntersection,..._(n)});var Z=class t extends k{_parse(e){let{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==y.array)return g(s,{code:f.invalid_type,expected:y.array,received:s.parsedType}),w;if(s.data.length<this._def.items.length)return g(s,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),w;!this._def.rest&&s.data.length>this._def.items.length&&(g(s,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...s.data].map((o,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new B(s,o,s.path,a)):null}).filter(o=>!!o);return s.common.async?Promise.all(i).then(o=>L.mergeArray(n,o)):L.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Z.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Z({items:t,typeName:x.ZodTuple,rest:null,..._(e)})};var He=class t extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==y.object)return g(s,{code:f.invalid_type,expected:y.object,received:s.parsedType}),w;let r=[],i=this._def.keyType,o=this._def.valueType;for(let a in s.data)r.push({key:i._parse(new B(s,a,s.path,a)),value:o._parse(new B(s,s.data[a],s.path,a)),alwaysSet:a in s.data});return s.common.async?L.mergeObjectAsync(n,r):L.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(e,n,s){return n instanceof k?new t({keyType:e,valueType:n,typeName:x.ZodRecord,..._(s)}):new t({keyType:se.create(),valueType:e,typeName:x.ZodRecord,..._(n)})}},Ie=class extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==y.map)return g(s,{code:f.invalid_type,expected:y.map,received:s.parsedType}),w;let r=this._def.keyType,i=this._def.valueType,o=[...s.data.entries()].map(([a,l],c)=>({key:r._parse(new B(s,a,s.path,[c,"key"])),value:i._parse(new B(s,l,s.path,[c,"value"]))}));if(s.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of o){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return w;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let l of o){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return w;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}};Ie.create=(t,e,n)=>new Ie({valueType:e,keyType:t,typeName:x.ZodMap,..._(n)});var Me=class t extends k{_parse(e){let{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==y.set)return g(s,{code:f.invalid_type,expected:y.set,received:s.parsedType}),w;let r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(g(s,{code:f.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),n.dirty()),r.maxSize!==null&&s.data.size>r.maxSize.value&&(g(s,{code:f.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());let i=this._def.valueType;function o(l){let c=new Set;for(let u of l){if(u.status==="aborted")return w;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}let a=[...s.data.values()].map((l,c)=>i._parse(new B(s,l,s.path,c)));return s.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,n){return new t({...this._def,minSize:{value:e,message:b.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:b.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};Me.create=(t,e)=>new Me({valueType:t,minSize:null,maxSize:null,typeName:x.ZodSet,..._(e)});var qe=class t extends k{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==y.function)return g(n,{code:f.invalid_type,expected:y.function,received:n.parsedType}),w;function s(a,l){return je({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ke(),Y].filter(c=>!!c),issueData:{code:f.invalid_arguments,argumentsError:l}})}function r(a,l){return je({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ke(),Y].filter(c=>!!c),issueData:{code:f.invalid_return_type,returnTypeError:l}})}let i={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof ie){let a=this;return A(async function(...l){let c=new R([]),u=await a._def.args.parseAsync(l,i).catch(m=>{throw c.addIssue(s(l,m)),c}),h=await Reflect.apply(o,this,u);return await a._def.returns._def.type.parseAsync(h,i).catch(m=>{throw c.addIssue(r(h,m)),c})})}else{let a=this;return A(function(...l){let c=a._def.args.safeParse(l,i);if(!c.success)throw new R([s(l,c.error)]);let u=Reflect.apply(o,this,c.data),h=a._def.returns.safeParse(u,i);if(!h.success)throw new R([r(u,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Z.create(e).rest(X.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,s){return new t({args:e||Z.create([]).rest(X.create()),returns:n||X.create(),typeName:x.ZodFunction,..._(s)})}},me=class extends k{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};me.create=(t,e)=>new me({getter:t,typeName:x.ZodLazy,..._(e)});var ge=class extends k{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return g(n,{received:n.data,code:f.invalid_literal,expected:this._def.value}),w}return{status:"valid",value:e.data}}get value(){return this._def.value}};ge.create=(t,e)=>new ge({value:t,typeName:x.ZodLiteral,..._(e)});function gt(t,e){return new ve({values:t,typeName:x.ZodEnum,..._(e)})}var ve=class t extends k{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),s=this._def.values;return g(n,{expected:T.joinValues(s),received:n.parsedType,code:f.invalid_type}),w}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),s=this._def.values;return g(n,{received:n.data,code:f.invalid_enum_value,options:s}),w}return A(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(s=>!e.includes(s)),{...this._def,...n})}};ve.create=gt;var ye=class extends k{_parse(e){let n=T.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==y.string&&s.parsedType!==y.number){let r=T.objectValues(n);return g(s,{expected:T.joinValues(r),received:s.parsedType,code:f.invalid_type}),w}if(this._cache||(this._cache=new Set(T.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let r=T.objectValues(n);return g(s,{received:s.data,code:f.invalid_enum_value,options:r}),w}return A(e.data)}get enum(){return this._def.values}};ye.create=(t,e)=>new ye({values:t,typeName:x.ZodNativeEnum,..._(e)});var ie=class extends k{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==y.promise&&n.common.async===!1)return g(n,{code:f.invalid_type,expected:y.promise,received:n.parsedType}),w;let s=n.parsedType===y.promise?n.data:Promise.resolve(n.data);return A(s.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}};ie.create=(t,e)=>new ie({type:t,typeName:x.ZodPromise,..._(e)});var F=class extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===x.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:s}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:o=>{g(s,o),o.fatal?n.abort():n.dirty()},get path(){return s.path}};if(i.addIssue=i.addIssue.bind(i),r.type==="preprocess"){let o=r.transform(s.data,i);if(s.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return w;let l=await this._def.schema._parseAsync({data:a,path:s.path,parent:s});return l.status==="aborted"?w:l.status==="dirty"?ae(l.value):n.value==="dirty"?ae(l.value):l});{if(n.value==="aborted")return w;let a=this._def.schema._parseSync({data:o,path:s.path,parent:s});return a.status==="aborted"?w:a.status==="dirty"?ae(a.value):n.value==="dirty"?ae(a.value):a}}if(r.type==="refinement"){let o=a=>{let l=r.refinement(a,i);if(s.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(s.common.async===!1){let a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?w:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(a=>a.status==="aborted"?w:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(r.type==="transform")if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!ne(o))return w;let a=r.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>ne(o)?Promise.resolve(r.transform(o.value,i)).then(a=>({status:n.value,value:a})):w);T.assertNever(r)}};F.create=(t,e,n)=>new F({schema:t,typeName:x.ZodEffects,effect:e,..._(n)});F.createWithPreprocess=(t,e,n)=>new F({schema:e,effect:{type:"preprocess",transform:t},typeName:x.ZodEffects,..._(n)});var K=class extends k{_parse(e){return this._getType(e)===y.undefined?A(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};K.create=(t,e)=>new K({innerType:t,typeName:x.ZodOptional,..._(e)});var W=class extends k{_parse(e){return this._getType(e)===y.null?A(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};W.create=(t,e)=>new W({innerType:t,typeName:x.ZodNullable,..._(e)});var be=class extends k{_parse(e){let{ctx:n}=this._processInputParams(e),s=n.data;return n.parsedType===y.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};be.create=(t,e)=>new be({innerType:t,typeName:x.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var we=class extends k{_parse(e){let{ctx:n}=this._processInputParams(e),s={...n,common:{...n.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Te(r)?r.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new R(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new R(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};we.create=(t,e)=>new we({innerType:t,typeName:x.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});var Le=class extends k{_parse(e){if(this._getType(e)!==y.nan){let s=this._getOrReturnCtx(e);return g(s,{code:f.invalid_type,expected:y.nan,received:s.parsedType}),w}return{status:"valid",value:e.data}}};Le.create=t=>new Le({typeName:x.ZodNaN,..._(t)});var Pn=Symbol("zod_brand"),Ne=class extends k{_parse(e){let{ctx:n}=this._processInputParams(e),s=n.data;return this._def.type._parse({data:s,path:n.path,parent:n})}unwrap(){return this._def.type}},Ve=class t extends k{_parse(e){let{status:n,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?w:i.status==="dirty"?(n.dirty(),ae(i.value)):this._def.out._parseAsync({data:i.value,path:s.path,parent:s})})();{let r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?w:r.status==="dirty"?(n.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,n){return new t({in:e,out:n,typeName:x.ZodPipeline})}},xe=class extends k{_parse(e){let n=this._def.innerType._parse(e),s=r=>(ne(r)&&(r.value=Object.freeze(r.value)),r);return Te(n)?n.then(r=>s(r)):s(n)}unwrap(){return this._def.innerType}};xe.create=(t,e)=>new xe({innerType:t,typeName:x.ZodReadonly,..._(e)});function ht(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function vt(t,e={},n){return t?re.create().superRefine((s,r)=>{let i=t(s);if(i instanceof Promise)return i.then(o=>{if(!o){let a=ht(e,s),l=a.fatal??n??!0;r.addIssue({code:"custom",...a,fatal:l})}});if(!i){let o=ht(e,s),a=o.fatal??n??!0;r.addIssue({code:"custom",...o,fatal:a})}}):re.create()}var Dn={object:O.lazycreate},x;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(x||(x={}));var Rn=(t,e={message:`Input not instance of ${t.name}`})=>vt(n=>n instanceof t,e),yt=se.create,bt=oe.create,On=Le.create,jn=le.create,wt=ce.create,Nn=ue.create,Vn=Ce.create,Kn=de.create,Bn=he.create,Fn=re.create,$n=X.create,zn=z.create,Hn=Se.create,qn=Q.create,Un=O.create,Zn=O.strictCreate,Wn=fe.create,Gn=ze.create,Yn=pe.create,Jn=Z.create,Xn=He.create,Qn=Ie.create,es=Me.create,ts=qe.create,ns=me.create,ss=ge.create,rs=ve.create,is=ye.create,as=ie.create,os=F.create,ls=K.create,cs=W.create,us=F.createWithPreprocess,ds=Ve.create,hs=()=>yt().optional(),fs=()=>bt().optional(),ps=()=>wt().optional(),ms={string:(t=>se.create({...t,coerce:!0})),number:(t=>oe.create({...t,coerce:!0})),boolean:(t=>ce.create({...t,coerce:!0})),bigint:(t=>le.create({...t,coerce:!0})),date:(t=>ue.create({...t,coerce:!0}))};var gs=w;var vs=d.object({shift:d.boolean(),ctrl:d.boolean(),alt:d.boolean(),meta:d.boolean()}),xt=d.object({time:d.number(),key:d.string(),code:d.string(),event:d.enum(["keydown","keyup"]),textLength:d.number().optional(),modifiers:vs.optional()}),_t=d.object({time:d.number(),event:d.enum(["focus","blur","visibilitychange"]),visibility:d.enum(["visible","hidden"]).optional(),blurDuration:d.number().optional()}),kt=d.object({time:d.number(),textLength:d.number(),textPreview:d.string().optional(),textHash:d.string().optional(),precedingKeystrokes:d.number(),blocked:d.boolean()}),ys=d.object({time:d.number(),event:d.enum(["mousemove","mousedown","mouseup","click"]),x:d.number(),y:d.number()}),bs=d.object({totalKeystrokes:d.number(),printableKeystrokes:d.number(),deletions:d.number(),meanIKI:d.number(),stdIKI:d.number(),medianIKI:d.number(),pauseCount:d.number(),productProcessRatio:d.number()}),ws=d.object({blurCount:d.number(),totalBlurDuration:d.number(),hiddenCount:d.number(),totalHiddenDuration:d.number()}),xs=d.object({firstKeystrokeLatency:d.number().optional(),totalResponseTime:d.number(),charactersPerMinute:d.number().optional()}),_s=d.object({keystroke:bs.optional(),focus:ws.optional(),timing:xs.optional()}),Tt=d.object({time:d.number().nonnegative(),event:d.enum(["keydown","keyup","focusin","focusout","input","change","click","submit","paste","copy","cut","pointerdown","pointerup","pointermove"]),control:d.enum(["select","button","text","radio","checkbox","range"]),trusted:d.boolean(),key:d.enum(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","End","Enter","Escape","Home","PageDown","PageUp","Tab","redacted"]).optional(),x:d.number().nonnegative().optional(),y:d.number().nonnegative().optional()}).strict(),Et=d.object({schemaVersion:d.literal("1.0"),events:d.array(Tt)}).strict(),Ct=d.object({responseControls:Et.optional(),keystrokes:d.array(xt).optional(),focus:d.array(_t).optional(),paste:d.array(kt).optional(),mouse:d.array(ys).optional(),metrics:_s.optional()}),St=d.enum(["info","low","medium","high"]),It=d.object({type:d.string(),severity:St,message:d.string(),timestamp:d.number(),details:d.record(d.unknown()).optional()}),ks=d.object({type:d.string(),analyzer:d.string(),severity:St,message:d.string(),confidence:d.number().min(0).max(1).optional(),evidence:d.record(d.unknown()).optional(),trialIds:d.array(d.string()).optional()}),Ts=d.object({name:d.string(),version:d.string().optional(),adapterVersion:d.string().optional()}),Es=d.object({userAgent:d.string(),screenResolution:d.tuple([d.number(),d.number()]),viewportSize:d.tuple([d.number(),d.number()]),devicePixelRatio:d.number(),timezone:d.string(),language:d.string(),touchCapable:d.boolean(),connectionType:d.string().optional()}),Cs=d.object({startTime:d.number(),endTime:d.number().optional(),duration:d.number().optional()}),Ss=d.object({type:d.enum(["text","image","audio","video","html","other"]),content:d.string().optional(),contentHash:d.string().optional(),parameters:d.record(d.unknown()).optional()});d.object({start:d.number(),end:d.number(),label:d.string(),text:d.string()});var Is=d.object({type:d.enum(["text","choice","multi-choice","slider","likert","annotation","other"]),value:d.unknown(),characterCount:d.number().optional(),wordCount:d.number().optional()}),Mt=d.object({trialId:d.string(),trialIndex:d.number(),trialType:d.string().optional(),startTime:d.number(),endTime:d.number(),rt:d.number().optional(),stimulus:Ss.optional(),response:Is.optional(),behavioral:Ct.optional(),platformData:d.record(d.unknown()).optional(),captureFlags:d.array(It).optional()}),Ms=d.object({timestamp:d.number(),event:d.enum(["focus","blur","visibilitychange"]),visibility:d.enum(["visible","hidden"]).optional()}),Ls=d.object({timestamp:d.number(),message:d.string(),stack:d.string().optional(),source:d.string().optional()}),As=d.object({timestamp:d.number(),type:d.string(),data:d.record(d.unknown()).optional()}),Ps=d.object({focus:d.array(Ms),errors:d.array(Ls),custom:d.array(As).optional()}),Ds=d.object({schemaVersion:d.literal("1.0"),sessionId:d.string(),participantId:d.string().optional(),studyId:d.string().optional(),platform:Ts,environment:Es,timing:Cs,trials:d.array(Mt),globalEvents:Ps,metadata:d.record(d.unknown()).optional()});async function Je(t){if(typeof crypto<"u"&&crypto.subtle){let s=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",s);return Array.from(new Uint8Array(r)).map(o=>o.toString(16).padStart(2,"0")).join("")}let e=0;for(let n=0;n<t.length;n++){let s=t.charCodeAt(n);e=(e<<5)-e+s,e=e&e}return Math.abs(e).toString(16).padStart(8,"0")}function Xe(t){let e=0;for(let n=0;n<t.length;n++){let s=t.charCodeAt(n);e=(e<<5)-e+s,e=e&e}return Math.abs(e).toString(16).padStart(8,"0")}var Rs=class{constructor(t,e,n,s,r){v(this,"pasteEvents",[]);v(this,"copyEvents",[]);v(this,"element",null);v(this,"startTime");v(this,"boundPaste");v(this,"boundCopy");v(this,"boundCut");this.config=t,this.getRecentKeystrokes=n,this.onPasteEvent=s,this.onCopyEvent=r,this.startTime=e,this.boundPaste=this.handlePaste.bind(this),this.boundCopy=this.handleCopy.bind(this),this.boundCut=this.handleCut.bind(this)}attach(t){this.element=t,this.config.capturePaste&&t.addEventListener("paste",this.boundPaste),this.config.captureCopyCut&&(t.addEventListener("copy",this.boundCopy),t.addEventListener("cut",this.boundCut))}detach(){this.element&&(this.element.removeEventListener("paste",this.boundPaste),this.element.removeEventListener("copy",this.boundCopy),this.element.removeEventListener("cut",this.boundCut),this.element=null)}reset(t){this.pasteEvents=[],this.copyEvents=[],t!==void 0&&(this.startTime=t)}getPasteEvents(){return[...this.pasteEvents]}getCopyEvents(){return[...this.copyEvents]}getAllEvents(){return[...this.pasteEvents,...this.copyEvents].sort((e,n)=>e.time-n.time)}handlePaste(t){let e=t.clipboardData?.getData("text/plain")??"",n=performance.now()-this.startTime,s=this.getRecentKeystrokes();this.config.prevent&&(t.preventDefault(),this.config.warnMessage&&alert(this.config.warnMessage));let r={time:n,textLength:e.length,precedingKeystrokes:s,blocked:this.config.prevent,...this.config.capturePreview?{textPreview:e.slice(0,this.config.previewLength)}:{},textHash:Xe(e)};this.pasteEvents.push(r),this.onPasteEvent?.(r),e.length>0&&Je(e).then(i=>{r.textHash=i})}handleCopy(t){this.handleCopyCut(t,"copy")}handleCut(t){this.handleCopyCut(t,"cut")}handleCopyCut(t,e){let n=performance.now()-this.startTime,r=window.getSelection()?.toString()??"",i,o,a=document.activeElement;(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement)&&(i=a.selectionStart??void 0,o=a.selectionEnd??void 0);let l={time:n,event:e,textLength:r.length,...this.config.capturePreview?{textPreview:r.slice(0,this.config.previewLength)}:{},textHash:Xe(r),...i!==void 0?{selectionStart:i}:{},...o!==void 0?{selectionEnd:o}:{}};this.copyEvents.push(l),this.onCopyEvent?.(l),r.length>0&&Je(r).then(c=>{l.textHash=c})}},Os=class{constructor(t,e,n){v(this,"events",[]);v(this,"startTime");v(this,"lastBlurTime");v(this,"lastHiddenTime");v(this,"boundFocus");v(this,"boundBlur");v(this,"boundVisibility");v(this,"attached",!1);this.config=t,this.onEvent=n,this.startTime=e,this.boundFocus=this.handleFocus.bind(this),this.boundBlur=this.handleBlur.bind(this),this.boundVisibility=this.handleVisibilityChange.bind(this)}attach(t){this.attached||(this.config.useBlurFocus&&(window.addEventListener("focus",this.boundFocus),window.addEventListener("blur",this.boundBlur)),this.config.useVisibilityAPI&&document.addEventListener("visibilitychange",this.boundVisibility),this.attached=!0)}detach(){this.attached&&(window.removeEventListener("focus",this.boundFocus),window.removeEventListener("blur",this.boundBlur),document.removeEventListener("visibilitychange",this.boundVisibility),this.lastBlurTime!==void 0&&this.updateLastBlurDuration(),this.attached=!1)}reset(t){this.events=[],this.lastBlurTime=void 0,this.lastHiddenTime=void 0,t!==void 0&&(this.startTime=t)}getEvents(){return[...this.events]}handleFocus(){let t=performance.now()-this.startTime;this.updateLastBlurDuration();let e={time:t,event:"focus"};this.events.push(e),this.onEvent?.(e)}handleBlur(){let t=performance.now()-this.startTime;this.lastBlurTime=t;let e={time:t,event:"blur"};this.events.push(e),this.onEvent?.(e)}handleVisibilityChange(){let t=performance.now()-this.startTime,e=document.visibilityState;e==="hidden"&&(this.lastHiddenTime=t);let n={time:t,event:"visibilitychange",visibility:e};this.events.push(n),this.onEvent?.(n)}updateLastBlurDuration(){if(this.lastBlurTime===void 0)return;let e=performance.now()-this.startTime-this.lastBlurTime;for(let n=this.events.length-1;n>=0;n--){let s=this.events[n];if(s?.event==="blur"&&s.blurDuration===void 0){s.blurDuration=e;break}}this.lastBlurTime=void 0}},js=class{constructor(t,e,n){v(this,"events",[]);v(this,"element",null);v(this,"startTime");v(this,"currentFocusStart",null);v(this,"currentKeystrokeCount",0);v(this,"currentPasteCount",0);v(this,"boundFocus");v(this,"boundBlur");this.config=t,this.onEvent=n,this.startTime=e,this.boundFocus=this.handleFocus.bind(this),this.boundBlur=this.handleBlur.bind(this)}attach(t){t instanceof Document||(this.element=t,t.addEventListener("focus",this.boundFocus),t.addEventListener("blur",this.boundBlur))}detach(){this.element&&(this.element.removeEventListener("focus",this.boundFocus),this.element.removeEventListener("blur",this.boundBlur),this.element=null),this.currentFocusStart!==null&&this.finalizeCurrentSession()}reset(t){this.events=[],this.currentFocusStart=null,this.currentKeystrokeCount=0,this.currentPasteCount=0,t!==void 0&&(this.startTime=t)}getEvents(){return[...this.events]}getCurrentFocusStart(){return this.currentFocusStart}incrementKeystrokes(){this.config.trackKeystrokes&&this.currentFocusStart!==null&&this.currentKeystrokeCount++}incrementPastes(){this.config.trackPastes&&this.currentFocusStart!==null&&this.currentPasteCount++}handleFocus(t){this.currentFocusStart===null&&(this.currentFocusStart=performance.now()-this.startTime,this.currentKeystrokeCount=0,this.currentPasteCount=0)}handleBlur(t){this.finalizeCurrentSession()}finalizeCurrentSession(){if(this.currentFocusStart===null)return;let t=performance.now()-this.startTime,e=t-this.currentFocusStart,n=this.getElementId(),s={focusTime:this.currentFocusStart,blurTime:t,duration:e};n!==void 0&&(s.elementId=n),this.config.trackKeystrokes&&(s.keystrokesDuringFocus=this.currentKeystrokeCount),this.config.trackPastes&&(s.pastesDuringFocus=this.currentPasteCount),this.events.push(s),this.onEvent?.(s),this.currentFocusStart=null,this.currentKeystrokeCount=0,this.currentPasteCount=0}getElementId(){if(this.element){if(this.element.id)return this.element.id;if(this.element instanceof HTMLInputElement||this.element instanceof HTMLTextAreaElement)return this.element.name||void 0}}},Ns=class{constructor(t,e,n){v(this,"events",[]);v(this,"element",null);v(this,"startTime");v(this,"firstKeystrokeTime");v(this,"boundKeydown");v(this,"boundKeyup");this.config=t,this.onEvent=n,this.startTime=e,this.boundKeydown=this.handleKeydown.bind(this),this.boundKeyup=this.handleKeyup.bind(this)}attach(t){this.element=t,t.addEventListener("keydown",this.boundKeydown),this.config.captureKeyUp&&t.addEventListener("keyup",this.boundKeyup)}detach(){this.element&&(this.element.removeEventListener("keydown",this.boundKeydown),this.element.removeEventListener("keyup",this.boundKeyup),this.element=null)}reset(t){this.events=[],this.firstKeystrokeTime=void 0,t!==void 0&&(this.startTime=t)}getEvents(){return[...this.events]}getFirstKeystrokeTime(){return this.firstKeystrokeTime}getRecentCount(t){let n=performance.now()-this.startTime-t;return this.events.filter(s=>s.time>=n).length}handleKeydown(t){this.recordEvent(t,"keydown")}handleKeyup(t){this.recordEvent(t,"keyup")}recordEvent(t,e){let n=performance.now()-this.startTime;this.firstKeystrokeTime===void 0&&e==="keydown"&&(this.firstKeystrokeTime=n);let s=this.getTextLength(t.target),r={time:n,key:t.key,code:t.code,event:e,...s!==void 0?{textLength:s}:{},...this.config.includeModifiers?{modifiers:this.getModifiers(t)}:{}};this.events.push(r),this.onEvent?.(r)}getTextLength(t){if(t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement)return t.value.length;if(t instanceof HTMLElement&&t.isContentEditable)return t.textContent?.length}getModifiers(t){return{shift:t.shiftKey,ctrl:t.ctrlKey,alt:t.altKey,meta:t.metaKey}}},Vs=class{constructor(t,e,n){v(this,"events",[]);v(this,"element",null);v(this,"startTime");v(this,"lastMoveTime",null);v(this,"lastX",null);v(this,"lastY",null);v(this,"isDragging",!1);v(this,"idlePeriods",[]);v(this,"idleStart",null);v(this,"idleCheckInterval",null);v(this,"boundMousemove");v(this,"boundMousedown");v(this,"boundMouseup");v(this,"boundClick");v(this,"throttledMoveHandler",null);v(this,"lastThrottledCall",0);this.config=t,this.onEvent=n,this.startTime=e,this.boundMousemove=this.handleMousemove.bind(this),this.boundMousedown=this.handleMousedown.bind(this),this.boundMouseup=this.handleMouseup.bind(this),this.boundClick=this.handleClick.bind(this)}attach(t){this.element=t,this.config.captureMovement&&(this.throttledMoveHandler=this.createThrottledHandler(this.boundMousemove,this.config.throttleMs),t.addEventListener("mousemove",this.throttledMoveHandler)),this.config.captureClicks&&(t.addEventListener("mousedown",this.boundMousedown),t.addEventListener("mouseup",this.boundMouseup),t.addEventListener("click",this.boundClick)),this.startIdleDetection()}detach(){if(this.element&&(this.throttledMoveHandler&&this.element.removeEventListener("mousemove",this.throttledMoveHandler),this.element.removeEventListener("mousedown",this.boundMousedown),this.element.removeEventListener("mouseup",this.boundMouseup),this.element.removeEventListener("click",this.boundClick),this.element=null),this.stopIdleDetection(),this.idleStart!==null){let t=performance.now()-this.startTime;this.idlePeriods.push({start:this.idleStart,end:t,duration:t-this.idleStart}),this.idleStart=null}}reset(t){this.events=[],this.idlePeriods=[],this.lastMoveTime=null,this.lastX=null,this.lastY=null,this.isDragging=!1,this.idleStart=null,this.lastThrottledCall=0,t!==void 0&&(this.startTime=t)}getEvents(){return[...this.events]}getIdlePeriods(){return[...this.idlePeriods]}getTotalIdleTime(){return this.idlePeriods.reduce((t,e)=>t+e.duration,0)}getTotalDistance(){return this.events.filter(t=>t.event==="mousemove"&&t.distance!==void 0).reduce((t,e)=>t+(e.distance??0),0)}createThrottledHandler(t,e){return n=>{let s=performance.now();s-this.lastThrottledCall>=e&&(this.lastThrottledCall=s,t(n))}}handleMousemove(t){let e=performance.now()-this.startTime,n=t.clientX,s=t.clientY,r,i,o;if(this.lastX!==null&&this.lastY!==null&&this.lastMoveTime!==null){let l=n-this.lastX,c=s-this.lastY;i=Math.sqrt(l*l+c*c),o=e-this.lastMoveTime,o>0&&(r=i/o)}let a={time:e,event:"mousemove",x:n,y:s,...r!==void 0?{velocity:r}:{},...i!==void 0?{distance:i}:{},...o!==void 0?{deltaTime:o}:{},...this.isDragging?{isDragging:!0}:{}};this.events.push(a),this.onEvent?.(a),this.lastX=n,this.lastY=s,this.lastMoveTime=e,this.recordActivity(e)}handleMousedown(t){let e=performance.now()-this.startTime;this.isDragging=!0;let n={time:e,event:"mousedown",x:t.clientX,y:t.clientY};this.events.push(n),this.onEvent?.(n),this.recordActivity(e)}handleMouseup(t){let e=performance.now()-this.startTime,n=this.isDragging;this.isDragging=!1;let s={time:e,event:"mouseup",x:t.clientX,y:t.clientY,...n?{isDragging:!0}:{}};this.events.push(s),this.onEvent?.(s),this.recordActivity(e)}handleClick(t){let e=performance.now()-this.startTime,n={time:e,event:"click",x:t.clientX,y:t.clientY};this.events.push(n),this.onEvent?.(n),this.recordActivity(e)}recordActivity(t){this.idleStart!==null&&(this.idlePeriods.push({start:this.idleStart,end:t,duration:t-this.idleStart}),this.idleStart=null)}startIdleDetection(){this.idleCheckInterval=setInterval(()=>{let t=performance.now()-this.startTime,e=this.getLastEventTime();e!==null&&t-e>=this.config.idleThresholdMs&&this.idleStart===null&&(this.idleStart=e+this.config.idleThresholdMs)},1e3)}stopIdleDetection(){this.idleCheckInterval!==null&&(clearInterval(this.idleCheckInterval),this.idleCheckInterval=null)}getLastEventTime(){return this.events.length===0?null:this.events[this.events.length-1]?.time??null}},Ks=class{constructor(t,e,n){v(this,"events",[]);v(this,"element",null);v(this,"startTime");v(this,"lastScrollTime");v(this,"lastScrollTop");v(this,"lastDirection");v(this,"directionChanges",0);v(this,"throttleTimer",null);v(this,"boundScroll");this.config=t,this.onEvent=n,this.startTime=e,this.boundScroll=this.handleScroll.bind(this)}attach(t){this.element=t,t.addEventListener("scroll",this.boundScroll,{passive:!0})}detach(){this.element&&(this.element.removeEventListener("scroll",this.boundScroll),this.element=null),this.throttleTimer!==null&&(clearTimeout(this.throttleTimer),this.throttleTimer=null)}reset(t){this.events=[],this.lastScrollTime=void 0,this.lastScrollTop=void 0,this.lastDirection=void 0,this.directionChanges=0,t!==void 0&&(this.startTime=t)}getEvents(){return[...this.events]}getDirectionChanges(){return this.directionChanges}handleScroll(t){this.config.enabled&&this.throttleTimer===null&&(this.throttleTimer=setTimeout(()=>{this.throttleTimer=null},this.config.throttleMs),this.recordEvent(t))}recordEvent(t){let e=performance.now()-this.startTime,n=this.getScrollTarget(t);if(!n)return;let s=n.scrollTop,r=n.scrollHeight,i=n.clientHeight,o=this.lastScrollTop!==void 0?s-this.lastScrollTop:0,a=o>=0?"down":"up";this.config.captureDirection&&this.lastDirection!==void 0&&a!==this.lastDirection&&this.directionChanges++;let l;if(this.lastScrollTime!==void 0&&this.lastScrollTop!==void 0){let u=e-this.lastScrollTime;u>0&&(l=Math.abs(o)/u)}let c={time:e,direction:a,deltaY:o,scrollTop:s,scrollHeight:r,clientHeight:i,...l!==void 0?{velocity:l}:{}};this.events.push(c),this.onEvent?.(c),this.lastScrollTime=e,this.lastScrollTop=s,this.lastDirection=a}getScrollTarget(t){let e=t.target;if(e instanceof Document){let n=e.documentElement;return{scrollTop:n.scrollTop,scrollHeight:n.scrollHeight,clientHeight:n.clientHeight}}return e instanceof HTMLElement?{scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight}:null}};function Bs(t){let e=0,n=0,s=0,r=0,i;for(let o of t)switch(o.event){case"blur":e++,o.blurDuration!==void 0&&(n+=o.blurDuration);break;case"visibilitychange":o.visibility==="hidden"?(s++,i=o.time):o.visibility==="visible"&&i!==void 0&&(r+=o.time-i,i=void 0);break}return{blurCount:e,totalBlurDuration:n,hiddenCount:s,totalHiddenDuration:r}}function Fs(t){if(t.length===0)return{totalFocusDuration:0,meanFocusDuration:0,focusSessionCount:0,maxFocusDuration:0};let e=t.map(i=>i.duration),n=e.reduce((i,o)=>i+o,0),s=n/t.length,r=Math.max(...e);return{totalFocusDuration:n,meanFocusDuration:s,focusSessionCount:t.length,maxFocusDuration:r}}var $s=2e3;function zs(t,e=$s){let n=t.filter(m=>m.event==="keydown");if(n.length===0)return{totalKeystrokes:0,printableKeystrokes:0,deletions:0,meanIKI:0,stdIKI:0,medianIKI:0,pauseCount:0,productProcessRatio:0};let s=n.filter(m=>m.key.length===1).length,r=n.filter(m=>m.key==="Backspace"||m.key==="Delete").length,i=Hs(n),{mean:o,std:a,median:l}=qs(i),c=i.filter(m=>m>e).length,h=n[n.length-1]?.textLength??0,p=n.length>0?h/n.length:0;return{totalKeystrokes:n.length,printableKeystrokes:s,deletions:r,meanIKI:o,stdIKI:a,medianIKI:l,pauseCount:c,productProcessRatio:p}}function Hs(t){if(t.length<2)return[];let e=[];for(let n=1;n<t.length;n++){let s=t[n-1],r=t[n];s&&r&&e.push(r.time-s.time)}return e}function qs(t){if(t.length===0)return{mean:0,std:0,median:0};let n=t.reduce((c,u)=>c+u,0)/t.length,r=t.map(c=>(c-n)**2).reduce((c,u)=>c+u,0)/t.length,i=Math.sqrt(r),o=[...t].sort((c,u)=>c-u),a=Math.floor(o.length/2),l=o.length%2===0?((o[a-1]??0)+(o[a]??0))/2:o[a]??0;return{mean:n,std:i,median:l}}function Us(t,e){if(t.length===0)return{totalEvents:0,clickCount:0,meanVelocity:0,totalDistance:0,totalIdleTime:0,idlePeriodCount:0};let n=t.filter(l=>l.event==="click").length,r=t.filter(l=>l.event==="mousemove"&&l.velocity!==void 0).map(l=>l.velocity??0),i=r.length>0?r.reduce((l,c)=>l+c,0)/r.length:0,o=t.filter(l=>l.event==="mousemove"&&l.distance!==void 0).reduce((l,c)=>l+(c.distance??0),0),a=e.reduce((l,c)=>l+c.duration,0);return{totalEvents:t.length,clickCount:n,meanVelocity:i,totalDistance:o,totalIdleTime:a,idlePeriodCount:e.length}}function Zs(t,e){if(t.length===0)return{totalScrollEvents:0,totalScrollDistance:0,directionChanges:0,meanScrollVelocity:0,upDownRatio:0};let n=t.reduce((c,u)=>c+Math.abs(u.deltaY),0),r=t.filter(c=>c.velocity!==void 0).map(c=>c.velocity??0),i=r.length>0?r.reduce((c,u)=>c+u,0)/r.length:0,o=t.filter(c=>c.direction==="up").length,a=t.filter(c=>c.direction==="down").length,l=a>0?o/a:o>0?1:0;return{totalScrollEvents:t.length,totalScrollDistance:n,directionChanges:e,meanScrollVelocity:i,upDownRatio:l}}function Ws(t,e){let n=t.filter(u=>u.event==="keydown"),r=n[0]?.time,i=n.filter(u=>u.key.length===1).length,o=n.filter(u=>u.key==="Backspace"||u.key==="Delete").length,a=Math.max(0,i-o),l=e/6e4,c=l>0?a/l:null;return{...r!==void 0?{firstKeystrokeLatency:r}:{},totalResponseTime:e,...c!==null?{charactersPerMinute:c}:{}}}var Gs=class{constructor(t){v(this,"config");v(this,"keystrokeCollector",null);v(this,"focusCollector",null);v(this,"clipboardCollector",null);v(this,"mouseCollector",null);v(this,"scrollCollector",null);v(this,"inputDurationCollector",null);v(this,"trialStartTime",0);v(this,"attachedElement",null);v(this,"listeners",new Map);this.config=this.normalizeConfig(t)}attach(t,e){this.trialStartTime=e??performance.now(),this.attachedElement=t instanceof Document?document.body:t,this.config.inputDuration.enabled&&(this.inputDurationCollector=new js(this.config.inputDuration,this.trialStartTime,n=>this.emit("inputDuration",n)),this.inputDurationCollector.attach(t)),this.config.keystroke.enabled&&(this.keystrokeCollector=new Ns(this.config.keystroke,this.trialStartTime,n=>{this.emit("keystroke",n),this.inputDurationCollector?.incrementKeystrokes()}),this.keystrokeCollector.attach(t)),this.config.focus.enabled&&(this.focusCollector=new Os(this.config.focus,this.trialStartTime,n=>this.emit("focus",n)),this.focusCollector.attach(document)),this.config.clipboard.enabled&&(this.clipboardCollector=new Rs(this.config.clipboard,this.trialStartTime,()=>this.keystrokeCollector?.getRecentCount(2e3)??0,n=>{this.emit("paste",n),this.inputDurationCollector?.incrementPastes()},n=>this.emit("clipboard",n)),this.clipboardCollector.attach(t)),this.config.mouse.enabled&&(this.mouseCollector=new Vs(this.config.mouse,this.trialStartTime,n=>this.emit("mouse",n)),this.mouseCollector.attach(t)),this.config.scroll.enabled&&(this.scrollCollector=new Ks(this.config.scroll,this.trialStartTime,n=>this.emit("scroll",n)),this.scrollCollector.attach(t))}detach(){this.keystrokeCollector?.detach(),this.focusCollector?.detach(),this.clipboardCollector?.detach(),this.mouseCollector?.detach(),this.scrollCollector?.detach(),this.inputDurationCollector?.detach(),this.keystrokeCollector=null,this.focusCollector=null,this.clipboardCollector=null,this.mouseCollector=null,this.scrollCollector=null,this.inputDurationCollector=null,this.attachedElement=null}reset(t){this.trialStartTime=t??performance.now(),this.keystrokeCollector?.reset(this.trialStartTime),this.focusCollector?.reset(this.trialStartTime),this.clipboardCollector?.reset(this.trialStartTime),this.mouseCollector?.reset(this.trialStartTime),this.scrollCollector?.reset(this.trialStartTime),this.inputDurationCollector?.reset(this.trialStartTime)}getData(){return{keystrokes:this.keystrokeCollector?.getEvents()??[],focus:this.focusCollector?.getEvents()??[],paste:this.clipboardCollector?.getPasteEvents()??[],mouse:this.mouseCollector?.getEvents()??[],scroll:this.scrollCollector?.getEvents()??[],clipboard:this.clipboardCollector?.getCopyEvents()??[],inputDuration:this.inputDurationCollector?.getEvents()??[],metrics:this.getMetrics()}}getMetrics(){let t=this.keystrokeCollector?.getEvents()??[],e=this.focusCollector?.getEvents()??[],n=this.mouseCollector?.getEvents()??[],s=this.mouseCollector?.getIdlePeriods()??[],r=this.scrollCollector?.getEvents()??[],i=this.scrollCollector?.getDirectionChanges()??0,o=this.inputDurationCollector?.getEvents()??[],l=performance.now()-this.trialStartTime,c=t.length>0?zs(t):null,u=e.length>0?Bs(e):null,h=n.length>0?Us(n,s):null,p=r.length>0?Zs(r,i):null,m=o.length>0?Fs(o):null;return{...c!==null?{keystroke:c}:{},...u!==null?{focus:u}:{},timing:Ws(t,l),...h!==null?{mouse:h}:{},...p!==null?{scroll:p}:{},...m!==null?{inputDuration:m}:{}}}getFlags(){let t=[],e=this.clipboardCollector?.getPasteEvents()??[];e.length>0&&t.push({type:"paste_detected",severity:"medium",message:`${e.length} paste event(s) detected`,timestamp:Date.now(),details:{count:e.length}});let s=(this.focusCollector?.getEvents()??[]).filter(a=>a.event==="blur").length;s>5&&t.push({type:"excessive_blur",severity:"low",message:`${s} window blur events detected`,timestamp:Date.now(),details:{count:s}});let i=(this.mouseCollector?.getIdlePeriods()??[]).filter(a=>a.duration>3e4);if(i.length>0){let a=i.reduce((l,c)=>l+c.duration,0);t.push({type:"mouse_idle_anomaly",severity:"low",message:`${i.length} long mouse idle period(s) detected (${Math.round(a/1e3)}s total)`,timestamp:Date.now(),details:{count:i.length,totalIdleMs:a,periods:i}})}let o=this.clipboardCollector?.getCopyEvents()??[];for(let a of e){let l=o.filter(c=>c.time<a.time&&a.time-c.time<5e3);l.length>0&&a.precedingKeystrokes<5&&t.push({type:"sudden_text_appearance",severity:"medium",message:"Text pasted shortly after internal copy with minimal typing, potential pre-composed content",timestamp:Date.now(),details:{pasteTime:a.time,pasteLength:a.textLength,precedingKeystrokes:a.precedingKeystrokes,recentCopyCount:l.length}})}return t}on(t,e){this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t)?.add(e)}off(t,e){this.listeners.get(t)?.delete(e)}emit(t,e){for(let n of this.listeners.get(t)??[])n(e)}normalizeConfig(t){let e=t.paste?.warnMessage,n=t.clipboard?.warnMessage;return{keystroke:{enabled:t.keystroke?.enabled??!0,captureKeyUp:t.keystroke?.captureKeyUp??!0,includeModifiers:t.keystroke?.includeModifiers??!0},focus:{enabled:t.focus?.enabled??!0,useVisibilityAPI:t.focus?.useVisibilityAPI??!0,useBlurFocus:t.focus?.useBlurFocus??!0},paste:{enabled:t.paste?.enabled??!0,prevent:t.paste?.prevent??!1,capturePreview:t.paste?.capturePreview??!0,previewLength:t.paste?.previewLength??100,...e!==void 0?{warnMessage:e}:{}},inputDuration:{enabled:t.inputDuration?.enabled??!0,trackKeystrokes:t.inputDuration?.trackKeystrokes??!0,trackPastes:t.inputDuration?.trackPastes??!0},clipboard:{enabled:t.clipboard?.enabled??!0,capturePaste:t.clipboard?.capturePaste??!0,captureCopyCut:t.clipboard?.captureCopyCut??!0,prevent:t.clipboard?.prevent??!1,capturePreview:t.clipboard?.capturePreview??!0,previewLength:t.clipboard?.previewLength??100,...n!==void 0?{warnMessage:n}:{}},mouse:{enabled:t.mouse?.enabled??!0,captureClicks:t.mouse?.captureClicks??!0,captureMovement:t.mouse?.captureMovement??!0,throttleMs:t.mouse?.throttleMs??50,idleThresholdMs:t.mouse?.idleThresholdMs??5e3},scroll:{enabled:t.scroll?.enabled??!0,throttleMs:t.scroll?.throttleMs??100,captureDirection:t.scroll?.captureDirection??!0}}}};function Qe(t){return new Gs(t)}var Ys=["keydown","keyup","focusin","focusout","input","change","click","submit","paste","copy","cut","pointerdown","pointerup","pointermove"],Js=["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","End","Enter","Escape","Home","PageDown","PageUp","Tab"];function Xs(t){return Js.find(e=>e===t)??"redacted"}function Qs(t){if(t instanceof HTMLSelectElement)return"select";if(t instanceof HTMLButtonElement)return"button";if(t instanceof HTMLTextAreaElement)return"text";if(t instanceof HTMLInputElement)switch(t.type){case"radio":case"checkbox":case"range":return t.type;case"button":case"submit":case"reset":return"button";case"text":case"search":case"number":return"text";default:return}}function Lt(t,e,n){if(!e.hasConsent()||e.signal?.aborted)return null;let s=new AbortController,r=[],i=-1/0,o=()=>s.abort();e.signal?.addEventListener("abort",o,{once:!0});for(let a of Ys)t.addEventListener(a,l=>{if(!e.hasConsent()){o();return}let c=typeof SubmitEvent<"u"&&l instanceof SubmitEvent?l.submitter:l.target;if(!(c instanceof Element))return;let u=c.closest(e.targetSelector);if(!u||!t.contains(u))return;let h=Qs(u);if(h===void 0)return;let p=performance.now()-n,m={time:p,event:a,control:h,trusted:l.isTrusted};if(l instanceof KeyboardEvent&&(m.key=Xs(l.key)),typeof PointerEvent<"u"&&l instanceof PointerEvent){let I=u.getBoundingClientRect(),j=l.clientX-I.left,P=l.clientY-I.top;if(j>=0&&j<=I.width&&P>=0&&P<=I.height&&(m.x=j,m.y=P),a==="pointermove"){if(m.x===void 0||p-i<16)return;i=p}}r.push(m)},{capture:!0,signal:s.signal});return{finish(){e.signal?.removeEventListener("abort",o);let a=s.signal.aborted||!e.hasConsent();return o(),a?null:{schemaVersion:"1.0",events:r}}}}function At(t){let{selector:e,container:n,timeout:s=5e3,onFound:r,onTimeout:i}=t,o=null,a=null,l=!1,c=()=>{o!==null&&(o.disconnect(),o=null),a!==null&&(clearTimeout(a),a=null)},u=(n instanceof Document,n),h=u.querySelector(e);if(h!==null)return l=!0,r(h),c;s>0&&(a=setTimeout(()=>{c(),!l&&i!==void 0&&i()},s)),o=new MutationObserver(()=>{if(l)return;let m=u.querySelector(e);m!==null&&(l=!0,c(),r(m))});let p=n instanceof Document?n.body:n;return o.observe(p,{childList:!0,subtree:!0}),c}var cr=Ze(Dt(),1),ur=Ze(Jt(),1),dr=Ze(tt(),1);var Ae=(t=>(t[t.BOOL=0]="BOOL",t[t.STRING=1]="STRING",t[t.INT=2]="INT",t[t.FLOAT=3]="FLOAT",t[t.FUNCTION=4]="FUNCTION",t[t.KEY=5]="KEY",t[t.KEYS=6]="KEYS",t[t.SELECT=7]="SELECT",t[t.HTML_STRING=8]="HTML_STRING",t[t.IMAGE=9]="IMAGE",t[t.AUDIO=10]="AUDIO",t[t.VIDEO=11]="VIDEO",t[t.OBJECT=12]="OBJECT",t[t.COMPLEX=13]="COMPLEX",t[t.TIMELINE=14]="TIMELINE",t))(Ae||{});var pi=[Ae.AUDIO,Ae.IMAGE,Ae.VIDEO];var ee=class extends Error{constructor(e="The global `jsPsych` variable is no longer available in jsPsych v7."){super(`${e} Please follow the migration guide at https://www.jspsych.org/7.0/support/migration-v7/ to update your experiment.`),this.name="MigrationError"}};window.jsPsych={get init(){throw new ee("`jsPsych.init()` was replaced by `initJsPsych()` in jsPsych v7.")},get data(){throw new ee},get randomization(){throw new ee},get turk(){throw new ee},get pluginAPI(){throw new ee},get ALL_KEYS(){throw new ee('jsPsych.ALL_KEYS was replaced by the "ALL_KEYS" string in jsPsych v7.')},get NO_KEYS(){throw new ee('jsPsych.NO_KEYS was replaced by the "NO_KEYS" string in jsPsych v7.')}};typeof window<"u"&&window.hasOwnProperty("webkitAudioContext")&&!window.hasOwnProperty("AudioContext")&&(window.AudioContext=webkitAudioContext);var Ke=class{constructor(e){v(this,"jsPsych");v(this,"capture",null);v(this,"responseCapture",null);v(this,"startTime",0);v(this,"observerCleanup",null);this.jsPsych=e}initialize(e){return Promise.resolve()}on_start(e){this.startTime=performance.now()}on_load(e){let n=this.jsPsych.getDisplayElement();if(e.responseControls!==void 0){this.responseCapture=Lt(n,e.responseControls,this.startTime);return}let s=e.targetSelector??"textarea, input[type='text']",r=At({selector:s,container:n,timeout:5e3,onFound:i=>{this.attachCapture(i,e)},onTimeout:()=>{console.warn("[slopit] Target element not found within timeout")}});this.observerCleanup=r}on_finish(){if(this.observerCleanup!==null&&(this.observerCleanup(),this.observerCleanup=null),this.responseCapture!==null){let s=this.responseCapture.finish();return this.responseCapture=null,s===null?{}:{slopit:{behavioral:{responseControls:s},flags:[]}}}if(this.capture===null)return{};let e=this.capture.getData(),n=this.capture.getFlags();return this.capture.detach(),this.capture=null,{slopit:{behavioral:e,flags:n}}}attachCapture(e,n){if(this.capture!==null)return;let s={};n.keystroke!==void 0&&(s.keystroke=n.keystroke),n.focus!==void 0&&(s.focus=n.focus),n.paste!==void 0&&(s.paste=n.paste),n.clipboard!==void 0&&(s.clipboard=n.clipboard),n.mouse!==void 0&&(s.mouse=n.mouse),n.scroll!==void 0&&(s.scroll=n.scroll),n.inputDuration!==void 0&&(s.inputDuration=n.inputDuration),this.capture=Qe(s),this.capture.attach(e,this.startTime)}};v(Ke,"info",{name:"slopit",version:"0.1.0",data:{slopit:{type:Ae.OBJECT}}});var hr="1.0";return an(fr);})();
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { BehavioralCaptureConfig } from '@slopit/behavioral';
1
+ import { BehavioralCaptureConfig, ResponseControlsConfig } from '@slopit/behavioral';
2
+ export { ResponseControlsConfig } from '@slopit/behavioral';
2
3
  import { JsPsychExtension, JsPsychExtensionInfo, JsPsych } from 'jspsych';
3
4
  import { BehavioralData, CaptureFlag, SlopitSession } from '@slopit/core';
4
5
 
@@ -53,6 +54,8 @@ interface SlopitExtensionParams extends BehavioralCaptureConfig {
53
54
  * @default "textarea, input[type='text']"
54
55
  */
55
56
  targetSelector?: string;
57
+ /** Use the consent-gated response-control profile in place of text capture. */
58
+ responseControls?: ResponseControlsConfig;
56
59
  }
57
60
  /**
58
61
  * jsPsych extension for behavioral capture.
@@ -91,9 +94,8 @@ declare class SlopitExtension implements JsPsychExtension {
91
94
  static info: JsPsychExtensionInfo;
92
95
  private jsPsych;
93
96
  private capture;
94
- private params;
97
+ private responseCapture;
95
98
  private startTime;
96
- private attachedElement;
97
99
  private observerCleanup;
98
100
  /**
99
101
  * Creates a new SlopitExtension instance.
@@ -113,7 +115,7 @@ declare class SlopitExtension implements JsPsychExtension {
113
115
  *
114
116
  * @param params - Extension parameters for this trial
115
117
  */
116
- on_start(params: SlopitExtensionParams): void;
118
+ on_start(_params: SlopitExtensionParams): void;
117
119
  /**
118
120
  * Called after the trial display is rendered.
119
121
  *
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { discoverElement, createSessionMetadata, completeSession, createTextResponse } from '@slopit/adapter-shared';
2
- import { createBehavioralCapture } from '@slopit/behavioral';
2
+ import { captureResponseControls, createBehavioralCapture } from '@slopit/behavioral';
3
3
  import { ParameterType } from 'jspsych';
4
4
 
5
5
  // src/extension.ts
@@ -15,9 +15,8 @@ var SlopitExtension = class {
15
15
  };
16
16
  jsPsych;
17
17
  capture = null;
18
- params = null;
18
+ responseCapture = null;
19
19
  startTime = 0;
20
- attachedElement = null;
21
20
  observerCleanup = null;
22
21
  /**
23
22
  * Creates a new SlopitExtension instance.
@@ -41,8 +40,7 @@ var SlopitExtension = class {
41
40
  *
42
41
  * @param params - Extension parameters for this trial
43
42
  */
44
- on_start(params) {
45
- this.params = params;
43
+ on_start(_params) {
46
44
  this.startTime = performance.now();
47
45
  }
48
46
  /**
@@ -54,6 +52,14 @@ var SlopitExtension = class {
54
52
  */
55
53
  on_load(params) {
56
54
  const displayElement = this.jsPsych.getDisplayElement();
55
+ if (params.responseControls !== void 0) {
56
+ this.responseCapture = captureResponseControls(
57
+ displayElement,
58
+ params.responseControls,
59
+ this.startTime
60
+ );
61
+ return;
62
+ }
57
63
  const selector = params.targetSelector ?? "textarea, input[type='text']";
58
64
  const cleanup = discoverElement({
59
65
  selector,
@@ -78,6 +84,11 @@ var SlopitExtension = class {
78
84
  this.observerCleanup();
79
85
  this.observerCleanup = null;
80
86
  }
87
+ if (this.responseCapture !== null) {
88
+ const responseControls = this.responseCapture.finish();
89
+ this.responseCapture = null;
90
+ return responseControls === null ? {} : { slopit: { behavioral: { responseControls }, flags: [] } };
91
+ }
81
92
  if (this.capture === null) {
82
93
  return {};
83
94
  }
@@ -85,8 +96,6 @@ var SlopitExtension = class {
85
96
  const flags = this.capture.getFlags();
86
97
  this.capture.detach();
87
98
  this.capture = null;
88
- this.attachedElement = null;
89
- this.params = null;
90
99
  return {
91
100
  slopit: {
92
101
  behavioral,
@@ -128,7 +137,6 @@ var SlopitExtension = class {
128
137
  }
129
138
  this.capture = createBehavioralCapture(config);
130
139
  this.capture.attach(element, this.startTime);
131
- this.attachedElement = element;
132
140
  }
133
141
  };
134
142
  function exportToSlopit(jsPsych, options = {}) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/extension.ts","../src/utils/export.ts"],"names":[],"mappings":";;;;;AAoEA,IAAM,kBAAN,MAAkD;AAAA,EAChD,OAAO,IAAA,GAA6B;AAAA,IAClC,IAAA,EAAM,QAAA;AAAA,IACN,OAAA,EAAS,OAAA;AAAA,IACT,IAAA,EAAM;AAAA,MACJ,MAAA,EAAQ;AAAA,QACN,MAAM,aAAA,CAAc;AAAA;AACtB;AACF,GACF;AAAA,EAEQ,OAAA;AAAA,EACA,OAAA,GAAoC,IAAA;AAAA,EACpC,MAAA,GAAuC,IAAA;AAAA,EACvC,SAAA,GAAY,CAAA;AAAA,EACZ,eAAA,GAAsC,IAAA;AAAA,EACtC,eAAA,GAAuC,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO/C,YAAY,OAAA,EAAkB;AAC5B,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,WAAW,OAAA,EAAiD;AAC1D,IAAA,OAAO,QAAQ,OAAA,EAAQ;AAAA,EACzB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,SAAS,MAAA,EAAqC;A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,EAAE,GAAG,KAAA,EAAM;AAChC,IAAA,OAAO,aAAa,QAAQ,CAAA;AAC5B,IAAA,SAAA,CAAU,YAAA,GAAe,YAAA;AAAA,EAC3B;AAEA,EAAA,OAAO,SAAA;AACT;AASO,SAAS,sBAAA,CACd,SACA,UAAA,EACuD;AACvD,EAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,IAAA,CAAK,GAAA,EAAI,CAAE,MAAA,CAAO,EAAE,WAAA,EAAa,UAAA,EAAY,CAAA,CAAE,MAAA,GAAS,CAAC,CAAA;AAI/E,EAAA,IAAI,CAAC,KAAA,IAAS,CAAC,KAAA,CAAM,QAAQ,CAAA,EAAG;AAC9B,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,OAAO,MAAM,QAAQ,CAAA;AACvB","file":"index.js","sourcesContent":["/**\n * jsPsych extension for adding behavioral capture to existing plugins.\n *\n * @module\n */\n\nimport { discoverElement } from \"@slopit/adapter-shared\";\nimport {\n type BehavioralCapture,\n type BehavioralCaptureConfig,\n createBehavioralCapture,\n} from \"@slopit/behavioral\";\nimport {\n type JsPsych,\n type JsPsychExtension,\n type JsPsychExtensionInfo,\n ParameterType,\n} from \"jspsych\";\nimport type { SlopitData } from \"./types.js\";\n\n/**\n * Extension parameters passed to individual trials.\n */\nexport interface SlopitExtensionParams extends BehavioralCaptureConfig {\n /**\n * CSS selector for the input element to monitor.\n *\n * If not specified, the extension will search for textarea or text input\n * elements within the trial display.\n *\n * @default \"textarea, input[type='text']\"\n */\n targetSelector?: string;\n}\n\n/**\n * jsPsych extension for behavioral capture.\n *\n * This extension wraps existing jsPsych plugins to add behavioral capture\n * without requiring plugin modifications. It attaches to text input elements\n * and collects keystroke dynamics, focus events, and clipboard operations.\n *\n * @example\n * ```javascript\n * import { initJsPsych } from \"jspsych\";\n * import jsPsychSurveyText from \"@jspsych/plugin-survey-text\";\n * import { SlopitExtension } from \"@slopit/adapter-jspsych\";\n *\n * const jsPsych = initJsPsych({\n * extensions: [{ type: SlopitExtension }],\n * });\n *\n * const trial = {\n * type: jsPsychSurveyText,\n * questions: [{ prompt: \"Describe your morning routine:\" }],\n * extensions: [\n * {\n * type: SlopitExtension,\n * params: {\n * targetSelector: \"textarea\",\n * keystroke: { enabled: true },\n * paste: { enabled: true, prevent: false },\n * },\n * },\n * ],\n * };\n * ```\n */\nclass SlopitExtension implements JsPsychExtension {\n static info: JsPsychExtensionInfo = {\n name: \"slopit\",\n version: \"0.1.0\",\n data: {\n slopit: {\n type: ParameterType.OBJECT,\n },\n },\n };\n\n private jsPsych: JsPsych;\n private capture: BehavioralCapture | null = null;\n private params: SlopitExtensionParams | null = null;\n private startTime = 0;\n private attachedElement: HTMLElement | null = null;\n private observerCleanup: (() => void) | null = null;\n\n /**\n * Creates a new SlopitExtension instance.\n *\n * @param jsPsych - The jsPsych instance\n */\n constructor(jsPsych: JsPsych) {\n this.jsPsych = jsPsych;\n }\n\n /**\n * Initializes the extension. Called once when jsPsych initializes.\n *\n * @param _params - Initialization parameters (unused)\n * @returns Promise that resolves when initialization is complete\n */\n initialize(_params: Record<string, unknown>): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Called when a trial using this extension begins.\n *\n * @param params - Extension parameters for this trial\n */\n on_start(params: SlopitExtensionParams): void {\n this.params = params;\n this.startTime = performance.now();\n }\n\n /**\n * Called after the trial display is rendered.\n *\n * Searches for the target element and attaches behavioral capture.\n *\n * @param params - Extension parameters for this trial\n */\n on_load(params: SlopitExtensionParams): void {\n const displayElement = this.jsPsych.getDisplayElement();\n const selector = params.targetSelector ?? \"textarea, input[type='text']\";\n\n const cleanup = discoverElement({\n selector,\n container: displayElement,\n timeout: 5000,\n onFound: (element) => {\n this.attachCapture(element, params);\n },\n onTimeout: () => {\n console.warn(\"[slopit] Target element not found within timeout\");\n },\n });\n this.observerCleanup = cleanup;\n }\n\n /**\n * Called when the trial ends.\n *\n * @returns Object containing behavioral capture data\n */\n on_finish(): { slopit: SlopitData } | Record<string, never> {\n if (this.observerCleanup !== null) {\n this.observerCleanup();\n this.observerCleanup = null;\n }\n\n if (this.capture === null) {\n return {};\n }\n\n const behavioral = this.capture.getData();\n const flags = this.capture.getFlags();\n\n this.capture.detach();\n this.capture = null;\n this.attachedElement = null;\n this.params = null;\n\n return {\n slopit: {\n behavioral,\n flags,\n },\n };\n }\n\n /**\n * Attaches behavioral capture to the target element.\n *\n * @param element - The element to attach to\n * @param params - Extension parameters\n */\n private attachCapture(element: HTMLElement, params: SlopitExtensionParams): void {\n if (this.capture !== null) {\n return; // Already attached\n }\n\n // Build config object, omitting undefined properties\n const config: BehavioralCaptureConfig = {};\n\n if (params.keystroke !== undefined) {\n config.keystroke = params.keystroke;\n }\n if (params.focus !== undefined) {\n config.focus = params.focus;\n }\n if (params.paste !== undefined) {\n config.paste = params.paste;\n }\n if (params.clipboard !== undefined) {\n config.clipboard = params.clipboard;\n }\n if (params.mouse !== undefined) {\n config.mouse = params.mouse;\n }\n if (params.scroll !== undefined) {\n config.scroll = params.scroll;\n }\n if (params.inputDuration !== undefined) {\n config.inputDuration = params.inputDuration;\n }\n\n this.capture = createBehavioralCapture(config);\n this.capture.attach(element, this.startTime);\n this.attachedElement = element;\n }\n}\n\nexport { SlopitExtension };\n","import { completeSession, createSessionMetadata, createTextResponse } from \"@slopit/adapter-shared\";\nimport type { SlopitSession, SlopitTrial } from \"@slopit/core\";\nimport type { JsPsych } from \"jspsych\";\n\n/**\n * Options for exporting jsPsych data to SlopitSession format.\n */\nexport interface ExportOptions {\n /**\n * Participant ID (e.g., from Prolific).\n */\n participantId?: string;\n\n /**\n * Study ID.\n */\n studyId?: string;\n\n /**\n * Filter function to select which trials to include.\n * @param trial - The jsPsych trial data\n * @returns true to include, false to exclude\n */\n trialFilter?: (trial: Record<string, unknown>) => boolean;\n\n /**\n * Whether to include raw platform data for each trial.\n * @default true\n */\n includePlatformData?: boolean;\n}\n\n/**\n * Export jsPsych data to SlopitSession format.\n *\n * @param jsPsych - The jsPsych instance\n * @param options - Export options\n * @returns SlopitSession object\n *\n * @example\n * ```javascript\n * const session = exportToSlopit(jsPsych, {\n * participantId: jsPsych.data.urlVariables().PROLIFIC_PID,\n * studyId: \"my-study-001\",\n * });\n *\n * // Send to server or save\n * console.log(JSON.stringify(session));\n * ```\n */\nexport function exportToSlopit(jsPsych: JsPsych, options: ExportOptions = {}): SlopitSession {\n const allTrials = jsPsych.data.get().values() as Record<string, unknown>[];\n const filteredTrials = options.trialFilter ? allTrials.filter(options.trialFilter) : allTrials;\n\n const sessionStartTime = jsPsych.getStartTime()?.getTime() ?? Date.now();\n\n const trials: SlopitTrial[] = filteredTrials.map((trial, index) => {\n return convertTrial(trial, index, options.includePlatformData ?? true);\n });\n\n // Use shared utilities to create session metadata\n const sessionBase = createSessionMetadata(\n {\n name: \"jspsych\",\n version: jsPsych.version(),\n adapterVersion: \"0.1.0\",\n },\n {\n ...(options.participantId !== undefined ? { participantId: options.participantId } : {}),\n ...(options.studyId !== undefined ? { studyId: options.studyId } : {}),\n startTime: sessionStartTime,\n },\n );\n\n // Complete the session with trials and end time\n return completeSession(sessionBase, trials);\n}\n\nfunction convertTrial(\n trial: Record<string, unknown>,\n index: number,\n includePlatformData: boolean,\n): SlopitTrial {\n const timeElapsed = Number(trial[\"time_elapsed\"] ?? 0);\n const rt = Number(trial[\"rt\"] ?? 0);\n\n const converted: SlopitTrial = {\n trialId: String(trial[\"trial_id\"] ?? `trial-${index}`),\n trialIndex: index,\n trialType: String(trial[\"trial_type\"] ?? \"unknown\"),\n startTime: timeElapsed - rt,\n endTime: timeElapsed,\n rt: rt,\n };\n\n // Extract response if present\n if (trial[\"response\"] !== undefined) {\n const response = trial[\"response\"];\n if (typeof response === \"string\") {\n converted.response = createTextResponse(response);\n } else {\n converted.response = {\n type: \"other\",\n value: response,\n };\n }\n }\n\n // Extract slopit behavioral data if present\n if (trial[\"slopit\"] && typeof trial[\"slopit\"] === \"object\") {\n const sd = trial[\"slopit\"] as Record<string, unknown>;\n if (sd[\"behavioral\"]) {\n converted.behavioral = sd[\"behavioral\"] as NonNullable<SlopitTrial[\"behavioral\"]>;\n }\n if (sd[\"flags\"] && Array.isArray(sd[\"flags\"])) {\n converted.captureFlags = sd[\"flags\"] as NonNullable<SlopitTrial[\"captureFlags\"]>;\n }\n }\n\n // Include raw platform data if requested\n if (includePlatformData) {\n const platformData = { ...trial };\n delete platformData[\"slopit\"];\n converted.platformData = platformData;\n }\n\n return converted;\n}\n\n/**\n * Get slopit data from a specific trial.\n *\n * @param jsPsych - The jsPsych instance\n * @param trialIndex - The trial index to get data from\n * @returns The slopit data or undefined if not found\n */\nexport function getSlopitDataFromTrial(\n jsPsych: JsPsych,\n trialIndex: number,\n): { behavioral: unknown; flags: unknown[] } | undefined {\n const trial = jsPsych.data.get().filter({ trial_index: trialIndex }).values()[0] as\n | Record<string, unknown>\n | undefined;\n\n if (!trial || !trial[\"slopit\"]) {\n return undefined;\n }\n\n return trial[\"slopit\"] as { behavioral: unknown; flags: unknown[] };\n}\n"]}
1
+ {"version":3,"sources":["../src/extension.ts","../src/utils/export.ts"],"names":[],"mappings":";;;;;AAyEA,IAAM,kBAAN,MAAkD;AAAA,EAChD,OAAO,IAAA,GAA6B;AAAA,IAClC,IAAA,EAAM,QAAA;AAAA,IACN,OAAA,EAAS,OAAA;AAAA,IACT,IAAA,EAAM;AAAA,MACJ,MAAA,EAAQ;AAAA,QACN,MAAM,aAAA,CAAc;AAAA;AACtB;AACF,GACF;AAAA,EAEQ,OAAA;AAAA,EACA,OAAA,GAAoC,IAAA;AAAA,EACpC,eAAA,GAA8D,IAAA;AAAA,EAC9D,SAAA,GAAY,CAAA;AAAA,EACZ,eAAA,GAAuC,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO/C,YAAY,OAAA,EAAkB;AAC5B,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,WAAW,OAAA,EAAiD;AAC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IAAK,OAAO,KAAA,CAAM,QAAQ,MAAM,QAAA,EAAU;AAC1D,IAAA,MAAM,EAAA,GAAK,MAAM,QAAQ,CAAA;AACzB,IAAA,IAAI,EAAA,CAAG,YAAY,CAAA,EAAG;AACpB,MAAA,SAAA,CAAU,UAAA,GAAa,GAAG,YAAY,CAAA;AAAA,IACxC;AACA,IAAA,IAAI,EAAA,CAAG,OAAO,CAAA,IAAK,KAAA,CAAM,QAAQ,EAAA,CAAG,OAAO,CAAC,CAAA,EAAG;AAC7C,MAAA,SAAA,CAAU,YAAA,GAAe,GAAG,OAAO,CAAA;AAAA,IACrC;AAAA,EACF;AAGA,EAAA,IAAI,mBAAA,EAAqB;AACvB,IAAA,MAAM,YAAA,GAAe,EAAE,GAAG,KAAA,EAAM;AAChC,IAAA,OAAO,aAAa,QAAQ,CAAA;AAC5B,IAAA,SAAA,CAAU,YAAA,GAAe,YAAA;AAAA,EAC3B;AAEA,EAAA,OAAO,SAAA;AACT;AASO,SAAS,sBAAA,CACd,SACA,UAAA,EACuD;AACvD,EAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,IAAA,CAAK,GAAA,EAAI,CAAE,MAAA,CAAO,EAAE,WAAA,EAAa,UAAA,EAAY,CAAA,CAAE,MAAA,GAAS,CAAC,CAAA;AAI/E,EAAA,IAAI,CAAC,KAAA,IAAS,CAAC,KAAA,CAAM,QAAQ,CAAA,EAAG;AAC9B,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,OAAO,MAAM,QAAQ,CAAA;AACvB","file":"index.js","sourcesContent":["/**\n * jsPsych extension for adding behavioral capture to existing plugins.\n *\n * @module\n */\n\nimport { discoverElement } from \"@slopit/adapter-shared\";\nimport {\n type BehavioralCapture,\n type BehavioralCaptureConfig,\n captureResponseControls,\n createBehavioralCapture,\n type ResponseControlsConfig,\n} from \"@slopit/behavioral\";\nimport {\n type JsPsych,\n type JsPsychExtension,\n type JsPsychExtensionInfo,\n ParameterType,\n} from \"jspsych\";\nimport type { SlopitData } from \"./types.js\";\n\n/**\n * Extension parameters passed to individual trials.\n */\nexport interface SlopitExtensionParams extends BehavioralCaptureConfig {\n /**\n * CSS selector for the input element to monitor.\n *\n * If not specified, the extension will search for textarea or text input\n * elements within the trial display.\n *\n * @default \"textarea, input[type='text']\"\n */\n targetSelector?: string;\n\n /** Use the consent-gated response-control profile in place of text capture. */\n responseControls?: ResponseControlsConfig;\n}\n\n/**\n * jsPsych extension for behavioral capture.\n *\n * This extension wraps existing jsPsych plugins to add behavioral capture\n * without requiring plugin modifications. It attaches to text input elements\n * and collects keystroke dynamics, focus events, and clipboard operations.\n *\n * @example\n * ```javascript\n * import { initJsPsych } from \"jspsych\";\n * import jsPsychSurveyText from \"@jspsych/plugin-survey-text\";\n * import { SlopitExtension } from \"@slopit/adapter-jspsych\";\n *\n * const jsPsych = initJsPsych({\n * extensions: [{ type: SlopitExtension }],\n * });\n *\n * const trial = {\n * type: jsPsychSurveyText,\n * questions: [{ prompt: \"Describe your morning routine:\" }],\n * extensions: [\n * {\n * type: SlopitExtension,\n * params: {\n * targetSelector: \"textarea\",\n * keystroke: { enabled: true },\n * paste: { enabled: true, prevent: false },\n * },\n * },\n * ],\n * };\n * ```\n */\nclass SlopitExtension implements JsPsychExtension {\n static info: JsPsychExtensionInfo = {\n name: \"slopit\",\n version: \"0.1.0\",\n data: {\n slopit: {\n type: ParameterType.OBJECT,\n },\n },\n };\n\n private jsPsych: JsPsych;\n private capture: BehavioralCapture | null = null;\n private responseCapture: ReturnType<typeof captureResponseControls> = null;\n private startTime = 0;\n private observerCleanup: (() => void) | null = null;\n\n /**\n * Creates a new SlopitExtension instance.\n *\n * @param jsPsych - The jsPsych instance\n */\n constructor(jsPsych: JsPsych) {\n this.jsPsych = jsPsych;\n }\n\n /**\n * Initializes the extension. Called once when jsPsych initializes.\n *\n * @param _params - Initialization parameters (unused)\n * @returns Promise that resolves when initialization is complete\n */\n initialize(_params: Record<string, unknown>): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Called when a trial using this extension begins.\n *\n * @param params - Extension parameters for this trial\n */\n on_start(_params: SlopitExtensionParams): void {\n this.startTime = performance.now();\n }\n\n /**\n * Called after the trial display is rendered.\n *\n * Searches for the target element and attaches behavioral capture.\n *\n * @param params - Extension parameters for this trial\n */\n on_load(params: SlopitExtensionParams): void {\n const displayElement = this.jsPsych.getDisplayElement();\n if (params.responseControls !== undefined) {\n this.responseCapture = captureResponseControls(\n displayElement,\n params.responseControls,\n this.startTime,\n );\n return;\n }\n const selector = params.targetSelector ?? \"textarea, input[type='text']\";\n\n const cleanup = discoverElement({\n selector,\n container: displayElement,\n timeout: 5000,\n onFound: (element) => {\n this.attachCapture(element, params);\n },\n onTimeout: () => {\n console.warn(\"[slopit] Target element not found within timeout\");\n },\n });\n this.observerCleanup = cleanup;\n }\n\n /**\n * Called when the trial ends.\n *\n * @returns Object containing behavioral capture data\n */\n on_finish(): { slopit: SlopitData } | Record<string, never> {\n if (this.observerCleanup !== null) {\n this.observerCleanup();\n this.observerCleanup = null;\n }\n\n if (this.responseCapture !== null) {\n const responseControls = this.responseCapture.finish();\n this.responseCapture = null;\n return responseControls === null\n ? {}\n : { slopit: { behavioral: { responseControls }, flags: [] } };\n }\n if (this.capture === null) {\n return {};\n }\n\n const behavioral = this.capture.getData();\n const flags = this.capture.getFlags();\n\n this.capture.detach();\n this.capture = null;\n\n return {\n slopit: {\n behavioral,\n flags,\n },\n };\n }\n\n /**\n * Attaches behavioral capture to the target element.\n *\n * @param element - The element to attach to\n * @param params - Extension parameters\n */\n private attachCapture(element: HTMLElement, params: SlopitExtensionParams): void {\n if (this.capture !== null) {\n return; // Already attached\n }\n\n // Build config object, omitting undefined properties\n const config: BehavioralCaptureConfig = {};\n\n if (params.keystroke !== undefined) {\n config.keystroke = params.keystroke;\n }\n if (params.focus !== undefined) {\n config.focus = params.focus;\n }\n if (params.paste !== undefined) {\n config.paste = params.paste;\n }\n if (params.clipboard !== undefined) {\n config.clipboard = params.clipboard;\n }\n if (params.mouse !== undefined) {\n config.mouse = params.mouse;\n }\n if (params.scroll !== undefined) {\n config.scroll = params.scroll;\n }\n if (params.inputDuration !== undefined) {\n config.inputDuration = params.inputDuration;\n }\n\n this.capture = createBehavioralCapture(config);\n this.capture.attach(element, this.startTime);\n }\n}\n\nexport { SlopitExtension };\n","import { completeSession, createSessionMetadata, createTextResponse } from \"@slopit/adapter-shared\";\nimport type { SlopitSession, SlopitTrial } from \"@slopit/core\";\nimport type { JsPsych } from \"jspsych\";\n\n/**\n * Options for exporting jsPsych data to SlopitSession format.\n */\nexport interface ExportOptions {\n /**\n * Participant ID (e.g., from Prolific).\n */\n participantId?: string;\n\n /**\n * Study ID.\n */\n studyId?: string;\n\n /**\n * Filter function to select which trials to include.\n * @param trial - The jsPsych trial data\n * @returns true to include, false to exclude\n */\n trialFilter?: (trial: Record<string, unknown>) => boolean;\n\n /**\n * Whether to include raw platform data for each trial.\n * @default true\n */\n includePlatformData?: boolean;\n}\n\n/**\n * Export jsPsych data to SlopitSession format.\n *\n * @param jsPsych - The jsPsych instance\n * @param options - Export options\n * @returns SlopitSession object\n *\n * @example\n * ```javascript\n * const session = exportToSlopit(jsPsych, {\n * participantId: jsPsych.data.urlVariables().PROLIFIC_PID,\n * studyId: \"my-study-001\",\n * });\n *\n * // Send to server or save\n * console.log(JSON.stringify(session));\n * ```\n */\nexport function exportToSlopit(jsPsych: JsPsych, options: ExportOptions = {}): SlopitSession {\n const allTrials = jsPsych.data.get().values() as Record<string, unknown>[];\n const filteredTrials = options.trialFilter ? allTrials.filter(options.trialFilter) : allTrials;\n\n const sessionStartTime = jsPsych.getStartTime()?.getTime() ?? Date.now();\n\n const trials: SlopitTrial[] = filteredTrials.map((trial, index) => {\n return convertTrial(trial, index, options.includePlatformData ?? true);\n });\n\n // Use shared utilities to create session metadata\n const sessionBase = createSessionMetadata(\n {\n name: \"jspsych\",\n version: jsPsych.version(),\n adapterVersion: \"0.1.0\",\n },\n {\n ...(options.participantId !== undefined ? { participantId: options.participantId } : {}),\n ...(options.studyId !== undefined ? { studyId: options.studyId } : {}),\n startTime: sessionStartTime,\n },\n );\n\n // Complete the session with trials and end time\n return completeSession(sessionBase, trials);\n}\n\nfunction convertTrial(\n trial: Record<string, unknown>,\n index: number,\n includePlatformData: boolean,\n): SlopitTrial {\n const timeElapsed = Number(trial[\"time_elapsed\"] ?? 0);\n const rt = Number(trial[\"rt\"] ?? 0);\n\n const converted: SlopitTrial = {\n trialId: String(trial[\"trial_id\"] ?? `trial-${index}`),\n trialIndex: index,\n trialType: String(trial[\"trial_type\"] ?? \"unknown\"),\n startTime: timeElapsed - rt,\n endTime: timeElapsed,\n rt: rt,\n };\n\n // Extract response if present\n if (trial[\"response\"] !== undefined) {\n const response = trial[\"response\"];\n if (typeof response === \"string\") {\n converted.response = createTextResponse(response);\n } else {\n converted.response = {\n type: \"other\",\n value: response,\n };\n }\n }\n\n // Extract slopit behavioral data if present\n if (trial[\"slopit\"] && typeof trial[\"slopit\"] === \"object\") {\n const sd = trial[\"slopit\"] as Record<string, unknown>;\n if (sd[\"behavioral\"]) {\n converted.behavioral = sd[\"behavioral\"] as NonNullable<SlopitTrial[\"behavioral\"]>;\n }\n if (sd[\"flags\"] && Array.isArray(sd[\"flags\"])) {\n converted.captureFlags = sd[\"flags\"] as NonNullable<SlopitTrial[\"captureFlags\"]>;\n }\n }\n\n // Include raw platform data if requested\n if (includePlatformData) {\n const platformData = { ...trial };\n delete platformData[\"slopit\"];\n converted.platformData = platformData;\n }\n\n return converted;\n}\n\n/**\n * Get slopit data from a specific trial.\n *\n * @param jsPsych - The jsPsych instance\n * @param trialIndex - The trial index to get data from\n * @returns The slopit data or undefined if not found\n */\nexport function getSlopitDataFromTrial(\n jsPsych: JsPsych,\n trialIndex: number,\n): { behavioral: unknown; flags: unknown[] } | undefined {\n const trial = jsPsych.data.get().filter({ trial_index: trialIndex }).values()[0] as\n | Record<string, unknown>\n | undefined;\n\n if (!trial || !trial[\"slopit\"]) {\n return undefined;\n }\n\n return trial[\"slopit\"] as { behavioral: unknown; flags: unknown[] };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slopit/adapter-jspsych",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "jsPsych integration adapter for slopit behavioral capture",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -29,7 +29,9 @@
29
29
  "ai-detection",
30
30
  "crowdsourcing"
31
31
  ],
32
+ "unpkg": "./dist/browser.global.js",
32
33
  "exports": {
34
+ "./browser": "./dist/browser.global.js",
33
35
  ".": {
34
36
  "import": "./dist/index.js",
35
37
  "types": "./dist/index.d.ts"
@@ -42,9 +44,9 @@
42
44
  "jspsych": "^8.0.0"
43
45
  },
44
46
  "dependencies": {
45
- "@slopit/adapter-shared": "0.1.0",
46
- "@slopit/behavioral": "0.1.0",
47
- "@slopit/core": "0.1.0"
47
+ "@slopit/adapter-shared": "0.1.1",
48
+ "@slopit/behavioral": "0.2.0",
49
+ "@slopit/core": "0.2.0"
48
50
  },
49
51
  "devDependencies": {
50
52
  "jspsych": "^8.2.2",
@@ -53,11 +55,11 @@
53
55
  "@jspsych/plugin-html-keyboard-response": "^2.0.0",
54
56
  "jsdom": "^25.0.1",
55
57
  "tsup": "^8.3.5",
56
- "typescript": "^5.7.2",
58
+ "typescript": "^5.9.3",
57
59
  "vitest": "^2.1.8"
58
60
  },
59
61
  "scripts": {
60
- "build": "tsup",
62
+ "build": "tsup && tsup --config tsup.browser.config.ts",
61
63
  "typecheck": "tsc --noEmit",
62
64
  "test": "vitest run",
63
65
  "test:watch": "vitest",