ripplo 0.7.27 → 0.7.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-RJNO37CR.js +220 -0
- package/dist/{chunk-3DQXKHCR.js → chunk-UODLSLH7.js} +6 -6
- package/dist/daemon-M3JF7E2X.js +92 -0
- package/dist/{daemon-2VCH67XS.js → daemon-W57NHXDG.js} +1 -1
- package/dist/index.js +2 -2
- package/package.json +3 -3
- package/dist/chunk-OPYF32NG.js +0 -220
- package/dist/daemon-APONU377.js +0 -92
|
@@ -17,7 +17,7 @@ ${S}`,U=Math.min(h.length,a),ne=0;for(;ne<U-1;ne++){let Me=c(String(ne),h[ne],m,
|
|
|
17
17
|
${w}`,m.pop(),`[${I}]`}let g=Object.keys(h),x=g.length;if(x===0)return"{}";if(s<m.length+1)return'"[Object]"';S+=y;let k=`,
|
|
18
18
|
${S}`,O="",N="",_=Math.min(x,a);Za(h)&&(O+=Kf(h,k,a),g=g.slice(h.length),_-=h.length,N=k),i&&(g=Ya(g,o)),m.push(h);for(let I=0;I<_;I++){let B=g[I],U=c(B,h[B],m,y,S);U!==void 0&&(O+=`${N}${Qt(B)}: ${U}`,N=k)}if(x>a){let I=x-a;O+=`${N}"...": "${fn(I)} not stringified"`,N=k}return N!==""&&(O=`
|
|
19
19
|
${S}${O}
|
|
20
|
-
${w}`),m.pop(),`{${O}}`}case"number":return isFinite(h)?String(h):t?t(h):"null";case"boolean":return h===!0?"true":"false";case"undefined":return;case"bigint":if(r)return String(h);default:return t?t(h):void 0}}function d(p,h,m){switch(typeof h){case"string":return Qt(h);case"object":{if(h===null)return"null";if(typeof h.toJSON=="function"){if(h=h.toJSON(p),typeof h!="object")return d(p,h,m);if(h===null)return"null"}if(m.indexOf(h)!==-1)return n;let y="",S=h.length!==void 0;if(S&&Array.isArray(h)){if(h.length===0)return"[]";if(s<m.length+1)return'"[Array]"';m.push(h);let O=Math.min(h.length,a),N=0;for(;N<O-1;N++){let I=d(String(N),h[N],m);y+=I!==void 0?I:"null",y+=","}let _=d(String(N),h[N],m);if(y+=_!==void 0?_:"null",h.length-1>a){let I=h.length-a-1;y+=`,"... ${fn(I)} not stringified"`}return m.pop(),`[${y}]`}let w=Object.keys(h),g=w.length;if(g===0)return"{}";if(s<m.length+1)return'"[Object]"';let x="",k=Math.min(g,a);S&&Za(h)&&(y+=Kf(h,",",a),w=w.slice(h.length),k-=h.length,x=","),i&&(w=Ya(w,o)),m.push(h);for(let O=0;O<k;O++){let N=w[O],_=d(N,h[N],m);_!==void 0&&(y+=`${x}${Qt(N)}:${_}`,x=",")}if(g>a){let O=g-a;y+=`${x}"...":"${fn(O)} not stringified"`}return m.pop(),`{${y}}`}case"number":return isFinite(h)?String(h):t?t(h):"null";case"boolean":return h===!0?"true":"false";case"undefined":return;case"bigint":if(r)return String(h);default:return t?t(h):void 0}}function f(p,h,m){if(arguments.length>1){let y="";if(typeof m=="number"?y=" ".repeat(Math.min(m,10)):typeof m=="string"&&(y=m.slice(0,10)),h!=null){if(typeof h=="function")return l("",{"":p},[],h,y,"");if(Array.isArray(h))return u("",p,[],Hx(h),y,"")}if(y.length!==0)return c("",p,[],y,"")}return d("",p,[])}return f}});var Cp=If((tB,zl)=>{"use strict";var Io=process||{},Rp=Io.argv||[],ko=Io.env||{},yC=!(ko.NO_COLOR||Rp.includes("--no-color"))&&(!!ko.FORCE_COLOR||Rp.includes("--color")||Io.platform==="win32"||(Io.stdout||{}).isTTY&&ko.TERM!=="dumb"||!!ko.CI),gC=(e,t,n=e)=>r=>{let i=""+r,o=i.indexOf(t,e.length);return~o?e+bC(i,t,n,o)+t:e+i+t},bC=(e,t,n,r)=>{let i="",o=0;do i+=e.substring(o,r)+n,o=r+t.length,r=e.indexOf(t,o);while(~r);return i+e.substring(o)},Ap=(e=yC)=>{let t=e?gC:()=>String;return{isColorSupported:e,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};zl.exports=Ap();zl.exports.createColors=Ap});import{z as C}from"zod";var Oa=C.enum(["fast","slow","async"]),$n=C.object({ref:C.string().min(1)}),Tt=C.union([C.string(),C.number(),C.boolean()]),Na=C.object({template:C.array(C.union([C.string(),$n])).min(1)}),De=C.union([$n,Tt,Na,C.null()]),Pf=C.object({kind:C.literal("changed")}),_a=C.union([De,Pf]),Ot=C.union([C.string(),$n,Na]),xx=C.object({by:C.literal("role"),name:C.union([Ot,C.undefined()]).optional().transform(e=>e),role:C.string().min(1)}),vx=C.object({by:C.literal("testId"),value:Ot}),Rx=C.object({by:C.literal("inside"),scope:C.lazy(()=>Se),target:C.lazy(()=>Se)}),Se=C.discriminatedUnion("by",[xx,vx,Rx]),Fi=C.enum(["string","number","boolean"]),$a=C.enum(["strict","eventual"]),Ax=C.object({kind:C.literal("string"),maxLength:C.number().int().positive().optional(),minLength:C.number().int().nonnegative().optional(),pattern:C.string().optional()}),Cx=C.object({kind:C.literal("number"),max:C.number().int().optional(),min:C.number().int().optional()}),Ex=C.object({kind:C.literal("datetime"),maxOffsetDays:C.number().int(),minOffsetDays:C.number().int()}),Mf=C.discriminatedUnion("kind",[Ax,Cx,Ex]),Tf=C.enum(["company.name","date.iso","internet.email","internet.url","person.fullName","lorem.slug","lorem.word"]),La=C.object({constraints:Mf.optional(),generator:Tf,name:C.string().min(1),type:Fi,values:C.array(Tt).min(1).optional()}),Of=C.object({consistency:$a.default("strict"),optional:C.boolean(),type:Fi,valueSpace:C.string().min(1).optional()}),Da=C.enum(["backend","client"]),Fa=C.object({description:C.string().optional(),identity:C.array(C.string().min(1)).min(1),identityKind:C.enum(["surrogate","natural"]),name:C.string().min(1),props:C.record(C.string().min(1),Of),source:Da.default("backend")}),Ba=C.object({consistency:$a.default("strict"),default:Tt,description:C.string().optional(),name:C.string().min(1),source:Da.default("backend"),type:Fi,valueSpace:C.string().min(1).optional()}),Nt=C.enum(["url","title","viewport"]);function Ua(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${Ua(e.scope)} \u25B8 ${Ua(e.target)}`:`${e.role} ${e.name??""}`.trim()}import{z as A}from"zod";var kx=A.discriminatedUnion("kind",[A.object({as:A.string().min(1),kind:A.literal("created"),props:A.record(A.string().min(1),De)}),A.object({as:A.string().min(1),kind:A.literal("updated"),props:A.record(A.string().min(1),_a)}),A.object({kind:A.literal("deleted")})]),Ix=A.object({kind:A.literal("is"),value:De}),Nf=A.lazy(()=>A.union([De,Mx])),Px=A.object({entity:A.string().min(1),where:A.record(A.string().min(1),Nf)}),Mx=A.object({field:A.string().min(1),kind:A.literal("within"),selection:Px}),Rt=A.union([Oa,A.undefined()]).optional().transform(e=>e),_f=A.object({assertion:Ix,kind:A.literal("singleton"),singleton:A.string().min(1),wait:Rt}),$f=A.object({entity:A.string().min(1),kind:A.literal("count"),value:A.number().int().nonnegative()}),Bi=A.lazy(()=>A.discriminatedUnion("kind",[_f,$f,A.object({kind:A.literal("not"),predicate:Bi}),A.object({kind:A.literal("and"),predicates:A.array(Bi)})])),Tx=A.lazy(()=>A.object({condition:A.union([Bi,A.undefined()]).optional().transform(e=>e),consequence:A.array(Ln),name:A.string().min(1)})),Ln=A.lazy(()=>A.discriminatedUnion("kind",[A.object({kind:A.literal("visible"),locator:Se,wait:Rt}),A.object({kind:A.literal("disabled"),locator:Se,wait:Rt}),A.object({kind:A.literal("enabled"),locator:Se,wait:Rt}),A.object({kind:A.literal("focused"),locator:Se,wait:Rt}),A.object({kind:A.literal("checked"),locator:Se,wait:Rt}),A.object({kind:A.literal("value"),locator:Se,value:Ot,wait:Rt}),A.object({kind:A.literal("text"),locator:Se,value:Ot,wait:Rt}),_f,A.object({kind:A.literal("browser"),name:Nt,value:Ot,wait:Rt}),A.object({assertion:kx,entity:A.string().min(1),key:A.record(A.string().min(1),Nf),kind:A.literal("state"),wait:Rt}),A.object({kind:A.literal("not"),predicate:Ln}),A.object({kind:A.literal("and"),predicates:A.array(Ln)}),$f,A.object({branches:A.array(Tx),kind:A.literal("when")})]));import{z as Ui}from"zod";var Ox=Ui.object({__codec:Ui.string().min(1),data:Ui.unknown(),version:Ui.number().int().positive()}),ji=class extends Error{codec;currentVersion;gotVersion;constructor(t){super(`Unsupported ${t.codec} version ${String(t.gotVersion)} (current ${String(t.currentVersion)}). Upgrade Ripplo or rebuild with a compatible CLI.`),this.name="CodecVersionError",this.codec=t.codec,this.currentVersion=t.currentVersion,this.gotVersion=t.gotVersion}},Vi=class extends Error{constructor(t){super(`Codec mismatch: expected "${t.expected}", got "${t.got}"`),this.name="CodecMismatchError"}};function ja({name:e,schema:t}){return{currentVersion:1,name:e,decode:n=>$x({name:e,raw:n,schema:t}),encode:n=>({__codec:e,data:n,version:1})}}function Nx(e,t){return JSON.stringify(e.encode(t))}function _x(e,t){let n=JSON.parse(t);return e.decode(n)}function $x({name:e,raw:t,schema:n}){let r=Ox.parse(t);if(r.__codec!==e)throw new Vi({expected:e,got:r.__codec});if(r.version!==1)throw new ji({codec:e,currentVersion:1,gotVersion:r.version});return n.parse(r.data)}var Wi="__ripplo__",Va="__ripplo_seed__";import{z as v}from"zod";var Lf=v.discriminatedUnion("kind",[v.object({kind:v.literal("goto"),url:Ot}),v.object({kind:v.literal("fill"),locator:Se,value:De}),v.object({kind:v.literal("clear"),locator:Se}),v.object({kind:v.literal("click"),locator:Se}),v.object({kind:v.literal("dblclick"),locator:Se}),v.object({kind:v.literal("select"),locator:Se,value:De}),v.object({kind:v.literal("check"),locator:Se}),v.object({kind:v.literal("uncheck"),locator:Se}),v.object({kind:v.literal("hover"),locator:Se}),v.object({files:v.array(v.string().min(1)).min(1),kind:v.literal("upload"),locator:Se}),v.object({key:v.string().min(1),kind:v.literal("press"),locator:Se.optional()})]),Wa=v.object({action:Lf,expect:v.array(Ln).default([])}),za=v.object({valueSpace:v.string().min(1)}),zi=v.object({as:v.string().min(1),entity:v.string().min(1),set:v.record(v.string().min(1),De)}),Ga=v.object({entity:v.string().min(1),where:v.record(v.string().min(1),De)}),Gi=v.object({absent:v.array(Ga).default([]),exclusive:v.array(v.string().min(1)).default([]),intent:v.string().min(1),name:v.string().min(1),params:v.record(v.string().min(1),za),singletons:v.record(v.string().min(1),De).default({}),slug:v.string().min(1),steps:v.array(Wa).default([]),workflow:v.string().min(1),world:v.array(zi).default([])}),Df=v.object({absent:v.array(Ga).default([]),exclusive:v.array(v.string().min(1)).default([]),intent:v.string().min(1),maybe:v.array(zi).default([]),name:v.string().min(1),params:v.record(v.string().min(1),za),singletons:v.record(v.string().min(1),De).default({}),sourcePath:v.string().min(1).optional(),steps:v.array(Wa).default([]),stub:v.boolean().default(!1),tests:v.array(Gi).default([]),world:v.array(zi).default([])}),Ff=v.object({sha256:v.string().regex(/^[0-9a-f]{64}$/u),size:v.number().int().nonnegative()}),Bf=v.object({entities:v.array(Fa),fixtures:v.record(v.string().min(1),Ff).default({}),singletons:v.array(Ba).default([]),valueSpaces:v.array(La),workflows:v.array(Df)}),Lx=ja({name:"ripplo-lockfile",schema:Bf});function Dx(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function Hi(e,t,n=""){let r=Dx(e),i=e?.length,o=t!==void 0;if(!r||o&&i!==t){let s=n&&`"${n}" `,a=o?` of length ${t}`:"",l=r?`length=${i}`:`type=${typeof e}`,u=s+"expected Uint8Array"+a+", got "+l;throw r?new RangeError(u):new TypeError(u)}return e}function Ha(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Uf(e,t){Hi(e,void 0,"digestInto() output");let n=t.outputLen;if(e.length<n)throw new RangeError('"digestInto() output" expected to be of length >='+n)}function Cr(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function qi(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function lt(e,t){return e<<32-t|e>>>t}var Fx=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Bx=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function jf(e){if(Hi(e),Fx)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Bx[e[n]];return t}function Vf(e){if(typeof e!="string")throw new TypeError("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Wf(e,t={}){let n=(i,o)=>e(o).update(i).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.canXOF=r.canXOF,n.create=i=>e(i),Object.assign(n,t),Object.freeze(n)}var zf=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function Gf(e,t,n){return e&t^~e&n}function Hf(e,t,n){return e&t^e&n^t&n}var Ki=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,n,r,i){this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=qi(this.buffer)}update(t){Ha(this),Hi(t);let{view:n,buffer:r,blockLen:i}=this,o=t.length;for(let s=0;s<o;){let a=Math.min(i-this.pos,o-s);if(a===i){let l=qi(t);for(;i<=o-s;s+=i)this.process(l,s);continue}r.set(t.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Ha(this),Uf(t,this),this.finished=!0;let{buffer:n,view:r,blockLen:i,isLE:o}=this,{pos:s}=this;n[s++]=128,Cr(this.buffer.subarray(s)),this.padOffset>i-s&&(this.process(r,0),s=0);for(let d=s;d<i;d++)n[d]=0;r.setBigUint64(i-8,BigInt(this.length*8),o),this.process(r,0);let a=qi(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let u=l/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)a.setUint32(4*d,c[d],o)}digest(){let{buffer:t,outputLen:n}=this;this.digestInto(t);let r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||=new this.constructor,t.set(...this.get());let{blockLen:n,buffer:r,length:i,finished:o,destroyed:s,pos:a}=this;return t.destroyed=s,t.finished=o,t.length=i,t.pos=a,i%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}},_t=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var Ux=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Jt=new Uint32Array(64),qa=class extends Ki{constructor(t){super(64,t,8,!1)}get(){let{A:t,B:n,C:r,D:i,E:o,F:s,G:a,H:l}=this;return[t,n,r,i,o,s,a,l]}set(t,n,r,i,o,s,a,l){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=a|0,this.H=l|0}process(t,n){for(let d=0;d<16;d++,n+=4)Jt[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){let f=Jt[d-15],p=Jt[d-2],h=lt(f,7)^lt(f,18)^f>>>3,m=lt(p,17)^lt(p,19)^p>>>10;Jt[d]=m+Jt[d-7]+h+Jt[d-16]|0}let{A:r,B:i,C:o,D:s,E:a,F:l,G:u,H:c}=this;for(let d=0;d<64;d++){let f=lt(a,6)^lt(a,11)^lt(a,25),p=c+f+Gf(a,l,u)+Ux[d]+Jt[d]|0,m=(lt(r,2)^lt(r,13)^lt(r,22))+Hf(r,i,o)|0;c=u,u=l,l=a,a=s+p|0,s=o,o=i,i=r,r=p+m|0}r=r+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,l=l+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(r,i,o,s,a,l,u,c)}roundClean(){Cr(Jt)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),Cr(this.buffer)}},Ka=class extends qa{A=_t[0]|0;B=_t[1]|0;C=_t[2]|0;D=_t[3]|0;E=_t[4]|0;F=_t[5]|0;G=_t[6]|0;H=_t[7]|0;constructor(){super(32)}};var qf=Wf(()=>new Ka,zf(1));var Qa=Ta(Xf(),1),RL=Qa.default.configure,kr=Qa.default;function el(e){return jf(qf(Vf(kr(e))))}function G(e){let t=kr(e);if(t==null)throw new Error("structuralKey: value is not serializable");return t}function tl({actionOffsets:e,durationMs:t}){let n=Zx({anchors:Kx({actionOffsets:e,durationMs:t}),durationMs:t});return{delayMs:Qx(Math.round(8e3/n.length),500,1800),offsets:n}}function Kx({actionOffsets:e,durationMs:t}){let n=e.map(i=>Math.min(i+150,t)),r=[...new Set([0,...n,t])].toSorted((i,o)=>i-o);return Yx(r)}function Yx(e){return e.reduce((t,n)=>{let r=t.at(-1);return r!=null&&n-r<120?t:[...t,n]},[])}function Zx({anchors:e,durationMs:t}){return e.length>60?Xx(e):e.length>=5?e:[...new Set([...e,...Jx(t,5)])].toSorted((n,r)=>n-r)}function Xx(e){return Array.from({length:60},(t,n)=>e[Math.round(n/59*(e.length-1))]??0)}function Jx(e,t){return Array.from({length:t},(n,r)=>Math.round(r/(t-1)*e))}function Qx(e,t,n){return Math.min(n,Math.max(t,e))}import{z as Ir}from"zod";var ev=Ir.object({index:Ir.number().int().nonnegative(),kind:Ir.string(),target:Ir.string(),value:Ir.string()});function tv(e){let t=rv(e);return{preconditions:e.entities.map(n=>({depends:t.get(n.name)??[],description:n.description??"",name:n.name,returns:n.identity})),singletons:e.singletons.map(n=>({defaultValue:String(n.default),description:n.description??"",name:n.name,type:n.type})),workflows:e.workflows.map(n=>({expectedOutcome:n.intent,name:n.intent,preconditions:av(lv(n),t),requiresKeys:n.world.map(r=>({namespace:r.as,preconditionName:r.entity})),slug:Qf(n.name),sourcePath:n.sourcePath??null,spec:n}))}}function nv(e,t){return{index:t,kind:e.action.kind,target:uv(e.action),value:cv(e.action)}}function Qf(e){return e.toLowerCase().replaceAll(/[^a-z0-9]/g,"-").split("-").filter(t=>t.length>0).join("-")}function rv(e){let t=e.workflows.reduce((n,r)=>iv(n,r),new Map);return new Map([...t].map(([n,r])=>[n,[...r]]))}function iv(e,t){let n=[...t.world,...t.maybe],r=new Map(n.map(i=>[i.as,i.entity]));return n.reduce((i,o)=>{let s=ov(o,r),a=i.get(o.entity)??new Set;return new Map([...i,[o.entity,new Set([...a,...s])]])},e)}function ov(e,t){return Object.values(e.set).flatMap(n=>sv(n)).map(n=>t.get(n)).filter(n=>n!=null&&n!==e.entity)}function sv(e){return e==null||typeof e!="object"?[]:"ref"in e?[Jf(e.ref)]:e.template.filter(t=>typeof t!="string").map(t=>Jf(t.ref))}function Jf(e){let[t]=e.split(".");return t??e}function av(e,t){let n=(r,i)=>r.has(i)?r:(t.get(i)??[]).reduce((o,s)=>n(o,s),new Set([...r,i]));return[...e.reduce((r,i)=>n(r,i),new Set)]}function lv(e){return[...new Set(e.world.map(t=>t.entity))]}function uv(e){return e.kind==="goto"?Yi(e.url):e.kind==="press"&&e.locator==null?"":Zi(e.locator)}function Yi(e){return typeof e=="string"?e:"ref"in e?`{${e.ref}}`:e.template.map(t=>typeof t=="string"?t:`{${t.ref}}`).join("")}function Zi(e){return e.by==="testId"?`testId=${Yi(e.value)}`:e.by==="inside"?`${Zi(e.scope)} \u25B8 ${Zi(e.target)}`:`${e.role} ${e.name==null?"":Yi(e.name)}`.trim()}function cv(e){return e.kind==="fill"||e.kind==="select"?dv(e.value):e.kind==="press"?e.key:""}function dv(e){return e==null?"":typeof e!="object"?String(e):Yi(e)}import{z as Re}from"zod";var eh=Re.enum(["Strict","Lax","None"]),th=Re.object({domain:Re.string().min(1),expires:Re.number(),httpOnly:Re.boolean(),name:Re.string().min(1),path:Re.string().min(1),sameSite:eh,secure:Re.boolean(),value:Re.string()}),nh=Re.object({localStorage:Re.array(Re.object({name:Re.string().min(1),value:Re.string()})),origin:Re.string().min(1)}),nl=Re.object({cookies:Re.array(th),headers:Re.record(Re.string().min(1),Re.string()).optional(),origins:Re.array(nh)});import{z as H}from"zod";var rl=H.union([Tt,H.null()]),il=H.record(H.string().min(1),rl),rh=H.object({as:H.string().min(1),entity:H.string().min(1),fields:H.record(H.string().min(1),De)}),fv=H.object({entities:H.array(rh),runId:H.string().min(1),singletons:H.record(H.string().min(1),rl).default({})}),ih=H.object({as:H.string().min(1),row:il,session:nl.optional()}),ol=H.object({rows:H.array(ih)}),hv=H.object({entities:H.array(H.string().min(1)),runId:H.string().min(1),singletons:H.array(H.string().min(1)).default([])}),sl=H.object({entities:H.record(H.string().min(1),H.array(il)),singletons:H.record(H.string().min(1),rl).default({})}),pv=H.object({runId:H.string().min(1)}),al=H.object({ok:H.literal(!0)});function $t(e){let t=new URL(e,"https://ripplo.invalid"),n=[...t.searchParams.entries()].toSorted(([r],[i])=>r.localeCompare(i)).map(([r,i])=>`${r}=${i}`).join("&");return n.length===0?t.pathname:`${t.pathname}?${n}`}function Dn(e,t){return e==="url"?$t(t):t}function ll(e,t,n){return Dn(e,String(t))===Dn(e,String(n))}function sh(e,t,n){return e!=="url"?ll(e,t,n):oh(String(t))===oh(String(n))}function oh(e){return new URL(e,"https://ripplo.invalid").pathname}function Xi({actual:e,canon:t,pre:n,predicted:r}){return[...[...new Set([...r.entities.keys(),...e.entities.keys()])].flatMap(s=>mv({actual:e.entities.get(s),canon:t,entity:s,pre:n.entities.get(s),predicted:r.entities.get(s)})),...gv(n.singletons,r.singletons,e.singletons)]}function mv({actual:e,canon:t,entity:n,pre:r,predicted:i}){return[...new Set([...i?.keys()??[],...e?.keys()??[]])].flatMap(s=>yv({actual:e?.get(s),canon:t,entity:n,key:s,predicted:i?.get(s),preHadKey:r?.has(s)??!1,preRow:r?.get(s)}))}function yv({actual:e,canon:t,entity:n,key:r,predicted:i,preHadKey:o,preRow:s}){if(i==null)return[{mismatch:{entity:n,key:r,kind:"unexpected-row"},pending:o}];if(e==null)return[{mismatch:{entity:n,key:r,kind:"missing-row"},pending:!o}];let a=(u,c,d)=>uh(t(n,u,c),t(n,u,d));return[...new Set([...Object.keys(i),...Object.keys(e)])].filter(u=>!a(u,i[u],e[u])).map(u=>({mismatch:{entity:n,field:u,key:r,kind:"wrong-value",snapshot:i[u],sut:e[u]},pending:s==null?e[u]===void 0:a(u,s[u],e[u])}))}function uh(e,t){return ah(e)===ah(t)}function ah(e){return e==null?"\u2205":JSON.stringify(e)}function gv(e,t,n){return[...new Set([...Object.keys(t),...Object.keys(n)])].flatMap(i=>{let o=t[i],s=n[i];return o===void 0||s===void 0||lh(i,o,s)?[]:[{mismatch:{kind:"singleton-mismatch",singleton:i,snapshot:o,sut:s},pending:e[i]!==void 0&&lh(i,e[i],s)}]})}function lh(e,t,n){let r=Nt.safeParse(e);return r.success?sh(r.data,t,n):uh(t,n)}function Pr(e){let t=bv(e.entities),n=Sv(e.singletons);return r=>wv(r,t,n)}function bv(e){return new Map(e.flatMap(t=>Object.entries(t.props).map(([n,r])=>[ch(t.name,n),r.consistency])))}function ch(e,t){return`${e}.${t}`}function Sv(e){return new Map(e.map(t=>[t.name,t.consistency]))}function wv(e,t,n){return e.kind==="singleton-mismatch"?xv(e.singleton,n):e.kind==="unexpected-row"||e.kind==="missing-row"?"strict":t.get(ch(e.entity,e.field))??"strict"}function xv(e,t){return Nt.safeParse(e).success?t.get(e)??"eventual":t.get(e)??"strict"}function Mr(e){let t=new Set(e.valueSpaces.filter(n=>n.generator==="date.iso").map(n=>n.name));return(n,r,i)=>{if(!t.has(`${n}.${r}`)||typeof i!="string")return i;let o=Date.parse(i);return Number.isNaN(o)?i:new Date(o).toISOString()}}function ul({onlyFirst:e=!1}={}){let i="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(i,e?void 0:"g")}var vv=ul();function cl(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(vv,"")}function dl(e,t,n){return{detail:n.slice(0,500),kind:"engine-http",path:e,status:t}}function Fn(e,t){return{code:mh(t),kind:"engine-network",message:Tr(t),path:e}}function fl(e){return{kind:"client-mount-missing",mountKey:e}}function hl(e,t){return{kind:"engine-decode",message:Tr(t),path:e}}function pl(e,t){return{entity:e,field:t,kind:"state-identity"}}function fh(e){return{as:e,kind:"setup-missing-row"}}function hh(e){return{count:e,kind:"conflicting-sessions"}}function pn(e){return{kind:"driver-launch",message:Tr(e)}}function ml(e){return{kind:"engine-unreachable",url:e}}function yl(e,t){return{action:e,kind:"action-failed",message:Tr(t)}}function gl(e){return{kind:"check-failed",message:Tr(e)}}function bl(){return{kind:"aborted"}}var dh=300;function en(e){switch(e.kind){case"engine-http":return`engine ${e.path} returned ${String(e.status)}: ${ph(e.detail)}${Rv(e.status)}`;case"engine-network":return`engine ${e.path} request failed: ${e.message}`;case"client-mount-missing":return`client bridge "${e.mountKey}" never mounted; client singletons unreadable`;case"engine-decode":return`engine ${e.path} response did not match schema: ${e.message}`;case"state-identity":return`row of "${e.entity}" is missing identity field "${e.field}"`;case"setup-missing-row":return`setup returned no row for "${e.as}"`;case"conflicting-sessions":return`world established ${String(e.count)} distinct auth sessions in one browser context; sessions are exclusive \u2014 a single context holds one signed-in user`;case"engine-unreachable":return`the engine at ${e.url} did not respond in time \u2014 the dev server may still be recompiling. Re-run once it settles.`;case"driver-launch":return`browser driver failed to launch: ${e.message}`;case"action-failed":return`action "${e.action}" failed: ${e.message}`;case"check-failed":return`check failed: ${e.message}`;case"aborted":return"run aborted"}}function Sl(e){throw new Error(en(e))}function tt(){}function ph(e){let t=e.replaceAll(/\s+/gu," ").trim();return t.length<=dh?t:`${t.slice(0,dh)}\u2026 [truncated]`}function Rv(e){return e===404?" \u2014 the engine adapter is not mounted at RIPPLO_ENGINE_URL (or the mount path differs). Verify the adapter is wired into the app server and ENABLE_RIPPLO_TESTING=true; `ripplo doctor` checks the endpoint.":e===403||e===401?" \u2014 the adapter rejected the request: ENABLE_RIPPLO_TESTING is not true in the app's env, or RIPPLO_WEBHOOK_SECRET differs between the app and .ripplo env.":""}function mh(e){if(!(typeof e!="object"||e==null))return"code"in e&&typeof e.code=="string"?e.code:"cause"in e?mh(e.cause):void 0}function Tr(e){let t=e instanceof Error?e.message:String(e);return ph(cl(t))}function yh(e){return G(e)}var Or=class extends Error{name="AbortError";constructor(){super("aborted")}};function wl(e){return e instanceof Error&&e.name==="AbortError"}function Lt(e){if(e.aborted)throw new Or}function xl(e,t){return t.aborted?Promise.reject(new Or):new Promise((n,r)=>{let i=()=>{clearTimeout(o),r(new Or)},o=setTimeout(()=>{t.removeEventListener("abort",i),n()},e);t.addEventListener("abort",i,{once:!0})})}var Av={check:"Check",clear:"Clear",click:"Click",dblclick:"Double-click",fill:"Fill",goto:"Go to",hover:"Hover",press:"Press",select:"Select",uncheck:"Uncheck",upload:"Upload"};function gh(e){let t=Av[e.kind]??e.kind;return e.kind==="press"&&e.key!=null?`${t}: ${e.key}`:t}function bh(e){return e.kind==="data-rule"?"data rule":Sh(e.check)}function Sh(e){return e.kind==="not"?`not ${Sh(e.inner)}`:e.kind==="browser"?e.name:`${wh(e.locator)} ${e.kind}`}function wh(e){return e.by==="testId"?"element":e.by==="inside"?wh(e.target):e.role}function Eh(e){return e.includes("async")?"async":e.includes("slow")?"slow":"fast"}var Cv=()=>[];async function Qi({canon:e,classify:t,initialSnapshot:n,observe:r,onAssertion:i,onStep:o,pageRulePendingChecks:s,steps:a,stopAfterStep:l},u){return kh({acc:[],canon:e,classify:t,index:0,observe:r,onAssertion:i,onStep:o,pageRulePendingChecks:s??Cv,signal:u,snapshot:n,steps:a,stopAfterStep:l})}async function kh({acc:e,canon:t,classify:n,index:r,observe:i,onAssertion:o,onStep:s,pageRulePendingChecks:a,signal:l,snapshot:u,steps:c,stopAfterStep:d}){Lt(l);let f=c[r];if(f==null)return{finalModel:u,findings:e};let p=Date.now(),h=await f.targetIds(),m=gh(f.step.action);if(!f.requiredState(u)){let y={kind:"impossible-action",step:f.step};return Rl(s,{annotations:[vl({actionLabel:m,outcome:"failed",rrwebIds:h,startMs:p})],endMs:Date.now(),findings:[y],index:r,post:u,pre:u,source:f.source,startMs:p,url:Al(u)}),{finalModel:u,findings:[...e,y]}}return f.perform().match(()=>kv({acc:e,actionLabel:m,canon:t,classify:n,index:r,observe:i,onAssertion:o,onStep:s,pageRulePendingChecks:a,rrwebIds:h,signal:l,snapshot:u,startMs:p,step:f,steps:c,stopAfterStep:d}),y=>{let S=Ji(y,f);return Rl(s,{annotations:[vl({actionLabel:m,outcome:"failed",rrwebIds:h,startMs:p})],endMs:Date.now(),findings:[S],index:r,post:u,pre:u,source:f.source,startMs:p,url:Al(u)}),Promise.resolve({finalModel:u,findings:[...e,S]})})}function vl({actionLabel:e,outcome:t,rrwebIds:n,startMs:r}){return{atMs:r,kind:"action",label:e,outcome:t,rrwebIds:n,url:!1}}function Ev(e){return e.kind==="data-rule"?!1:Ih(e.check)}function Ih(e){return e.kind==="not"?Ih(e.inner):e.kind==="browser"&&e.name==="url"}async function kv({acc:e,actionLabel:t,canon:n,classify:r,index:i,observe:o,onAssertion:s,onStep:a,pageRulePendingChecks:l,rrwebIds:u,signal:c,snapshot:d,startMs:f,step:p,steps:h,stopAfterStep:m}){let y=p.effect(d),S=await Nv({canon:n,classify:r,observe:o,pre:d,predicted:y,signal:c,step:p}),w=[...p.pendingChecks,...l(d,S.snapshot)],g=await Iv({onAssertion:s,pendingChecks:w,signal:c,step:p}),x=[...g.findings,...S.findings];Rl(a,{annotations:[vl({actionLabel:t,outcome:x.length>0?"failed":"passed",rrwebIds:u,startMs:f}),...g.annotations],endMs:Date.now(),findings:x,index:i,post:S.snapshot,pre:d,source:p.source,startMs:f,url:Al(S.snapshot)});let k=[...e,...x];return x.length>0?{finalModel:S.snapshot,findings:k}:m!=null&&i+1>=m?{finalModel:S.snapshot,findings:k}:kh({acc:k,canon:n,classify:r,index:i+1,observe:o,onAssertion:s,onStep:a,pageRulePendingChecks:l,signal:c,snapshot:S.snapshot,steps:h,stopAfterStep:m})}async function Iv({onAssertion:e,pendingChecks:t,signal:n,step:r}){let i=[...new Map(t.map(s=>[yh(s.source),s])).values()],o=await Promise.all(i.map(async s=>{let a=await Pv(s,n),l=Date.now(),u=await s.targetIds();return{atMs:l,outcome:a,pendingCheck:s,rrwebIds:u}}));return o.forEach(s=>{Mv(e,s.pendingCheck,s.outcome,r)}),{annotations:o.filter(s=>s.pendingCheck.source.kind==="step").map(s=>({atMs:s.atMs,kind:"assertion",label:bh(s.pendingCheck.source),outcome:Ph(s.outcome),rrwebIds:s.rrwebIds,url:Ev(s.pendingCheck.source)})),findings:o.flatMap(s=>Tv(s.pendingCheck,s.outcome,r))}}function Pv(e,t){if(e.check.kind==="decided"){let n=e.check.passed?"passed":"failed";return Promise.resolve({kind:n})}return _v(e.budget,e.check.run,t)}function Mv(e,t,n,r){e?.({outcome:Ph(n),source:t.source,step:r.step})}function Ph(e){return e.kind==="passed"?"passed":e.kind==="error"?"error":"failed"}function Tv(e,t,n){return t.kind==="error"?[Ji(t.error,n)]:t.kind==="failed"?[{budget:e.budget,kind:"pending-check",source:e.source,step:n.step}]:[]}function Ji(e,t){return{error:e,kind:"driver-error",step:t.step}}function Rl(e,t){e?.(t)}function Al(e){let t=e.singletons.url;return typeof t=="string"?t:null}var Nr={async:12e4,fast:5e3,slow:3e4},Mh={async:{backoffMs:[500,1e3,2e3,5e3],timeoutMs:Nr.async},fast:{backoffMs:[100,250,500,1e3],timeoutMs:Nr.fast},slow:{backoffMs:[250,500,1e3,2e3],timeoutMs:Nr.slow}};function Th(e,t){return e.backoffMs[Math.min(t,e.backoffMs.length-1)]??0}function xh(e){return e().match(t=>({observed:t,ok:!0}),t=>({error:t,ok:!1}))}function Ov(e,t,n){return n.reconcile==null?e:n.reconcile(e,t)}function vh({canon:e,pre:t,predicted:n,step:r},i){let o=r.verifyChanges==null?[]:r.verifyChanges(n,i),s=Ov(n,i,r),a=o.map(l=>({mismatch:l,pending:!0}));return{adopted:s,probed:[...a,...Xi({actual:i.snapshot,canon:e,pre:t,predicted:s})]}}function Oh(e,t){return{budget:t.sync,kind:"consistency",mismatch:e.mismatch,pending:e.pending,step:t.step}}function Rh(e,t,n){let r=e.probed.filter(i=>!i.pending&&n(i.mismatch)==="strict");return r.length>0?{findings:r.map(i=>Oh(i,t)),snapshot:e.adopted}:e.probed.length===0?{findings:[],snapshot:e.adopted}:null}function Ah(e,t,n){return{findings:[...e.probed.map(r=>Oh(r,t)),...n],snapshot:e.adopted}}async function Nv({canon:e,classify:t,observe:n,pre:r,predicted:i,signal:o,step:s}){let a=Mh[s.sync],l=Date.now()+a.timeoutMs,u=await xh(n);if(!u.ok)return{findings:[Ji(u.error,s)],snapshot:i};let c=vh({canon:e,pre:r,predicted:i,step:s},u.observed),d=0;for(;Date.now()<l;){Lt(o);let f=Rh(c,s,t);if(f!=null)return f;await xl(Th(a,d),o),d+=1;let p=await xh(n);if(!p.ok)return Ah(c,s,[Ji(p.error,s)]);c=vh({canon:e,pre:r,predicted:i,step:s},p.observed)}return Rh(c,s,t)??Ah(c,s,[])}async function _v(e,t,n){let r=Mh[e],i=Date.now()+r.timeoutMs,o=await Ch(t),s=0;for(;o.kind==="pending"&&Date.now()<i;)Lt(n),await xl(Th(r,s),n),s+=1,o=await Ch(t);return o.kind==="pending"?{kind:"failed"}:o}function Ch(e){return e().match(t=>t?{kind:"passed"}:{kind:"pending"},t=>({error:t,kind:"error"}))}import{z as $v}from"zod";var El=$v.string().brand(),Z=El.parse("");function At(e){return El.parse(e)}function Ye(e,t){return El.parse(e.length===0?t:`${e}.${t}`)}function pe(e){return $n.safeParse(e).success}function mn(e){let t=e.lastIndexOf(".");return t===-1?void 0:{alias:e.slice(0,t),field:e.slice(t+1)}}function Ze(e){return typeof e=="object"&&e!==null&&"template"in e}function Cl(e,t,n){let r=Ye(t,e.ref);if(!n.has(r))throw new Error(`unresolved binding ref "${r}"`);return n.get(r)??null}function Nh(e,t,n){return Lv(e).every(r=>n.has(Ye(t,r)))}function ut(e,t,n){return typeof e=="string"?e:pe(e)?String(Cl(e,t,n)):e.template.map(r=>typeof r=="string"?r:String(Cl(r,t,n))).join("")}function nt(e,t,n){return e===null||typeof e=="number"||typeof e=="boolean"?e:pe(e)?Cl(e,t,n):ut(e,t,n)}function _h(e,t){return nt(e,Z,t)}function _r(e){return kr(e)}function Bn(e,t,n){return Object.fromEntries(Object.entries(e).map(([r,i])=>[r,nt(i,t,n)]))}function Lv(e){return e==null||typeof e!="object"?[]:Ze(e)?e.template.flatMap(t=>typeof t=="string"?[]:[t.ref]):[e.ref]}function $h(e){return kl(e.expect).some(t=>t.assertion.kind==="deleted")}function tn(e){return typeof e=="object"&&e!==null&&"kind"in e}function yn(e){return Object.fromEntries(Object.entries(e).filter(t=>!tn(t[1])))}function $r(e,t,n){return t.reduce((r,i)=>Dv(r,i,n,e),e)}function Lh(e,t){return Object.keys(t).length===0?e:{...e,singletons:{...e.singletons,...t}}}function kl(e){return e.flatMap(t=>t.kind==="state"?[t]:t.kind==="and"?kl(t.predicates):t.kind==="when"?kl(t.branches.flatMap(n=>n.consequence)):[])}function Dv(e,t,n,r){if(!Fv(t,n))return e;if(t.assertion.kind==="created"){let o=Bn(t.assertion.props,Z,n);return Bv(e,t.entity,_r(o),o)}if(t.assertion.kind==="deleted")return Il(e,t.entity,Wv(t.key,n,r));let i=Bn(yn(t.assertion.props),Z,n);return Il(e,t.entity,zv(t.key,i,n,r))}function Fv(e,t){return("props"in e.assertion?[e.key,yn(e.assertion.props)]:[e.key]).every(r=>Object.values(r).every(i=>Bh(i)||!pe(i)||t.has(At(i.ref))))}function Bv(e,t,n,r){let i=new Map([...e.entities.get(t)??[],[n,r]]);return{...e,entities:new Map([...e.entities,[t,i]])}}function Il(e,t,n){let r=n(e.entities.get(t)??new Map);return{...e,entities:new Map([...e.entities,[t,r]])}}function gn(e,t,n,r){let i={env:r,key:n,snapshot:e};return[...(e.entities.get(t)??new Map).values()].filter(o=>to(o,i))}function Dh(e,t,n,r,i){let o={env:r,key:n,snapshot:e};return Il(e,t,s=>new Map([...s].map(([a,l])=>[a,to(l,o)?i(l):l])))}function to(e,t){return Object.entries(t.key).every(([n,r])=>Fh(e[n],r,t))}function Fh(e,t,n){return Bh(t)?Uv(t,n).has(eo(e)):eo(e)===eo(Vv(t,n.env))}function Bh(e){return typeof e=="object"&&e!==null&&"kind"in e}function Uv(e,t){let n=t.snapshot.entities.get(e.selection.entity);return n==null?new Set:new Set([...n.values()].filter(r=>jv(r,e.selection.where,t)).map(r=>eo(r[e.field])))}function jv(e,t,n){return Object.entries(t).every(([r,i])=>Fh(e[r],i,n))}function eo(e){return e==null?"\u2205":e instanceof Date?e.toISOString():JSON.stringify(e)}function Vv(e,t){return nt(e,Z,t)}function Wv(e,t,n){let r={env:t,key:e,snapshot:n};return i=>new Map([...i].filter(([,o])=>!to(o,r)))}function zv(e,t,n,r){let i={env:n,key:e,snapshot:r};return o=>new Map([...o].map(([s,a])=>to(a,i)?[s,{...a,...t}]:[s,a]))}function Pl(e){let t=e.predicates.filter(o=>zh(o)),n=t.filter(o=>o.assertion.kind==="created"),r=Wh(t);if(n.length===0&&r.length===0&&e.deferred.length===0&&e.adopt.length===0)return;let i=t.filter(o=>o.assertion.kind==="updated");return(o,s)=>{let a=n.reduce((c,d)=>Xv(c,s,d,e.env),{env:e.env,snapshot:o}),l=r.reduce((c,d)=>Zv(c,s,d,e.env),a.snapshot),u=i.reduce((c,d)=>Hv(c,s,d),a.env);return Gv(eR(l,e.deferred,u),s,e.adopt)}}function Gv(e,t,n){if(n.length===0)return e;let r=n.reduce((i,o)=>{let s=t.snapshot.singletons[o];return s===void 0?i:{...i,[o]:s}},e.singletons);return{...e,singletons:r}}function Vh(e,t,n){return new Map([...e,...Object.entries(n).map(([r,i])=>[Ye(Z,`${t}.${r}`),i])])}function Hv(e,t,n){let r=gn(t.snapshot,n.entity,n.key,e).at(0);return r==null?e:Vh(e,n.assertion.as,r)}function Ml(e){let t=Wh(e.predicates.filter(n=>zh(n)));if(t.length!==0)return(n,r)=>t.flatMap(i=>qv(i,n,r,e.env))}function Wh(e){return e.filter(t=>t.assertion.kind==="updated"&&Tl(t.assertion.props).length>0)}function Tl(e){return Object.entries(e).filter(([,t])=>tn(t)).map(([t])=>t)}function zh(e){return e.assertion.kind==="created"||e.assertion.kind==="updated"}function qv(e,t,n,r){let i=gn(t,e.entity,e.key,r).at(0),o=gn(n.snapshot,e.entity,e.key,r).at(0);if(i==null||o==null)return[];let s=_r(Kv(e.key,r));return Tl(e.assertion.props).flatMap(a=>Uh(i[a])===Uh(o[a])?[{entity:e.entity,field:a,key:s,kind:"expected-change",value:o[a]}]:[])}function Kv(e,t){let n=Object.fromEntries(Object.entries(e).filter(r=>!Yv(r[1])));return Bn(n,Z,t)}function Yv(e){return typeof e=="object"&&e!==null&&"kind"in e}function Uh(e){return e==null?"\u2205":JSON.stringify(e)}function Zv(e,t,n,r){let i=Tl(n.assertion.props),o=gn(t.snapshot,n.entity,n.key,r).at(0);return o==null?e:Dh(e,n.entity,n.key,r,s=>({...s,...Object.fromEntries(i.flatMap(a=>{let l=o[a];return l===void 0?[]:[[a,l]]}))}))}function Xv(e,t,n,r){if(n.assertion.kind!=="created")return e;let i=Bn(n.assertion.props,Z,r),o=_r(i),s=e.snapshot.entities.get(n.entity);if(s==null||!s.has(o))return e;let a=Jv(t.snapshot.entities.get(n.entity),s,i);if(a==null)return e;let[l,u]=a,c=new Map(s);return c.delete(o),c.set(l,{...u,...i}),{env:Vh(e.env,n.assertion.as,u),snapshot:{...e.snapshot,entities:new Map(e.snapshot.entities).set(n.entity,c)}}}function Jv(e,t,n){if(e==null)return;let r=Object.entries(n),i=[...e].filter(([o])=>!t.has(o)).map(([o,s])=>({entry:[o,s],score:r.filter(([a,l])=>jh(s[a])===jh(l)).length}));return Qv(i,r.length)}function jh(e){return e==null?"\u2205":JSON.stringify(e)}function Qv(e,t){let n=e.reduce((i,o)=>Math.max(i,o.score),0);if(n===0)return;let r=e.filter(i=>i.score===n);if(!(n<t&&r.length!==1))return r[0]?.entry}function eR(e,t,n){let r=t.reduce((i,o)=>{let s=tR(o.value,n);return s==null?i:{...i,[o.name]:Dn(o.name,s)}},e.singletons);return{...e,singletons:r}}function tR(e,t){try{return ut(e,Z,t)}catch{return}}function no(e,t){if(e.kind==="visible"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused"||e.kind==="checked")return{kind:e.kind,locator:Lr(e.locator,t)};if(e.kind==="not"){let n=no(e.predicate,t);return n==null?null:{inner:n,kind:"not"}}return e.kind==="value"||e.kind==="text"?{kind:e.kind,locator:Lr(e.locator,t),value:ut(e.value,Z,t)}:e.kind!=="browser"?null:{kind:"browser",name:e.name,value:ut(e.value,Z,t)}}function Un(e,t){let n=e.expect.filter(a=>a.kind==="state"),r=aR(n),{adopt:i,deferred:o,immediate:s}=nR(e,t,r);return{action:lR(e.action,t),label:e.action.kind,pendingChecks:e.expect.flatMap(a=>cR(a,t)),reconcile:Pl({adopt:i,deferred:o,env:t,predicates:n}),verifyChanges:Ml({adopt:i,deferred:o,env:t,predicates:n}),effect:a=>Lh($r(a,n,t),s)}}function Lr(e,t){return e.by==="role"?{by:"role",name:e.name==null?void 0:ut(e.name,Z,t),role:e.role}:e.by==="inside"?{by:"inside",scope:Lr(e.scope,t),target:Lr(e.target,t)}:{by:"testId",value:ut(e.value,Z,t)}}function nR(e,t,n){let r=e.action.kind==="goto"&&!e.expect.some(s=>s.kind==="browser"&&s.name==="url"),i=e.action.kind==="goto"&&!r?{url:$t(ut(e.action.url,Z,t))}:{},o=r?["url"]:[];return e.expect.reduce((s,a)=>a.kind==="browser"&&rR(a.value,n)?{...s,deferred:[...s.deferred,{name:a.name,value:a.value}]}:a.kind==="browser"||a.kind==="singleton"?{...s,immediate:{...s.immediate,...oR(a,t)}}:s,{adopt:o,deferred:[],immediate:i})}function rR(e,t){return iR(e).some(n=>t.has(n.split(".")[0]??n))}function iR(e){return typeof e=="string"?[]:pe(e)?[e.ref]:e.template.filter(t=>typeof t!="string").map(t=>t.ref)}function oR(e,t){if(e.kind==="browser")return{[e.name]:sR(e,t)};if(e.kind==="singleton")return{[e.singleton]:nt(e.assertion.value,Z,t)};throw new Error("when() consequence must be a url (browser) or singleton assertion")}function sR(e,t){return Dn(e.name,ut(e.value,Z,t))}function aR(e){return new Set(e.flatMap(t=>t.assertion.kind==="created"||t.assertion.kind==="updated"?[t.assertion.as]:[]))}function lR(e,t){return{files:e.kind==="upload"?e.files:void 0,key:e.kind==="press"?e.key:void 0,kind:e.kind,locator:uR(e,t),url:e.kind==="goto"?ut(e.url,Z,t):void 0,value:"value"in e?_h(e.value,t):void 0}}function uR(e,t){if(!(!("locator"in e)||e.locator==null))return Lr(e.locator,t)}function cR(e,t){if(e.kind==="browser"||e.kind==="singleton")return[];let n=no(e,t),r="wait"in e?e.wait??"fast":"fast";return n==null?[]:[{budget:r,check:n}]}import{err as Gh,ok as Nl,okAsync as dR,Result as fR}from"neverthrow";function jn(e,t,n){let r=SR(e),i={env:new Map,generate:n.generate,generatedParams:new Set,indexed:r,overrides:new Map(Object.entries(n.params??{}).map(([s,a])=>[At(s),a]))};wR(t.params,Z,i);let o=t.world.map(s=>xR(s,Z,i));return n.materialize(o).andThen(s=>CR(s,i.env,r).map(a=>hR({base:a,generatedParams:i.generatedParams,lockfile:e,test:t})))}function ro(e,t){let n=new Map(t.map(r=>[r.name,r]));return r=>dR(yR(r,e,n).rows)}function io(e){return t=>{let n=t.map(r=>({as:r.as,entity:r.entity,fields:r.fields}));return e(n).andThen(r=>mR(t,r))}}function _l(e,t){let n=Dr(t);return Object.fromEntries(Object.entries(e).filter(([r,i])=>n.includes(r)&&i!=null))}function Dr(e){return Object.keys(e.props)}function hR({base:e,generatedParams:t,lockfile:n,test:r}){let i=Object.fromEntries(n.singletons.map(c=>[c.name,c.default])),o=Object.fromEntries(Object.entries(r.singletons).map(([c,d])=>[c,nt(d,Z,e.env)])),s=Object.entries(r.singletons).filter(([,c])=>pR(c,t)).map(([c])=>c),a={...i,...o},l=new Set(n.singletons.filter(c=>c.source==="client").map(c=>c.name)),u=Object.fromEntries(Object.entries(a).filter(([c])=>l.has(c)));return{...e,clientState:u,generatedSingletons:s,snapshot:{...e.snapshot,singletons:a}}}function pR(e,t){return pe(e)?t.has(Ye(Z,e.ref)):Ze(e)?e.template.some(n=>typeof n!="string"&&t.has(Ye(Z,n.ref))):!1}function mR(e,t){let n=new Map(t.map(r=>[r.as,r]));return fR.combine(e.map(r=>{let i=n.get(r.as);return i==null?Gh(fh(r.as)):Nl({as:r.as,entity:r.entity,generatedFields:r.generatedFields,row:i.row,session:i.session})}))}function yR(e,t,n){return e.reduce((r,i)=>{let o=gR(i.fields,r.env),s=kR({generate:t,model:i.model,seedPrefix:i.seedPrefix,set:o,valueSpaces:n}),a=Object.entries(s).map(([u,c])=>[`${i.as}.${u}`,c]),l=Object.keys(s).filter(u=>!(u in o));return{env:new Map([...r.env,...a]),rows:[...r.rows,{as:i.as,entity:i.entity,generatedFields:[...new Set([...i.generatedFields,...l])],row:s,session:void 0}]}},{env:new Map,rows:[]})}function gR(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>{if(pe(r))return[n,bR(t,r.ref)];if(Ze(r))throw new Error(`template value not allowed in entity field "${n}"`);return[n,r]}))}function bR(e,t){let n=e.get(t);if(n==null)throw new Error(`setup ref "${t}" was not produced by an earlier entity`);return n}function SR(e){return{models:new Map(e.entities.map(t=>[t.name,t])),valueSpaces:new Map(e.valueSpaces.map(t=>[t.name,t]))}}function wR(e,t,n){Object.entries(e).forEach(([r,i])=>{let o=Ye(t,r),s=n.indexed.valueSpaces.get(i.valueSpace);if(s==null)throw new Error(`unknown valueSpace "${i.valueSpace}" for param "${o}"`);let a=n.overrides.get(o);a==null&&n.generatedParams.add(o);let l=a??n.generate.value({anchor:void 0,constraints:s.constraints,generator:s.generator,nullable:!1,seed:o,type:s.type,values:s.values,valueSpace:i.valueSpace});n.env.set(o,l)})}function xR(e,t,n){let r=n.indexed.models.get(e.entity);if(r==null)throw new Error(`model "${e.entity}" not found for setup "${e.as}"`);let i=Ye(t,e.as),o=vR(e.set,t,n.env),s=AR(r,o,i,n),a=Object.entries(e.set).filter(([,l])=>pe(l)&&n.generatedParams.has(Ye(t,l.ref))).map(([l])=>l);return{as:i,entity:e.entity,fields:{...s,...o},generatedFields:[...Object.keys(s),...a],model:r,seedPrefix:i}}function vR(e,t,n){return Object.fromEntries(Object.entries(e).map(([r,i])=>[r,RR(i,t,n)]))}function RR(e,t,n){if(!pe(e))return e;let r=Ye(t,e.ref);return n.get(r)??{ref:r}}function AR(e,t,n,r){return Object.fromEntries(Object.entries(e.props).filter(([i,o])=>!o.optional&&!e.identity.includes(i)&&!(i in t)).map(([i,o])=>[i,Hh({field:i,generate:r.generate,model:e,seedPrefix:n,spec:o,valueSpaces:r.indexed.valueSpaces})]))}function CR(e,t,n){let r=new Map,i=e.flatMap(a=>{let l=n.models.get(a.entity);if(l==null)throw new Error(`model "${a.entity}" not found for setup "${a.as}"`);Object.entries(a.row).forEach(([c,d])=>t.set(Ye(At(a.as),c),d));let u=r.get(a.entity)??new Map;return u.set(Ol(a.row,l),_l(a.row,l)),r.set(a.entity,u),a.session==null?[]:[a.session]}),o=e.flatMap(a=>{let l=n.models.get(a.entity);return l==null?[]:[{alias:a.as,entity:a.entity,key:Ol(a.row,l)}]}),s=e.flatMap(a=>{let l=n.models.get(a.entity);if(l==null)return[];let u=Ol(a.row,l);return a.generatedFields.map(c=>({entity:a.entity,field:c,key:u}))});return ER(i).map(a=>({aliases:o,auth:a,env:t,generated:s,snapshot:{entities:IR(r),singletons:{}}}))}function ER(e){if(e.length===0)return Nl(void 0);let t=new Set(e.map(r=>JSON.stringify(r.cookies))).size;if(t>1)return Gh(hh(t));let n=e.flatMap(r=>Object.entries(r.headers??{}));return Nl({cookies:e.flatMap(r=>r.cookies),headers:n.length===0?void 0:Object.fromEntries(n),origins:e.flatMap(r=>r.origins)})}function kR({generate:e,model:t,seedPrefix:n,set:r,valueSpaces:i}){return{...Object.fromEntries(Object.entries(t.props).filter(([s])=>!(s in r)).map(([s,a])=>[s,Hh({field:s,generate:e,model:t,seedPrefix:n,spec:a,valueSpaces:i})])),...r}}function Hh({field:e,generate:t,model:n,seedPrefix:r,spec:i,valueSpaces:o}){let s=`${n.name}.${e}`;return t.value({anchor:void 0,constraints:o.get(s)?.constraints,generator:o.get(s)?.generator??"lorem.word",nullable:i.optional,seed:Ye(r,e),type:i.type,values:o.get(s)?.values,valueSpace:s})}function Ol(e,t){return t.identity.map(n=>String(e[n])).join(":")}function IR(e){return new Map([...e].map(([t,n])=>[t,new Map(n)]))}function Dt(e,t){return[...new Map(e.map(n=>[t(n),n])).values()]}function qh(e){return Dt(e,G)}function rt(e){return`${e.workflow}/${e.slug}`}function Ct(e){return e.workflows.flatMap(t=>t.tests.map(n=>({ref:rt(n),test:n,workflow:t})))}function Et(e){return`${e.test}#${String(e.index)}`}function Sn(e){let t=Ct(e).flatMap(n=>Fr(e,n.test));return Dt(t,n=>`${n.test}:${G(n.steps)}`)}function Fr(e,t){let n=Zh(t),r=Kh(n,t.singletons),i=JR(t,XR(e)),o=PR(e,t);return MR(r,QR(t.steps),n).reduce((a,{chunk:l,requiredState:u},c)=>({offset:a.offset+l.length,transitions:[...a.transitions,YR({chunk:l,index:c,intent:t.intent,namespace:n.namespace,paramSpaceOf:i,requiredState:u,testRef:rt(t),whenChunk:o.slice(a.offset,a.offset+l.length)})]}),{offset:0,transitions:[]}).transitions}function Kh(e,t){return{absences:HR(e),entities:KR(e),exclusives:e.exclusives,singletons:Object.fromEntries(Object.entries(t).filter(([,n])=>!pe(n)&&!Ze(n)))}}function PR(e,t){let n=e.workflows.find(r=>r.name===t.workflow);return n==null||n.steps.length!==t.steps.length?t.steps:n.steps}function oo(e,t,n){return Object.values(e).flatMap(r=>pe(r)?Ll(r.ref,n):[]).find(r=>r.entity===t)?.aliasPath}function MR(e,t,n){return t.reduce((r,i)=>({requiredState:TR(r.requiredState,i,n),withRequiredState:[...r.withRequiredState,{chunk:i,requiredState:WR(r.requiredState,i)}]}),{requiredState:e,withRequiredState:[]}).withRequiredState}function TR(e,t,n){let r=t.flatMap(i=>i.expect.filter(o=>o.kind==="state")).reduce((i,o)=>OR(i,o,n),e);return{...r,singletons:{...r.singletons,...UR(t)}}}function OR(e,t,n){return t.assertion.kind==="deleted"?NR(e,t,n):t.assertion.kind==="created"?LR(e,t.entity,t.assertion.as,t.assertion.props,n):FR(e,t,n)}function NR(e,t,n){let r=oo(t.key,t.entity,n.namespace),i=e.entities.find(a=>a.alias===r),o=Br(_R(t.key),n),s=i==null?{entity:t.entity,...o}:{entity:i.entity,...$R(i,o)};return{...e,absences:[...e.absences,s],entities:e.entities.filter(a=>a.alias!==r)}}function _R(e){return Object.fromEntries(Object.entries(e).flatMap(t=>{let n=t[1];return Jh(n)?[]:[[t[0],n]]}))}function $R(e,t){return{literals:{...e.literals,...t.literals},relations:[...e.relations.filter(n=>!t.relations.some(r=>r.field===n.field)),...t.relations]}}function LR(e,t,n,r,i){let o=Br(r,i);return{...e,absences:e.absences.filter(s=>s.entity!==t||!DR(o,s)),entities:[...e.entities,{alias:n,entity:t,...o}]}}function DR(e,t){return Object.entries(t.literals).every(([r,i])=>e.literals[r]===i)&&t.relations.every(r=>e.relations.some(i=>i.field===r.field&&i.targetAlias===r.targetAlias&&i.targetField===r.targetField))}function FR(e,t,n){if(t.assertion.kind!=="updated")return e;let r=oo(t.key,t.entity,n.namespace);if(r==null)return e;let i=Br(yn(t.assertion.props),n),o=Object.entries(t.assertion.props).filter(([,a])=>tn(a)).map(([a])=>a),s=a=>a.alias===r?BR(a,i,o):a;return{...e,entities:e.entities.map(a=>s(a))}}function BR(e,t,n){let r=Object.entries(e.literals).filter(([i])=>!n.includes(i)&&!(i in t.literals));return{...e,literals:{...Object.fromEntries(r),...t.literals},relations:[...e.relations.filter(i=>!t.relations.some(o=>o.field===i.field)),...t.relations]}}function UR(e){return e.reduce((t,n)=>({...t,...jR(n),...VR(n)}),{})}function jR(e){return e.action.kind==="goto"?{url:e.action.url}:{}}function VR(e){return Object.fromEntries(e.expect.flatMap(t=>t.kind==="browser"?[[t.name,t.value]]:t.kind==="singleton"?[[t.singleton,t.assertion.value]]:[]))}function WR(e,t){return t[0]?.action.kind!=="goto"?e:{...e,singletons:Object.fromEntries(Object.entries(e.singletons).filter(([n])=>n!=="url"))}}function so(e,t){let n=Zh(t);return{namespace:n.namespace,requiredState:Kh(n,t.singletons)}}function Yh(e,t){return[...new Set(e)].flatMap(n=>Ll(n,t))}function ct(e){return pe(e)?[e.ref]:Ze(e)?e.template.flatMap(t=>pe(t)?[t.ref]:[]):[]}function bn(e){switch(e.kind){case"visible":case"disabled":case"enabled":case"focused":case"checked":return nn(e.locator);case"value":case"text":return[...nn(e.locator),...ct(e.value)];case"singleton":return ct(e.assertion.value);case"browser":return ct(e.value);case"state":return[...e.assertion.kind==="deleted"?[]:Object.values(yn(e.assertion.props)).flatMap(t=>ct(t)),...Object.values(e.key).flatMap(t=>Xh(t))];case"not":return bn(e.predicate);case"when":return e.branches.flatMap(t=>t.consequence.flatMap(n=>bn(n)));case"and":return e.predicates.flatMap(t=>bn(t));case"count":return[]}}function Zh(e){return{absences:e.absent,exclusives:e.exclusive,namespace:new Map(e.world.map(t=>[t.as,t.entity])),setups:e.world}}function nn(e){return e.by==="inside"?[...nn(e.scope),...nn(e.target)]:e.by==="role"?e.name==null?[]:ct(e.name):ct(e.value)}function Xh(e){return Jh(e)?Object.values(e.selection.where).flatMap(t=>Xh(t)):ct(e)}function Jh(e){return typeof e=="object"&&e!==null&&"kind"in e}function zR(e){return e.kind==="goto"?ct(e.url):e.kind==="fill"||e.kind==="select"?[...nn(e.locator),...ct(e.value)]:e.kind==="press"?e.locator==null?[]:nn(e.locator):(e.kind==="upload",nn(e.locator))}function GR(e){return[...zR(e.action),...e.expect.flatMap(t=>bn(t))]}function HR(e){return e.absences.map(t=>({entity:t.entity,...Br(t.where,e)}))}function Br(e,t){let n=Object.entries(e),r=Object.fromEntries(n.flatMap(([o,s])=>pe(s)||Ze(s)?[]:[[o,s]])),i=n.flatMap(o=>{let s=o[1];if(!pe(s))return[];let a=Ll(s.ref,t.namespace).at(0);return a==null?[]:[{entity:a.entity,field:o[0],targetAlias:a.aliasPath,targetField:a.field}]});return{literals:r,relations:i}}function qR(e,t){return e.map(n=>({alias:n.as,entity:n.entity,...Br(n.set,t)}))}function KR(e){return qR(e.setups,e)}function YR(e){let t=e.chunk.findIndex(s=>s.action.kind!=="goto"),n=t===-1?e.chunk:e.chunk.slice(0,t),r=e.chunk.slice(n.length),i=r.at(-1)??e.chunk.at(-1);if(i==null)throw new Error("empty transition chunk");let o=[...new Set(e.chunk.flatMap(s=>GR(s)))];return{effectStep:i,index:e.index,intent:e.intent,namespace:e.namespace,nav:n,paramSpaces:Object.fromEntries(o.filter(s=>e.paramSpaceOf.has(s)).map(s=>[s,e.paramSpaceOf.get(s)])),requiredState:e.requiredState,steps:r,test:e.testRef,wait:Eh(r.flatMap(s=>ZR(s))),whenSteps:e.whenChunk}}function ZR(e){return e.expect.flatMap(t=>t.kind==="state"&&t.wait!=null?[t.wait]:[])}function Ll(e,t){let n=mn(e);if(n==null)return[];let r=t.get(n.alias);return r==null?[]:[{aliasPath:n.alias,entity:r,field:n.field,ref:e}]}function XR(e){return new Map(e.valueSpaces.map(t=>[t.name,t]))}function JR(e,t){return new Map(Object.entries(e.params).map(([n,r])=>[n,t.get(r.valueSpace)]))}function QR(e){return $l(e,0,[],[])}function $l(e,t,n,r){let i=e[t];if(i==null)return n.length===0?r:[...r,n];let o=[...n,i];return eA(i)?$l(e,t+1,[],[...r,o]):$l(e,t+1,o,r)}function eA(e){return e.expect.some(t=>t.kind==="state")}function Qh(e){return ep(e,new Map)}function tA(e,t){return e.reduce((n,r)=>n??t(r),null)}function ep(e,t){let n=e.variables.find(r=>!t.has(r));return n==null?t:tA(e.domain(n),r=>{let i=new Map([...t,[n,r]]);return e.consistent(i)?ep(e,i):null})}function dt(e,t){let n=tp(e,t);if(n==null)return null;let r=uA(n);return cA(e.singletons,t,r)?r:null}function tp(e,t){let{absences:n,entities:r,exclusives:i}=e,o=new Map(r.map(a=>[a.alias,a])),s=Qh({variables:r.map(a=>a.alias),consistent:a=>nA(a)&&rA(r,a)&&oA(n,a,t),domain:a=>aA(o.get(a),t)});return s==null?null:lA(i,r,s,t)?s:null}function nA(e){let t=[...e.values()];return new Set(t).size===t.length}function rA(e,t){return e.every(n=>t.has(n.alias)?n.relations.every(r=>iA(n,r,t)):!0)}function iA(e,t,n){if(!n.has(t.targetAlias))return!0;let r=n.get(t.targetAlias)?.[t.targetField];return r==null?!0:n.get(e.alias)?.[t.field]===r}function oA(e,t,n){return e.every(r=>![...n.entities.get(r.entity)?.values()??[]].some(i=>sA(i,r,t)))}function sA(e,t,n){return np(e,t)?t.relations.every(r=>{if(!n.has(r.targetAlias))return!1;let i=n.get(r.targetAlias)?.[r.targetField];return i!=null&&e[r.field]===i}):!1}function np(e,t){return Object.entries(t.literals).every(([n,r])=>r===null?e[n]==null:e[n]===r)}function aA(e,t){return e==null?[]:[...t.entities.get(e.entity)?.values()??[]].filter(n=>np(n,e))}function lA(e,t,n,r){return e.every(i=>{let o=t.filter(a=>a.entity===i&&n.has(a.alias)).length;return(r.entities.get(i)?.size??0)===o})}function uA(e){return new Map([...e].flatMap(([t,n])=>Object.entries(n).flatMap(r=>{let i=r[1];return typeof i=="string"||typeof i=="number"||typeof i=="boolean"?[[At(`${t}.${r[0]}`),i]]:[]})))}function cA(e,t,n){return Object.entries(e).every(([r,i])=>{if(!Nh(i,Z,n))return!1;let o=nt(i,Z,n),s=t.singletons[r],a=Nt.safeParse(r);return a.success?ll(a.data,o,s):s===o})}function ip(e,t,n){return e.reduce((r,i)=>{let o=$r(r.snapshot,dA(i),n);return{resolved:[...r.resolved,fA(i,o,n)],snapshot:o}},{resolved:[],snapshot:t}).resolved}function dA(e){return e.expect.filter(t=>t.kind==="state")}function fA(e,t,n){return e.expect.some(r=>r.kind==="when")?{...e,expect:e.expect.flatMap(r=>op(r,{env:n,snapshot:t}))}:e}function op(e,t){if(e.kind!=="when")return[e];let n=hA(e,t);return n==null?[]:n.flatMap(r=>op(r,t))}function hA(e,t){return e.branches.find(n=>n.condition==null||Dl(n.condition,t))?.consequence}function Dl(e,t){if(e.kind==="count")return gn(t.snapshot,e.entity,{},t.env).length===e.value;if(e.kind==="singleton"){let n=nt(e.assertion.value,Z,t.env);return rp(t.snapshot.singletons[e.singleton])===rp(n)}return e.kind==="not"?!Dl(e.predicate,t):e.predicates.every(n=>Dl(n,t))}function rp(e){return e==null?"\u2205":JSON.stringify(e)}function Ur(e,t,n){let r=dt(e.requiredState,t);return r==null?null:new Map([...r,...Object.entries(n).map(([i,o])=>[At(i),o])])}function jr(e,t,n){let r=ip(e.whenSteps,n,t),i=r.at(-1)??e.effectStep,o=Un(i,t),s=yA(e,t);return{effect:gA(o.effect,s),steps:r.map(a=>{let l=Un(a,t);return{action:l.action,effect:l.effect,pendingChecks:l.pendingChecks,reconcile:l.reconcile,source:a,verifyChanges:l.verifyChanges}})}}function lo(e,t,n){return dt(e.requiredState,n)==null?!1:ao(t(n))!==ao(n)||bA(e)||pA(e)}function pA(e){return[...e.nav,...e.steps].every(t=>t.expect.every(n=>n.kind!=="state"))}var sp=new WeakMap;function ao(e){let t=sp.get(e);if(t!=null)return t;let n=G({entities:[...e.entities].map(([r,i])=>[r,[...i]]),singletons:mA(e.singletons)});return sp.set(e,n),n}function mA(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>t==="url"&&typeof n=="string"?[t,$t(n)]:[t,n]))}function yA(e,t){let n=e.nav.at(-1);return n==null?void 0:Un(n,t).action.url}function gA(e,t){if(t==null)return e;let n=$t(t);return r=>{let i=e(r);return{...i,singletons:{...i.singletons,url:n}}}}function bA(e){return e.effectStep.expect.some(t=>t.kind==="state"&&t.assertion.kind==="updated"&&Object.values(t.assertion.props).some(n=>tn(n)))}function uo(e,t,n){let r=Ur(e,t.snapshot,n);if(r==null)return null;let i=SA(e,r,t.snapshot);return i==null||!lo(e,i.effect,t.snapshot)?null:{next:{snapshot:i.effect(t.snapshot)},resolved:i}}function ap(e,t,n){let r=Ur(e,t.snapshot,n);if(r==null)return"required-state-unsatisfied";try{return jr(e,r,t.snapshot),"no-effect"}catch{return"unresolvable"}}function SA(e,t,n){try{return jr(e,t,n)}catch{return null}}function co(e,t,n){return e.flatMap((r,i)=>{let o=n(r),s=uo(r,t,o);return s==null?[]:[{idx:i,label:Et(r),params:o,stepRun:s}]})}var wA={absences:[],entities:[],exclusives:[],singletons:{}};function Vn(e){return{...wA,...e}}function Vr(e,t){if(e==null)return new Set;if(e.by==="inside")return new Set([...Vr(e.scope,t),...Vr(e.target,t)]);let n=e.by==="role"?e.name:e.value;return new Set(t(n))}function fo(e){return xA(e).flatMap(t=>vA(t))}function xA(e){return[...e.reduce((n,r)=>{let i=G([r.when.singletons,r.consequence]);return new Map([...n,[i,[...n.get(i)??[],r]]])},new Map).values()]}function vA(e){if(e.length<2)return[];let t=e.map(o=>new Set(o.when.entities.map(s=>Fl(s)))),[n]=t;if(n==null)return[];let r=[...n].filter(o=>t.every(s=>s.has(o))),i=e.toSorted((o,s)=>o.when.entities.length-s.when.entities.length)[0];return i==null||r.length===i.when.entities.length?[]:RA(e,r)?[]:kA(i,r,PA(e))}function Fl(e){return G([e.entity,e.literals])}function RA(e,t){return e.some(n=>{let r=lp(n.consequence),i=AA(r),o=CA(r);return n.when.entities.some(s=>!t.includes(Fl(s))&&(EA(s,i)||o.has(s.alias)))})}function lp(e){return e.kind==="not"?lp(e.predicate):"locator"in e?e.locator:void 0}function AA(e){return Vr(e,t=>t==null||pe(t)||Ze(t)?[]:[t])}function CA(e){return Vr(e,t=>{if(t==null||!pe(t))return[];let n=mn(t.ref);return n==null?[]:[n.alias]})}function EA(e,t){return Object.values(e.literals).some(n=>typeof n=="string"&&t.has(n))}function kA(e,t,n){let r=e.when.entities.filter(l=>t.includes(Fl(l))),i=e.when.entities.filter(l=>!r.includes(l)).filter(l=>e.when.exclusives.includes(l.entity)).map(l=>({...l,literals:{},relations:[]})),o=[...r,...i],s=new Set(o.map(l=>l.alias));if(![...e.refs].every(l=>s.has(l)))return[];let a=Vn({entities:o.map(l=>IA(l,s)),exclusives:e.when.exclusives.filter(l=>o.some(u=>u.entity===l)),singletons:e.when.singletons});return[{consequence:e.consequence,origin:{kind:"generalized",tests:n},refs:e.refs,when:a}]}function IA(e,t){return{...e,relations:e.relations.filter(n=>t.has(n.targetAlias))}}function PA(e){return[...new Set(e.flatMap(t=>t.origin==null?[]:t.origin.kind==="generalized"?t.origin.tests:[t.origin.test]))]}function fp(e){return e.flatMap((t,n)=>e.slice(n+1).flatMap(r=>pp(t,r)))}function hp(e,t){return pp(e,t).length>0}function pp(e,t){let n=up(e.when,t.when);return!n&&!up(t.when,e.when)||!TA(e.consequence,t.consequence)?[]:[{a:e.consequence,b:t.consequence,when:n?t.when:e.when}]}function up(e,t){return cp(e.entities,t.entities)&&cp(e.absences,t.absences)&&e.exclusives.every(n=>t.exclusives.includes(n))&&MA(e.singletons,t.singletons)}function cp(e,t){let n=new Set(t.map(r=>G(r)));return e.every(r=>n.has(G(r)))}function MA(e,t){return Object.entries(e).every(([n,r])=>n in t&&G(t[n])===G(r))}function TA(e,t){return e.kind==="not"?Bl(e.predicate,t):t.kind==="not"?Bl(e,t.predicate):OA(e,t)||NA(e,t)}function Bl(e,t){return e.kind===t.kind&&"locator"in e&&"locator"in t&&mp(e,t)}function mp(e,t){return"locator"in t&&G(e.locator)===G(t.locator)}function OA(e,t){let n=new Set([e.kind,t.kind]);return n.has("enabled")&&n.has("disabled")&&"locator"in e&&"locator"in t?mp(e,t):!1}function NA(e,t){let n=dp(e),r=dp(t);return n==null||r==null||e.kind!==t.kind?!1:Bl(e,t)&&G(n)!==G(r)}function dp(e){return e.kind==="value"||e.kind==="text"?e.value:null}function yp(e,t){return e.flatMap(n=>{let r=_A(n),i=new Set(n.requiredState.absences.map(o=>o.entity));return t.flatMap(o=>$A(n,o,r,i))})}function _A(e){return new Set(e.steps.flatMap(t=>t.expect.flatMap(n=>n.kind==="state"&&n.assertion.kind==="deleted"?[n.entity]:[])))}function $A(e,t,n,r){let{source:i,target:o}=t.reference;return!n.has(o)||n.has(i)||r.has(i)?[]:[{dataRule:t,source:i,target:o,transition:Et(e)}]}function Ul(e){return G({consequence:e.consequence,when:e.when})}function po(e){let t=[...LA(e),...YA(e)],n=fo(t).reduce((r,i)=>[...t,...r].some(s=>hp(i,s))?r:[...r,i],[]);return Dt([...t,...n],Ul)}function mo(e,t){return e.filter(n=>!DA(n)||FA(n)===t)}function yo(e){return e.kind==="not"?yo(e.predicate):e.kind==="visible"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused"||e.kind==="checked"||e.kind==="value"||e.kind==="text"}function go(e,t,n){if(dt(e.when,t)!=null)return null;let r=dt(e.when,n);return r==null?null:XA(e,r)}function LA(e){return Dt(Ct(e).flatMap(t=>BA(e,t)),Ul)}function DA(e){return e.origin==null||e.origin.kind==="generalized"?!1:bn(e.consequence).some(t=>mn(t)!=null)}function FA(e){let{origin:t}=e;if(!(t==null||t.kind==="generalized"))return t.test}function BA(e,{test:t,workflow:n}){let r=so(e,t),i=UA(n.steps);return t.steps.reduce((o,s)=>({pageRules:[...o.pageRules,...KA({branchScoped:i,namespace:r.namespace,origin:{kind:"test",test:rt(t)},requiredState:o.requiredState,step:s})],requiredState:jA(o.requiredState,s,r)}),{pageRules:[],requiredState:r.requiredState}).pageRules}function UA(e){let t=e.flatMap(n=>n.expect).flatMap(n=>ho(n)).map(n=>G(n));return new Set(t)}function ho(e){return e.kind==="not"?ho(e.predicate):e.kind==="and"?e.predicates.flatMap(t=>ho(t)):e.kind!=="when"?[]:e.branches.flatMap(t=>t.consequence.flatMap(n=>[n,...ho(n)]))}function jA(e,t,n){return t.expect.reduce((r,i)=>i.kind==="state"?VA(r,i,n):r,e)}function VA(e,t,n){if(t.assertion.kind==="created"){let o=WA(t.assertion.as,t.entity,t.assertion.props,n);return{...e,entities:[...e.entities,o]}}let r=oo(t.key,t.entity,n.namespace);if(r==null)return e;if(t.assertion.kind==="deleted")return HA(e,r);let i=yn(t.assertion.props);return{...e,entities:e.entities.map(o=>o.alias===r?bp(o,i,n):o)}}function WA(e,t,n,r){return bp({alias:e,entity:t,literals:{},relations:[]},n,r)}function bp(e,t,n){return Object.entries(t).reduce((r,[i,o])=>{if(Ze(o))return r;if(pe(o)){let s=zA(o.ref,i,n.namespace);return{...r,literals:GA(r.literals,i),relations:s==null?r.relations:[...gp(r.relations,i),s]}}return{...r,literals:{...r.literals,[i]:o},relations:gp(r.relations,i)}},e)}function zA(e,t,n){let r=mn(e);if(r==null)return;let i=n.get(r.alias);return i==null?void 0:{entity:i,field:t,targetAlias:r.alias,targetField:r.field}}function GA(e,t){return Object.fromEntries(Object.entries(e).filter(([n])=>n!==t))}function gp(e,t){return e.filter(n=>n.field!==t)}function HA(e,t){let n=e.entities.find(i=>i.alias===t),r=qA(e,t);return n==null?r:{...r,absences:[...r.absences,{entity:n.entity,literals:n.literals,relations:n.relations}]}}function qA(e,t){return{...e,entities:e.entities.filter(n=>n.alias!==t)}}function KA({branchScoped:e,namespace:t,origin:n,requiredState:r,step:i}){if(i.action.kind!=="goto")return[];let o=i.action.url;return i.expect.filter(s=>yo(s)).filter(s=>!e.has(G(s))).map(s=>Sp({consequence:s,namespace:t,origin:n,requiredState:r,url:o}))}function Sp({consequence:e,namespace:t,origin:n,requiredState:r,url:i}){return{consequence:e,origin:n,refs:new Set(Yh([...ct(i),...bn(e)],t).map(o=>o.aliasPath)),when:{...r,singletons:{...r.singletons,url:i}}}}function YA(e){return Dt(Sn(e).flatMap(t=>ZA(t)),Ul)}function ZA(e){let t=e.nav.at(-1),n=e.steps[0]?.action,r=n!=null&&"locator"in n?n.locator:void 0;return t==null||t.action.kind!=="goto"||r==null?[]:[Sp({consequence:{kind:"enabled",locator:r,wait:void 0},namespace:e.namespace,origin:{intent:e.intent,kind:"trigger",test:e.test},requiredState:e.requiredState,url:t.action.url})]}function XA(e,t){try{let n=no(e.consequence,t);return n==null?null:{check:n}}catch{return null}}function bo(e){return qh(Ct(e).flatMap(t=>JA(e,t.test)))}function So(e,t){return dt(e.when,t)==null?!1:dt(e.holds,t)==null}function JA(e,t){let n=so(e,t);return n.requiredState.entities.flatMap(r=>r.relations.flatMap(i=>QA(e,r,i,n.namespace)?nC(r,i,n.namespace):[]))}function QA(e,t,n,r){let i=r.get(n.targetAlias);return i!=null&&!eC(e,t.entity,n.field)&&tC(e,i,n.targetField)}function eC(e,t,n){return e.entities.find(r=>r.name===t)?.props[n]?.optional===!0}function tC(e,t,n){return e.entities.find(r=>r.name===t)?.identity.includes(n)===!0}function nC(e,t,n){let r=n.get(t.targetAlias);if(r==null)return[];let i=wp(e.alias,e.entity),o=wp(t.targetAlias,r);return[{holds:Vn({entities:[{...i,relations:[t]},o]}),reference:{field:t.field,source:e.entity,target:r,targetField:t.targetField},when:Vn({entities:[i]})}]}function wp(e,t){return{alias:e,entity:t,literals:{},relations:[]}}function xp(e,t){let n=[...t.entities].flatMap(([o,s])=>[...s].map(([a,l])=>rC({entity:o,key:a,pre:e,row:l}))),r=[...e.entities].flatMap(([o,s])=>[...s].flatMap(([a,l])=>iC({entity:o,key:a,post:t,row:l}))),i=Object.entries(t.singletons).map(([o,s])=>({changed:e.singletons[o]!==s,name:o,value:s}));return{rows:[...n,...r],singletons:i}}function rC({entity:e,key:t,pre:n,row:r}){let i=oC(n.entities.get(e),t),o=Object.entries(r).map(([s,a])=>({changed:i==null||i[s]!==a,field:s,value:a}));return{changed:i==null||o.some(s=>s.changed),entity:e,fields:o,key:t,status:i==null?"created":"present"}}function iC({entity:e,key:t,post:n,row:r}){if(n.entities.get(e)?.has(t)===!0)return[];let i=Object.entries(r).map(([o,s])=>({changed:!1,field:o,value:s}));return[{changed:!0,entity:e,fields:i,key:t,status:"deleted"}]}function oC(e,t){return e?.get(t)}function wo(e,t,n){return t.steps.map(r=>({effect:r.effect,pendingChecks:r.pendingChecks.map(i=>({budget:i.budget,check:{kind:"poll",run:()=>n.evaluate(i.check)},source:{check:i.check,kind:"step"},targetIds:()=>n.locateIds(xo(i.check))})),reconcile:r.reconcile,source:r.source,step:{action:r.action,intent:e.intent,test:e.test},sync:e.wait,verifyChanges:r.verifyChanges,perform:()=>n.perform(r.action),requiredState:()=>!0,targetIds:()=>n.locateIds(r.action.locator)}))}function xo(e){if(e.kind==="not")return xo(e.inner);if(e.kind!=="browser")return e.locator}async function Vl(e,t){let{params:n,transition:r}=e.stepRun,i=uo(r,e.state,n);if(i==null){let s={intent:r.intent,kind:"unrunnable",reason:ap(r,e.state,n),test:r.test};return{label:Et(r),next:e.state,result:{finalModel:e.state.snapshot,findings:[s]}}}let o=await Qi({canon:e.canon,classify:e.classify,initialSnapshot:e.state.snapshot,observe:e.driver.observe,onAssertion:e.onAssertion,onStep:e.onStep,pageRulePendingChecks:sC(e.pageRules,e.dataRules,e.driver),steps:wo(e.stepRun.transition,i.resolved,e.driver),stopAfterStep:e.stopAfterStep==null?void 0:e.stopAfterStep-e.stepBase},t);return{label:Et(e.stepRun.transition),next:{snapshot:o.finalModel},result:o}}function vp(e,t){return So(e,t)?[{budget:"fast",check:{kind:"decided",passed:!1},source:{dataRule:e,kind:"data-rule"},targetIds:()=>Promise.resolve([])}]:[]}function sC(e,t,n){return(r,i)=>[...e.flatMap(o=>aC(o,r,i,n)),...t.flatMap(o=>vp(o,i))]}function aC(e,t,n,r){let i=go(e,t,n);return i==null?[]:[{budget:"fast",check:{kind:"poll",run:()=>r.evaluate(i.check)},source:{check:i.check,kind:"page-rule",origin:e.origin},targetIds:()=>r.locateIds(xo(i.check))}]}function Wr(e,t){return jl({acc:{findings:[],ran:[]},index:0,params:e,signal:t,state:e.initialState,stepBase:0})}async function jl({acc:e,index:t,params:n,signal:r,state:i,stepBase:o}){Lt(r);let s=n.sequence[t];if(s==null)return e;let a=Date.now(),l=[],u=await Vl({canon:n.canon,classify:n.classify,dataRules:n.dataRules,driver:n.driver,onAssertion:n.onAssertion,pageRules:n.pageRules,state:i,stepBase:o,stepRun:s,stopAfterStep:n.stopAfterStep,onStep:d=>{l.push(d.index),n.onEvent({annotations:d.annotations,endMs:d.endMs,findings:d.findings,index:o+d.index,kind:"step",source:d.source,startMs:d.startMs,state:xp(d.pre,d.post),url:d.url})}},r);if(u==null)return jl({acc:e,index:t+1,params:n,signal:r,state:i,stepBase:o});n.onEvent({endMs:Date.now(),intent:s.transition.intent,kind:"ran",startMs:a}),u.result.findings.forEach(d=>{n.onEvent({finding:d,kind:"finding"})});let c={findings:[...e.findings,...u.result.findings],ran:[...e.ran,u.label]};return u.result.findings.length>0||n.stopAfterStep!=null&&o+l.length>=n.stopAfterStep?c:jl({acc:c,index:t+1,params:n,signal:r,state:u.next,stepBase:o+l.length})}var zr={value:e=>lC(e)};function Co(e,t){return{value:n=>e.value({...n,seed:`${t}:${n.seed}`})}}function Eo(e,t){return{value:n=>e.value({...n,anchor:t})}}function lC({anchor:e,constraints:t,generator:n,nullable:r,seed:i,type:o,values:s,valueSpace:a}){let l=Wl(`${a}:${i}`);return r&&l%4===0?null:s!=null&&s.length>0?s[l%s.length]??s[0]??null:n==="date.iso"?uC({anchor:e,constraints:t,n:l,timeHash:Wl(`${a}:${i}#tod`)}):o==="number"?cC(l,t):o==="boolean"?l%2===0:mC(n,l)}var vo=864e5;function uC({anchor:e,constraints:t,n,timeHash:r}){if(t?.kind!=="datetime")throw new Error("datetime value space requires offsetDays constraints");if(e==null)throw new Error("datetime value space requires a run anchor timestamp");let i=Date.parse(e);if(Number.isNaN(i))throw new TypeError(`datetime anchor "${e}" is not a valid ISO timestamp`);let o=t.maxOffsetDays-t.minOffsetDays+1,s=o<=0?t.minOffsetDays:t.minOffsetDays+n%o,a=Math.floor(i/vo)*vo;return new Date(a+s*vo+r%vo).toISOString()}function Wl(e,t=0,n=7){return t>=e.length?n>>>0:Wl(e,t+1,n*31+(e.codePointAt(t)??0)>>>0)}function cC(e,t){if(t?.kind!=="number"||t.min==null||t.max==null)throw new Error("number value space requires min and max constraints");let n=t.max-t.min+1;return n<=0?t.min:t.min+e%n}var dC=["ada","bruno","carmen","dario","elena","felix","greta","hugo","iris","jonas","kira","lena","mateo","nadia","oscar","petra","quinn","rosa","stefan","tara","ugo","vera","wim","yara"],fC=["abreu","berg","costa","duval","eriksen","fischer","garza","holm","ito","jansen","kovac","laurent","moreau","novak","okafor","petrov","quist","rossi","sato","tanaka","ueda","vargas","weber","zhang"],hC=["amber","brisk","calm","deep","early","fond","glad","hazel","ivory","jade","keen","lush","mauve","noble","opal","plum","quiet","rapid","sage","teal","umber","vivid","warm","zesty"],pC=["aspen","brook","cedar","dune","ember","fjord","grove","harbor","isle","juniper","knoll","lagoon","meadow","nimbus","orchid","prairie","quartz","ridge","summit","thicket","umbra","vale","willow","zephyr"];function Ro(e,t){let n=e[t%e.length];if(n==null)throw new Error("empty word list");return n}function Ao(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function mC(e,t){let n=Ro(dC,t),r=Ro(fC,Math.floor(t/31)),i=Ro(hC,t),o=Ro(pC,Math.floor(t/29));return e==="internet.email"?`${n}.${r}${String(t%100)}@test.ripplo.ai`:e==="internet.url"?`https://${i}-${o}.example.com`:e==="person.fullName"?`${Ao(n)} ${Ao(r)}`:e==="company.name"?`${Ao(i)} ${Ao(o)}`:e==="lorem.slug"?`${i}-${o}`:`${o}-${String(t%1e3)}`}var ie=Ta(Cp(),1),Ne={actual:e=>ie.default.red(e),bad:e=>ie.default.red(ie.default.bold(e)),bold:e=>ie.default.bold(e),dim:e=>ie.default.dim(e),expected:e=>ie.default.green(e),good:e=>ie.default.green(ie.default.bold(e)),heading:e=>ie.default.bold(ie.default.cyan(e)),path:e=>ie.default.cyan(ie.default.underline(e)),warn:e=>ie.default.yellow(ie.default.bold(e))},SC={assertion:ie.default.yellow,consistency:ie.default.magenta,"data rule":ie.default.yellow,driver:ie.default.red,"impossible action":ie.default.cyan,"page rule":ie.default.yellow,skipped:ie.default.red};function ft(e){return`${ie.default.red(ie.default.bold("\u2717"))} ${SC[e](ie.default.bold(e))}`}var wC=ie.default.red("\u2717"),nB=ie.default.green("\u2713"),xC=ie.default.dim("\u203A"),vC=8;function Ep(e,t,n){let r=n==null?"":` ${Ne.dim(n)}`;return` ${Ne.dim(e.padStart(vC))} ${t}${r}`}function wn(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${wn(e.scope)} \u25B8 ${wn(e.target)}`:e.name==null?e.role:`${e.role} "${e.name}"`}function Mo(e){return e.url!=null?`${e.kind} ${e.url}`:e.locator!=null?`${e.kind} ${wn(e.locator)}`:e.kind}function xn(e){return e.kind==="not"?`not ${xn(e.inner)}`:e.kind==="browser"?`${e.name}="${e.value}"`:e.kind==="value"||e.kind==="text"?`${e.kind} ${wn(e.locator)}="${e.value}"`:`${e.kind} ${wn(e.locator)}`}function zn(e){let{field:t,source:n,target:r,targetField:i}=e.reference;return`${n}.${t} \u2192 ${r}.${i}`}function Hl(e){return`${e.intent} \u203A ${Mo(e.action)}`}function ql(e){return e.kind==="data-rule"?`data rule ${zn(e.dataRule)}`:`${e.kind} ${xn(e.check)}`}function _e(e){return e==null?"\u2205":JSON.stringify(e)}function Kl(e){return e.kind==="unexpected-row"?`${e.entity} "${e.key}" present in the app but the test expected none`:e.kind==="missing-row"?`${e.entity} "${e.key}" expected by the test but missing in the app`:e.kind==="wrong-value"?`${e.entity}.${e.field} [${e.key}] expected=${_e(e.snapshot)} actual=${_e(e.sut)}`:e.kind==="expected-change"?`${e.entity}.${e.field} [${e.key}] expected to change but stayed ${_e(e.value)}`:`${e.singleton} expected=${_e(e.snapshot)} actual=${_e(e.sut)}`}function To(e){return{label:ql(e.source),step:Hl(e.step)}}function Oo({evidencePath:e,finding:t}){let n=RC(t);return e==null?n:`${n} Evidence: ${Ne.path(e)}`}function Yl(e){return CC(EC(e))}function RC(e){return e.kind==="consistency"?OC(e):e.kind==="pending-check"?$C(e.source,e.step,e.budget):e.kind==="impossible-action"?`${ft("impossible action")} The step "${e.step.intent}" ran ${Mo(e.step.action)} from a state the test says can't happen. Either the test's required state is stricter than the app really is, or the app exposes this action somewhere it shouldn't \u2014 check which before loosening the test.`:e.kind==="unrunnable"?`${ft("skipped")} The planned step "${e.intent}" could not run \u2014 ${Ip(e.reason)}. A planned move was skipped, so this run proved less than it claims \u2014 fix the plan or the starting state rather than ignoring the skip.`:`${ft("driver")} The browser failed while running "${e.step.intent}" \u2014 ${en(e.error)}. This is an environment failure (daemon, dev server, ports), not an app or test bug \u2014 fix the run environment and rerun.`}var AC=new RegExp(`${String.fromCodePoint(27)}\\[[0-9;]*m`,"g");function CC(e){return e.replaceAll(AC,"").replaceAll(/\s+/g," ").trim()}function EC(e){if(e.kind==="consistency"){let t=e.step==null?"":` after "${e.step.intent}"`;return`${Kl(e.mismatch)}${t}`}return e.kind==="pending-check"?`${DC(e.source)} failed at "${e.step.intent}": ${FC(e.source)}`:e.kind==="impossible-action"?`"${e.step.intent}" ran from a state the test says can't happen`:e.kind==="unrunnable"?`planned step "${e.intent}" could not run \u2014 ${Ip(e.reason)}`:`driver failed at "${e.step.intent}": ${en(e.error)}`}var kC={"no-effect":"the action has no observable effect from this state","required-state-unsatisfied":"the live state doesn't satisfy the step's required state",unresolvable:"a step references a value that doesn't exist yet (e.g. a not-yet-created id)"};function Ip(e){return kC[e]}function Pp({debugDir:e,runId:t}){let n=`${e}/${t}`;return Ep("behavior",Ne.path(`${n}/behavior.jsonl`),void 0)}function Mp(e){if(e.kind==="cascade-gap"){let{gap:n}=e;return`${ft("data rule")} ${n.transition} deletes ${n.target} but leaves ${n.source} rows pointing at the deleted row. That breaks the data rule ${zn(n.dataRule)} \u2014 cascade the delete in the app or declare the cleanup on the deleting step.`}if(e.kind==="create-gap"){let{gap:n}=e,r=n.missing.length===1?"field":"fields",i=n.missing.length===1?"it":"them";return`${ft("data rule")} ${n.transition} creates ${n.entity} without setting the required ${r} ${n.missing.join(", ")}. Set ${i} on the creating step or drop the requirement from the entity.`}let{conflict:t}=e;return`${ft("page rule")} Two page rules contradict each other \u2014 ${t.a.kind} vs ${t.b.kind} when ${JSON.stringify(t.when.singletons)}. They were learned from different tests asserting opposite things about the same page \u2014 one of those tests is wrong, fix it before trusting either rule.`}function Tp(e){return"locator"in e&&e.locator!=null?`${e.kind} ${Gl(e.locator)}`:"url"in e?`${e.kind} ${IC(e.url)}`:e.kind}function IC(e){return typeof e=="string"?e:"ref"in e?`{${e.ref}}`:Op(e)}function Gl(e){return e.by==="role"?e.name==null?e.role:`${e.role} ${kp(e.name)}`:e.by==="inside"?`${Gl(e.scope)} \u25B8 ${Gl(e.target)}`:kp(e.value)}function kp(e){return e===null?"\u2205":typeof e=="string"?`"${e}"`:typeof e!="object"?String(e):"ref"in e?`{${e.ref}}`:Op(e)}function Op(e){return e.template.map(t=>typeof t=="string"?t:":id").join("")}function Po(e){return e==null?"At the end of the run":`After ${MC(e.action)} in ${e.intent}`}var PC={click:"clicking",fill:"filling",goto:"opening",hover:"hovering over",press:"pressing",select:"selecting",upload:"uploading to"};function MC(e){return e.url!=null?`opening ${e.url}`:e.locator!=null?`${PC[e.kind]??e.kind} ${Wn(e.locator)}`:e.kind}function Wn(e){return e.by==="testId"?`the element with testId "${e.value}"`:e.by==="inside"?`${Wn(e.target)} inside ${Wn(e.scope)}`:e.name==null?`the ${e.role}`:`the "${e.name}" ${e.role}`}function TC(e){return e.kind==="not"&&e.inner.kind==="visible"?`${Wn(e.inner.locator)} never disappeared`:e.kind==="visible"?`${Wn(e.locator)} never appeared`:e.kind==="value"||e.kind==="text"?`${Wn(e.locator)} never showed "${e.value}"`:`the check ${xn(e)} never held`}function OC(e){let t=e.pending?NC(e):_C(e.mismatch,e.step);return`${ft("consistency")} ${t}`}function NC(e){let t=`${Np(e.budget)} wait window`,n="If this write is legitimately slow, declare wait: on the expectation or move it to a slower tier.",{mismatch:r}=e,i=Po(e.step);return r.kind==="wrong-value"?`${i}, ${r.entity}.${r.field} on row "${r.key}" never changed within the ${t} \u2014 it still showed ${Ne.actual(_e(r.sut))} instead of ${Ne.expected(_e(r.snapshot))}, so the write may not have landed at all. ${n}`:r.kind==="unexpected-row"?`${i}, the ${r.entity} row "${r.key}" was still there at the end of the ${t} \u2014 the delete may not have landed. ${n}`:r.kind==="missing-row"?`${i}, the ${r.entity} row "${r.key}" never appeared within the ${t} \u2014 the create may not have landed. ${n}`:r.kind==="expected-change"?`${i}, ${r.entity}.${r.field} on row "${r.key}" was expected to change but stayed ${Ne.actual(_e(r.value))} through the ${t}, so the write may not have landed at all. ${n}`:`${i}, ${r.singleton} never changed within the ${t} \u2014 it still showed ${Ne.actual(_e(r.sut))} instead of ${Ne.expected(_e(r.snapshot))}, so the write may not have landed at all. ${n}`}function Np(e){return`${String(Nr[e]/1e3)}s`}function _C(e,t){let n=Po(t);return e.kind==="wrong-value"?`${n}, ${e.entity}.${e.field} on row "${e.key}" showed ${Ne.actual(_e(e.sut))} but the test expected ${Ne.expected(_e(e.snapshot))}. This is an app bug if the expected value is the promised behavior \u2014 if the app legitimately owns this value, assert changed() instead.`:e.kind==="singleton-mismatch"?`${n}, ${e.singleton} showed ${Ne.actual(_e(e.sut))} but the test expected ${Ne.expected(_e(e.snapshot))}. This is an app bug if the expected value is the promised behavior \u2014 otherwise correct the expected value at the step that sets it.`:e.kind==="unexpected-row"?`${n}, the app held a ${e.entity} row "${e.key}" the test never expected. Some step writes this row without declaring it \u2014 declare the effect on the acting step (${e.entity}.created, updated, or deleted), or if this write belongs to a different flow, cover it in that flow's test.`:e.kind==="missing-row"?`${n}, the test expected a ${e.entity} row "${e.key}" but the app had none. This is an app bug if the write was promised \u2014 if it only happens from a different starting state, restrict this test's given and cover that state in its own test.`:`${n}, ${e.entity}.${e.field} on row "${e.key}" was expected to change but stayed ${Ne.actual(_e(e.value))}. This is an app bug if this action should change it \u2014 if the change needs other preconditions, split that case into its own test with the right given.`}function $C(e,t,n){let r=`${Np(n)} wait window`;return e.kind==="data-rule"?`${ft("data rule")} ${Po(t)}, the data rule ${zn(e.dataRule)} stopped holding \u2014 a referenced row went missing. This is an app bug if the reference should survive this action \u2014 confirm in behavior.jsonl before relaxing the rule.`:e.kind==="page-rule"?`${ft("page rule")} A page rule learned from ${LC(e.origin)} says ${xn(e.check)} at this URL \u2014 it never held here within the ${r}. Either the rule is broader than the app guarantees or this page regressed \u2014 confirm in behavior.jsonl before narrowing the rule.`:`${ft("assertion")} ${Po(t)}, ${TC(e.check)} within the ${r}. This is usually a wrong accessible name, a UI regression, or a starting state this page doesn't have \u2014 confirm in behavior.jsonl before changing the test.`}function LC(e){return e==null?"another workflow":e.kind==="test"?`an assertion in test "${e.test}"`:e.kind==="trigger"?`the trigger of "${e.intent}" in test "${e.test}"`:`tests ${e.tests.map(n=>JSON.stringify(n)).join(", ")}`}function DC(e){return e.kind==="data-rule"?"data rule":e.kind==="page-rule"?"page rule":"assertion"}function FC(e){return e.kind==="data-rule"?zn(e.dataRule):xn(e.check)}function Gr(e){return{dataRules:bo(e),pageRules:po(e)}}var _p=Object.defineProperty,$p=(e,t)=>{let n={};for(var r in e)_p(n,r,{get:e[r],enumerable:!0});return t||_p(n,Symbol.toStringTag,{value:"Module"}),n};var BC=class Lp{constructor(t){this.seed=t}clone(){return new Lp(this.seed)}next(){let t=Zl(this.seed),n=Xl(t),r=Zl(t),i=Xl(r);return this.seed=Zl(r),Xl(this.seed)+(i+(n<<15)<<15)|0}jump(){this.seed=Math.imul(this.seed,1994129409)+916127744&4294967295}getState(){return[this.seed]}};function Zl(e){return Math.imul(e,214013)+2531011&4294967295}function Xl(e){return(e&-2147483649)>>16}function Dp(e){return new BC(e)}var UC="SUSgbA\\W`E[]KN2RUSo8XVU?HKBFRl11E\\KoWOg5B]XEWG;BE;1:oVK[`B^Z9Qd23^XTnhL>]Unda4f[X;_j9H5QD=cN<5H`3bW>9bk1mjoI2fK0obmAAINOV:>Mek_V9dd<hZ\\gC3?Fm7FEk07QH_3PLm^@?^i\\QMkgP<]oLHmFnlecg5F@7U^@4jhZ?WZS0k@GHehmM36:5^9;>Hmm`co>k:KOSkSbIINb1VFf>LXgP>GUAQTD>Ci>XMGkUflLlb?_FaFUk@?5N7i70@;1o68ah@I<HFH7R2^J:G][Gf962ITWID9GWK8ElD2G5=DcHcL]cA]P2n7A=[<bInM;IHDQnJMReRXDWbVldnGEIPij`E08Xdci3@0c:IBbD4:Nk]?lEN9j^;T`0blZX7eiWE8c`<ak7j05FZi>AjUDh?M1B?^??FAXKThf<aBOXZf7jXYGK>R<;NHk3S9YhM7STJ6`:MIE`S@7298X8W>PNK=@;lLX<i\\TXLL<W@X[X54H]in8M;;n?kkQbajgAMY=Tf9b;ZKf0QUB2FHYWfnfkDoU9YkcLd95T>lK6GM1YL\\lid:J>KYS=iJ]Y>QlF>?R5_[5QeYC=66;A32Ac>OHk_ne^0g>bK:g;KFPgbGUcPR_Z=TX3H9d03bKZ2IhEPKBo>LSGWd0iFdV8C<Y:<>T[O6lC\\blaZ>GoAYP4clf^j1IfnZJ]QeDe2X<HE[LJNWnaCg[P]Co^:IRbWPY?97UePBlZNNHY6LOBM8P>=h?Ye:_f_Sb9Ki5GDYBF4dWeMfdg^ccPllNWM7G1\\UMdoYeOOD5^e@foA22G?ADYo5:FVG[bWo96;>3kc_c1Ab30>30;1@4F8g2hY?DJ4[LOL;ZLLKo2]jo>[KMDUcR279N_kF=3WL@Dd620bMTdA\\U9k``ef2iD9JgJ8CZBHS>F^Uk;<laeaeHS<15OSeS`PcSSKBRBFY]aQ=EgUXGNg=?d56`KA@2BejY0^[_DCX`L=CGMT=BW^6S1i@2ATBVk>3_ocRA>2U:4GPQ6o>5jX2HIcV3S@On6KB<[SKB?FC_AAji9agbBFkAi\\;4I\\UJ]c36Ub@[;gQACVGY<V]SDJBUU]La\\_a@JdOO8gm2T0DJMa:8Hf7>E]noQ[1Kambn??QQ]S?1i0oMGOijb\\aGY6lQ^CJ?9bFle8<eH4UUjBINX;n8@VOA5ah^URV49B[A?ONHhHAC1J5;;h0SXYlG^0W=eJdHh^K4SGe=1HZLLam;D<Q3AOdbPcdX``82\\jo0En8jRVGC73WMCF9`d:0heS?80?C188cSn7H9<daZ]MgS4Pb^1HkA:1PU^5>^h_g[RQV@PnYBRI_]`B]Bh@Uk03eXGY`I16L76H28X`R>IROMeNVUdU[:lghLhPCQZ:4a<30YBZCYnXe[?;jc8gKI2QH2MjnWBm4nGCZW`aVU2a;P<AMI25mlW_Nm][2?b6o851X@lAm]YZ`bWRF1g<Ga:T]1NXH5Veja5P9S9>:aNg:Th1Y=5o78K>LQ8hW@5S?I83Lk5Xk;j5@I3o[d:4RjE^oS30:WP9gC\\i8aSI>QRE@4lP:7lDg8g2`Ql[2I8aBU\\BQ?B4_clL9Q]S;^e1Ob5[>3JER2`c7B=o]fPOWO<DGi;Niba1PoWPPE_Q3aX0OB0mZej\\f_M[J4Y6]1`h2MkF[GiW8Q^d3^_=<I1N2Q7]2<2j[iP7V3V821FaI]A`93bC^Z\\G=WJ;^Ih?B97_iIF@\\Dl<eK1je8SNTWo_=XFMZH<<JYLZ^YQMPgYOV45K_:]kSI8^XlO0]GY=VUfe_C_F6TOcoAlVUH:o=WhhT@K`2KFhe<3\\KXQ>W:M?S_4S5d@J^`[AGA7@3]DnGSCO`\\?E8HT75^d9\\:m\\m1egIfk8cd6bD9\\eU8\\n[Pb0Cgd^S0n9kGJHb]i5XodlKHc34Fhi9K>0U5WK`>7Ff2^KL=WC6:kc?e5C^a1T1:4:^S5flXlGNIj08AfO?Dh7T7dWO>E]NI9?ob7B7P_h[4TEP[EU;GllFTnSmg9:\\[N]<SAoKP_kPlG56A:I3T6EG8Hj=XnUE`KT5U@OQ?]7[N^MFN1_NU4KO_3::Le`8IL9[1Z1H1;V3SC\\N3]S@4U[F2mhT5dYM7[4Pg_Na0_8WTH0`bgceQS8]EG;XgD4Ib4iLTP@kE79Mn>AYRJA1U5^Blhgno:aHVYc03c3J0Vc9FjEV^M75Zfd8kVC9>iJDk`AJ[6f7DK2D^DL\\AX:6b5h31XH;RQB\\N<ZSM=J;6L[`UW^eOIFc1Y]6_dfedIe4ARh72mTXC0WND_IDHVCZRDE0eODARCEETQI5TPUQE=jEH5bS?LP[ai`F5ABRYDo2o\\@=]GT?_9;hc4Lm:\\SF9k1T<0E@fX9BG[]g0nY7k[Qmi@la8`PF0j6@Q?Ii7bLkXQ<lLHf]`:DCh@9JY5>hEVLTdhL\\b1EB0lLh<=WaO@F<;8g<d:@e:LA:cFIEdmQh7hNHfSRToW?8N4:Z1K;XEDRO;OIDh<UdVln?bjgL>?VE98[B\\K<BVjkG8LiSX;fb>jf?DUK00Aih<WY6QD6cEnHBZ8iN_fd<G8Ci`11RUW2QlW]IXV:m?;J0GXXHfGNQ>:D`=fLPbO?VOTEYLj^cNj5PM>jKB5HVjJ4U7lXaTQNL9<@\\1`m\\Ug@VQHd7>jW=ca0`miF7;N0F=GjoQ`RFchKMGTmn8cF@Oh4GGCm7m2`U9j93Tb>=kSERjE_J939F01I1;`<ijk_=_Vn=7RVAI6fnQI5KlF:C44bN<<8K=Z<2TP<1]5?<dB>^LA=ebloE2Y2:9lkh0\\<YKbHD97iE`<C5oj^1>X:??`H6BXF2hG1Q[dF0Q=>W=J?7C\\k1T?<;R44oW?1hY^G8Zm]ZKnfOf0eCFYo6?=D8?<`6HU5SXh1;=:23LmV_FSi;OJfV<^?GkIDPISeHg1LaGE:V3Y3K3H<QJfbY?=;ldZRhnhQT_mGXDLFXXhSONE6Do_0iNZagB:BPGOTH;VhHUTd6LhQm^[;dO]5Hlkg<R:F<Kn\\:I:EGojgWZ2X@SYO_dlH;G8S<>oEKabY`:oU;=JW7ig?S?EYb86b7n8ce\\]IRa]koiWY<RfO;5kUI;7lVeC?[@ZaXDiF04B8R]bg@>O<mQDoUcBLcf^f>m2kMBUloD>Ze@NN^Z11TM`inXYhE_I=kA`:ZF4d\\>`L@;ZP[`ENU5cL[BV6\\Z?Di76:jg3hE6oG6jFc8kP=[GS1;WSedYQW1:U4\\OF32GgmMC<AjO]872bdBb`bKAA?8j78b>T3VfcUB2m4J^CPRU;8dScI]LU]^bBYA5_3:Y0N5i^?200000",jC=class Bp{constructor(t,n){this.states=t,this.index=n}clone(){return new Bp(this.states.slice(),this.index)}next(){let t=this.states[this.index];return t^=t>>>11,t^=t<<7&2636928640,t^=t<<15&4022730752,t^=t>>>18,this.index=No(this.states,this.index),t}getState(){return[this.index,...this.states]}jump(){let t=this.states.slice(),n=this.index;this.index=No(this.states,this.index);for(let r=19932;r>0;--r)UC.charCodeAt(r/6|0)-48&1<<r%6&&Fp(this.states,this.index,t,n),this.index=No(this.states,this.index);Fp(this.states,this.index,t,n)}};function Fp(e,t,n,r){let i=0;if(r>=t){for(;i<624-r;i++)e[i+t]^=n[i+r];for(;i<624-t;i++)e[i+t]^=n[i+r-624];for(;i<624;i++)e[i+t-624]^=n[i+r-624]}else{for(;i<624-t;i++)e[i+t]^=n[i+r];for(;i<624-r;i++)e[i+t-624]^=n[i+r];for(;i<624;i++)e[i+t-624]^=n[i+r-624]}}function No(e,t){if(t<227){let n=e[t]&2147483648|e[t+1]&2147483647;return e[t]=e[t+397]^n>>>1^-(n&1)&2567483615,t+1}else if(t<623){let n=e[t]&2147483648|e[t+1]&2147483647;return e[t]=e[t+397-624]^n>>>1^-(n&1)&2567483615,t+1}else{let n=e[t]&2147483648|e[0]&2147483647;return e[t]=e[396]^n>>>1^-(n&1)&2567483615,0}}function VC(e){for(let t=0;t!==624;++t)No(e,t)}function Up(e){let t=[e|0];for(let n=1;n!==624;++n){let r=t[n-1]^t[n-1]>>>30;t.push(Math.imul(1812433253,r)+n|0)}return VC(t),new jC(t,0)}var WC=class jp{constructor(t,n,r,i){this.s01=t,this.s00=n,this.s11=r,this.s10=i}clone(){return new jp(this.s01,this.s00,this.s11,this.s10)}next(){let t=this.s00^this.s00<<23,n=this.s01^(this.s01<<23|this.s00>>>9),r=t^this.s10^(t>>>18|n<<14)^(this.s10>>>5|this.s11<<27),i=n^this.s11^n>>>18^this.s11>>>5,o=this.s00+this.s10|0;return this.s01=this.s11,this.s00=this.s10,this.s11=i,this.s10=r,o}jump(){let t=0,n=0,r=0,i=0,o=[1667051007,2321340297,1548169110,304075285];for(let s=0;s!==4;++s)for(let a=1;a;a<<=1)o[s]&a&&(t^=this.s01,n^=this.s00,r^=this.s11,i^=this.s10),this.next();this.s01=t,this.s00=n,this.s11=r,this.s10=i}getState(){return[this.s01,this.s00,this.s11,this.s10]}};function Jl(e){return new WC(-1,~e,e|0,0)}var zC=class Vp{constructor(t,n,r,i){this.s01=t,this.s00=n,this.s11=r,this.s10=i}clone(){return new Vp(this.s01,this.s00,this.s11,this.s10)}next(){let t=this.s00+this.s10|0,n=this.s10^this.s00,r=this.s11^this.s01,i=this.s00,o=this.s01;return this.s00=i<<24^o>>>8^n^n<<16,this.s01=o<<24^i>>>8^r^(r<<16|n>>>16),this.s10=r<<5^n>>>27,this.s11=n<<5^r>>>27,t}jump(){let t=0,n=0,r=0,i=0,o=[3639956645,3750757012,1261568508,386426335];for(let s=0;s!==4;++s)for(let a=1;a;a<<=1)o[s]&a&&(t^=this.s01,n^=this.s00,r^=this.s11,i^=this.s10),this.next();this.s01=t,this.s00=n,this.s11=r,this.s10=i}getState(){return[this.s01,this.s00,this.s11,this.s10]}};function Wp(e){return new zC(-1,~e,e|0,0)}function zp(e,t){for(let n=0;n!==t;++n)e.next()}var Gp=BigInt,GC=4294967296n;function qp(e,t,n){let r=n-t+1n,i=GC,o=1;for(;i<r;)i<<=32n,++o;let s=Hp(o,e);if(s<r)return s+t;if(s+r<i)return s%r+t;let a=i-i%r;for(;s>=a;)s=Hp(o,e);return s%r+t}function Hp(e,t){let n=Gp(t.next()+2147483648);for(let r=1;r<e;++r){let i=t.next();n=(n<<32n)+Gp(i+2147483648)}return n}function Hr(e,t){let n=t>2?~~(4294967296/t)*t:4294967296,r=e.next()+2147483648;for(;r>=n;)r=e.next()+2147483648;return r%t}function Ql(e,t){if(t<0){let n=-t;e.sign=-1,e.data[0]=~~(n/4294967296),e.data[1]=n>>>0}else e.sign=1,e.data[0]=~~(t/4294967296),e.data[1]=t>>>0;return e}function HC(e,t,n){let r=t.data[1],i=t.data[0],o=t.sign,s=n.data[1],a=n.data[0],l=n.sign;if(e.sign=1,o===1&&l===-1){let m=r+s,y=i+a+(m>4294967295?1:0);return e.data[0]=y>>>0,e.data[1]=m>>>0,e}let u=r,c=i,d=s,f=a;o===-1&&(u=s,c=a,d=r,f=i);let p=0,h=u-d;return h<0&&(p=1,h=h>>>0),e.data[0]=c-f-p,e.data[1]=h,e}function qC(e,t,n){let r=n[0]+1;for(t[0]=Hr(e,r),t[1]=Hr(e,4294967296);t[0]>=n[0]&&(t[0]!==n[0]||t[1]>=n[1]);)t[0]=Hr(e,r),t[1]=Hr(e,4294967296);return t}var KC=Number.MAX_SAFE_INTEGER,YC={sign:1,data:[0,0]},ZC={sign:1,data:[0,0]},Kp={sign:1,data:[0,0]},eu=[0,0];function XC(e,t,n,r){let i=r<=KC?Ql(Kp,r):HC(Kp,Ql(YC,n),Ql(ZC,t));return i.data[1]===4294967295?(i.data[0]+=1,i.data[1]=0):i.data[1]+=1,qC(e,eu,i.data),eu[0]*4294967296+eu[1]+t}function _o(e,t,n){let r=n-t;return r<=4294967295?Hr(e,r+1)+t:XC(e,t,n,r)}var Yp=Symbol.for("fast-check/PreconditionFailure"),cn=class extends Error{constructor(e=!1){super(),this.interruptExecution=e,this.footprint=Yp}static isFailure(e){return e!=null&&e.footprint===Yp}};function JC(e){if(!e)throw new cn}var QC=class{[Symbol.iterator](){return this}next(e){return{value:e,done:!0}}},eE=new QC;function tE(){return eE}function*nE(e,t){for(let n of e)yield t(n)}function*rE(e,t){for(let n of e)yield*t(n)}function*iE(e,t){for(let n of e)t(n)&&(yield n)}function*oE(e,t){for(let n=0;n<t;++n){let r=e.next();if(r.done)break;yield r.value}}function*sE(e,t){let n=e.next();for(;!n.done&&t(n.value);)yield n.value,n=e.next()}function*aE(e,t){for(let n=e.next();!n.done;n=e.next())yield n.value;for(let n of t)for(let r=n.next();!r.done;r=n.next())yield r.value}var lE=Symbol.iterator,L=class Ft{static nil(){return new Ft(tE())}static of(...t){return new Ft(t[lE]())}constructor(t){this.g=t}next(){return this.g.next()}[Symbol.iterator](){return this.g}map(t){return new Ft(nE(this.g,t))}flatMap(t){return new Ft(rE(this.g,t))}dropWhile(t){let n=!1;function*r(i){(n||!t(i))&&(n=!0,yield i)}return this.flatMap(r)}drop(t){if(t<=0)return this;let n=0;function r(){return n++<t}return this.dropWhile(r)}takeWhile(t){return new Ft(sE(this.g,t))}take(t){return new Ft(oE(this.g,t))}filter(t){return new Ft(iE(this.g,t))}every(t){for(let n of this.g)if(!t(n))return!1;return!0}has(t){for(let n of this.g)if(t(n))return[!0,n];return[!1,null]}join(...t){return new Ft(aE(this.g,t))}getNthOrLast(t){let n=t,r=null;for(let i of this.g){if(n--===0)return i;r=i}return r}};function ln(e){return new L(e)}var Ie=Symbol.for("fast-check/cloneMethod");function Rn(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&Ie in e&&typeof e[Ie]=="function"}function Yn(e){return Rn(e)?e[Ie]():e}var uE=Object.defineProperty,T=class{constructor(e,t,n){this.value_=e,this.context=t,this.hasToBeCloned=n!==void 0||Rn(e),this.readOnce=!1,this.value=e,this.hasToBeCloned&&uE(this,"value",{get:n!==void 0?n:this.getValue,enumerable:!1,configurable:!1})}getValue(){return this.hasToBeCloned?this.readOnce?this.value_[Ie]():(this.readOnce=!0,this.value_):this.value_}},ue=class{filter(e){return new fE(this,e)}map(e,t){return new dE(this,e,t)}chain(e){return new cE(this,e)}},cE=class extends ue{constructor(e,t){super(),this.arb=e,this.chainer=t}generate(e,t){let n=e.clone(),r=this.arb.generate(e,t);return this.valueChainer(r,e,n,t)}canShrinkWithoutContext(e){return!1}shrink(e,t){return this.isSafeContext(t)?(t.stoppedForOriginal?L.nil():this.arb.shrink(t.originalValue,t.originalContext).map(n=>this.valueChainer(n,t.clonedMrng.clone(),t.clonedMrng,t.originalBias))).join(t.chainedArbitrary.shrink(e,t.chainedContext).map(n=>{let r={...t,chainedContext:n.context,stoppedForOriginal:!0};return new T(n.value_,r)})):L.nil()}valueChainer(e,t,n,r){let i=this.chainer(e.value_),o=i.generate(t,r),s={originalBias:r,originalValue:e.value_,originalContext:e.context,stoppedForOriginal:!1,chainedArbitrary:i,chainedContext:o.context,clonedMrng:n};return new T(o.value_,s)}isSafeContext(e){return e!=null&&typeof e=="object"&&"originalBias"in e&&"originalValue"in e&&"originalContext"in e&&"stoppedForOriginal"in e&&"chainedArbitrary"in e&&"chainedContext"in e&&"clonedMrng"in e}},dE=class extends ue{constructor(e,t,n){super(),this.arb=e,this.mapper=t,this.unmapper=n,this.bindValueMapper=r=>this.valueMapper(r)}generate(e,t){let n=this.arb.generate(e,t);return this.valueMapper(n)}canShrinkWithoutContext(e){if(this.unmapper!==void 0)try{let t=this.unmapper(e);return this.arb.canShrinkWithoutContext(t)}catch{return!1}return!1}shrink(e,t){if(this.isSafeContext(t))return this.arb.shrink(t.originalValue,t.originalContext).map(this.bindValueMapper);if(this.unmapper!==void 0){let n=this.unmapper(e);return this.arb.shrink(n,void 0).map(this.bindValueMapper)}return L.nil()}mapperWithCloneIfNeeded(e){let t=e.value,n=this.mapper(t);return e.hasToBeCloned&&(typeof n=="object"&&n!==null||typeof n=="function")&&Object.isExtensible(n)&&!Rn(n)&&Object.defineProperty(n,Ie,{get:()=>()=>this.mapperWithCloneIfNeeded(e)[0]}),[n,t]}valueMapper(e){let[t,n]=this.mapperWithCloneIfNeeded(e);return new T(t,{originalValue:n,originalContext:e.context})}isSafeContext(e){return e!=null&&typeof e=="object"&&"originalValue"in e&&"originalContext"in e}},fE=class extends ue{constructor(e,t){super(),this.arb=e,this.refinement=t,this.bindRefinementOnValue=n=>this.refinementOnValue(n)}generate(e,t){for(;;){let n=this.arb.generate(e,t);if(this.refinementOnValue(n))return n}}canShrinkWithoutContext(e){return this.arb.canShrinkWithoutContext(e)&&this.refinement(e)}shrink(e,t){return this.arb.shrink(e,t).filter(this.bindRefinementOnValue)}refinementOnValue(e){return this.refinement(e.value)}};function Yy(e){return typeof e=="object"&&e!==null&&"generate"in e&&"shrink"in e&&"canShrinkWithoutContext"in e}function Zy(e){if(!Yy(e))throw new Error("Unexpected value received: not an instance of Arbitrary")}var Xy=Function.prototype.apply,tu=Symbol("apply");function hE(e){try{return e.apply}catch{return}}function pE(e,t,n){let r=e;r[tu]=Xy;let i=r[tu](t,n);return delete r[tu],i}function W(e,t,n){return hE(e)===Xy?e.apply(t,n):pE(e,t,n)}var Jy=Array,E=BigInt,mE=BigInt64Array,yE=BigUint64Array,Qy=Boolean,Yo=Date,P=Error,eg=Float32Array,tg=Float64Array,gE=Int8Array,bE=Int16Array,SE=Int32Array,Ut=Number,Fe=String,Zn=Set,wE=Uint8Array,xE=Uint8ClampedArray,vE=Uint16Array,RE=Uint32Array,AE=encodeURIComponent,jt=Map,Vo=Symbol,Zp=Array.prototype.forEach,Xp=Array.prototype.indexOf,Jp=Array.prototype.join,Qp=Array.prototype.map,em=Array.prototype.flat,tm=Array.prototype.filter,nm=Array.prototype.push,rm=Array.prototype.pop,im=Array.prototype.splice,om=Array.prototype.slice,sm=Array.prototype.sort,am=Array.prototype.every;function CE(e){try{return e.forEach}catch{return}}function EE(e){try{return e.indexOf}catch{return}}function kE(e){try{return e.join}catch{return}}function IE(e){try{return e.map}catch{return}}function PE(e){try{return e.flat}catch{return}}function ME(e){try{return e.filter}catch{return}}function TE(e){try{return e.push}catch{return}}function OE(e){try{return e.pop}catch{return}}function NE(e){try{return e.splice}catch{return}}function _E(e){try{return e.slice}catch{return}}function $E(e){try{return e.sort}catch{return}}function LE(e){try{return e.every}catch{return}}function ng(e,t){return CE(e)===Zp?e.forEach(t):W(Zp,e,[t])}function Bt(e,...t){return EE(e)===Xp?e.indexOf(...t):W(Xp,e,t)}function le(e,...t){return kE(e)===Jp?e.join(...t):W(Jp,e,t)}function j(e,t){return IE(e)===Qp?e.map(t):W(Qp,e,[t])}function DE(e,t){return PE(e)===em?([].flat(),e.flat(t)):W(em,e,[t])}function FE(e,t){return ME(e)===tm?e.filter(t):W(tm,e,[t])}function M(e,...t){return TE(e)===nm?e.push(...t):W(nm,e,t)}function rg(e){return OE(e)===rm?e.pop():W(rm,e,[])}function ig(e,...t){return NE(e)===im?e.splice(...t):W(im,e,t)}function Te(e,...t){return _E(e)===om?e.slice(...t):W(om,e,t)}function og(e,...t){return $E(e)===sm?e.sort(...t):W(sm,e,t)}function sg(e,...t){return LE(e)===am?e.every(...t):W(am,e,t)}var lm=Date.prototype.getTime,um=Date.prototype.toISOString;function BE(e){try{return e.getTime}catch{return}}function UE(e){try{return e.toISOString}catch{return}}function Zo(e){return BE(e)===lm?e.getTime():W(lm,e,[])}function jE(e){return UE(e)===um?e.toISOString():W(um,e,[])}var cm=Set.prototype.add,dm=Set.prototype.has;function VE(e){try{return e.add}catch{return}}function WE(e){try{return e.has}catch{return}}function Xr(e,t){return VE(e)===cm?e.add(t):W(cm,e,[t])}function Xo(e,t){return WE(e)===dm?e.has(t):W(dm,e,[t])}var fm=WeakMap.prototype.set,hm=WeakMap.prototype.get;function zE(e){try{return e.set}catch{return}}function GE(e){try{return e.get}catch{return}}function HE(e,t,n){return zE(e)===fm?e.set(t,n):W(fm,e,[t,n])}function qE(e,t){return GE(e)===hm?e.get(t):W(hm,e,[t])}var pm=Map.prototype.set,mm=Map.prototype.get,ym=Map.prototype.has;function KE(e){try{return e.set}catch{return}}function YE(e){try{return e.get}catch{return}}function ZE(e){try{return e.has}catch{return}}function ht(e,t,n){return KE(e)===pm?e.set(t,n):W(pm,e,[t,n])}function Qe(e,t){return YE(e)===mm?e.get(t):W(mm,e,[t])}function XE(e,t){return ZE(e)===ym?e.has(t):W(ym,e,[t])}var gm=String.prototype.split,bm=String.prototype.startsWith,Sm=String.prototype.endsWith,wm=String.prototype.substring,xm=String.prototype.toLowerCase,vm=String.prototype.toUpperCase,Rm=String.prototype.padStart,Am=String.prototype.charCodeAt,Cm=String.prototype.normalize,Em=String.prototype.replace;function JE(e){try{return e.split}catch{return}}function QE(e){try{return e.startsWith}catch{return}}function ek(e){try{return e.endsWith}catch{return}}function tk(e){try{return e.substring}catch{return}}function nk(e){try{return e.toLowerCase}catch{return}}function rk(e){try{return e.toUpperCase}catch{return}}function ik(e){try{return e.padStart}catch{return}}function ok(e){try{return e.charCodeAt}catch{return}}function sk(e){try{return e.normalize}catch{return}}function ak(e){try{return e.replace}catch{return}}function Be(e,...t){return JE(e)===gm?e.split(...t):W(gm,e,t)}function lk(e,...t){return QE(e)===bm?e.startsWith(...t):W(bm,e,t)}function uk(e,...t){return ek(e)===Sm?e.endsWith(...t):W(Sm,e,t)}function me(e,...t){return tk(e)===wm?e.substring(...t):W(wm,e,t)}function Eu(e){return nk(e)===xm?e.toLowerCase():W(xm,e,[])}function Ju(e){return rk(e)===vm?e.toUpperCase():W(vm,e,[])}function ck(e,...t){return ik(e)===Rm?e.padStart(...t):W(Rm,e,t)}function Xn(e,t){return ok(e)===Am?e.charCodeAt(t):W(Am,e,[t])}function dk(e,t){return sk(e)===Cm?e.normalize(t):W(Cm,e,[t])}function fk(e,t,n){return ak(e)===Em?e.replace(t,n):W(Em,e,[t,n])}var km=Number.prototype.toString;function hk(e){try{return e.toString}catch{return}}function Jr(e,...t){return hk(e)===km?e.toString(...t):W(km,e,t)}var pk=Object.prototype.hasOwnProperty,mk=Object.prototype.toString;function ag(e,t){return W(pk,e,[t])}function ku(e){return W(mk,e,[])}var yk=Error.prototype.toString;function gk(e){return W(yk,e,[])}var bk=class{constructor(e){this.producer=e}[Symbol.iterator](){return this.it===void 0&&(this.it=this.producer()),this.it}next(){return this.it===void 0&&(this.it=this.producer()),this.it.next()}};function an(e){return new bk(e)}var lg=Array.isArray,Sk=Object.defineProperty;function ug(e,t){return Sk(e,Ie,{value:()=>{let n=[];for(let r=0;r!==t.length;++r)M(n,t[r].value);return ug(n,t),n}})}function cg(e){let t=!1,n=[],r=[];for(let i=0;i!==e.length;++i){let o=e[i];t=t||o.hasToBeCloned,M(n,o.value),M(r,o.context)}return t&&ug(n,e),new T(n,r)}function dg(e,t,n){let r=[],i=lg(n)?n:[];for(let o=0;o!==e.length;++o)M(r,an(()=>e[o].shrink(t[o],i[o]).map(s=>{let a=j(t,(l,u)=>new T(Yn(l),i[u]));return[...Te(a,0,o),s,...Te(a,o+1)]}).map(cg)));return L.nil().join(...r)}var wk=class extends ue{constructor(e){super(),this.arbs=e;for(let t=0;t!==e.length;++t){let n=e[t];if(n==null||n.generate===null||n.generate===void 0)throw new Error(`Invalid parameter encountered at index ${t}: expecting an Arbitrary`)}}generate(e,t){let n=[];for(let r=0;r!==this.arbs.length;++r)M(n,this.arbs[r].generate(e,t));return cg(n)}canShrinkWithoutContext(e){if(!lg(e)||e.length!==this.arbs.length)return!1;for(let t=0;t!==this.arbs.length;++t)if(!this.arbs[t].canShrinkWithoutContext(e[t]))return!1;return!0}shrink(e,t){return dg(this.arbs,e,t)}};function D(...e){return new wk(e)}var xk=Math.log;function fg(e){return 2+~~(xk(e+1)*.4342944819032518)}var Qu={};function vk(e){Qu=e}function pt(){return Qu}function Rk(){Qu={}}var Qr=Symbol("UndefinedContextPlaceholder");function Jn(e){return e.context!==void 0?e:e.hasToBeCloned?new T(e.value_,Qr,()=>e.value):new T(e.value_,Qr)}var Im=()=>{},Ak=class{constructor(e,t){this.arb=e,this.predicate=t;let{asyncBeforeEach:n,asyncAfterEach:r,beforeEach:i,afterEach:o}=pt()||{};if(n!==void 0&&i!==void 0)throw P(`Global "asyncBeforeEach" and "beforeEach" parameters can't be set at the same time when running async properties`);if(r!==void 0&&o!==void 0)throw P(`Global "asyncAfterEach" and "afterEach" parameters can't be set at the same time when running async properties`);this.beforeEachHook=n||i||Im,this.afterEachHook=r||o||Im}isAsync(){return!0}generate(e,t){return Jn(this.arb.generate(e,t!==void 0?fg(t):void 0))}shrink(e){if(e.context===void 0&&!this.arb.canShrinkWithoutContext(e.value_))return L.nil();let t=e.context!==Qr?e.context:void 0;return this.arb.shrink(e.value_,t).map(Jn)}async runBeforeEach(){await this.beforeEachHook()}async runAfterEach(){await this.afterEachHook()}async run(e){try{let t=await this.predicate(e);return t===void 0||t===!0?null:{error:new P("Property failed by returning false")}}catch(t){return cn.isFailure(t)?t:{error:t}}}beforeEach(e){let t=this.beforeEachHook;return this.beforeEachHook=()=>e(t),this}afterEach(e){let t=this.afterEachHook;return this.afterEachHook=()=>e(t),this}},hg=class extends ue{constructor(e){super(),this.arb=e}generate(e,t){return Jn(this.arb.generate(e,t))}canShrinkWithoutContext(e){return!0}shrink(e,t){if(t===void 0&&!this.arb.canShrinkWithoutContext(e))return L.nil();let n=t!==Qr?t:void 0;return this.arb.shrink(e,n).map(Jn)}};function Ck(...e){if(e.length<2)throw new Error("asyncProperty expects at least two parameters");let t=Te(e,0,e.length-1),n=e[e.length-1];return ng(t,Zy),new Ak(D(...j(t,r=>new hg(r))),r=>n(...r))}var Pm=()=>{},pg=class{constructor(e,t){this.arb=e,this.predicate=t;let{beforeEach:n=Pm,afterEach:r=Pm,asyncBeforeEach:i,asyncAfterEach:o}=pt()||{};if(i!==void 0)throw P(`"asyncBeforeEach" can't be set when running synchronous properties`);if(o!==void 0)throw P(`"asyncAfterEach" can't be set when running synchronous properties`);this.beforeEachHook=n,this.afterEachHook=r}isAsync(){return!1}generate(e,t){return Jn(this.arb.generate(e,t!==void 0?fg(t):void 0))}shrink(e){if(e.context===void 0&&!this.arb.canShrinkWithoutContext(e.value_))return L.nil();let t=e.context!==Qr?e.context:void 0;return this.arb.shrink(e.value_,t).map(Jn)}runBeforeEach(){this.beforeEachHook()}runAfterEach(){this.afterEachHook()}run(e){try{let t=this.predicate(e);return t===void 0||t===!0?null:{error:new P("Property failed by returning false")}}catch(t){return cn.isFailure(t)?t:{error:t}}}beforeEach(e){let t=this.beforeEachHook;return this.beforeEachHook=()=>e(t),this}afterEach(e){let t=this.afterEachHook;return this.afterEachHook=()=>e(t),this}};function Ek(...e){if(e.length<2)throw new Error("property expects at least two parameters");let t=Te(e,0,e.length-1),n=e[e.length-1];return ng(t,Zy),new pg(D(...j(t,r=>new hg(r))),r=>n(...r))}var kk=(function(e){return e[e.None=0]="None",e[e.Verbose=1]="Verbose",e[e.VeryVerbose=2]="VeryVerbose",e})({});function Iu(e){return"unsafeNext"in e?e.unsafeJump===void 0?{clone:()=>Iu(e),next:()=>e.unsafeNext(),getState:()=>e.getState()}:{clone:()=>Iu(e),next:()=>e.unsafeNext(),jump:()=>e.unsafeJump(),getState:()=>e.getState()}:e}function mg(e){return"jump"in e&&typeof e.jump=="function"?e:{clone:()=>mg(e),next:()=>e.next(),jump:()=>zp(e,42),getState:()=>e.getState()}}function ts(e){return mg(Iu(e))}var Ik=Date.now,Pk=Math.min,Mk=Math.random,Tk=class{constructor(e){let t=e||{};this.seed=Ok(t),this.randomType=Nk(t),this.numRuns=_k(t),this.verbose=$k(t),this.maxSkipsPerRun=t.maxSkipsPerRun!==void 0?t.maxSkipsPerRun:100,this.timeout=ru(t.timeout),this.skipAllAfterTimeLimit=ru(t.skipAllAfterTimeLimit),this.interruptAfterTimeLimit=ru(t.interruptAfterTimeLimit),this.markInterruptAsFailure=t.markInterruptAsFailure===!0,this.skipEqualValues=t.skipEqualValues===!0,this.ignoreEqualValues=t.ignoreEqualValues===!0,this.logger=t.logger!==void 0?t.logger:n=>{console.log(n)},this.path=t.path!==void 0?t.path:"",this.unbiased=t.unbiased===!0,this.examples=t.examples!==void 0?t.examples:[],this.endOnFailure=t.endOnFailure===!0,this.reporter=t.reporter,this.asyncReporter=t.asyncReporter,this.includeErrorInReport=t.includeErrorInReport===!0}toParameters(){return{seed:this.seed,randomType:this.randomType,numRuns:this.numRuns,maxSkipsPerRun:this.maxSkipsPerRun,timeout:this.timeout,skipAllAfterTimeLimit:this.skipAllAfterTimeLimit,interruptAfterTimeLimit:this.interruptAfterTimeLimit,markInterruptAsFailure:this.markInterruptAsFailure,skipEqualValues:this.skipEqualValues,ignoreEqualValues:this.ignoreEqualValues,path:this.path,logger:this.logger,unbiased:this.unbiased,verbose:this.verbose,examples:this.examples,endOnFailure:this.endOnFailure,reporter:this.reporter,asyncReporter:this.asyncReporter,includeErrorInReport:this.includeErrorInReport}}};function nu(e){return t=>ts(e(t))}function Ok(e){if(e.seed===void 0)return Ik()^Mk()*4294967296;let t=e.seed|0;return e.seed===t?t:t^(e.seed-t)*4294967296}function Nk(e){if(e.randomType===void 0)return Jl;if(typeof e.randomType=="string")switch(e.randomType){case"mersenne":return nu(Up);case"congruential":case"congruential32":return nu(Dp);case"xorshift128plus":return Jl;case"xoroshiro128plus":return Wp;default:throw new Error(`Invalid random specified: '${e.randomType}'`)}let t=e.randomType(0);if("min"in t&&t.min!==-2147483648)throw new Error(`Invalid random number generator: min must equal -0x80000000, got ${String(t.min)}`);if("max"in t&&t.max!==2147483647)throw new Error(`Invalid random number generator: max must equal 0x7fffffff, got ${String(t.max)}`);return t===ts(t)?e.randomType:nu(e.randomType)}function _k(e){return e.numRuns!==void 0?e.numRuns:e.num_runs!==void 0?e.num_runs:100}function $k(e){return e.verbose===void 0?0:typeof e.verbose=="boolean"?e.verbose===!0?1:0:e.verbose<=0?0:e.verbose>=2?2:e.verbose|0}function ru(e){if(e!==void 0)return Pk(e,2147483647)}function ec(e){return new Tk(e)}function Lk(e,t,n){let r=null;return{clear:()=>n(r),promise:new Promise(i=>{r=t(()=>{i(new cn(!0))},e)})}}var Mm=class{constructor(e,t,n,r,i,o){this.property=e,this.getTime=t,this.interruptExecution=r,this.setTimeoutSafe=i,this.clearTimeoutSafe=o,this.skipAfterTime=this.getTime()+n}isAsync(){return this.property.isAsync()}generate(e,t){return this.property.generate(e,t)}shrink(e){return this.property.shrink(e)}run(e){let t=this.skipAfterTime-this.getTime();if(t<=0){let n=new cn(this.interruptExecution);return this.isAsync()?Promise.resolve(n):n}if(this.interruptExecution&&this.isAsync()){let n=Lk(t,this.setTimeoutSafe,this.clearTimeoutSafe),r=Promise.race([this.property.run(e),n.promise]);return r.then(n.clear,n.clear),r}return this.property.run(e)}runBeforeEach(){return this.property.runBeforeEach()}runAfterEach(){return this.property.runAfterEach()}},Dk=(e,t,n)=>{let r=null;return{clear:()=>n(r),promise:new Promise(i=>{r=t(()=>{i({error:new P(`Property timeout: exceeded limit of ${e} milliseconds`)})},e)})}},Fk=class{constructor(e,t,n,r){this.property=e,this.timeMs=t,this.setTimeoutSafe=n,this.clearTimeoutSafe=r}isAsync(){return!0}generate(e,t){return this.property.generate(e,t)}shrink(e){return this.property.shrink(e)}async run(e){let t=Dk(this.timeMs,this.setTimeoutSafe,this.clearTimeoutSafe),n=Promise.race([this.property.run(e),t.promise]);return n.then(t.clear,t.clear),n}runBeforeEach(){return Promise.resolve(this.property.runBeforeEach())}runAfterEach(){return Promise.resolve(this.property.runAfterEach())}},yg=class{constructor(e){this.property=e}isAsync(){return this.property.isAsync()}generate(e,t){return this.property.generate(e,void 0)}shrink(e){return this.property.shrink(e)}run(e){return this.property.run(e)}runBeforeEach(){return this.property.runBeforeEach()}runAfterEach(){return this.property.runAfterEach()}},Tm=Array.from,Om=typeof Buffer<"u"?Buffer.isBuffer:void 0,Gn=JSON.stringify,Nm=Number.isNaN,Bk=Object.keys,Uk=Object.getOwnPropertySymbols,jk=Object.getOwnPropertyDescriptor,_m=Object.getPrototypeOf,$m=Number.NEGATIVE_INFINITY,Vk=Number.POSITIVE_INFINITY,mt=Symbol.for("fast-check/toStringMethod");function tc(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&mt in e&&typeof e[mt]=="function"}var Vt=Symbol.for("fast-check/asyncToStringMethod");function nc(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&Vt in e&&typeof e[Vt]=="function"}var Wk=/^Symbol\((.*)\)$/;function zk(e){if(e.description!==void 0)return e.description;let t=Wk.exec(Fe(e));return t&&t[1].length?t[1]:null}function Lm(e){switch(e){case 0:return 1/e===$m?"-0":"0";case $m:return"Number.NEGATIVE_INFINITY";case Vk:return"Number.POSITIVE_INFINITY";default:return e===e?Fe(e):"Number.NaN"}}function Gk(e){let t=-1;for(let n in e){let r=Number(n);if(r!==t+1)return!0;t=r}return t+1!==e.length}function Je(e,t,n){let r=[...t,e];if(typeof e=="object"&&Bt(t,e)!==-1)return"[cyclic]";if(nc(e)){let i=n(e);if(i.state==="fulfilled")return i.value}if(tc(e))try{return e[mt]()}catch{}switch(ku(e)){case"[object Array]":{let i=e;if(i.length>=50&&Gk(i)){let s=[];for(let a in i)Nm(Number(a))||M(s,`${a}:${Je(i[a],r,n)}`);return s.length!==0?`Object.assign(Array(${i.length}),{${le(s,",")}})`:`Array(${i.length})`}let o=le(j(i,s=>Je(s,r,n)),",");return i.length===0||i.length-1 in i?`[${o}]`:`[${o},]`}case"[object BigInt]":return`${e}n`;case"[object Boolean]":{let i=e==!0?"true":"false";return typeof e=="boolean"?i:`new Boolean(${i})`}case"[object Date]":{let i=e;return Nm(Zo(i))?"new Date(NaN)":`new Date(${Gn(jE(i))})`}case"[object Map]":return`new Map(${Je(Array.from(e),r,n)})`;case"[object Null]":return"null";case"[object Number]":return typeof e=="number"?Lm(e):`new Number(${Lm(Number(e))})`;case"[object Object]":{try{let o=e.toString;if(typeof o=="function"&&o!==Object.prototype.toString)return e.toString()}catch{return"[object Object]"}let i=o=>`${o==="__proto__"?'["__proto__"]':typeof o=="symbol"?`[${Je(o,r,n)}]`:Gn(o)}:${Je(e[o],r,n)}`;return"{"+le([..._m(e)===null?["__proto__:null"]:[],...j(Bk(e),i),...j(FE(Uk(e),o=>{let s=jk(e,o);return s&&s.enumerable}),i)],",")+"}"}case"[object Set]":return`new Set(${Je(Array.from(e),r,n)})`;case"[object String]":return typeof e=="string"?Gn(e):`new String(${Gn(e)})`;case"[object Symbol]":{let i=e;if(Vo.keyFor(i)!==void 0)return`Symbol.for(${Gn(Vo.keyFor(i))})`;let o=zk(i);return o===null?"Symbol()":i===(o.startsWith("Symbol.")&&Vo[o.substring(7)])?o:`Symbol(${Gn(o)})`}case"[object Promise]":{let i=n(e);switch(i.state){case"fulfilled":return`Promise.resolve(${Je(i.value,r,n)})`;case"rejected":return`Promise.reject(${Je(i.value,r,n)})`;case"pending":return"new Promise(() => {/*pending*/})";default:return"new Promise(() => {/*unknown*/})"}}case"[object Error]":if(e instanceof Error)return`new Error(${Je(e.message,r,n)})`;break;case"[object Undefined]":return"undefined";case"[object Int8Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Int16Array]":case"[object Uint16Array]":case"[object Int32Array]":case"[object Uint32Array]":case"[object Float32Array]":case"[object Float64Array]":case"[object BigInt64Array]":case"[object BigUint64Array]":{if(typeof Om=="function"&&Om(e))return`Buffer.from(${e.buffer.detached?"/*detached ArrayBuffer*/":Je(Tm(e.values()),r,n)})`;let i=_m(e),o=i&&i.constructor&&i.constructor.name;if(typeof o=="string"){let s=e;return s.buffer.detached?`${o}.from(/*detached ArrayBuffer*/)`:`${o}.from(${Je(Tm(s.values()),r,n)})`}break}}try{return e.toString()}catch{return ku(e)}}function xe(e){return Je(e,[],()=>({state:"unknown",value:void 0}))}function gg(e){let t=Vo(),n=[],r=new jt;function i(){let l=null,u=()=>{l!==null&&clearTimeout(l)};return{delay:new Promise(c=>{l=setTimeout(()=>{l=null,c(t)},0)}),cancel:u}}let o={state:"unknown",value:void 0},s=function(u){let c=u;if(r.has(c))return r.get(c);let d=i(),f=Vt in u?Promise.resolve().then(()=>u[Vt]()):u;return f.catch(()=>{}),n.push(Promise.race([f,d.delay]).then(p=>{p===t?r.set(c,{state:"pending",value:void 0}):r.set(c,{state:"fulfilled",value:p}),d.cancel()},p=>{r.set(c,{state:"rejected",value:p}),d.cancel()})),r.set(c,o),o};function a(){let l=Je(e,[],s);return n.length===0?l:Promise.all(n.splice(0)).then(a)}return a()}async function rc(e){return Promise.resolve(gg(e))}function Dm(e){return e===null?new cn:e}function Hk(...e){return e[1]?e[0].then(Dm):Dm(e[0])}function qk(e,t){return Hk(e,t)}var Fm=class{constructor(e,t){this.property=e,this.skipRuns=t,this.coveredCases=new Map}isAsync(){return this.property.isAsync()}generate(e,t){return this.property.generate(e,t)}shrink(e){return this.property.shrink(e)}run(e){let t=xe(e);if(this.coveredCases.has(t)){let r=this.coveredCases.get(t);return this.skipRuns?qk(r,this.property.isAsync()):r}let n=this.property.run(e);return this.coveredCases.set(t,n),n}runBeforeEach(){return this.property.runBeforeEach()}runAfterEach(){return this.property.runAfterEach()}},Bm=Date.now,iu=setTimeout,ou=clearTimeout;function Kk(e,t){let n=e;return e.isAsync()&&t.timeout!==void 0&&(n=new Fk(n,t.timeout,iu,ou)),t.unbiased&&(n=new yg(n)),t.skipAllAfterTimeLimit!==void 0&&(n=new Mm(n,Bm,t.skipAllAfterTimeLimit,!1,iu,ou)),t.interruptAfterTimeLimit!==void 0&&(n=new Mm(n,Bm,t.interruptAfterTimeLimit,!0,iu,ou)),t.skipEqualValues&&(n=new Fm(n,!0)),t.ignoreEqualValues&&(n=new Fm(n,!1)),n}var Yk=(function(e){return e[e.Success=0]="Success",e[e.Skipped=-1]="Skipped",e[e.Failure=1]="Failure",e})({}),Zk=class bg{constructor(t,n){this.verbosity=t,this.interruptedAsFailure=n,this.rootExecutionTrees=[],this.currentLevelExecutionTrees=this.rootExecutionTrees,this.failure=null,this.numSkips=0,this.numSuccesses=0,this.interrupted=!1}appendExecutionTree(t,n){let r={status:t,value:n,children:[]};return this.currentLevelExecutionTrees.push(r),r}fail(t,n,r){if(this.verbosity>=1){let i=this.appendExecutionTree(1,t);this.currentLevelExecutionTrees=i.children}this.pathToFailure===void 0?this.pathToFailure=`${n}`:this.pathToFailure+=`:${n}`,this.value=t,this.failure=r}skip(t){this.verbosity>=2&&this.appendExecutionTree(-1,t),this.pathToFailure===void 0&&++this.numSkips}success(t){this.verbosity>=2&&this.appendExecutionTree(0,t),this.pathToFailure===void 0&&++this.numSuccesses}interrupt(){this.interrupted=!0}isSuccess(){return this.pathToFailure===void 0}firstFailure(){return this.pathToFailure!==void 0?+Be(this.pathToFailure,":")[0]:-1}numShrinks(){return this.pathToFailure!==void 0?Be(this.pathToFailure,":").length-1:0}extractFailures(){if(this.isSuccess())return[];let t=[],n=this.rootExecutionTrees;for(;n.length>0&&n[n.length-1].status===1;){let r=n[n.length-1];t.push(r.value),n=r.children}return t}static mergePaths(t,n){if(t.length===0)return n;let r=t.split(":"),i=n.split(":"),o=+r[r.length-1]+ +i[0];return[...r.slice(0,r.length-1),`${o}`,...i.slice(1)].join(":")}toRunDetails(t,n,r,i){if(!this.isSuccess())return{failed:!0,interrupted:this.interrupted,numRuns:this.firstFailure()+1-this.numSkips,numSkips:this.numSkips,numShrinks:this.numShrinks(),seed:t,counterexample:this.value,counterexamplePath:bg.mergePaths(n,this.pathToFailure),errorInstance:this.failure.error,failures:this.extractFailures(),executionSummary:this.rootExecutionTrees,verbose:this.verbosity,runConfiguration:i.toParameters()};let o=this.interruptedAsFailure||this.numSuccesses===0;return{failed:this.numSkips>r||this.interrupted&&o,interrupted:this.interrupted,numRuns:this.numSuccesses,numSkips:this.numSkips,numShrinks:0,seed:t,counterexample:null,counterexamplePath:null,error:null,errorInstance:null,failures:[],executionSummary:this.rootExecutionTrees,verbose:this.verbosity,runConfiguration:i.toParameters()}}},Sg=class{constructor(e,t,n,r){this.sourceValues=e,this.shrink=t,this.runExecution=new Zk(n,r),this.currentIdx=-1,this.nextValues=e}[Symbol.iterator](){return this}next(){let e=this.nextValues.next();return e.done||this.runExecution.interrupted?{done:!0,value:void 0}:(this.currentValue=e.value,++this.currentIdx,{done:!1,value:e.value.value_})}handleResult(e){e!==null&&typeof e=="object"&&!cn.isFailure(e)?(this.runExecution.fail(this.currentValue.value_,this.currentIdx,e),this.currentIdx=-1,this.nextValues=this.shrink(this.currentValue)):e!==null?e.interruptExecution?this.runExecution.interrupt():(this.runExecution.skip(this.currentValue.value_),this.sourceValues.skippedOne()):this.runExecution.success(this.currentValue.value_)}},Xk=class{constructor(e,t,n){this.initialValues=e,this.maxInitialIterations=t,this.remainingSkips=n}[Symbol.iterator](){return this}next(){if(--this.maxInitialIterations!==-1&&this.remainingSkips>=0){let e=this.initialValues.next();if(!e.done)return{value:e.value,done:!1}}return{value:void 0,done:!0}}skippedOne(){--this.remainingSkips,++this.maxInitialIterations}},Jk=-2147483648,Qk=2147483647,e2=Math.pow(2,27),t2=Math.pow(2,-53),ic=class wg{constructor(t){this.internalRng=ts(t.clone())}clone(){return new wg(this.internalRng)}next(t){return _o(this.internalRng,0,(1<<t)-1)}nextBoolean(){return _o(this.internalRng,0,1)===1}nextInt(t,n){return _o(this.internalRng,t===void 0?Jk:t,n===void 0?Qk:n)}nextBigInt(t,n){return qp(this.internalRng,t,n)}nextDouble(){let t=this.next(26),n=this.next(27);return(t*e2+n)*t2}getState(){if("getState"in this.internalRng&&typeof this.internalRng.getState=="function")return this.internalRng.getState()}};function n2(e,t,n){return t.jump(),e.generate(new ic(t),n)}function*xg(e,t,n,r){for(let i=0;i!==r.length;++i)yield new T(r[i],void 0);for(let i=0,o=n(t);;++i)yield n2(e,o,i)}function r2(e,t,n){return()=>e.generate(new ic(t),n)}function*vg(e,t,n,r){yield*j(r,s=>()=>new T(s,void 0));let i=0,o=ts(n(t));for(;;)o.jump(),yield r2(e,o,i++)}function Um(e){return e()}function Rg(e,t,n){let r=t,i=e.split(":").map(s=>+s);if(i.length===0)return r.map(Um);if(!i.every(s=>!Number.isNaN(s)))throw new Error(`Unable to replay, got invalid path=${e}`);let o=r.drop(i[0]).map(Um);for(let s of i.slice(1)){let a=o.getNthOrLast(0);if(a===null)throw new Error(`Unable to replay, got wrong path=${e}`);o=n(a).drop(s)}return o}var i2=Object.assign;function o2(e){return e.length===1?`Hint: ${e[0]}`:e.map((t,n)=>`Hint (${n+1}): ${t}`).join(`
|
|
20
|
+
${w}`),m.pop(),`{${O}}`}case"number":return isFinite(h)?String(h):t?t(h):"null";case"boolean":return h===!0?"true":"false";case"undefined":return;case"bigint":if(r)return String(h);default:return t?t(h):void 0}}function d(p,h,m){switch(typeof h){case"string":return Qt(h);case"object":{if(h===null)return"null";if(typeof h.toJSON=="function"){if(h=h.toJSON(p),typeof h!="object")return d(p,h,m);if(h===null)return"null"}if(m.indexOf(h)!==-1)return n;let y="",S=h.length!==void 0;if(S&&Array.isArray(h)){if(h.length===0)return"[]";if(s<m.length+1)return'"[Array]"';m.push(h);let O=Math.min(h.length,a),N=0;for(;N<O-1;N++){let I=d(String(N),h[N],m);y+=I!==void 0?I:"null",y+=","}let _=d(String(N),h[N],m);if(y+=_!==void 0?_:"null",h.length-1>a){let I=h.length-a-1;y+=`,"... ${fn(I)} not stringified"`}return m.pop(),`[${y}]`}let w=Object.keys(h),g=w.length;if(g===0)return"{}";if(s<m.length+1)return'"[Object]"';let x="",k=Math.min(g,a);S&&Za(h)&&(y+=Kf(h,",",a),w=w.slice(h.length),k-=h.length,x=","),i&&(w=Ya(w,o)),m.push(h);for(let O=0;O<k;O++){let N=w[O],_=d(N,h[N],m);_!==void 0&&(y+=`${x}${Qt(N)}:${_}`,x=",")}if(g>a){let O=g-a;y+=`${x}"...":"${fn(O)} not stringified"`}return m.pop(),`{${y}}`}case"number":return isFinite(h)?String(h):t?t(h):"null";case"boolean":return h===!0?"true":"false";case"undefined":return;case"bigint":if(r)return String(h);default:return t?t(h):void 0}}function f(p,h,m){if(arguments.length>1){let y="";if(typeof m=="number"?y=" ".repeat(Math.min(m,10)):typeof m=="string"&&(y=m.slice(0,10)),h!=null){if(typeof h=="function")return l("",{"":p},[],h,y,"");if(Array.isArray(h))return u("",p,[],Hx(h),y,"")}if(y.length!==0)return c("",p,[],y,"")}return d("",p,[])}return f}});var Cp=If((nB,zl)=>{"use strict";var Io=process||{},Rp=Io.argv||[],ko=Io.env||{},yC=!(ko.NO_COLOR||Rp.includes("--no-color"))&&(!!ko.FORCE_COLOR||Rp.includes("--color")||Io.platform==="win32"||(Io.stdout||{}).isTTY&&ko.TERM!=="dumb"||!!ko.CI),gC=(e,t,n=e)=>r=>{let i=""+r,o=i.indexOf(t,e.length);return~o?e+bC(i,t,n,o)+t:e+i+t},bC=(e,t,n,r)=>{let i="",o=0;do i+=e.substring(o,r)+n,o=r+t.length,r=e.indexOf(t,o);while(~r);return i+e.substring(o)},Ap=(e=yC)=>{let t=e?gC:()=>String;return{isColorSupported:e,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};zl.exports=Ap();zl.exports.createColors=Ap});import{z as C}from"zod";var Oa=C.enum(["fast","slow","async"]),$n=C.object({ref:C.string().min(1)}),Tt=C.union([C.string(),C.number(),C.boolean()]),Na=C.object({template:C.array(C.union([C.string(),$n])).min(1)}),De=C.union([$n,Tt,Na,C.null()]),Pf=C.object({kind:C.literal("changed")}),_a=C.union([De,Pf]),Ot=C.union([C.string(),$n,Na]),xx=C.object({by:C.literal("role"),name:C.union([Ot,C.undefined()]).optional().transform(e=>e),role:C.string().min(1)}),vx=C.object({by:C.literal("testId"),value:Ot}),Rx=C.object({by:C.literal("inside"),scope:C.lazy(()=>Se),target:C.lazy(()=>Se)}),Se=C.discriminatedUnion("by",[xx,vx,Rx]),Fi=C.enum(["string","number","boolean"]),$a=C.enum(["strict","eventual"]),Ax=C.object({kind:C.literal("string"),maxLength:C.number().int().positive().optional(),minLength:C.number().int().nonnegative().optional(),pattern:C.string().optional()}),Cx=C.object({kind:C.literal("number"),max:C.number().int().optional(),min:C.number().int().optional()}),Ex=C.object({kind:C.literal("datetime"),maxOffsetDays:C.number().int(),minOffsetDays:C.number().int()}),Mf=C.discriminatedUnion("kind",[Ax,Cx,Ex]),Tf=C.enum(["company.name","date.iso","internet.email","internet.url","person.fullName","lorem.slug","lorem.word"]),La=C.object({constraints:Mf.optional(),generator:Tf,name:C.string().min(1),type:Fi,values:C.array(Tt).min(1).optional()}),Of=C.object({consistency:$a.default("strict"),optional:C.boolean(),type:Fi,valueSpace:C.string().min(1).optional()}),Da=C.enum(["backend","client"]),Fa=C.object({description:C.string().optional(),identity:C.array(C.string().min(1)).min(1),identityKind:C.enum(["surrogate","natural"]),name:C.string().min(1),props:C.record(C.string().min(1),Of),source:Da.default("backend")}),Ba=C.object({consistency:$a.default("strict"),default:Tt,description:C.string().optional(),name:C.string().min(1),source:Da.default("backend"),type:Fi,valueSpace:C.string().min(1).optional()}),Nt=C.enum(["url","title","viewport"]);function Ua(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${Ua(e.scope)} \u25B8 ${Ua(e.target)}`:`${e.role} ${e.name??""}`.trim()}import{z as A}from"zod";var kx=A.discriminatedUnion("kind",[A.object({as:A.string().min(1),kind:A.literal("created"),props:A.record(A.string().min(1),De)}),A.object({as:A.string().min(1),kind:A.literal("updated"),props:A.record(A.string().min(1),_a)}),A.object({kind:A.literal("deleted")})]),Ix=A.object({kind:A.literal("is"),value:De}),Nf=A.lazy(()=>A.union([De,Mx])),Px=A.object({entity:A.string().min(1),where:A.record(A.string().min(1),Nf)}),Mx=A.object({field:A.string().min(1),kind:A.literal("within"),selection:Px}),Rt=A.union([Oa,A.undefined()]).optional().transform(e=>e),_f=A.object({assertion:Ix,kind:A.literal("singleton"),singleton:A.string().min(1),wait:Rt}),$f=A.object({entity:A.string().min(1),kind:A.literal("count"),value:A.number().int().nonnegative()}),Bi=A.lazy(()=>A.discriminatedUnion("kind",[_f,$f,A.object({kind:A.literal("not"),predicate:Bi}),A.object({kind:A.literal("and"),predicates:A.array(Bi)})])),Tx=A.lazy(()=>A.object({condition:A.union([Bi,A.undefined()]).optional().transform(e=>e),consequence:A.array(Ln),name:A.string().min(1)})),Ln=A.lazy(()=>A.discriminatedUnion("kind",[A.object({kind:A.literal("visible"),locator:Se,wait:Rt}),A.object({kind:A.literal("disabled"),locator:Se,wait:Rt}),A.object({kind:A.literal("enabled"),locator:Se,wait:Rt}),A.object({kind:A.literal("focused"),locator:Se,wait:Rt}),A.object({kind:A.literal("checked"),locator:Se,wait:Rt}),A.object({kind:A.literal("value"),locator:Se,value:Ot,wait:Rt}),A.object({kind:A.literal("text"),locator:Se,value:Ot,wait:Rt}),_f,A.object({kind:A.literal("browser"),name:Nt,value:Ot,wait:Rt}),A.object({assertion:kx,entity:A.string().min(1),key:A.record(A.string().min(1),Nf),kind:A.literal("state"),wait:Rt}),A.object({kind:A.literal("not"),predicate:Ln}),A.object({kind:A.literal("and"),predicates:A.array(Ln)}),$f,A.object({branches:A.array(Tx),kind:A.literal("when")})]));import{z as Ui}from"zod";var Ox=Ui.object({__codec:Ui.string().min(1),data:Ui.unknown(),version:Ui.number().int().positive()}),ji=class extends Error{codec;currentVersion;gotVersion;constructor(t){super(`Unsupported ${t.codec} version ${String(t.gotVersion)} (current ${String(t.currentVersion)}). Upgrade Ripplo or rebuild with a compatible CLI.`),this.name="CodecVersionError",this.codec=t.codec,this.currentVersion=t.currentVersion,this.gotVersion=t.gotVersion}},Vi=class extends Error{constructor(t){super(`Codec mismatch: expected "${t.expected}", got "${t.got}"`),this.name="CodecMismatchError"}};function ja({name:e,schema:t}){return{currentVersion:1,name:e,decode:n=>$x({name:e,raw:n,schema:t}),encode:n=>({__codec:e,data:n,version:1})}}function Nx(e,t){return JSON.stringify(e.encode(t))}function _x(e,t){let n=JSON.parse(t);return e.decode(n)}function $x({name:e,raw:t,schema:n}){let r=Ox.parse(t);if(r.__codec!==e)throw new Vi({expected:e,got:r.__codec});if(r.version!==1)throw new ji({codec:e,currentVersion:1,gotVersion:r.version});return n.parse(r.data)}var Wi="__ripplo__",Va="__ripplo_seed__";import{z as v}from"zod";var Lf=v.discriminatedUnion("kind",[v.object({kind:v.literal("goto"),url:Ot}),v.object({kind:v.literal("fill"),locator:Se,value:De}),v.object({kind:v.literal("clear"),locator:Se}),v.object({kind:v.literal("click"),locator:Se}),v.object({kind:v.literal("dblclick"),locator:Se}),v.object({kind:v.literal("select"),locator:Se,value:De}),v.object({kind:v.literal("check"),locator:Se}),v.object({kind:v.literal("uncheck"),locator:Se}),v.object({kind:v.literal("hover"),locator:Se}),v.object({files:v.array(v.string().min(1)).min(1),kind:v.literal("upload"),locator:Se}),v.object({key:v.string().min(1),kind:v.literal("press"),locator:Se.optional()})]),Wa=v.object({action:Lf,expect:v.array(Ln).default([])}),za=v.object({valueSpace:v.string().min(1)}),zi=v.object({as:v.string().min(1),entity:v.string().min(1),set:v.record(v.string().min(1),De)}),Ga=v.object({entity:v.string().min(1),where:v.record(v.string().min(1),De)}),Gi=v.object({absent:v.array(Ga).default([]),exclusive:v.array(v.string().min(1)).default([]),intent:v.string().min(1),name:v.string().min(1),params:v.record(v.string().min(1),za),singletons:v.record(v.string().min(1),De).default({}),slug:v.string().min(1),steps:v.array(Wa).default([]),workflow:v.string().min(1),world:v.array(zi).default([])}),Df=v.object({absent:v.array(Ga).default([]),exclusive:v.array(v.string().min(1)).default([]),intent:v.string().min(1),maybe:v.array(zi).default([]),name:v.string().min(1),params:v.record(v.string().min(1),za),singletons:v.record(v.string().min(1),De).default({}),sourcePath:v.string().min(1).optional(),steps:v.array(Wa).default([]),stub:v.boolean().default(!1),tests:v.array(Gi).default([]),world:v.array(zi).default([])}),Ff=v.object({sha256:v.string().regex(/^[0-9a-f]{64}$/u),size:v.number().int().nonnegative()}),Bf=v.object({entities:v.array(Fa),fixtures:v.record(v.string().min(1),Ff).default({}),singletons:v.array(Ba).default([]),valueSpaces:v.array(La),workflows:v.array(Df)}),Lx=ja({name:"ripplo-lockfile",schema:Bf});function Dx(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function Hi(e,t,n=""){let r=Dx(e),i=e?.length,o=t!==void 0;if(!r||o&&i!==t){let s=n&&`"${n}" `,a=o?` of length ${t}`:"",l=r?`length=${i}`:`type=${typeof e}`,u=s+"expected Uint8Array"+a+", got "+l;throw r?new RangeError(u):new TypeError(u)}return e}function Ha(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Uf(e,t){Hi(e,void 0,"digestInto() output");let n=t.outputLen;if(e.length<n)throw new RangeError('"digestInto() output" expected to be of length >='+n)}function Cr(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function qi(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function lt(e,t){return e<<32-t|e>>>t}var Fx=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Bx=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function jf(e){if(Hi(e),Fx)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Bx[e[n]];return t}function Vf(e){if(typeof e!="string")throw new TypeError("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Wf(e,t={}){let n=(i,o)=>e(o).update(i).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.canXOF=r.canXOF,n.create=i=>e(i),Object.assign(n,t),Object.freeze(n)}var zf=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function Gf(e,t,n){return e&t^~e&n}function Hf(e,t,n){return e&t^e&n^t&n}var Ki=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,n,r,i){this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=qi(this.buffer)}update(t){Ha(this),Hi(t);let{view:n,buffer:r,blockLen:i}=this,o=t.length;for(let s=0;s<o;){let a=Math.min(i-this.pos,o-s);if(a===i){let l=qi(t);for(;i<=o-s;s+=i)this.process(l,s);continue}r.set(t.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Ha(this),Uf(t,this),this.finished=!0;let{buffer:n,view:r,blockLen:i,isLE:o}=this,{pos:s}=this;n[s++]=128,Cr(this.buffer.subarray(s)),this.padOffset>i-s&&(this.process(r,0),s=0);for(let d=s;d<i;d++)n[d]=0;r.setBigUint64(i-8,BigInt(this.length*8),o),this.process(r,0);let a=qi(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let u=l/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)a.setUint32(4*d,c[d],o)}digest(){let{buffer:t,outputLen:n}=this;this.digestInto(t);let r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||=new this.constructor,t.set(...this.get());let{blockLen:n,buffer:r,length:i,finished:o,destroyed:s,pos:a}=this;return t.destroyed=s,t.finished=o,t.length=i,t.pos=a,i%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}},_t=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var Ux=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Jt=new Uint32Array(64),qa=class extends Ki{constructor(t){super(64,t,8,!1)}get(){let{A:t,B:n,C:r,D:i,E:o,F:s,G:a,H:l}=this;return[t,n,r,i,o,s,a,l]}set(t,n,r,i,o,s,a,l){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=a|0,this.H=l|0}process(t,n){for(let d=0;d<16;d++,n+=4)Jt[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){let f=Jt[d-15],p=Jt[d-2],h=lt(f,7)^lt(f,18)^f>>>3,m=lt(p,17)^lt(p,19)^p>>>10;Jt[d]=m+Jt[d-7]+h+Jt[d-16]|0}let{A:r,B:i,C:o,D:s,E:a,F:l,G:u,H:c}=this;for(let d=0;d<64;d++){let f=lt(a,6)^lt(a,11)^lt(a,25),p=c+f+Gf(a,l,u)+Ux[d]+Jt[d]|0,m=(lt(r,2)^lt(r,13)^lt(r,22))+Hf(r,i,o)|0;c=u,u=l,l=a,a=s+p|0,s=o,o=i,i=r,r=p+m|0}r=r+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,l=l+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(r,i,o,s,a,l,u,c)}roundClean(){Cr(Jt)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),Cr(this.buffer)}},Ka=class extends qa{A=_t[0]|0;B=_t[1]|0;C=_t[2]|0;D=_t[3]|0;E=_t[4]|0;F=_t[5]|0;G=_t[6]|0;H=_t[7]|0;constructor(){super(32)}};var qf=Wf(()=>new Ka,zf(1));var Qa=Ta(Xf(),1),AL=Qa.default.configure,kr=Qa.default;function el(e){return jf(qf(Vf(kr(e))))}function G(e){let t=kr(e);if(t==null)throw new Error("structuralKey: value is not serializable");return t}function tl({actionOffsets:e,durationMs:t}){let n=Zx({anchors:Kx({actionOffsets:e,durationMs:t}),durationMs:t});return{delayMs:Qx(Math.round(8e3/n.length),500,1800),offsets:n}}function Kx({actionOffsets:e,durationMs:t}){let n=e.map(i=>Math.min(i+150,t)),r=[...new Set([0,...n,t])].toSorted((i,o)=>i-o);return Yx(r)}function Yx(e){return e.reduce((t,n)=>{let r=t.at(-1);return r!=null&&n-r<120?t:[...t,n]},[])}function Zx({anchors:e,durationMs:t}){return e.length>60?Xx(e):e.length>=5?e:[...new Set([...e,...Jx(t,5)])].toSorted((n,r)=>n-r)}function Xx(e){return Array.from({length:60},(t,n)=>e[Math.round(n/59*(e.length-1))]??0)}function Jx(e,t){return Array.from({length:t},(n,r)=>Math.round(r/(t-1)*e))}function Qx(e,t,n){return Math.min(n,Math.max(t,e))}import{z as Ir}from"zod";var ev=Ir.object({index:Ir.number().int().nonnegative(),kind:Ir.string(),target:Ir.string(),value:Ir.string()});function tv(e){let t=rv(e);return{preconditions:e.entities.map(n=>({depends:t.get(n.name)??[],description:n.description??"",name:n.name,returns:n.identity})),singletons:e.singletons.map(n=>({defaultValue:String(n.default),description:n.description??"",name:n.name,type:n.type})),workflows:e.workflows.map(n=>({expectedOutcome:n.intent,name:n.intent,preconditions:av(lv(n),t),requiresKeys:n.world.map(r=>({namespace:r.as,preconditionName:r.entity})),slug:Qf(n.name),sourcePath:n.sourcePath??null,spec:n}))}}function nv(e,t){return{index:t,kind:e.action.kind,target:uv(e.action),value:cv(e.action)}}function Qf(e){return e.toLowerCase().replaceAll(/[^a-z0-9]/g,"-").split("-").filter(t=>t.length>0).join("-")}function rv(e){let t=e.workflows.reduce((n,r)=>iv(n,r),new Map);return new Map([...t].map(([n,r])=>[n,[...r]]))}function iv(e,t){let n=[...t.world,...t.maybe],r=new Map(n.map(i=>[i.as,i.entity]));return n.reduce((i,o)=>{let s=ov(o,r),a=i.get(o.entity)??new Set;return new Map([...i,[o.entity,new Set([...a,...s])]])},e)}function ov(e,t){return Object.values(e.set).flatMap(n=>sv(n)).map(n=>t.get(n)).filter(n=>n!=null&&n!==e.entity)}function sv(e){return e==null||typeof e!="object"?[]:"ref"in e?[Jf(e.ref)]:e.template.filter(t=>typeof t!="string").map(t=>Jf(t.ref))}function Jf(e){let[t]=e.split(".");return t??e}function av(e,t){let n=(r,i)=>r.has(i)?r:(t.get(i)??[]).reduce((o,s)=>n(o,s),new Set([...r,i]));return[...e.reduce((r,i)=>n(r,i),new Set)]}function lv(e){return[...new Set(e.world.map(t=>t.entity))]}function uv(e){return e.kind==="goto"?Yi(e.url):e.kind==="press"&&e.locator==null?"":Zi(e.locator)}function Yi(e){return typeof e=="string"?e:"ref"in e?`{${e.ref}}`:e.template.map(t=>typeof t=="string"?t:`{${t.ref}}`).join("")}function Zi(e){return e.by==="testId"?`testId=${Yi(e.value)}`:e.by==="inside"?`${Zi(e.scope)} \u25B8 ${Zi(e.target)}`:`${e.role} ${e.name==null?"":Yi(e.name)}`.trim()}function cv(e){return e.kind==="fill"||e.kind==="select"?dv(e.value):e.kind==="press"?e.key:""}function dv(e){return e==null?"":typeof e!="object"?String(e):Yi(e)}import{z as Re}from"zod";var eh=Re.enum(["Strict","Lax","None"]),th=Re.object({domain:Re.string().min(1),expires:Re.number(),httpOnly:Re.boolean(),name:Re.string().min(1),path:Re.string().min(1),sameSite:eh,secure:Re.boolean(),value:Re.string()}),nh=Re.object({localStorage:Re.array(Re.object({name:Re.string().min(1),value:Re.string()})),origin:Re.string().min(1)}),nl=Re.object({cookies:Re.array(th),headers:Re.record(Re.string().min(1),Re.string()).optional(),origins:Re.array(nh)});import{z as H}from"zod";var rl=H.union([Tt,H.null()]),il=H.record(H.string().min(1),rl),rh=H.object({as:H.string().min(1),entity:H.string().min(1),fields:H.record(H.string().min(1),De)}),fv=H.object({entities:H.array(rh),runId:H.string().min(1),singletons:H.record(H.string().min(1),rl).default({})}),ih=H.object({as:H.string().min(1),row:il,session:nl.optional()}),ol=H.object({rows:H.array(ih)}),hv=H.object({entities:H.array(H.string().min(1)),runId:H.string().min(1),singletons:H.array(H.string().min(1)).default([])}),sl=H.object({entities:H.record(H.string().min(1),H.array(il)),singletons:H.record(H.string().min(1),rl).default({})}),pv=H.object({runId:H.string().min(1)}),al=H.object({ok:H.literal(!0)});function $t(e){let t=new URL(e,"https://ripplo.invalid"),n=[...t.searchParams.entries()].toSorted(([r],[i])=>r.localeCompare(i)).map(([r,i])=>`${r}=${i}`).join("&");return n.length===0?t.pathname:`${t.pathname}?${n}`}function Dn(e,t){return e==="url"?$t(t):t}function ll(e,t,n){return Dn(e,String(t))===Dn(e,String(n))}function sh(e,t,n){return e!=="url"?ll(e,t,n):oh(String(t))===oh(String(n))}function oh(e){return new URL(e,"https://ripplo.invalid").pathname}function Xi({actual:e,canon:t,pre:n,predicted:r}){return[...[...new Set([...r.entities.keys(),...e.entities.keys()])].flatMap(s=>mv({actual:e.entities.get(s),canon:t,entity:s,pre:n.entities.get(s),predicted:r.entities.get(s)})),...gv(n.singletons,r.singletons,e.singletons)]}function mv({actual:e,canon:t,entity:n,pre:r,predicted:i}){return[...new Set([...i?.keys()??[],...e?.keys()??[]])].flatMap(s=>yv({actual:e?.get(s),canon:t,entity:n,key:s,predicted:i?.get(s),preHadKey:r?.has(s)??!1,preRow:r?.get(s)}))}function yv({actual:e,canon:t,entity:n,key:r,predicted:i,preHadKey:o,preRow:s}){if(i==null)return[{mismatch:{entity:n,key:r,kind:"unexpected-row"},pending:o}];if(e==null)return[{mismatch:{entity:n,key:r,kind:"missing-row"},pending:!o}];let a=(u,c,d)=>uh(t(n,u,c),t(n,u,d));return[...new Set([...Object.keys(i),...Object.keys(e)])].filter(u=>!a(u,i[u],e[u])).map(u=>({mismatch:{entity:n,field:u,key:r,kind:"wrong-value",snapshot:i[u],sut:e[u]},pending:s==null?e[u]===void 0:a(u,s[u],e[u])}))}function uh(e,t){return ah(e)===ah(t)}function ah(e){return e==null?"\u2205":JSON.stringify(e)}function gv(e,t,n){return[...new Set([...Object.keys(t),...Object.keys(n)])].flatMap(i=>{let o=t[i],s=n[i];return o===void 0||s===void 0||lh(i,o,s)?[]:[{mismatch:{kind:"singleton-mismatch",singleton:i,snapshot:o,sut:s},pending:e[i]!==void 0&&lh(i,e[i],s)}]})}function lh(e,t,n){let r=Nt.safeParse(e);return r.success?sh(r.data,t,n):uh(t,n)}function Pr(e){let t=bv(e.entities),n=Sv(e.singletons);return r=>wv(r,t,n)}function bv(e){return new Map(e.flatMap(t=>Object.entries(t.props).map(([n,r])=>[ch(t.name,n),r.consistency])))}function ch(e,t){return`${e}.${t}`}function Sv(e){return new Map(e.map(t=>[t.name,t.consistency]))}function wv(e,t,n){return e.kind==="singleton-mismatch"?xv(e.singleton,n):e.kind==="unexpected-row"||e.kind==="missing-row"?"strict":t.get(ch(e.entity,e.field))??"strict"}function xv(e,t){return Nt.safeParse(e).success?t.get(e)??"eventual":t.get(e)??"strict"}function Mr(e){let t=new Set(e.valueSpaces.filter(n=>n.generator==="date.iso").map(n=>n.name));return(n,r,i)=>{if(!t.has(`${n}.${r}`)||typeof i!="string")return i;let o=Date.parse(i);return Number.isNaN(o)?i:new Date(o).toISOString()}}function ul({onlyFirst:e=!1}={}){let i="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(i,e?void 0:"g")}var vv=ul();function cl(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(vv,"")}function dl(e,t,n){return{detail:n.slice(0,500),kind:"engine-http",path:e,status:t}}function Fn(e,t){return{code:mh(t),kind:"engine-network",message:Tr(t),path:e}}function fl(e){return{kind:"client-mount-missing",mountKey:e}}function hl(e,t){return{kind:"engine-decode",message:Tr(t),path:e}}function pl(e,t){return{entity:e,field:t,kind:"state-identity"}}function fh(e){return{as:e,kind:"setup-missing-row"}}function hh(e){return{count:e,kind:"conflicting-sessions"}}function pn(e){return{kind:"driver-launch",message:Tr(e)}}function ml(e){return{kind:"engine-unreachable",url:e}}function yl(e,t){return{action:e,kind:"action-failed",message:Tr(t)}}function gl(e){return{kind:"check-failed",message:Tr(e)}}function bl(){return{kind:"aborted"}}var dh=300;function en(e){switch(e.kind){case"engine-http":return`engine ${e.path} returned ${String(e.status)}: ${ph(e.detail)}${Rv(e.status)}`;case"engine-network":return`engine ${e.path} request failed: ${e.message}`;case"client-mount-missing":return`client bridge "${e.mountKey}" never mounted; client singletons unreadable`;case"engine-decode":return`engine ${e.path} response did not match schema: ${e.message}`;case"state-identity":return`row of "${e.entity}" is missing identity field "${e.field}"`;case"setup-missing-row":return`setup returned no row for "${e.as}"`;case"conflicting-sessions":return`world established ${String(e.count)} distinct auth sessions in one browser context; sessions are exclusive \u2014 a single context holds one signed-in user`;case"engine-unreachable":return`the engine at ${e.url} did not respond in time \u2014 the dev server may still be recompiling. Re-run once it settles.`;case"driver-launch":return`browser driver failed to launch: ${e.message}`;case"action-failed":return`action "${e.action}" failed: ${e.message}`;case"check-failed":return`check failed: ${e.message}`;case"aborted":return"run aborted"}}function Sl(e){throw new Error(en(e))}function tt(){}function ph(e){let t=e.replaceAll(/\s+/gu," ").trim();return t.length<=dh?t:`${t.slice(0,dh)}\u2026 [truncated]`}function Rv(e){return e===404?" \u2014 the engine adapter is not mounted at RIPPLO_ENGINE_URL (or the mount path differs). Verify the adapter is wired into the app server and ENABLE_RIPPLO_TESTING=true; `ripplo doctor` checks the endpoint.":e===403||e===401?" \u2014 the adapter rejected the request: ENABLE_RIPPLO_TESTING is not true in the app's env, or RIPPLO_WEBHOOK_SECRET differs between the app and .ripplo env.":""}function mh(e){if(!(typeof e!="object"||e==null))return"code"in e&&typeof e.code=="string"?e.code:"cause"in e?mh(e.cause):void 0}function Tr(e){let t=e instanceof Error?e.message:String(e);return ph(cl(t))}function yh(e){return G(e)}var Or=class extends Error{name="AbortError";constructor(){super("aborted")}};function wl(e){return e instanceof Error&&e.name==="AbortError"}function Lt(e){if(e.aborted)throw new Or}function xl(e,t){return t.aborted?Promise.reject(new Or):new Promise((n,r)=>{let i=()=>{clearTimeout(o),r(new Or)},o=setTimeout(()=>{t.removeEventListener("abort",i),n()},e);t.addEventListener("abort",i,{once:!0})})}var Av={check:"Check",clear:"Clear",click:"Click",dblclick:"Double-click",fill:"Fill",goto:"Go to",hover:"Hover",press:"Press",select:"Select",uncheck:"Uncheck",upload:"Upload"};function gh(e){let t=Av[e.kind]??e.kind;return e.kind==="press"&&e.key!=null?`${t}: ${e.key}`:t}function bh(e){return e.kind==="data-rule"?"data rule":Sh(e.check)}function Sh(e){return e.kind==="not"?`not ${Sh(e.inner)}`:e.kind==="browser"?e.name:`${wh(e.locator)} ${e.kind}`}function wh(e){return e.by==="testId"?"element":e.by==="inside"?wh(e.target):e.role}function Eh(e){return e.includes("async")?"async":e.includes("slow")?"slow":"fast"}var Cv=()=>[];async function Qi({canon:e,classify:t,initialSnapshot:n,observe:r,onAssertion:i,onStep:o,pageRulePendingChecks:s,steps:a,stopAfterStep:l},u){return kh({acc:[],canon:e,classify:t,index:0,observe:r,onAssertion:i,onStep:o,pageRulePendingChecks:s??Cv,signal:u,snapshot:n,steps:a,stopAfterStep:l})}async function kh({acc:e,canon:t,classify:n,index:r,observe:i,onAssertion:o,onStep:s,pageRulePendingChecks:a,signal:l,snapshot:u,steps:c,stopAfterStep:d}){Lt(l);let f=c[r];if(f==null)return{finalModel:u,findings:e};let p=Date.now(),h=await f.targetIds(),m=gh(f.step.action);if(!f.requiredState(u)){let y={kind:"impossible-action",step:f.step};return Rl(s,{annotations:[vl({actionLabel:m,outcome:"failed",rrwebIds:h,startMs:p})],endMs:Date.now(),findings:[y],index:r,post:u,pre:u,source:f.source,startMs:p,url:Al(u)}),{finalModel:u,findings:[...e,y]}}return f.perform().match(()=>kv({acc:e,actionLabel:m,canon:t,classify:n,index:r,observe:i,onAssertion:o,onStep:s,pageRulePendingChecks:a,rrwebIds:h,signal:l,snapshot:u,startMs:p,step:f,steps:c,stopAfterStep:d}),y=>{let S=Ji(y,f);return Rl(s,{annotations:[vl({actionLabel:m,outcome:"failed",rrwebIds:h,startMs:p})],endMs:Date.now(),findings:[S],index:r,post:u,pre:u,source:f.source,startMs:p,url:Al(u)}),Promise.resolve({finalModel:u,findings:[...e,S]})})}function vl({actionLabel:e,outcome:t,rrwebIds:n,startMs:r}){return{atMs:r,kind:"action",label:e,outcome:t,rrwebIds:n,url:!1}}function Ev(e){return e.kind==="data-rule"?!1:Ih(e.check)}function Ih(e){return e.kind==="not"?Ih(e.inner):e.kind==="browser"&&e.name==="url"}async function kv({acc:e,actionLabel:t,canon:n,classify:r,index:i,observe:o,onAssertion:s,onStep:a,pageRulePendingChecks:l,rrwebIds:u,signal:c,snapshot:d,startMs:f,step:p,steps:h,stopAfterStep:m}){let y=p.effect(d),S=await Nv({canon:n,classify:r,observe:o,pre:d,predicted:y,signal:c,step:p}),w=[...p.pendingChecks,...l(d,S.snapshot)],g=await Iv({onAssertion:s,pendingChecks:w,signal:c,step:p}),x=[...g.findings,...S.findings];Rl(a,{annotations:[vl({actionLabel:t,outcome:x.length>0?"failed":"passed",rrwebIds:u,startMs:f}),...g.annotations],endMs:Date.now(),findings:x,index:i,post:S.snapshot,pre:d,source:p.source,startMs:f,url:Al(S.snapshot)});let k=[...e,...x];return x.length>0?{finalModel:S.snapshot,findings:k}:m!=null&&i+1>=m?{finalModel:S.snapshot,findings:k}:kh({acc:k,canon:n,classify:r,index:i+1,observe:o,onAssertion:s,onStep:a,pageRulePendingChecks:l,signal:c,snapshot:S.snapshot,steps:h,stopAfterStep:m})}async function Iv({onAssertion:e,pendingChecks:t,signal:n,step:r}){let i=[...new Map(t.map(s=>[yh(s.source),s])).values()],o=await Promise.all(i.map(async s=>{let a=await Pv(s,n),l=Date.now(),u=await s.targetIds();return{atMs:l,outcome:a,pendingCheck:s,rrwebIds:u}}));return o.forEach(s=>{Mv(e,s.pendingCheck,s.outcome,r)}),{annotations:o.filter(s=>s.pendingCheck.source.kind==="step").map(s=>({atMs:s.atMs,kind:"assertion",label:bh(s.pendingCheck.source),outcome:Ph(s.outcome),rrwebIds:s.rrwebIds,url:Ev(s.pendingCheck.source)})),findings:o.flatMap(s=>Tv(s.pendingCheck,s.outcome,r))}}function Pv(e,t){if(e.check.kind==="decided"){let n=e.check.passed?"passed":"failed";return Promise.resolve({kind:n})}return _v(e.budget,e.check.run,t)}function Mv(e,t,n,r){e?.({outcome:Ph(n),source:t.source,step:r.step})}function Ph(e){return e.kind==="passed"?"passed":e.kind==="error"?"error":"failed"}function Tv(e,t,n){return t.kind==="error"?[Ji(t.error,n)]:t.kind==="failed"?[{budget:e.budget,kind:"pending-check",source:e.source,step:n.step}]:[]}function Ji(e,t){return{error:e,kind:"driver-error",step:t.step}}function Rl(e,t){e?.(t)}function Al(e){let t=e.singletons.url;return typeof t=="string"?t:null}var Nr={async:12e4,fast:5e3,slow:3e4},Mh={async:{backoffMs:[500,1e3,2e3,5e3],timeoutMs:Nr.async},fast:{backoffMs:[100,250,500,1e3],timeoutMs:Nr.fast},slow:{backoffMs:[250,500,1e3,2e3],timeoutMs:Nr.slow}};function Th(e,t){return e.backoffMs[Math.min(t,e.backoffMs.length-1)]??0}function xh(e){return e().match(t=>({observed:t,ok:!0}),t=>({error:t,ok:!1}))}function Ov(e,t,n){return n.reconcile==null?e:n.reconcile(e,t)}function vh({canon:e,pre:t,predicted:n,step:r},i){let o=r.verifyChanges==null?[]:r.verifyChanges(n,i),s=Ov(n,i,r),a=o.map(l=>({mismatch:l,pending:!0}));return{adopted:s,probed:[...a,...Xi({actual:i.snapshot,canon:e,pre:t,predicted:s})]}}function Oh(e,t){return{budget:t.sync,kind:"consistency",mismatch:e.mismatch,pending:e.pending,step:t.step}}function Rh(e,t,n){let r=e.probed.filter(i=>!i.pending&&n(i.mismatch)==="strict");return r.length>0?{findings:r.map(i=>Oh(i,t)),snapshot:e.adopted}:e.probed.length===0?{findings:[],snapshot:e.adopted}:null}function Ah(e,t,n){return{findings:[...e.probed.map(r=>Oh(r,t)),...n],snapshot:e.adopted}}async function Nv({canon:e,classify:t,observe:n,pre:r,predicted:i,signal:o,step:s}){let a=Mh[s.sync],l=Date.now()+a.timeoutMs,u=await xh(n);if(!u.ok)return{findings:[Ji(u.error,s)],snapshot:i};let c=vh({canon:e,pre:r,predicted:i,step:s},u.observed),d=0;for(;Date.now()<l;){Lt(o);let f=Rh(c,s,t);if(f!=null)return f;await xl(Th(a,d),o),d+=1;let p=await xh(n);if(!p.ok)return Ah(c,s,[Ji(p.error,s)]);c=vh({canon:e,pre:r,predicted:i,step:s},p.observed)}return Rh(c,s,t)??Ah(c,s,[])}async function _v(e,t,n){let r=Mh[e],i=Date.now()+r.timeoutMs,o=await Ch(t),s=0;for(;o.kind==="pending"&&Date.now()<i;)Lt(n),await xl(Th(r,s),n),s+=1,o=await Ch(t);return o.kind==="pending"?{kind:"failed"}:o}function Ch(e){return e().match(t=>t?{kind:"passed"}:{kind:"pending"},t=>({error:t,kind:"error"}))}import{z as $v}from"zod";var El=$v.string().brand(),Z=El.parse("");function At(e){return El.parse(e)}function Ye(e,t){return El.parse(e.length===0?t:`${e}.${t}`)}function pe(e){return $n.safeParse(e).success}function mn(e){let t=e.lastIndexOf(".");return t===-1?void 0:{alias:e.slice(0,t),field:e.slice(t+1)}}function Ze(e){return typeof e=="object"&&e!==null&&"template"in e}function Cl(e,t,n){let r=Ye(t,e.ref);if(!n.has(r))throw new Error(`unresolved binding ref "${r}"`);return n.get(r)??null}function Nh(e,t,n){return Lv(e).every(r=>n.has(Ye(t,r)))}function ut(e,t,n){return typeof e=="string"?e:pe(e)?String(Cl(e,t,n)):e.template.map(r=>typeof r=="string"?r:String(Cl(r,t,n))).join("")}function nt(e,t,n){return e===null||typeof e=="number"||typeof e=="boolean"?e:pe(e)?Cl(e,t,n):ut(e,t,n)}function _h(e,t){return nt(e,Z,t)}function _r(e){return kr(e)}function Bn(e,t,n){return Object.fromEntries(Object.entries(e).map(([r,i])=>[r,nt(i,t,n)]))}function Lv(e){return e==null||typeof e!="object"?[]:Ze(e)?e.template.flatMap(t=>typeof t=="string"?[]:[t.ref]):[e.ref]}function $h(e){return kl(e.expect).some(t=>t.assertion.kind==="deleted")}function tn(e){return typeof e=="object"&&e!==null&&"kind"in e}function yn(e){return Object.fromEntries(Object.entries(e).filter(t=>!tn(t[1])))}function $r(e,t,n){return t.reduce((r,i)=>Dv(r,i,n,e),e)}function Lh(e,t){return Object.keys(t).length===0?e:{...e,singletons:{...e.singletons,...t}}}function kl(e){return e.flatMap(t=>t.kind==="state"?[t]:t.kind==="and"?kl(t.predicates):t.kind==="when"?kl(t.branches.flatMap(n=>n.consequence)):[])}function Dv(e,t,n,r){if(!Fv(t,n))return e;if(t.assertion.kind==="created"){let o=Bn(t.assertion.props,Z,n);return Bv(e,t.entity,_r(o),o)}if(t.assertion.kind==="deleted")return Il(e,t.entity,Wv(t.key,n,r));let i=Bn(yn(t.assertion.props),Z,n);return Il(e,t.entity,zv(t.key,i,n,r))}function Fv(e,t){return("props"in e.assertion?[e.key,yn(e.assertion.props)]:[e.key]).every(r=>Object.values(r).every(i=>Bh(i)||!pe(i)||t.has(At(i.ref))))}function Bv(e,t,n,r){let i=new Map([...e.entities.get(t)??[],[n,r]]);return{...e,entities:new Map([...e.entities,[t,i]])}}function Il(e,t,n){let r=n(e.entities.get(t)??new Map);return{...e,entities:new Map([...e.entities,[t,r]])}}function gn(e,t,n,r){let i={env:r,key:n,snapshot:e};return[...(e.entities.get(t)??new Map).values()].filter(o=>to(o,i))}function Dh(e,t,n,r,i){let o={env:r,key:n,snapshot:e};return Il(e,t,s=>new Map([...s].map(([a,l])=>[a,to(l,o)?i(l):l])))}function to(e,t){return Object.entries(t.key).every(([n,r])=>Fh(e[n],r,t))}function Fh(e,t,n){return Bh(t)?Uv(t,n).has(eo(e)):eo(e)===eo(Vv(t,n.env))}function Bh(e){return typeof e=="object"&&e!==null&&"kind"in e}function Uv(e,t){let n=t.snapshot.entities.get(e.selection.entity);return n==null?new Set:new Set([...n.values()].filter(r=>jv(r,e.selection.where,t)).map(r=>eo(r[e.field])))}function jv(e,t,n){return Object.entries(t).every(([r,i])=>Fh(e[r],i,n))}function eo(e){return e==null?"\u2205":e instanceof Date?e.toISOString():JSON.stringify(e)}function Vv(e,t){return nt(e,Z,t)}function Wv(e,t,n){let r={env:t,key:e,snapshot:n};return i=>new Map([...i].filter(([,o])=>!to(o,r)))}function zv(e,t,n,r){let i={env:n,key:e,snapshot:r};return o=>new Map([...o].map(([s,a])=>to(a,i)?[s,{...a,...t}]:[s,a]))}function Pl(e){let t=e.predicates.filter(o=>zh(o)),n=t.filter(o=>o.assertion.kind==="created"),r=Wh(t);if(n.length===0&&r.length===0&&e.deferred.length===0&&e.adopt.length===0)return;let i=t.filter(o=>o.assertion.kind==="updated");return(o,s)=>{let a=n.reduce((c,d)=>Xv(c,s,d,e.env),{env:e.env,snapshot:o}),l=r.reduce((c,d)=>Zv(c,s,d,e.env),a.snapshot),u=i.reduce((c,d)=>Hv(c,s,d),a.env);return Gv(eR(l,e.deferred,u),s,e.adopt)}}function Gv(e,t,n){if(n.length===0)return e;let r=n.reduce((i,o)=>{let s=t.snapshot.singletons[o];return s===void 0?i:{...i,[o]:s}},e.singletons);return{...e,singletons:r}}function Vh(e,t,n){return new Map([...e,...Object.entries(n).map(([r,i])=>[Ye(Z,`${t}.${r}`),i])])}function Hv(e,t,n){let r=gn(t.snapshot,n.entity,n.key,e).at(0);return r==null?e:Vh(e,n.assertion.as,r)}function Ml(e){let t=Wh(e.predicates.filter(n=>zh(n)));if(t.length!==0)return(n,r)=>t.flatMap(i=>qv(i,n,r,e.env))}function Wh(e){return e.filter(t=>t.assertion.kind==="updated"&&Tl(t.assertion.props).length>0)}function Tl(e){return Object.entries(e).filter(([,t])=>tn(t)).map(([t])=>t)}function zh(e){return e.assertion.kind==="created"||e.assertion.kind==="updated"}function qv(e,t,n,r){let i=gn(t,e.entity,e.key,r).at(0),o=gn(n.snapshot,e.entity,e.key,r).at(0);if(i==null||o==null)return[];let s=_r(Kv(e.key,r));return Tl(e.assertion.props).flatMap(a=>Uh(i[a])===Uh(o[a])?[{entity:e.entity,field:a,key:s,kind:"expected-change",value:o[a]}]:[])}function Kv(e,t){let n=Object.fromEntries(Object.entries(e).filter(r=>!Yv(r[1])));return Bn(n,Z,t)}function Yv(e){return typeof e=="object"&&e!==null&&"kind"in e}function Uh(e){return e==null?"\u2205":JSON.stringify(e)}function Zv(e,t,n,r){let i=Tl(n.assertion.props),o=gn(t.snapshot,n.entity,n.key,r).at(0);return o==null?e:Dh(e,n.entity,n.key,r,s=>({...s,...Object.fromEntries(i.flatMap(a=>{let l=o[a];return l===void 0?[]:[[a,l]]}))}))}function Xv(e,t,n,r){if(n.assertion.kind!=="created")return e;let i=Bn(n.assertion.props,Z,r),o=_r(i),s=e.snapshot.entities.get(n.entity);if(s==null||!s.has(o))return e;let a=Jv(t.snapshot.entities.get(n.entity),s,i);if(a==null)return e;let[l,u]=a,c=new Map(s);return c.delete(o),c.set(l,{...u,...i}),{env:Vh(e.env,n.assertion.as,u),snapshot:{...e.snapshot,entities:new Map(e.snapshot.entities).set(n.entity,c)}}}function Jv(e,t,n){if(e==null)return;let r=Object.entries(n),i=[...e].filter(([o])=>!t.has(o)).map(([o,s])=>({entry:[o,s],score:r.filter(([a,l])=>jh(s[a])===jh(l)).length}));return Qv(i,r.length)}function jh(e){return e==null?"\u2205":JSON.stringify(e)}function Qv(e,t){let n=e.reduce((i,o)=>Math.max(i,o.score),0);if(n===0)return;let r=e.filter(i=>i.score===n);if(!(n<t&&r.length!==1))return r[0]?.entry}function eR(e,t,n){let r=t.reduce((i,o)=>{let s=tR(o.value,n);return s==null?i:{...i,[o.name]:Dn(o.name,s)}},e.singletons);return{...e,singletons:r}}function tR(e,t){try{return ut(e,Z,t)}catch{return}}function no(e,t){if(e.kind==="visible"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused"||e.kind==="checked")return{kind:e.kind,locator:Lr(e.locator,t)};if(e.kind==="not"){let n=no(e.predicate,t);return n==null?null:{inner:n,kind:"not"}}return e.kind==="value"||e.kind==="text"?{kind:e.kind,locator:Lr(e.locator,t),value:ut(e.value,Z,t)}:e.kind!=="browser"?null:{kind:"browser",name:e.name,value:ut(e.value,Z,t)}}function Un(e,t){let n=e.expect.filter(a=>a.kind==="state"),r=aR(n),{adopt:i,deferred:o,immediate:s}=nR(e,t,r);return{action:lR(e.action,t),label:e.action.kind,pendingChecks:e.expect.flatMap(a=>cR(a,t)),reconcile:Pl({adopt:i,deferred:o,env:t,predicates:n}),verifyChanges:Ml({adopt:i,deferred:o,env:t,predicates:n}),effect:a=>Lh($r(a,n,t),s)}}function Lr(e,t){return e.by==="role"?{by:"role",name:e.name==null?void 0:ut(e.name,Z,t),role:e.role}:e.by==="inside"?{by:"inside",scope:Lr(e.scope,t),target:Lr(e.target,t)}:{by:"testId",value:ut(e.value,Z,t)}}function nR(e,t,n){let r=e.action.kind==="goto"&&!e.expect.some(s=>s.kind==="browser"&&s.name==="url"),i=e.action.kind==="goto"&&!r?{url:$t(ut(e.action.url,Z,t))}:{},o=r?["url"]:[];return e.expect.reduce((s,a)=>a.kind==="browser"&&rR(a.value,n)?{...s,deferred:[...s.deferred,{name:a.name,value:a.value}]}:a.kind==="browser"||a.kind==="singleton"?{...s,immediate:{...s.immediate,...oR(a,t)}}:s,{adopt:o,deferred:[],immediate:i})}function rR(e,t){return iR(e).some(n=>t.has(n.split(".")[0]??n))}function iR(e){return typeof e=="string"?[]:pe(e)?[e.ref]:e.template.filter(t=>typeof t!="string").map(t=>t.ref)}function oR(e,t){if(e.kind==="browser")return{[e.name]:sR(e,t)};if(e.kind==="singleton")return{[e.singleton]:nt(e.assertion.value,Z,t)};throw new Error("when() consequence must be a url (browser) or singleton assertion")}function sR(e,t){return Dn(e.name,ut(e.value,Z,t))}function aR(e){return new Set(e.flatMap(t=>t.assertion.kind==="created"||t.assertion.kind==="updated"?[t.assertion.as]:[]))}function lR(e,t){return{files:e.kind==="upload"?e.files:void 0,key:e.kind==="press"?e.key:void 0,kind:e.kind,locator:uR(e,t),url:e.kind==="goto"?ut(e.url,Z,t):void 0,value:"value"in e?_h(e.value,t):void 0}}function uR(e,t){if(!(!("locator"in e)||e.locator==null))return Lr(e.locator,t)}function cR(e,t){if(e.kind==="browser"||e.kind==="singleton")return[];let n=no(e,t),r="wait"in e?e.wait??"fast":"fast";return n==null?[]:[{budget:r,check:n}]}import{err as Gh,ok as Nl,okAsync as dR,Result as fR}from"neverthrow";function jn(e,t,n){let r=SR(e),i={env:new Map,generate:n.generate,generatedParams:new Set,indexed:r,overrides:new Map(Object.entries(n.params??{}).map(([s,a])=>[At(s),a]))};wR(t.params,Z,i);let o=t.world.map(s=>xR(s,Z,i));return n.materialize(o).andThen(s=>CR(s,i.env,r).map(a=>hR({base:a,generatedParams:i.generatedParams,lockfile:e,test:t})))}function ro(e,t){let n=new Map(t.map(r=>[r.name,r]));return r=>dR(yR(r,e,n).rows)}function io(e){return t=>{let n=t.map(r=>({as:r.as,entity:r.entity,fields:r.fields}));return e(n).andThen(r=>mR(t,r))}}function _l(e,t){let n=Dr(t);return Object.fromEntries(Object.entries(e).filter(([r,i])=>n.includes(r)&&i!=null))}function Dr(e){return Object.keys(e.props)}function hR({base:e,generatedParams:t,lockfile:n,test:r}){let i=Object.fromEntries(n.singletons.map(c=>[c.name,c.default])),o=Object.fromEntries(Object.entries(r.singletons).map(([c,d])=>[c,nt(d,Z,e.env)])),s=Object.entries(r.singletons).filter(([,c])=>pR(c,t)).map(([c])=>c),a={...i,...o},l=new Set(n.singletons.filter(c=>c.source==="client").map(c=>c.name)),u=Object.fromEntries(Object.entries(a).filter(([c])=>l.has(c)));return{...e,clientState:u,generatedSingletons:s,snapshot:{...e.snapshot,singletons:a}}}function pR(e,t){return pe(e)?t.has(Ye(Z,e.ref)):Ze(e)?e.template.some(n=>typeof n!="string"&&t.has(Ye(Z,n.ref))):!1}function mR(e,t){let n=new Map(t.map(r=>[r.as,r]));return fR.combine(e.map(r=>{let i=n.get(r.as);return i==null?Gh(fh(r.as)):Nl({as:r.as,entity:r.entity,generatedFields:r.generatedFields,row:i.row,session:i.session})}))}function yR(e,t,n){return e.reduce((r,i)=>{let o=gR(i.fields,r.env),s=kR({generate:t,model:i.model,seedPrefix:i.seedPrefix,set:o,valueSpaces:n}),a=Object.entries(s).map(([u,c])=>[`${i.as}.${u}`,c]),l=Object.keys(s).filter(u=>!(u in o));return{env:new Map([...r.env,...a]),rows:[...r.rows,{as:i.as,entity:i.entity,generatedFields:[...new Set([...i.generatedFields,...l])],row:s,session:void 0}]}},{env:new Map,rows:[]})}function gR(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>{if(pe(r))return[n,bR(t,r.ref)];if(Ze(r))throw new Error(`template value not allowed in entity field "${n}"`);return[n,r]}))}function bR(e,t){let n=e.get(t);if(n==null)throw new Error(`setup ref "${t}" was not produced by an earlier entity`);return n}function SR(e){return{models:new Map(e.entities.map(t=>[t.name,t])),valueSpaces:new Map(e.valueSpaces.map(t=>[t.name,t]))}}function wR(e,t,n){Object.entries(e).forEach(([r,i])=>{let o=Ye(t,r),s=n.indexed.valueSpaces.get(i.valueSpace);if(s==null)throw new Error(`unknown valueSpace "${i.valueSpace}" for param "${o}"`);let a=n.overrides.get(o);a==null&&n.generatedParams.add(o);let l=a??n.generate.value({anchor:void 0,constraints:s.constraints,generator:s.generator,nullable:!1,seed:o,type:s.type,values:s.values,valueSpace:i.valueSpace});n.env.set(o,l)})}function xR(e,t,n){let r=n.indexed.models.get(e.entity);if(r==null)throw new Error(`model "${e.entity}" not found for setup "${e.as}"`);let i=Ye(t,e.as),o=vR(e.set,t,n.env),s=AR(r,o,i,n),a=Object.entries(e.set).filter(([,l])=>pe(l)&&n.generatedParams.has(Ye(t,l.ref))).map(([l])=>l);return{as:i,entity:e.entity,fields:{...s,...o},generatedFields:[...Object.keys(s),...a],model:r,seedPrefix:i}}function vR(e,t,n){return Object.fromEntries(Object.entries(e).map(([r,i])=>[r,RR(i,t,n)]))}function RR(e,t,n){if(!pe(e))return e;let r=Ye(t,e.ref);return n.get(r)??{ref:r}}function AR(e,t,n,r){return Object.fromEntries(Object.entries(e.props).filter(([i,o])=>!o.optional&&!e.identity.includes(i)&&!(i in t)).map(([i,o])=>[i,Hh({field:i,generate:r.generate,model:e,seedPrefix:n,spec:o,valueSpaces:r.indexed.valueSpaces})]))}function CR(e,t,n){let r=new Map,i=e.flatMap(a=>{let l=n.models.get(a.entity);if(l==null)throw new Error(`model "${a.entity}" not found for setup "${a.as}"`);Object.entries(a.row).forEach(([c,d])=>t.set(Ye(At(a.as),c),d));let u=r.get(a.entity)??new Map;return u.set(Ol(a.row,l),_l(a.row,l)),r.set(a.entity,u),a.session==null?[]:[a.session]}),o=e.flatMap(a=>{let l=n.models.get(a.entity);return l==null?[]:[{alias:a.as,entity:a.entity,key:Ol(a.row,l)}]}),s=e.flatMap(a=>{let l=n.models.get(a.entity);if(l==null)return[];let u=Ol(a.row,l);return a.generatedFields.map(c=>({entity:a.entity,field:c,key:u}))});return ER(i).map(a=>({aliases:o,auth:a,env:t,generated:s,snapshot:{entities:IR(r),singletons:{}}}))}function ER(e){if(e.length===0)return Nl(void 0);let t=new Set(e.map(r=>JSON.stringify(r.cookies))).size;if(t>1)return Gh(hh(t));let n=e.flatMap(r=>Object.entries(r.headers??{}));return Nl({cookies:e.flatMap(r=>r.cookies),headers:n.length===0?void 0:Object.fromEntries(n),origins:e.flatMap(r=>r.origins)})}function kR({generate:e,model:t,seedPrefix:n,set:r,valueSpaces:i}){return{...Object.fromEntries(Object.entries(t.props).filter(([s])=>!(s in r)).map(([s,a])=>[s,Hh({field:s,generate:e,model:t,seedPrefix:n,spec:a,valueSpaces:i})])),...r}}function Hh({field:e,generate:t,model:n,seedPrefix:r,spec:i,valueSpaces:o}){let s=`${n.name}.${e}`;return t.value({anchor:void 0,constraints:o.get(s)?.constraints,generator:o.get(s)?.generator??"lorem.word",nullable:i.optional,seed:Ye(r,e),type:i.type,values:o.get(s)?.values,valueSpace:s})}function Ol(e,t){return t.identity.map(n=>String(e[n])).join(":")}function IR(e){return new Map([...e].map(([t,n])=>[t,new Map(n)]))}function Dt(e,t){return[...new Map(e.map(n=>[t(n),n])).values()]}function qh(e){return Dt(e,G)}function rt(e){return`${e.workflow}/${e.slug}`}function Ct(e){return e.workflows.flatMap(t=>t.tests.map(n=>({ref:rt(n),test:n,workflow:t})))}function Et(e){return`${e.test}#${String(e.index)}`}function Sn(e){let t=Ct(e).flatMap(n=>Fr(e,n.test));return Dt(t,n=>`${n.test}:${G(n.steps)}`)}function Fr(e,t){let n=Zh(t),r=Kh(n,t.singletons),i=JR(t,XR(e)),o=PR(e,t);return MR(r,QR(t.steps),n).reduce((a,{chunk:l,requiredState:u},c)=>({offset:a.offset+l.length,transitions:[...a.transitions,YR({chunk:l,index:c,intent:t.intent,namespace:n.namespace,paramSpaceOf:i,requiredState:u,testRef:rt(t),whenChunk:o.slice(a.offset,a.offset+l.length)})]}),{offset:0,transitions:[]}).transitions}function Kh(e,t){return{absences:HR(e),entities:KR(e),exclusives:e.exclusives,singletons:Object.fromEntries(Object.entries(t).filter(([,n])=>!pe(n)&&!Ze(n)))}}function PR(e,t){let n=e.workflows.find(r=>r.name===t.workflow);return n==null||n.steps.length!==t.steps.length?t.steps:n.steps}function oo(e,t,n){return Object.values(e).flatMap(r=>pe(r)?Ll(r.ref,n):[]).find(r=>r.entity===t)?.aliasPath}function MR(e,t,n){return t.reduce((r,i)=>({requiredState:TR(r.requiredState,i,n),withRequiredState:[...r.withRequiredState,{chunk:i,requiredState:WR(r.requiredState,i)}]}),{requiredState:e,withRequiredState:[]}).withRequiredState}function TR(e,t,n){let r=t.flatMap(i=>i.expect.filter(o=>o.kind==="state")).reduce((i,o)=>OR(i,o,n),e);return{...r,singletons:{...r.singletons,...UR(t)}}}function OR(e,t,n){return t.assertion.kind==="deleted"?NR(e,t,n):t.assertion.kind==="created"?LR(e,t.entity,t.assertion.as,t.assertion.props,n):FR(e,t,n)}function NR(e,t,n){let r=oo(t.key,t.entity,n.namespace),i=e.entities.find(a=>a.alias===r),o=Br(_R(t.key),n),s=i==null?{entity:t.entity,...o}:{entity:i.entity,...$R(i,o)};return{...e,absences:[...e.absences,s],entities:e.entities.filter(a=>a.alias!==r)}}function _R(e){return Object.fromEntries(Object.entries(e).flatMap(t=>{let n=t[1];return Jh(n)?[]:[[t[0],n]]}))}function $R(e,t){return{literals:{...e.literals,...t.literals},relations:[...e.relations.filter(n=>!t.relations.some(r=>r.field===n.field)),...t.relations]}}function LR(e,t,n,r,i){let o=Br(r,i);return{...e,absences:e.absences.filter(s=>s.entity!==t||!DR(o,s)),entities:[...e.entities,{alias:n,entity:t,...o}]}}function DR(e,t){return Object.entries(t.literals).every(([r,i])=>e.literals[r]===i)&&t.relations.every(r=>e.relations.some(i=>i.field===r.field&&i.targetAlias===r.targetAlias&&i.targetField===r.targetField))}function FR(e,t,n){if(t.assertion.kind!=="updated")return e;let r=oo(t.key,t.entity,n.namespace);if(r==null)return e;let i=Br(yn(t.assertion.props),n),o=Object.entries(t.assertion.props).filter(([,a])=>tn(a)).map(([a])=>a),s=a=>a.alias===r?BR(a,i,o):a;return{...e,entities:e.entities.map(a=>s(a))}}function BR(e,t,n){let r=Object.entries(e.literals).filter(([i])=>!n.includes(i)&&!(i in t.literals));return{...e,literals:{...Object.fromEntries(r),...t.literals},relations:[...e.relations.filter(i=>!t.relations.some(o=>o.field===i.field)),...t.relations]}}function UR(e){return e.reduce((t,n)=>({...t,...jR(n),...VR(n)}),{})}function jR(e){return e.action.kind==="goto"?{url:e.action.url}:{}}function VR(e){return Object.fromEntries(e.expect.flatMap(t=>t.kind==="browser"?[[t.name,t.value]]:t.kind==="singleton"?[[t.singleton,t.assertion.value]]:[]))}function WR(e,t){return t[0]?.action.kind!=="goto"?e:{...e,singletons:Object.fromEntries(Object.entries(e.singletons).filter(([n])=>n!=="url"))}}function so(e,t){let n=Zh(t);return{namespace:n.namespace,requiredState:Kh(n,t.singletons)}}function Yh(e,t){return[...new Set(e)].flatMap(n=>Ll(n,t))}function ct(e){return pe(e)?[e.ref]:Ze(e)?e.template.flatMap(t=>pe(t)?[t.ref]:[]):[]}function bn(e){switch(e.kind){case"visible":case"disabled":case"enabled":case"focused":case"checked":return nn(e.locator);case"value":case"text":return[...nn(e.locator),...ct(e.value)];case"singleton":return ct(e.assertion.value);case"browser":return ct(e.value);case"state":return[...e.assertion.kind==="deleted"?[]:Object.values(yn(e.assertion.props)).flatMap(t=>ct(t)),...Object.values(e.key).flatMap(t=>Xh(t))];case"not":return bn(e.predicate);case"when":return e.branches.flatMap(t=>t.consequence.flatMap(n=>bn(n)));case"and":return e.predicates.flatMap(t=>bn(t));case"count":return[]}}function Zh(e){return{absences:e.absent,exclusives:e.exclusive,namespace:new Map(e.world.map(t=>[t.as,t.entity])),setups:e.world}}function nn(e){return e.by==="inside"?[...nn(e.scope),...nn(e.target)]:e.by==="role"?e.name==null?[]:ct(e.name):ct(e.value)}function Xh(e){return Jh(e)?Object.values(e.selection.where).flatMap(t=>Xh(t)):ct(e)}function Jh(e){return typeof e=="object"&&e!==null&&"kind"in e}function zR(e){return e.kind==="goto"?ct(e.url):e.kind==="fill"||e.kind==="select"?[...nn(e.locator),...ct(e.value)]:e.kind==="press"?e.locator==null?[]:nn(e.locator):(e.kind==="upload",nn(e.locator))}function GR(e){return[...zR(e.action),...e.expect.flatMap(t=>bn(t))]}function HR(e){return e.absences.map(t=>({entity:t.entity,...Br(t.where,e)}))}function Br(e,t){let n=Object.entries(e),r=Object.fromEntries(n.flatMap(([o,s])=>pe(s)||Ze(s)?[]:[[o,s]])),i=n.flatMap(o=>{let s=o[1];if(!pe(s))return[];let a=Ll(s.ref,t.namespace).at(0);return a==null?[]:[{entity:a.entity,field:o[0],targetAlias:a.aliasPath,targetField:a.field}]});return{literals:r,relations:i}}function qR(e,t){return e.map(n=>({alias:n.as,entity:n.entity,...Br(n.set,t)}))}function KR(e){return qR(e.setups,e)}function YR(e){let t=e.chunk.findIndex(s=>s.action.kind!=="goto"),n=t===-1?e.chunk:e.chunk.slice(0,t),r=e.chunk.slice(n.length),i=r.at(-1)??e.chunk.at(-1);if(i==null)throw new Error("empty transition chunk");let o=[...new Set(e.chunk.flatMap(s=>GR(s)))];return{effectStep:i,index:e.index,intent:e.intent,namespace:e.namespace,nav:n,paramSpaces:Object.fromEntries(o.filter(s=>e.paramSpaceOf.has(s)).map(s=>[s,e.paramSpaceOf.get(s)])),requiredState:e.requiredState,steps:r,test:e.testRef,wait:Eh(r.flatMap(s=>ZR(s))),whenSteps:e.whenChunk}}function ZR(e){return e.expect.flatMap(t=>t.kind==="state"&&t.wait!=null?[t.wait]:[])}function Ll(e,t){let n=mn(e);if(n==null)return[];let r=t.get(n.alias);return r==null?[]:[{aliasPath:n.alias,entity:r,field:n.field,ref:e}]}function XR(e){return new Map(e.valueSpaces.map(t=>[t.name,t]))}function JR(e,t){return new Map(Object.entries(e.params).map(([n,r])=>[n,t.get(r.valueSpace)]))}function QR(e){return $l(e,0,[],[])}function $l(e,t,n,r){let i=e[t];if(i==null)return n.length===0?r:[...r,n];let o=[...n,i];return eA(i)?$l(e,t+1,[],[...r,o]):$l(e,t+1,o,r)}function eA(e){return e.expect.some(t=>t.kind==="state")}function Qh(e){return ep(e,new Map)}function tA(e,t){return e.reduce((n,r)=>n??t(r),null)}function ep(e,t){let n=e.variables.find(r=>!t.has(r));return n==null?t:tA(e.domain(n),r=>{let i=new Map([...t,[n,r]]);return e.consistent(i)?ep(e,i):null})}function dt(e,t){let n=tp(e,t);if(n==null)return null;let r=uA(n);return cA(e.singletons,t,r)?r:null}function tp(e,t){let{absences:n,entities:r,exclusives:i}=e,o=new Map(r.map(a=>[a.alias,a])),s=Qh({variables:r.map(a=>a.alias),consistent:a=>nA(a)&&rA(r,a)&&oA(n,a,t),domain:a=>aA(o.get(a),t)});return s==null?null:lA(i,r,s,t)?s:null}function nA(e){let t=[...e.values()];return new Set(t).size===t.length}function rA(e,t){return e.every(n=>t.has(n.alias)?n.relations.every(r=>iA(n,r,t)):!0)}function iA(e,t,n){if(!n.has(t.targetAlias))return!0;let r=n.get(t.targetAlias)?.[t.targetField];return r==null?!0:n.get(e.alias)?.[t.field]===r}function oA(e,t,n){return e.every(r=>![...n.entities.get(r.entity)?.values()??[]].some(i=>sA(i,r,t)))}function sA(e,t,n){return np(e,t)?t.relations.every(r=>{if(!n.has(r.targetAlias))return!1;let i=n.get(r.targetAlias)?.[r.targetField];return i!=null&&e[r.field]===i}):!1}function np(e,t){return Object.entries(t.literals).every(([n,r])=>r===null?e[n]==null:e[n]===r)}function aA(e,t){return e==null?[]:[...t.entities.get(e.entity)?.values()??[]].filter(n=>np(n,e))}function lA(e,t,n,r){return e.every(i=>{let o=t.filter(a=>a.entity===i&&n.has(a.alias)).length;return(r.entities.get(i)?.size??0)===o})}function uA(e){return new Map([...e].flatMap(([t,n])=>Object.entries(n).flatMap(r=>{let i=r[1];return typeof i=="string"||typeof i=="number"||typeof i=="boolean"?[[At(`${t}.${r[0]}`),i]]:[]})))}function cA(e,t,n){return Object.entries(e).every(([r,i])=>{if(!Nh(i,Z,n))return!1;let o=nt(i,Z,n),s=t.singletons[r],a=Nt.safeParse(r);return a.success?ll(a.data,o,s):s===o})}function ip(e,t,n){return e.reduce((r,i)=>{let o=$r(r.snapshot,dA(i),n);return{resolved:[...r.resolved,fA(i,o,n)],snapshot:o}},{resolved:[],snapshot:t}).resolved}function dA(e){return e.expect.filter(t=>t.kind==="state")}function fA(e,t,n){return e.expect.some(r=>r.kind==="when")?{...e,expect:e.expect.flatMap(r=>op(r,{env:n,snapshot:t}))}:e}function op(e,t){if(e.kind!=="when")return[e];let n=hA(e,t);return n==null?[]:n.flatMap(r=>op(r,t))}function hA(e,t){return e.branches.find(n=>n.condition==null||Dl(n.condition,t))?.consequence}function Dl(e,t){if(e.kind==="count")return gn(t.snapshot,e.entity,{},t.env).length===e.value;if(e.kind==="singleton"){let n=nt(e.assertion.value,Z,t.env);return rp(t.snapshot.singletons[e.singleton])===rp(n)}return e.kind==="not"?!Dl(e.predicate,t):e.predicates.every(n=>Dl(n,t))}function rp(e){return e==null?"\u2205":JSON.stringify(e)}function Ur(e,t,n){let r=dt(e.requiredState,t);return r==null?null:new Map([...r,...Object.entries(n).map(([i,o])=>[At(i),o])])}function jr(e,t,n){let r=ip(e.whenSteps,n,t),i=r.at(-1)??e.effectStep,o=Un(i,t),s=yA(e,t);return{effect:gA(o.effect,s),steps:r.map(a=>{let l=Un(a,t);return{action:l.action,effect:l.effect,pendingChecks:l.pendingChecks,reconcile:l.reconcile,source:a,verifyChanges:l.verifyChanges}})}}function lo(e,t,n){return dt(e.requiredState,n)==null?!1:ao(t(n))!==ao(n)||bA(e)||pA(e)}function pA(e){return[...e.nav,...e.steps].every(t=>t.expect.every(n=>n.kind!=="state"))}var sp=new WeakMap;function ao(e){let t=sp.get(e);if(t!=null)return t;let n=G({entities:[...e.entities].map(([r,i])=>[r,[...i]]),singletons:mA(e.singletons)});return sp.set(e,n),n}function mA(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>t==="url"&&typeof n=="string"?[t,$t(n)]:[t,n]))}function yA(e,t){let n=e.nav.at(-1);return n==null?void 0:Un(n,t).action.url}function gA(e,t){if(t==null)return e;let n=$t(t);return r=>{let i=e(r);return{...i,singletons:{...i.singletons,url:n}}}}function bA(e){return e.effectStep.expect.some(t=>t.kind==="state"&&t.assertion.kind==="updated"&&Object.values(t.assertion.props).some(n=>tn(n)))}function uo(e,t,n){let r=Ur(e,t.snapshot,n);if(r==null)return null;let i=SA(e,r,t.snapshot);return i==null||!lo(e,i.effect,t.snapshot)?null:{next:{snapshot:i.effect(t.snapshot)},resolved:i}}function ap(e,t,n){let r=Ur(e,t.snapshot,n);if(r==null)return"required-state-unsatisfied";try{return jr(e,r,t.snapshot),"no-effect"}catch{return"unresolvable"}}function SA(e,t,n){try{return jr(e,t,n)}catch{return null}}function co(e,t,n){return e.flatMap((r,i)=>{let o=n(r),s=uo(r,t,o);return s==null?[]:[{idx:i,label:Et(r),params:o,stepRun:s}]})}var wA={absences:[],entities:[],exclusives:[],singletons:{}};function Vn(e){return{...wA,...e}}function Vr(e,t){if(e==null)return new Set;if(e.by==="inside")return new Set([...Vr(e.scope,t),...Vr(e.target,t)]);let n=e.by==="role"?e.name:e.value;return new Set(t(n))}function fo(e){return xA(e).flatMap(t=>vA(t))}function xA(e){return[...e.reduce((n,r)=>{let i=G([r.when.singletons,r.consequence]);return new Map([...n,[i,[...n.get(i)??[],r]]])},new Map).values()]}function vA(e){if(e.length<2)return[];let t=e.map(o=>new Set(o.when.entities.map(s=>Fl(s)))),[n]=t;if(n==null)return[];let r=[...n].filter(o=>t.every(s=>s.has(o))),i=e.toSorted((o,s)=>o.when.entities.length-s.when.entities.length)[0];return i==null||r.length===i.when.entities.length?[]:RA(e,r)?[]:kA(i,r,PA(e))}function Fl(e){return G([e.entity,e.literals])}function RA(e,t){return e.some(n=>{let r=lp(n.consequence),i=AA(r),o=CA(r);return n.when.entities.some(s=>!t.includes(Fl(s))&&(EA(s,i)||o.has(s.alias)))})}function lp(e){return e.kind==="not"?lp(e.predicate):"locator"in e?e.locator:void 0}function AA(e){return Vr(e,t=>t==null||pe(t)||Ze(t)?[]:[t])}function CA(e){return Vr(e,t=>{if(t==null||!pe(t))return[];let n=mn(t.ref);return n==null?[]:[n.alias]})}function EA(e,t){return Object.values(e.literals).some(n=>typeof n=="string"&&t.has(n))}function kA(e,t,n){let r=e.when.entities.filter(l=>t.includes(Fl(l))),i=e.when.entities.filter(l=>!r.includes(l)).filter(l=>e.when.exclusives.includes(l.entity)).map(l=>({...l,literals:{},relations:[]})),o=[...r,...i],s=new Set(o.map(l=>l.alias));if(![...e.refs].every(l=>s.has(l)))return[];let a=Vn({entities:o.map(l=>IA(l,s)),exclusives:e.when.exclusives.filter(l=>o.some(u=>u.entity===l)),singletons:e.when.singletons});return[{consequence:e.consequence,origin:{kind:"generalized",tests:n},refs:e.refs,when:a}]}function IA(e,t){return{...e,relations:e.relations.filter(n=>t.has(n.targetAlias))}}function PA(e){return[...new Set(e.flatMap(t=>t.origin==null?[]:t.origin.kind==="generalized"?t.origin.tests:[t.origin.test]))]}function fp(e){return e.flatMap((t,n)=>e.slice(n+1).flatMap(r=>pp(t,r)))}function hp(e,t){return pp(e,t).length>0}function pp(e,t){let n=up(e.when,t.when);return!n&&!up(t.when,e.when)||!TA(e.consequence,t.consequence)?[]:[{a:e.consequence,b:t.consequence,when:n?t.when:e.when}]}function up(e,t){return cp(e.entities,t.entities)&&cp(e.absences,t.absences)&&e.exclusives.every(n=>t.exclusives.includes(n))&&MA(e.singletons,t.singletons)}function cp(e,t){let n=new Set(t.map(r=>G(r)));return e.every(r=>n.has(G(r)))}function MA(e,t){return Object.entries(e).every(([n,r])=>n in t&&G(t[n])===G(r))}function TA(e,t){return e.kind==="not"?Bl(e.predicate,t):t.kind==="not"?Bl(e,t.predicate):OA(e,t)||NA(e,t)}function Bl(e,t){return e.kind===t.kind&&"locator"in e&&"locator"in t&&mp(e,t)}function mp(e,t){return"locator"in t&&G(e.locator)===G(t.locator)}function OA(e,t){let n=new Set([e.kind,t.kind]);return n.has("enabled")&&n.has("disabled")&&"locator"in e&&"locator"in t?mp(e,t):!1}function NA(e,t){let n=dp(e),r=dp(t);return n==null||r==null||e.kind!==t.kind?!1:Bl(e,t)&&G(n)!==G(r)}function dp(e){return e.kind==="value"||e.kind==="text"?e.value:null}function yp(e,t){return e.flatMap(n=>{let r=_A(n),i=new Set(n.requiredState.absences.map(o=>o.entity));return t.flatMap(o=>$A(n,o,r,i))})}function _A(e){return new Set(e.steps.flatMap(t=>t.expect.flatMap(n=>n.kind==="state"&&n.assertion.kind==="deleted"?[n.entity]:[])))}function $A(e,t,n,r){let{source:i,target:o}=t.reference;return!n.has(o)||n.has(i)||r.has(i)?[]:[{dataRule:t,source:i,target:o,transition:Et(e)}]}function Ul(e){return G({consequence:e.consequence,when:e.when})}function po(e){let t=[...LA(e),...YA(e)],n=fo(t).reduce((r,i)=>[...t,...r].some(s=>hp(i,s))?r:[...r,i],[]);return Dt([...t,...n],Ul)}function mo(e,t){return e.filter(n=>!DA(n)||FA(n)===t)}function yo(e){return e.kind==="not"?yo(e.predicate):e.kind==="visible"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused"||e.kind==="checked"||e.kind==="value"||e.kind==="text"}function go(e,t,n){if(dt(e.when,t)!=null)return null;let r=dt(e.when,n);return r==null?null:XA(e,r)}function LA(e){return Dt(Ct(e).flatMap(t=>BA(e,t)),Ul)}function DA(e){return e.origin==null||e.origin.kind==="generalized"?!1:bn(e.consequence).some(t=>mn(t)!=null)}function FA(e){let{origin:t}=e;if(!(t==null||t.kind==="generalized"))return t.test}function BA(e,{test:t,workflow:n}){let r=so(e,t),i=UA(n.steps);return t.steps.reduce((o,s)=>({pageRules:[...o.pageRules,...KA({branchScoped:i,namespace:r.namespace,origin:{kind:"test",test:rt(t)},requiredState:o.requiredState,step:s})],requiredState:jA(o.requiredState,s,r)}),{pageRules:[],requiredState:r.requiredState}).pageRules}function UA(e){let t=e.flatMap(n=>n.expect).flatMap(n=>ho(n)).map(n=>G(n));return new Set(t)}function ho(e){return e.kind==="not"?ho(e.predicate):e.kind==="and"?e.predicates.flatMap(t=>ho(t)):e.kind!=="when"?[]:e.branches.flatMap(t=>t.consequence.flatMap(n=>[n,...ho(n)]))}function jA(e,t,n){return t.expect.reduce((r,i)=>i.kind==="state"?VA(r,i,n):r,e)}function VA(e,t,n){if(t.assertion.kind==="created"){let o=WA(t.assertion.as,t.entity,t.assertion.props,n);return{...e,entities:[...e.entities,o]}}let r=oo(t.key,t.entity,n.namespace);if(r==null)return e;if(t.assertion.kind==="deleted")return HA(e,r);let i=yn(t.assertion.props);return{...e,entities:e.entities.map(o=>o.alias===r?bp(o,i,n):o)}}function WA(e,t,n,r){return bp({alias:e,entity:t,literals:{},relations:[]},n,r)}function bp(e,t,n){return Object.entries(t).reduce((r,[i,o])=>{if(Ze(o))return r;if(pe(o)){let s=zA(o.ref,i,n.namespace);return{...r,literals:GA(r.literals,i),relations:s==null?r.relations:[...gp(r.relations,i),s]}}return{...r,literals:{...r.literals,[i]:o},relations:gp(r.relations,i)}},e)}function zA(e,t,n){let r=mn(e);if(r==null)return;let i=n.get(r.alias);return i==null?void 0:{entity:i,field:t,targetAlias:r.alias,targetField:r.field}}function GA(e,t){return Object.fromEntries(Object.entries(e).filter(([n])=>n!==t))}function gp(e,t){return e.filter(n=>n.field!==t)}function HA(e,t){let n=e.entities.find(i=>i.alias===t),r=qA(e,t);return n==null?r:{...r,absences:[...r.absences,{entity:n.entity,literals:n.literals,relations:n.relations}]}}function qA(e,t){return{...e,entities:e.entities.filter(n=>n.alias!==t)}}function KA({branchScoped:e,namespace:t,origin:n,requiredState:r,step:i}){if(i.action.kind!=="goto")return[];let o=i.action.url;return i.expect.filter(s=>yo(s)).filter(s=>!e.has(G(s))).map(s=>Sp({consequence:s,namespace:t,origin:n,requiredState:r,url:o}))}function Sp({consequence:e,namespace:t,origin:n,requiredState:r,url:i}){return{consequence:e,origin:n,refs:new Set(Yh([...ct(i),...bn(e)],t).map(o=>o.aliasPath)),when:{...r,singletons:{...r.singletons,url:i}}}}function YA(e){return Dt(Sn(e).flatMap(t=>ZA(t)),Ul)}function ZA(e){let t=e.nav.at(-1),n=e.steps[0]?.action,r=n!=null&&"locator"in n?n.locator:void 0;return t==null||t.action.kind!=="goto"||r==null?[]:[Sp({consequence:{kind:"enabled",locator:r,wait:void 0},namespace:e.namespace,origin:{intent:e.intent,kind:"trigger",test:e.test},requiredState:e.requiredState,url:t.action.url})]}function XA(e,t){try{let n=no(e.consequence,t);return n==null?null:{check:n}}catch{return null}}function bo(e){return qh(Ct(e).flatMap(t=>JA(e,t.test)))}function So(e,t){return dt(e.when,t)==null?!1:dt(e.holds,t)==null}function JA(e,t){let n=so(e,t);return n.requiredState.entities.flatMap(r=>r.relations.flatMap(i=>QA(e,r,i,n.namespace)?nC(r,i,n.namespace):[]))}function QA(e,t,n,r){let i=r.get(n.targetAlias);return i!=null&&!eC(e,t.entity,n.field)&&tC(e,i,n.targetField)}function eC(e,t,n){return e.entities.find(r=>r.name===t)?.props[n]?.optional===!0}function tC(e,t,n){return e.entities.find(r=>r.name===t)?.identity.includes(n)===!0}function nC(e,t,n){let r=n.get(t.targetAlias);if(r==null)return[];let i=wp(e.alias,e.entity),o=wp(t.targetAlias,r);return[{holds:Vn({entities:[{...i,relations:[t]},o]}),reference:{field:t.field,source:e.entity,target:r,targetField:t.targetField},when:Vn({entities:[i]})}]}function wp(e,t){return{alias:e,entity:t,literals:{},relations:[]}}function xp(e,t){let n=[...t.entities].flatMap(([o,s])=>[...s].map(([a,l])=>rC({entity:o,key:a,pre:e,row:l}))),r=[...e.entities].flatMap(([o,s])=>[...s].flatMap(([a,l])=>iC({entity:o,key:a,post:t,row:l}))),i=Object.entries(t.singletons).map(([o,s])=>({changed:e.singletons[o]!==s,name:o,value:s}));return{rows:[...n,...r],singletons:i}}function rC({entity:e,key:t,pre:n,row:r}){let i=oC(n.entities.get(e),t),o=Object.entries(r).map(([s,a])=>({changed:i==null||i[s]!==a,field:s,value:a}));return{changed:i==null||o.some(s=>s.changed),entity:e,fields:o,key:t,status:i==null?"created":"present"}}function iC({entity:e,key:t,post:n,row:r}){if(n.entities.get(e)?.has(t)===!0)return[];let i=Object.entries(r).map(([o,s])=>({changed:!1,field:o,value:s}));return[{changed:!0,entity:e,fields:i,key:t,status:"deleted"}]}function oC(e,t){return e?.get(t)}function wo(e,t,n){return t.steps.map(r=>({effect:r.effect,pendingChecks:r.pendingChecks.map(i=>({budget:i.budget,check:{kind:"poll",run:()=>n.evaluate(i.check)},source:{check:i.check,kind:"step"},targetIds:()=>n.locateIds(xo(i.check))})),reconcile:r.reconcile,source:r.source,step:{action:r.action,intent:e.intent,test:e.test},sync:e.wait,verifyChanges:r.verifyChanges,perform:()=>n.perform(r.action),requiredState:()=>!0,targetIds:()=>n.locateIds(r.action.locator)}))}function xo(e){if(e.kind==="not")return xo(e.inner);if(e.kind!=="browser")return e.locator}async function Vl(e,t){let{params:n,transition:r}=e.stepRun,i=uo(r,e.state,n);if(i==null){let s={intent:r.intent,kind:"unrunnable",reason:ap(r,e.state,n),test:r.test};return{label:Et(r),next:e.state,result:{finalModel:e.state.snapshot,findings:[s]}}}let o=await Qi({canon:e.canon,classify:e.classify,initialSnapshot:e.state.snapshot,observe:e.driver.observe,onAssertion:e.onAssertion,onStep:e.onStep,pageRulePendingChecks:sC(e.pageRules,e.dataRules,e.driver),steps:wo(e.stepRun.transition,i.resolved,e.driver),stopAfterStep:e.stopAfterStep==null?void 0:e.stopAfterStep-e.stepBase},t);return{label:Et(e.stepRun.transition),next:{snapshot:o.finalModel},result:o}}function vp(e,t){return So(e,t)?[{budget:"fast",check:{kind:"decided",passed:!1},source:{dataRule:e,kind:"data-rule"},targetIds:()=>Promise.resolve([])}]:[]}function sC(e,t,n){return(r,i)=>[...e.flatMap(o=>aC(o,r,i,n)),...t.flatMap(o=>vp(o,i))]}function aC(e,t,n,r){let i=go(e,t,n);return i==null?[]:[{budget:"fast",check:{kind:"poll",run:()=>r.evaluate(i.check)},source:{check:i.check,kind:"page-rule",origin:e.origin},targetIds:()=>r.locateIds(xo(i.check))}]}function Wr(e,t){return jl({acc:{findings:[],ran:[]},index:0,params:e,signal:t,state:e.initialState,stepBase:0})}async function jl({acc:e,index:t,params:n,signal:r,state:i,stepBase:o}){Lt(r);let s=n.sequence[t];if(s==null)return e;let a=Date.now(),l=[],u=await Vl({canon:n.canon,classify:n.classify,dataRules:n.dataRules,driver:n.driver,onAssertion:n.onAssertion,pageRules:n.pageRules,state:i,stepBase:o,stepRun:s,stopAfterStep:n.stopAfterStep,onStep:d=>{l.push(d.index),n.onEvent({annotations:d.annotations,endMs:d.endMs,findings:d.findings,index:o+d.index,kind:"step",source:d.source,startMs:d.startMs,state:xp(d.pre,d.post),url:d.url})}},r);if(u==null)return jl({acc:e,index:t+1,params:n,signal:r,state:i,stepBase:o});n.onEvent({endMs:Date.now(),intent:s.transition.intent,kind:"ran",startMs:a}),u.result.findings.forEach(d=>{n.onEvent({finding:d,kind:"finding"})});let c={findings:[...e.findings,...u.result.findings],ran:[...e.ran,u.label]};return u.result.findings.length>0||n.stopAfterStep!=null&&o+l.length>=n.stopAfterStep?c:jl({acc:c,index:t+1,params:n,signal:r,state:u.next,stepBase:o+l.length})}var zr={value:e=>lC(e)};function Co(e,t){return{value:n=>e.value({...n,seed:`${t}:${n.seed}`})}}function Eo(e,t){return{value:n=>e.value({...n,anchor:t})}}function lC({anchor:e,constraints:t,generator:n,nullable:r,seed:i,type:o,values:s,valueSpace:a}){let l=Wl(`${a}:${i}`);return r&&l%4===0?null:s!=null&&s.length>0?s[l%s.length]??s[0]??null:n==="date.iso"?uC({anchor:e,constraints:t,n:l,timeHash:Wl(`${a}:${i}#tod`)}):o==="number"?cC(l,t):o==="boolean"?l%2===0:mC(n,l)}var vo=864e5;function uC({anchor:e,constraints:t,n,timeHash:r}){if(t?.kind!=="datetime")throw new Error("datetime value space requires offsetDays constraints");if(e==null)throw new Error("datetime value space requires a run anchor timestamp");let i=Date.parse(e);if(Number.isNaN(i))throw new TypeError(`datetime anchor "${e}" is not a valid ISO timestamp`);let o=t.maxOffsetDays-t.minOffsetDays+1,s=o<=0?t.minOffsetDays:t.minOffsetDays+n%o,a=Math.floor(i/vo)*vo;return new Date(a+s*vo+r%vo).toISOString()}function Wl(e,t=0,n=7){return t>=e.length?n>>>0:Wl(e,t+1,n*31+(e.codePointAt(t)??0)>>>0)}function cC(e,t){if(t?.kind!=="number"||t.min==null||t.max==null)throw new Error("number value space requires min and max constraints");let n=t.max-t.min+1;return n<=0?t.min:t.min+e%n}var dC=["ada","bruno","carmen","dario","elena","felix","greta","hugo","iris","jonas","kira","lena","mateo","nadia","oscar","petra","quinn","rosa","stefan","tara","ugo","vera","wim","yara"],fC=["abreu","berg","costa","duval","eriksen","fischer","garza","holm","ito","jansen","kovac","laurent","moreau","novak","okafor","petrov","quist","rossi","sato","tanaka","ueda","vargas","weber","zhang"],hC=["amber","brisk","calm","deep","early","fond","glad","hazel","ivory","jade","keen","lush","mauve","noble","opal","plum","quiet","rapid","sage","teal","umber","vivid","warm","zesty"],pC=["aspen","brook","cedar","dune","ember","fjord","grove","harbor","isle","juniper","knoll","lagoon","meadow","nimbus","orchid","prairie","quartz","ridge","summit","thicket","umbra","vale","willow","zephyr"];function Ro(e,t){let n=e[t%e.length];if(n==null)throw new Error("empty word list");return n}function Ao(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function mC(e,t){let n=Ro(dC,t),r=Ro(fC,Math.floor(t/31)),i=Ro(hC,t),o=Ro(pC,Math.floor(t/29));return e==="internet.email"?`${n}.${r}${String(t%100)}@test.ripplo.ai`:e==="internet.url"?`https://${i}-${o}.example.com`:e==="person.fullName"?`${Ao(n)} ${Ao(r)}`:e==="company.name"?`${Ao(i)} ${Ao(o)}`:e==="lorem.slug"?`${i}-${o}`:`${o}-${String(t%1e3)}`}var ie=Ta(Cp(),1),Ne={actual:e=>ie.default.red(e),bad:e=>ie.default.red(ie.default.bold(e)),bold:e=>ie.default.bold(e),dim:e=>ie.default.dim(e),expected:e=>ie.default.green(e),good:e=>ie.default.green(ie.default.bold(e)),heading:e=>ie.default.bold(ie.default.cyan(e)),path:e=>ie.default.cyan(ie.default.underline(e)),warn:e=>ie.default.yellow(ie.default.bold(e))},SC={assertion:ie.default.yellow,consistency:ie.default.magenta,"data rule":ie.default.yellow,driver:ie.default.red,"impossible action":ie.default.cyan,"page rule":ie.default.yellow,skipped:ie.default.red};function ft(e){return`${ie.default.red(ie.default.bold("\u2717"))} ${SC[e](ie.default.bold(e))}`}var wC=ie.default.red("\u2717"),rB=ie.default.green("\u2713"),xC=ie.default.dim("\u203A"),vC=8;function Ep(e,t,n){let r=n==null?"":` ${Ne.dim(n)}`;return` ${Ne.dim(e.padStart(vC))} ${t}${r}`}function wn(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${wn(e.scope)} \u25B8 ${wn(e.target)}`:e.name==null?e.role:`${e.role} "${e.name}"`}function Mo(e){return e.url!=null?`${e.kind} ${e.url}`:e.locator!=null?`${e.kind} ${wn(e.locator)}`:e.kind}function xn(e){return e.kind==="not"?`not ${xn(e.inner)}`:e.kind==="browser"?`${e.name}="${e.value}"`:e.kind==="value"||e.kind==="text"?`${e.kind} ${wn(e.locator)}="${e.value}"`:`${e.kind} ${wn(e.locator)}`}function zn(e){let{field:t,source:n,target:r,targetField:i}=e.reference;return`${n}.${t} \u2192 ${r}.${i}`}function Hl(e){return`${e.intent} \u203A ${Mo(e.action)}`}function ql(e){return e.kind==="data-rule"?`data rule ${zn(e.dataRule)}`:`${e.kind} ${xn(e.check)}`}function _e(e){return e==null?"\u2205":JSON.stringify(e)}function Kl(e){return e.kind==="unexpected-row"?`${e.entity} "${e.key}" present in the app but the test expected none`:e.kind==="missing-row"?`${e.entity} "${e.key}" expected by the test but missing in the app`:e.kind==="wrong-value"?`${e.entity}.${e.field} [${e.key}] expected=${_e(e.snapshot)} actual=${_e(e.sut)}`:e.kind==="expected-change"?`${e.entity}.${e.field} [${e.key}] expected to change but stayed ${_e(e.value)}`:`${e.singleton} expected=${_e(e.snapshot)} actual=${_e(e.sut)}`}function To(e){return{label:ql(e.source),step:Hl(e.step)}}function Oo({evidencePath:e,finding:t}){let n=RC(t);return e==null?n:`${n} Evidence: ${Ne.path(e)}`}function Yl(e){return CC(EC(e))}function RC(e){return e.kind==="consistency"?OC(e):e.kind==="pending-check"?$C(e.source,e.step,e.budget):e.kind==="impossible-action"?`${ft("impossible action")} The step "${e.step.intent}" ran ${Mo(e.step.action)} from a state the test says can't happen. Either the test's required state is stricter than the app really is, or the app exposes this action somewhere it shouldn't \u2014 check which before loosening the test.`:e.kind==="unrunnable"?`${ft("skipped")} The planned step "${e.intent}" could not run \u2014 ${Ip(e.reason)}. A planned move was skipped, so this run proved less than it claims \u2014 fix the plan or the starting state rather than ignoring the skip.`:`${ft("driver")} The browser failed while running "${e.step.intent}" \u2014 ${en(e.error)}. This is an environment failure (daemon, dev server, ports), not an app or test bug \u2014 fix the run environment and rerun.`}var AC=new RegExp(`${String.fromCodePoint(27)}\\[[0-9;]*m`,"g");function CC(e){return e.replaceAll(AC,"").replaceAll(/\s+/g," ").trim()}function EC(e){if(e.kind==="consistency"){let t=e.step==null?"":` after "${e.step.intent}"`;return`${Kl(e.mismatch)}${t}`}return e.kind==="pending-check"?`${DC(e.source)} failed at "${e.step.intent}": ${FC(e.source)}`:e.kind==="impossible-action"?`"${e.step.intent}" ran from a state the test says can't happen`:e.kind==="unrunnable"?`planned step "${e.intent}" could not run \u2014 ${Ip(e.reason)}`:`driver failed at "${e.step.intent}": ${en(e.error)}`}var kC={"no-effect":"the action has no observable effect from this state","required-state-unsatisfied":"the live state doesn't satisfy the step's required state",unresolvable:"a step references a value that doesn't exist yet (e.g. a not-yet-created id)"};function Ip(e){return kC[e]}function Pp({debugDir:e,runId:t}){let n=`${e}/${t}`;return Ep("behavior",Ne.path(`${n}/behavior.jsonl`),void 0)}function Mp(e){if(e.kind==="cascade-gap"){let{gap:n}=e;return`${ft("data rule")} ${n.transition} deletes ${n.target} but leaves ${n.source} rows pointing at the deleted row. That breaks the data rule ${zn(n.dataRule)} \u2014 cascade the delete in the app or declare the cleanup on the deleting step.`}if(e.kind==="create-gap"){let{gap:n}=e,r=n.missing.length===1?"field":"fields",i=n.missing.length===1?"it":"them";return`${ft("data rule")} ${n.transition} creates ${n.entity} without setting the required ${r} ${n.missing.join(", ")}. Set ${i} on the creating step or drop the requirement from the entity.`}let{conflict:t}=e;return`${ft("page rule")} Two page rules contradict each other \u2014 ${t.a.kind} vs ${t.b.kind} when ${JSON.stringify(t.when.singletons)}. They were learned from different tests asserting opposite things about the same page \u2014 one of those tests is wrong, fix it before trusting either rule.`}function Tp(e){return"locator"in e&&e.locator!=null?`${e.kind} ${Gl(e.locator)}`:"url"in e?`${e.kind} ${IC(e.url)}`:e.kind}function IC(e){return typeof e=="string"?e:"ref"in e?`{${e.ref}}`:Op(e)}function Gl(e){return e.by==="role"?e.name==null?e.role:`${e.role} ${kp(e.name)}`:e.by==="inside"?`${Gl(e.scope)} \u25B8 ${Gl(e.target)}`:kp(e.value)}function kp(e){return e===null?"\u2205":typeof e=="string"?`"${e}"`:typeof e!="object"?String(e):"ref"in e?`{${e.ref}}`:Op(e)}function Op(e){return e.template.map(t=>typeof t=="string"?t:":id").join("")}function Po(e){return e==null?"At the end of the run":`After ${MC(e.action)} in ${e.intent}`}var PC={click:"clicking",fill:"filling",goto:"opening",hover:"hovering over",press:"pressing",select:"selecting",upload:"uploading to"};function MC(e){return e.url!=null?`opening ${e.url}`:e.locator!=null?`${PC[e.kind]??e.kind} ${Wn(e.locator)}`:e.kind}function Wn(e){return e.by==="testId"?`the element with testId "${e.value}"`:e.by==="inside"?`${Wn(e.target)} inside ${Wn(e.scope)}`:e.name==null?`the ${e.role}`:`the "${e.name}" ${e.role}`}function TC(e){return e.kind==="not"&&e.inner.kind==="visible"?`${Wn(e.inner.locator)} never disappeared`:e.kind==="visible"?`${Wn(e.locator)} never appeared`:e.kind==="value"||e.kind==="text"?`${Wn(e.locator)} never showed "${e.value}"`:`the check ${xn(e)} never held`}function OC(e){let t=e.pending?NC(e):_C(e.mismatch,e.step);return`${ft("consistency")} ${t}`}function NC(e){let t=`${Np(e.budget)} wait window`,n="If this write is legitimately slow, declare wait: on the expectation or move it to a slower tier.",{mismatch:r}=e,i=Po(e.step);return r.kind==="wrong-value"?`${i}, ${r.entity}.${r.field} on row "${r.key}" never changed within the ${t} \u2014 it still showed ${Ne.actual(_e(r.sut))} instead of ${Ne.expected(_e(r.snapshot))}, so the write may not have landed at all. ${n}`:r.kind==="unexpected-row"?`${i}, the ${r.entity} row "${r.key}" was still there at the end of the ${t} \u2014 the delete may not have landed. ${n}`:r.kind==="missing-row"?`${i}, the ${r.entity} row "${r.key}" never appeared within the ${t} \u2014 the create may not have landed. ${n}`:r.kind==="expected-change"?`${i}, ${r.entity}.${r.field} on row "${r.key}" was expected to change but stayed ${Ne.actual(_e(r.value))} through the ${t}, so the write may not have landed at all. ${n}`:`${i}, ${r.singleton} never changed within the ${t} \u2014 it still showed ${Ne.actual(_e(r.sut))} instead of ${Ne.expected(_e(r.snapshot))}, so the write may not have landed at all. ${n}`}function Np(e){return`${String(Nr[e]/1e3)}s`}function _C(e,t){let n=Po(t);return e.kind==="wrong-value"?`${n}, ${e.entity}.${e.field} on row "${e.key}" showed ${Ne.actual(_e(e.sut))} but the test expected ${Ne.expected(_e(e.snapshot))}. This is an app bug if the expected value is the promised behavior \u2014 if the app legitimately owns this value, assert changed() instead.`:e.kind==="singleton-mismatch"?`${n}, ${e.singleton} showed ${Ne.actual(_e(e.sut))} but the test expected ${Ne.expected(_e(e.snapshot))}. This is an app bug if the expected value is the promised behavior \u2014 otherwise correct the expected value at the step that sets it.`:e.kind==="unexpected-row"?`${n}, the app held a ${e.entity} row "${e.key}" the test never expected. Some step writes this row without declaring it \u2014 declare the effect on the acting step (${e.entity}.created, updated, or deleted), or if this write belongs to a different flow, cover it in that flow's test.`:e.kind==="missing-row"?`${n}, the test expected a ${e.entity} row "${e.key}" but the app had none. This is an app bug if the write was promised \u2014 if it only happens from a different starting state, restrict this test's given and cover that state in its own test.`:`${n}, ${e.entity}.${e.field} on row "${e.key}" was expected to change but stayed ${Ne.actual(_e(e.value))}. This is an app bug if this action should change it \u2014 if the change needs other preconditions, split that case into its own test with the right given.`}function $C(e,t,n){let r=`${Np(n)} wait window`;return e.kind==="data-rule"?`${ft("data rule")} ${Po(t)}, the data rule ${zn(e.dataRule)} stopped holding \u2014 a referenced row went missing. This is an app bug if the reference should survive this action \u2014 confirm in behavior.jsonl before relaxing the rule.`:e.kind==="page-rule"?`${ft("page rule")} A page rule learned from ${LC(e.origin)} says ${xn(e.check)} at this URL \u2014 it never held here within the ${r}. Either the rule is broader than the app guarantees or this page regressed \u2014 confirm in behavior.jsonl before narrowing the rule.`:`${ft("assertion")} ${Po(t)}, ${TC(e.check)} within the ${r}. This is usually a wrong accessible name, a UI regression, or a starting state this page doesn't have \u2014 confirm in behavior.jsonl before changing the test.`}function LC(e){return e==null?"another workflow":e.kind==="test"?`an assertion in test "${e.test}"`:e.kind==="trigger"?`the trigger of "${e.intent}" in test "${e.test}"`:`tests ${e.tests.map(n=>JSON.stringify(n)).join(", ")}`}function DC(e){return e.kind==="data-rule"?"data rule":e.kind==="page-rule"?"page rule":"assertion"}function FC(e){return e.kind==="data-rule"?zn(e.dataRule):xn(e.check)}function Gr(e){return{dataRules:bo(e),pageRules:po(e)}}var _p=Object.defineProperty,$p=(e,t)=>{let n={};for(var r in e)_p(n,r,{get:e[r],enumerable:!0});return t||_p(n,Symbol.toStringTag,{value:"Module"}),n};var BC=class Lp{constructor(t){this.seed=t}clone(){return new Lp(this.seed)}next(){let t=Zl(this.seed),n=Xl(t),r=Zl(t),i=Xl(r);return this.seed=Zl(r),Xl(this.seed)+(i+(n<<15)<<15)|0}jump(){this.seed=Math.imul(this.seed,1994129409)+916127744&4294967295}getState(){return[this.seed]}};function Zl(e){return Math.imul(e,214013)+2531011&4294967295}function Xl(e){return(e&-2147483649)>>16}function Dp(e){return new BC(e)}var UC="SUSgbA\\W`E[]KN2RUSo8XVU?HKBFRl11E\\KoWOg5B]XEWG;BE;1:oVK[`B^Z9Qd23^XTnhL>]Unda4f[X;_j9H5QD=cN<5H`3bW>9bk1mjoI2fK0obmAAINOV:>Mek_V9dd<hZ\\gC3?Fm7FEk07QH_3PLm^@?^i\\QMkgP<]oLHmFnlecg5F@7U^@4jhZ?WZS0k@GHehmM36:5^9;>Hmm`co>k:KOSkSbIINb1VFf>LXgP>GUAQTD>Ci>XMGkUflLlb?_FaFUk@?5N7i70@;1o68ah@I<HFH7R2^J:G][Gf962ITWID9GWK8ElD2G5=DcHcL]cA]P2n7A=[<bInM;IHDQnJMReRXDWbVldnGEIPij`E08Xdci3@0c:IBbD4:Nk]?lEN9j^;T`0blZX7eiWE8c`<ak7j05FZi>AjUDh?M1B?^??FAXKThf<aBOXZf7jXYGK>R<;NHk3S9YhM7STJ6`:MIE`S@7298X8W>PNK=@;lLX<i\\TXLL<W@X[X54H]in8M;;n?kkQbajgAMY=Tf9b;ZKf0QUB2FHYWfnfkDoU9YkcLd95T>lK6GM1YL\\lid:J>KYS=iJ]Y>QlF>?R5_[5QeYC=66;A32Ac>OHk_ne^0g>bK:g;KFPgbGUcPR_Z=TX3H9d03bKZ2IhEPKBo>LSGWd0iFdV8C<Y:<>T[O6lC\\blaZ>GoAYP4clf^j1IfnZJ]QeDe2X<HE[LJNWnaCg[P]Co^:IRbWPY?97UePBlZNNHY6LOBM8P>=h?Ye:_f_Sb9Ki5GDYBF4dWeMfdg^ccPllNWM7G1\\UMdoYeOOD5^e@foA22G?ADYo5:FVG[bWo96;>3kc_c1Ab30>30;1@4F8g2hY?DJ4[LOL;ZLLKo2]jo>[KMDUcR279N_kF=3WL@Dd620bMTdA\\U9k``ef2iD9JgJ8CZBHS>F^Uk;<laeaeHS<15OSeS`PcSSKBRBFY]aQ=EgUXGNg=?d56`KA@2BejY0^[_DCX`L=CGMT=BW^6S1i@2ATBVk>3_ocRA>2U:4GPQ6o>5jX2HIcV3S@On6KB<[SKB?FC_AAji9agbBFkAi\\;4I\\UJ]c36Ub@[;gQACVGY<V]SDJBUU]La\\_a@JdOO8gm2T0DJMa:8Hf7>E]noQ[1Kambn??QQ]S?1i0oMGOijb\\aGY6lQ^CJ?9bFle8<eH4UUjBINX;n8@VOA5ah^URV49B[A?ONHhHAC1J5;;h0SXYlG^0W=eJdHh^K4SGe=1HZLLam;D<Q3AOdbPcdX``82\\jo0En8jRVGC73WMCF9`d:0heS?80?C188cSn7H9<daZ]MgS4Pb^1HkA:1PU^5>^h_g[RQV@PnYBRI_]`B]Bh@Uk03eXGY`I16L76H28X`R>IROMeNVUdU[:lghLhPCQZ:4a<30YBZCYnXe[?;jc8gKI2QH2MjnWBm4nGCZW`aVU2a;P<AMI25mlW_Nm][2?b6o851X@lAm]YZ`bWRF1g<Ga:T]1NXH5Veja5P9S9>:aNg:Th1Y=5o78K>LQ8hW@5S?I83Lk5Xk;j5@I3o[d:4RjE^oS30:WP9gC\\i8aSI>QRE@4lP:7lDg8g2`Ql[2I8aBU\\BQ?B4_clL9Q]S;^e1Ob5[>3JER2`c7B=o]fPOWO<DGi;Niba1PoWPPE_Q3aX0OB0mZej\\f_M[J4Y6]1`h2MkF[GiW8Q^d3^_=<I1N2Q7]2<2j[iP7V3V821FaI]A`93bC^Z\\G=WJ;^Ih?B97_iIF@\\Dl<eK1je8SNTWo_=XFMZH<<JYLZ^YQMPgYOV45K_:]kSI8^XlO0]GY=VUfe_C_F6TOcoAlVUH:o=WhhT@K`2KFhe<3\\KXQ>W:M?S_4S5d@J^`[AGA7@3]DnGSCO`\\?E8HT75^d9\\:m\\m1egIfk8cd6bD9\\eU8\\n[Pb0Cgd^S0n9kGJHb]i5XodlKHc34Fhi9K>0U5WK`>7Ff2^KL=WC6:kc?e5C^a1T1:4:^S5flXlGNIj08AfO?Dh7T7dWO>E]NI9?ob7B7P_h[4TEP[EU;GllFTnSmg9:\\[N]<SAoKP_kPlG56A:I3T6EG8Hj=XnUE`KT5U@OQ?]7[N^MFN1_NU4KO_3::Le`8IL9[1Z1H1;V3SC\\N3]S@4U[F2mhT5dYM7[4Pg_Na0_8WTH0`bgceQS8]EG;XgD4Ib4iLTP@kE79Mn>AYRJA1U5^Blhgno:aHVYc03c3J0Vc9FjEV^M75Zfd8kVC9>iJDk`AJ[6f7DK2D^DL\\AX:6b5h31XH;RQB\\N<ZSM=J;6L[`UW^eOIFc1Y]6_dfedIe4ARh72mTXC0WND_IDHVCZRDE0eODARCEETQI5TPUQE=jEH5bS?LP[ai`F5ABRYDo2o\\@=]GT?_9;hc4Lm:\\SF9k1T<0E@fX9BG[]g0nY7k[Qmi@la8`PF0j6@Q?Ii7bLkXQ<lLHf]`:DCh@9JY5>hEVLTdhL\\b1EB0lLh<=WaO@F<;8g<d:@e:LA:cFIEdmQh7hNHfSRToW?8N4:Z1K;XEDRO;OIDh<UdVln?bjgL>?VE98[B\\K<BVjkG8LiSX;fb>jf?DUK00Aih<WY6QD6cEnHBZ8iN_fd<G8Ci`11RUW2QlW]IXV:m?;J0GXXHfGNQ>:D`=fLPbO?VOTEYLj^cNj5PM>jKB5HVjJ4U7lXaTQNL9<@\\1`m\\Ug@VQHd7>jW=ca0`miF7;N0F=GjoQ`RFchKMGTmn8cF@Oh4GGCm7m2`U9j93Tb>=kSERjE_J939F01I1;`<ijk_=_Vn=7RVAI6fnQI5KlF:C44bN<<8K=Z<2TP<1]5?<dB>^LA=ebloE2Y2:9lkh0\\<YKbHD97iE`<C5oj^1>X:??`H6BXF2hG1Q[dF0Q=>W=J?7C\\k1T?<;R44oW?1hY^G8Zm]ZKnfOf0eCFYo6?=D8?<`6HU5SXh1;=:23LmV_FSi;OJfV<^?GkIDPISeHg1LaGE:V3Y3K3H<QJfbY?=;ldZRhnhQT_mGXDLFXXhSONE6Do_0iNZagB:BPGOTH;VhHUTd6LhQm^[;dO]5Hlkg<R:F<Kn\\:I:EGojgWZ2X@SYO_dlH;G8S<>oEKabY`:oU;=JW7ig?S?EYb86b7n8ce\\]IRa]koiWY<RfO;5kUI;7lVeC?[@ZaXDiF04B8R]bg@>O<mQDoUcBLcf^f>m2kMBUloD>Ze@NN^Z11TM`inXYhE_I=kA`:ZF4d\\>`L@;ZP[`ENU5cL[BV6\\Z?Di76:jg3hE6oG6jFc8kP=[GS1;WSedYQW1:U4\\OF32GgmMC<AjO]872bdBb`bKAA?8j78b>T3VfcUB2m4J^CPRU;8dScI]LU]^bBYA5_3:Y0N5i^?200000",jC=class Bp{constructor(t,n){this.states=t,this.index=n}clone(){return new Bp(this.states.slice(),this.index)}next(){let t=this.states[this.index];return t^=t>>>11,t^=t<<7&2636928640,t^=t<<15&4022730752,t^=t>>>18,this.index=No(this.states,this.index),t}getState(){return[this.index,...this.states]}jump(){let t=this.states.slice(),n=this.index;this.index=No(this.states,this.index);for(let r=19932;r>0;--r)UC.charCodeAt(r/6|0)-48&1<<r%6&&Fp(this.states,this.index,t,n),this.index=No(this.states,this.index);Fp(this.states,this.index,t,n)}};function Fp(e,t,n,r){let i=0;if(r>=t){for(;i<624-r;i++)e[i+t]^=n[i+r];for(;i<624-t;i++)e[i+t]^=n[i+r-624];for(;i<624;i++)e[i+t-624]^=n[i+r-624]}else{for(;i<624-t;i++)e[i+t]^=n[i+r];for(;i<624-r;i++)e[i+t-624]^=n[i+r];for(;i<624;i++)e[i+t-624]^=n[i+r-624]}}function No(e,t){if(t<227){let n=e[t]&2147483648|e[t+1]&2147483647;return e[t]=e[t+397]^n>>>1^-(n&1)&2567483615,t+1}else if(t<623){let n=e[t]&2147483648|e[t+1]&2147483647;return e[t]=e[t+397-624]^n>>>1^-(n&1)&2567483615,t+1}else{let n=e[t]&2147483648|e[0]&2147483647;return e[t]=e[396]^n>>>1^-(n&1)&2567483615,0}}function VC(e){for(let t=0;t!==624;++t)No(e,t)}function Up(e){let t=[e|0];for(let n=1;n!==624;++n){let r=t[n-1]^t[n-1]>>>30;t.push(Math.imul(1812433253,r)+n|0)}return VC(t),new jC(t,0)}var WC=class jp{constructor(t,n,r,i){this.s01=t,this.s00=n,this.s11=r,this.s10=i}clone(){return new jp(this.s01,this.s00,this.s11,this.s10)}next(){let t=this.s00^this.s00<<23,n=this.s01^(this.s01<<23|this.s00>>>9),r=t^this.s10^(t>>>18|n<<14)^(this.s10>>>5|this.s11<<27),i=n^this.s11^n>>>18^this.s11>>>5,o=this.s00+this.s10|0;return this.s01=this.s11,this.s00=this.s10,this.s11=i,this.s10=r,o}jump(){let t=0,n=0,r=0,i=0,o=[1667051007,2321340297,1548169110,304075285];for(let s=0;s!==4;++s)for(let a=1;a;a<<=1)o[s]&a&&(t^=this.s01,n^=this.s00,r^=this.s11,i^=this.s10),this.next();this.s01=t,this.s00=n,this.s11=r,this.s10=i}getState(){return[this.s01,this.s00,this.s11,this.s10]}};function Jl(e){return new WC(-1,~e,e|0,0)}var zC=class Vp{constructor(t,n,r,i){this.s01=t,this.s00=n,this.s11=r,this.s10=i}clone(){return new Vp(this.s01,this.s00,this.s11,this.s10)}next(){let t=this.s00+this.s10|0,n=this.s10^this.s00,r=this.s11^this.s01,i=this.s00,o=this.s01;return this.s00=i<<24^o>>>8^n^n<<16,this.s01=o<<24^i>>>8^r^(r<<16|n>>>16),this.s10=r<<5^n>>>27,this.s11=n<<5^r>>>27,t}jump(){let t=0,n=0,r=0,i=0,o=[3639956645,3750757012,1261568508,386426335];for(let s=0;s!==4;++s)for(let a=1;a;a<<=1)o[s]&a&&(t^=this.s01,n^=this.s00,r^=this.s11,i^=this.s10),this.next();this.s01=t,this.s00=n,this.s11=r,this.s10=i}getState(){return[this.s01,this.s00,this.s11,this.s10]}};function Wp(e){return new zC(-1,~e,e|0,0)}function zp(e,t){for(let n=0;n!==t;++n)e.next()}var Gp=BigInt,GC=4294967296n;function qp(e,t,n){let r=n-t+1n,i=GC,o=1;for(;i<r;)i<<=32n,++o;let s=Hp(o,e);if(s<r)return s+t;if(s+r<i)return s%r+t;let a=i-i%r;for(;s>=a;)s=Hp(o,e);return s%r+t}function Hp(e,t){let n=Gp(t.next()+2147483648);for(let r=1;r<e;++r){let i=t.next();n=(n<<32n)+Gp(i+2147483648)}return n}function Hr(e,t){let n=t>2?~~(4294967296/t)*t:4294967296,r=e.next()+2147483648;for(;r>=n;)r=e.next()+2147483648;return r%t}function Ql(e,t){if(t<0){let n=-t;e.sign=-1,e.data[0]=~~(n/4294967296),e.data[1]=n>>>0}else e.sign=1,e.data[0]=~~(t/4294967296),e.data[1]=t>>>0;return e}function HC(e,t,n){let r=t.data[1],i=t.data[0],o=t.sign,s=n.data[1],a=n.data[0],l=n.sign;if(e.sign=1,o===1&&l===-1){let m=r+s,y=i+a+(m>4294967295?1:0);return e.data[0]=y>>>0,e.data[1]=m>>>0,e}let u=r,c=i,d=s,f=a;o===-1&&(u=s,c=a,d=r,f=i);let p=0,h=u-d;return h<0&&(p=1,h=h>>>0),e.data[0]=c-f-p,e.data[1]=h,e}function qC(e,t,n){let r=n[0]+1;for(t[0]=Hr(e,r),t[1]=Hr(e,4294967296);t[0]>=n[0]&&(t[0]!==n[0]||t[1]>=n[1]);)t[0]=Hr(e,r),t[1]=Hr(e,4294967296);return t}var KC=Number.MAX_SAFE_INTEGER,YC={sign:1,data:[0,0]},ZC={sign:1,data:[0,0]},Kp={sign:1,data:[0,0]},eu=[0,0];function XC(e,t,n,r){let i=r<=KC?Ql(Kp,r):HC(Kp,Ql(YC,n),Ql(ZC,t));return i.data[1]===4294967295?(i.data[0]+=1,i.data[1]=0):i.data[1]+=1,qC(e,eu,i.data),eu[0]*4294967296+eu[1]+t}function _o(e,t,n){let r=n-t;return r<=4294967295?Hr(e,r+1)+t:XC(e,t,n,r)}var Yp=Symbol.for("fast-check/PreconditionFailure"),cn=class extends Error{constructor(e=!1){super(),this.interruptExecution=e,this.footprint=Yp}static isFailure(e){return e!=null&&e.footprint===Yp}};function JC(e){if(!e)throw new cn}var QC=class{[Symbol.iterator](){return this}next(e){return{value:e,done:!0}}},eE=new QC;function tE(){return eE}function*nE(e,t){for(let n of e)yield t(n)}function*rE(e,t){for(let n of e)yield*t(n)}function*iE(e,t){for(let n of e)t(n)&&(yield n)}function*oE(e,t){for(let n=0;n<t;++n){let r=e.next();if(r.done)break;yield r.value}}function*sE(e,t){let n=e.next();for(;!n.done&&t(n.value);)yield n.value,n=e.next()}function*aE(e,t){for(let n=e.next();!n.done;n=e.next())yield n.value;for(let n of t)for(let r=n.next();!r.done;r=n.next())yield r.value}var lE=Symbol.iterator,L=class Ft{static nil(){return new Ft(tE())}static of(...t){return new Ft(t[lE]())}constructor(t){this.g=t}next(){return this.g.next()}[Symbol.iterator](){return this.g}map(t){return new Ft(nE(this.g,t))}flatMap(t){return new Ft(rE(this.g,t))}dropWhile(t){let n=!1;function*r(i){(n||!t(i))&&(n=!0,yield i)}return this.flatMap(r)}drop(t){if(t<=0)return this;let n=0;function r(){return n++<t}return this.dropWhile(r)}takeWhile(t){return new Ft(sE(this.g,t))}take(t){return new Ft(oE(this.g,t))}filter(t){return new Ft(iE(this.g,t))}every(t){for(let n of this.g)if(!t(n))return!1;return!0}has(t){for(let n of this.g)if(t(n))return[!0,n];return[!1,null]}join(...t){return new Ft(aE(this.g,t))}getNthOrLast(t){let n=t,r=null;for(let i of this.g){if(n--===0)return i;r=i}return r}};function ln(e){return new L(e)}var Ie=Symbol.for("fast-check/cloneMethod");function Rn(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&Ie in e&&typeof e[Ie]=="function"}function Yn(e){return Rn(e)?e[Ie]():e}var uE=Object.defineProperty,T=class{constructor(e,t,n){this.value_=e,this.context=t,this.hasToBeCloned=n!==void 0||Rn(e),this.readOnce=!1,this.value=e,this.hasToBeCloned&&uE(this,"value",{get:n!==void 0?n:this.getValue,enumerable:!1,configurable:!1})}getValue(){return this.hasToBeCloned?this.readOnce?this.value_[Ie]():(this.readOnce=!0,this.value_):this.value_}},ue=class{filter(e){return new fE(this,e)}map(e,t){return new dE(this,e,t)}chain(e){return new cE(this,e)}},cE=class extends ue{constructor(e,t){super(),this.arb=e,this.chainer=t}generate(e,t){let n=e.clone(),r=this.arb.generate(e,t);return this.valueChainer(r,e,n,t)}canShrinkWithoutContext(e){return!1}shrink(e,t){return this.isSafeContext(t)?(t.stoppedForOriginal?L.nil():this.arb.shrink(t.originalValue,t.originalContext).map(n=>this.valueChainer(n,t.clonedMrng.clone(),t.clonedMrng,t.originalBias))).join(t.chainedArbitrary.shrink(e,t.chainedContext).map(n=>{let r={...t,chainedContext:n.context,stoppedForOriginal:!0};return new T(n.value_,r)})):L.nil()}valueChainer(e,t,n,r){let i=this.chainer(e.value_),o=i.generate(t,r),s={originalBias:r,originalValue:e.value_,originalContext:e.context,stoppedForOriginal:!1,chainedArbitrary:i,chainedContext:o.context,clonedMrng:n};return new T(o.value_,s)}isSafeContext(e){return e!=null&&typeof e=="object"&&"originalBias"in e&&"originalValue"in e&&"originalContext"in e&&"stoppedForOriginal"in e&&"chainedArbitrary"in e&&"chainedContext"in e&&"clonedMrng"in e}},dE=class extends ue{constructor(e,t,n){super(),this.arb=e,this.mapper=t,this.unmapper=n,this.bindValueMapper=r=>this.valueMapper(r)}generate(e,t){let n=this.arb.generate(e,t);return this.valueMapper(n)}canShrinkWithoutContext(e){if(this.unmapper!==void 0)try{let t=this.unmapper(e);return this.arb.canShrinkWithoutContext(t)}catch{return!1}return!1}shrink(e,t){if(this.isSafeContext(t))return this.arb.shrink(t.originalValue,t.originalContext).map(this.bindValueMapper);if(this.unmapper!==void 0){let n=this.unmapper(e);return this.arb.shrink(n,void 0).map(this.bindValueMapper)}return L.nil()}mapperWithCloneIfNeeded(e){let t=e.value,n=this.mapper(t);return e.hasToBeCloned&&(typeof n=="object"&&n!==null||typeof n=="function")&&Object.isExtensible(n)&&!Rn(n)&&Object.defineProperty(n,Ie,{get:()=>()=>this.mapperWithCloneIfNeeded(e)[0]}),[n,t]}valueMapper(e){let[t,n]=this.mapperWithCloneIfNeeded(e);return new T(t,{originalValue:n,originalContext:e.context})}isSafeContext(e){return e!=null&&typeof e=="object"&&"originalValue"in e&&"originalContext"in e}},fE=class extends ue{constructor(e,t){super(),this.arb=e,this.refinement=t,this.bindRefinementOnValue=n=>this.refinementOnValue(n)}generate(e,t){for(;;){let n=this.arb.generate(e,t);if(this.refinementOnValue(n))return n}}canShrinkWithoutContext(e){return this.arb.canShrinkWithoutContext(e)&&this.refinement(e)}shrink(e,t){return this.arb.shrink(e,t).filter(this.bindRefinementOnValue)}refinementOnValue(e){return this.refinement(e.value)}};function Yy(e){return typeof e=="object"&&e!==null&&"generate"in e&&"shrink"in e&&"canShrinkWithoutContext"in e}function Zy(e){if(!Yy(e))throw new Error("Unexpected value received: not an instance of Arbitrary")}var Xy=Function.prototype.apply,tu=Symbol("apply");function hE(e){try{return e.apply}catch{return}}function pE(e,t,n){let r=e;r[tu]=Xy;let i=r[tu](t,n);return delete r[tu],i}function W(e,t,n){return hE(e)===Xy?e.apply(t,n):pE(e,t,n)}var Jy=Array,E=BigInt,mE=BigInt64Array,yE=BigUint64Array,Qy=Boolean,Yo=Date,P=Error,eg=Float32Array,tg=Float64Array,gE=Int8Array,bE=Int16Array,SE=Int32Array,Ut=Number,Fe=String,Zn=Set,wE=Uint8Array,xE=Uint8ClampedArray,vE=Uint16Array,RE=Uint32Array,AE=encodeURIComponent,jt=Map,Vo=Symbol,Zp=Array.prototype.forEach,Xp=Array.prototype.indexOf,Jp=Array.prototype.join,Qp=Array.prototype.map,em=Array.prototype.flat,tm=Array.prototype.filter,nm=Array.prototype.push,rm=Array.prototype.pop,im=Array.prototype.splice,om=Array.prototype.slice,sm=Array.prototype.sort,am=Array.prototype.every;function CE(e){try{return e.forEach}catch{return}}function EE(e){try{return e.indexOf}catch{return}}function kE(e){try{return e.join}catch{return}}function IE(e){try{return e.map}catch{return}}function PE(e){try{return e.flat}catch{return}}function ME(e){try{return e.filter}catch{return}}function TE(e){try{return e.push}catch{return}}function OE(e){try{return e.pop}catch{return}}function NE(e){try{return e.splice}catch{return}}function _E(e){try{return e.slice}catch{return}}function $E(e){try{return e.sort}catch{return}}function LE(e){try{return e.every}catch{return}}function ng(e,t){return CE(e)===Zp?e.forEach(t):W(Zp,e,[t])}function Bt(e,...t){return EE(e)===Xp?e.indexOf(...t):W(Xp,e,t)}function le(e,...t){return kE(e)===Jp?e.join(...t):W(Jp,e,t)}function j(e,t){return IE(e)===Qp?e.map(t):W(Qp,e,[t])}function DE(e,t){return PE(e)===em?([].flat(),e.flat(t)):W(em,e,[t])}function FE(e,t){return ME(e)===tm?e.filter(t):W(tm,e,[t])}function M(e,...t){return TE(e)===nm?e.push(...t):W(nm,e,t)}function rg(e){return OE(e)===rm?e.pop():W(rm,e,[])}function ig(e,...t){return NE(e)===im?e.splice(...t):W(im,e,t)}function Te(e,...t){return _E(e)===om?e.slice(...t):W(om,e,t)}function og(e,...t){return $E(e)===sm?e.sort(...t):W(sm,e,t)}function sg(e,...t){return LE(e)===am?e.every(...t):W(am,e,t)}var lm=Date.prototype.getTime,um=Date.prototype.toISOString;function BE(e){try{return e.getTime}catch{return}}function UE(e){try{return e.toISOString}catch{return}}function Zo(e){return BE(e)===lm?e.getTime():W(lm,e,[])}function jE(e){return UE(e)===um?e.toISOString():W(um,e,[])}var cm=Set.prototype.add,dm=Set.prototype.has;function VE(e){try{return e.add}catch{return}}function WE(e){try{return e.has}catch{return}}function Xr(e,t){return VE(e)===cm?e.add(t):W(cm,e,[t])}function Xo(e,t){return WE(e)===dm?e.has(t):W(dm,e,[t])}var fm=WeakMap.prototype.set,hm=WeakMap.prototype.get;function zE(e){try{return e.set}catch{return}}function GE(e){try{return e.get}catch{return}}function HE(e,t,n){return zE(e)===fm?e.set(t,n):W(fm,e,[t,n])}function qE(e,t){return GE(e)===hm?e.get(t):W(hm,e,[t])}var pm=Map.prototype.set,mm=Map.prototype.get,ym=Map.prototype.has;function KE(e){try{return e.set}catch{return}}function YE(e){try{return e.get}catch{return}}function ZE(e){try{return e.has}catch{return}}function ht(e,t,n){return KE(e)===pm?e.set(t,n):W(pm,e,[t,n])}function Qe(e,t){return YE(e)===mm?e.get(t):W(mm,e,[t])}function XE(e,t){return ZE(e)===ym?e.has(t):W(ym,e,[t])}var gm=String.prototype.split,bm=String.prototype.startsWith,Sm=String.prototype.endsWith,wm=String.prototype.substring,xm=String.prototype.toLowerCase,vm=String.prototype.toUpperCase,Rm=String.prototype.padStart,Am=String.prototype.charCodeAt,Cm=String.prototype.normalize,Em=String.prototype.replace;function JE(e){try{return e.split}catch{return}}function QE(e){try{return e.startsWith}catch{return}}function ek(e){try{return e.endsWith}catch{return}}function tk(e){try{return e.substring}catch{return}}function nk(e){try{return e.toLowerCase}catch{return}}function rk(e){try{return e.toUpperCase}catch{return}}function ik(e){try{return e.padStart}catch{return}}function ok(e){try{return e.charCodeAt}catch{return}}function sk(e){try{return e.normalize}catch{return}}function ak(e){try{return e.replace}catch{return}}function Be(e,...t){return JE(e)===gm?e.split(...t):W(gm,e,t)}function lk(e,...t){return QE(e)===bm?e.startsWith(...t):W(bm,e,t)}function uk(e,...t){return ek(e)===Sm?e.endsWith(...t):W(Sm,e,t)}function me(e,...t){return tk(e)===wm?e.substring(...t):W(wm,e,t)}function Eu(e){return nk(e)===xm?e.toLowerCase():W(xm,e,[])}function Ju(e){return rk(e)===vm?e.toUpperCase():W(vm,e,[])}function ck(e,...t){return ik(e)===Rm?e.padStart(...t):W(Rm,e,t)}function Xn(e,t){return ok(e)===Am?e.charCodeAt(t):W(Am,e,[t])}function dk(e,t){return sk(e)===Cm?e.normalize(t):W(Cm,e,[t])}function fk(e,t,n){return ak(e)===Em?e.replace(t,n):W(Em,e,[t,n])}var km=Number.prototype.toString;function hk(e){try{return e.toString}catch{return}}function Jr(e,...t){return hk(e)===km?e.toString(...t):W(km,e,t)}var pk=Object.prototype.hasOwnProperty,mk=Object.prototype.toString;function ag(e,t){return W(pk,e,[t])}function ku(e){return W(mk,e,[])}var yk=Error.prototype.toString;function gk(e){return W(yk,e,[])}var bk=class{constructor(e){this.producer=e}[Symbol.iterator](){return this.it===void 0&&(this.it=this.producer()),this.it}next(){return this.it===void 0&&(this.it=this.producer()),this.it.next()}};function an(e){return new bk(e)}var lg=Array.isArray,Sk=Object.defineProperty;function ug(e,t){return Sk(e,Ie,{value:()=>{let n=[];for(let r=0;r!==t.length;++r)M(n,t[r].value);return ug(n,t),n}})}function cg(e){let t=!1,n=[],r=[];for(let i=0;i!==e.length;++i){let o=e[i];t=t||o.hasToBeCloned,M(n,o.value),M(r,o.context)}return t&&ug(n,e),new T(n,r)}function dg(e,t,n){let r=[],i=lg(n)?n:[];for(let o=0;o!==e.length;++o)M(r,an(()=>e[o].shrink(t[o],i[o]).map(s=>{let a=j(t,(l,u)=>new T(Yn(l),i[u]));return[...Te(a,0,o),s,...Te(a,o+1)]}).map(cg)));return L.nil().join(...r)}var wk=class extends ue{constructor(e){super(),this.arbs=e;for(let t=0;t!==e.length;++t){let n=e[t];if(n==null||n.generate===null||n.generate===void 0)throw new Error(`Invalid parameter encountered at index ${t}: expecting an Arbitrary`)}}generate(e,t){let n=[];for(let r=0;r!==this.arbs.length;++r)M(n,this.arbs[r].generate(e,t));return cg(n)}canShrinkWithoutContext(e){if(!lg(e)||e.length!==this.arbs.length)return!1;for(let t=0;t!==this.arbs.length;++t)if(!this.arbs[t].canShrinkWithoutContext(e[t]))return!1;return!0}shrink(e,t){return dg(this.arbs,e,t)}};function D(...e){return new wk(e)}var xk=Math.log;function fg(e){return 2+~~(xk(e+1)*.4342944819032518)}var Qu={};function vk(e){Qu=e}function pt(){return Qu}function Rk(){Qu={}}var Qr=Symbol("UndefinedContextPlaceholder");function Jn(e){return e.context!==void 0?e:e.hasToBeCloned?new T(e.value_,Qr,()=>e.value):new T(e.value_,Qr)}var Im=()=>{},Ak=class{constructor(e,t){this.arb=e,this.predicate=t;let{asyncBeforeEach:n,asyncAfterEach:r,beforeEach:i,afterEach:o}=pt()||{};if(n!==void 0&&i!==void 0)throw P(`Global "asyncBeforeEach" and "beforeEach" parameters can't be set at the same time when running async properties`);if(r!==void 0&&o!==void 0)throw P(`Global "asyncAfterEach" and "afterEach" parameters can't be set at the same time when running async properties`);this.beforeEachHook=n||i||Im,this.afterEachHook=r||o||Im}isAsync(){return!0}generate(e,t){return Jn(this.arb.generate(e,t!==void 0?fg(t):void 0))}shrink(e){if(e.context===void 0&&!this.arb.canShrinkWithoutContext(e.value_))return L.nil();let t=e.context!==Qr?e.context:void 0;return this.arb.shrink(e.value_,t).map(Jn)}async runBeforeEach(){await this.beforeEachHook()}async runAfterEach(){await this.afterEachHook()}async run(e){try{let t=await this.predicate(e);return t===void 0||t===!0?null:{error:new P("Property failed by returning false")}}catch(t){return cn.isFailure(t)?t:{error:t}}}beforeEach(e){let t=this.beforeEachHook;return this.beforeEachHook=()=>e(t),this}afterEach(e){let t=this.afterEachHook;return this.afterEachHook=()=>e(t),this}},hg=class extends ue{constructor(e){super(),this.arb=e}generate(e,t){return Jn(this.arb.generate(e,t))}canShrinkWithoutContext(e){return!0}shrink(e,t){if(t===void 0&&!this.arb.canShrinkWithoutContext(e))return L.nil();let n=t!==Qr?t:void 0;return this.arb.shrink(e,n).map(Jn)}};function Ck(...e){if(e.length<2)throw new Error("asyncProperty expects at least two parameters");let t=Te(e,0,e.length-1),n=e[e.length-1];return ng(t,Zy),new Ak(D(...j(t,r=>new hg(r))),r=>n(...r))}var Pm=()=>{},pg=class{constructor(e,t){this.arb=e,this.predicate=t;let{beforeEach:n=Pm,afterEach:r=Pm,asyncBeforeEach:i,asyncAfterEach:o}=pt()||{};if(i!==void 0)throw P(`"asyncBeforeEach" can't be set when running synchronous properties`);if(o!==void 0)throw P(`"asyncAfterEach" can't be set when running synchronous properties`);this.beforeEachHook=n,this.afterEachHook=r}isAsync(){return!1}generate(e,t){return Jn(this.arb.generate(e,t!==void 0?fg(t):void 0))}shrink(e){if(e.context===void 0&&!this.arb.canShrinkWithoutContext(e.value_))return L.nil();let t=e.context!==Qr?e.context:void 0;return this.arb.shrink(e.value_,t).map(Jn)}runBeforeEach(){this.beforeEachHook()}runAfterEach(){this.afterEachHook()}run(e){try{let t=this.predicate(e);return t===void 0||t===!0?null:{error:new P("Property failed by returning false")}}catch(t){return cn.isFailure(t)?t:{error:t}}}beforeEach(e){let t=this.beforeEachHook;return this.beforeEachHook=()=>e(t),this}afterEach(e){let t=this.afterEachHook;return this.afterEachHook=()=>e(t),this}};function Ek(...e){if(e.length<2)throw new Error("property expects at least two parameters");let t=Te(e,0,e.length-1),n=e[e.length-1];return ng(t,Zy),new pg(D(...j(t,r=>new hg(r))),r=>n(...r))}var kk=(function(e){return e[e.None=0]="None",e[e.Verbose=1]="Verbose",e[e.VeryVerbose=2]="VeryVerbose",e})({});function Iu(e){return"unsafeNext"in e?e.unsafeJump===void 0?{clone:()=>Iu(e),next:()=>e.unsafeNext(),getState:()=>e.getState()}:{clone:()=>Iu(e),next:()=>e.unsafeNext(),jump:()=>e.unsafeJump(),getState:()=>e.getState()}:e}function mg(e){return"jump"in e&&typeof e.jump=="function"?e:{clone:()=>mg(e),next:()=>e.next(),jump:()=>zp(e,42),getState:()=>e.getState()}}function ts(e){return mg(Iu(e))}var Ik=Date.now,Pk=Math.min,Mk=Math.random,Tk=class{constructor(e){let t=e||{};this.seed=Ok(t),this.randomType=Nk(t),this.numRuns=_k(t),this.verbose=$k(t),this.maxSkipsPerRun=t.maxSkipsPerRun!==void 0?t.maxSkipsPerRun:100,this.timeout=ru(t.timeout),this.skipAllAfterTimeLimit=ru(t.skipAllAfterTimeLimit),this.interruptAfterTimeLimit=ru(t.interruptAfterTimeLimit),this.markInterruptAsFailure=t.markInterruptAsFailure===!0,this.skipEqualValues=t.skipEqualValues===!0,this.ignoreEqualValues=t.ignoreEqualValues===!0,this.logger=t.logger!==void 0?t.logger:n=>{console.log(n)},this.path=t.path!==void 0?t.path:"",this.unbiased=t.unbiased===!0,this.examples=t.examples!==void 0?t.examples:[],this.endOnFailure=t.endOnFailure===!0,this.reporter=t.reporter,this.asyncReporter=t.asyncReporter,this.includeErrorInReport=t.includeErrorInReport===!0}toParameters(){return{seed:this.seed,randomType:this.randomType,numRuns:this.numRuns,maxSkipsPerRun:this.maxSkipsPerRun,timeout:this.timeout,skipAllAfterTimeLimit:this.skipAllAfterTimeLimit,interruptAfterTimeLimit:this.interruptAfterTimeLimit,markInterruptAsFailure:this.markInterruptAsFailure,skipEqualValues:this.skipEqualValues,ignoreEqualValues:this.ignoreEqualValues,path:this.path,logger:this.logger,unbiased:this.unbiased,verbose:this.verbose,examples:this.examples,endOnFailure:this.endOnFailure,reporter:this.reporter,asyncReporter:this.asyncReporter,includeErrorInReport:this.includeErrorInReport}}};function nu(e){return t=>ts(e(t))}function Ok(e){if(e.seed===void 0)return Ik()^Mk()*4294967296;let t=e.seed|0;return e.seed===t?t:t^(e.seed-t)*4294967296}function Nk(e){if(e.randomType===void 0)return Jl;if(typeof e.randomType=="string")switch(e.randomType){case"mersenne":return nu(Up);case"congruential":case"congruential32":return nu(Dp);case"xorshift128plus":return Jl;case"xoroshiro128plus":return Wp;default:throw new Error(`Invalid random specified: '${e.randomType}'`)}let t=e.randomType(0);if("min"in t&&t.min!==-2147483648)throw new Error(`Invalid random number generator: min must equal -0x80000000, got ${String(t.min)}`);if("max"in t&&t.max!==2147483647)throw new Error(`Invalid random number generator: max must equal 0x7fffffff, got ${String(t.max)}`);return t===ts(t)?e.randomType:nu(e.randomType)}function _k(e){return e.numRuns!==void 0?e.numRuns:e.num_runs!==void 0?e.num_runs:100}function $k(e){return e.verbose===void 0?0:typeof e.verbose=="boolean"?e.verbose===!0?1:0:e.verbose<=0?0:e.verbose>=2?2:e.verbose|0}function ru(e){if(e!==void 0)return Pk(e,2147483647)}function ec(e){return new Tk(e)}function Lk(e,t,n){let r=null;return{clear:()=>n(r),promise:new Promise(i=>{r=t(()=>{i(new cn(!0))},e)})}}var Mm=class{constructor(e,t,n,r,i,o){this.property=e,this.getTime=t,this.interruptExecution=r,this.setTimeoutSafe=i,this.clearTimeoutSafe=o,this.skipAfterTime=this.getTime()+n}isAsync(){return this.property.isAsync()}generate(e,t){return this.property.generate(e,t)}shrink(e){return this.property.shrink(e)}run(e){let t=this.skipAfterTime-this.getTime();if(t<=0){let n=new cn(this.interruptExecution);return this.isAsync()?Promise.resolve(n):n}if(this.interruptExecution&&this.isAsync()){let n=Lk(t,this.setTimeoutSafe,this.clearTimeoutSafe),r=Promise.race([this.property.run(e),n.promise]);return r.then(n.clear,n.clear),r}return this.property.run(e)}runBeforeEach(){return this.property.runBeforeEach()}runAfterEach(){return this.property.runAfterEach()}},Dk=(e,t,n)=>{let r=null;return{clear:()=>n(r),promise:new Promise(i=>{r=t(()=>{i({error:new P(`Property timeout: exceeded limit of ${e} milliseconds`)})},e)})}},Fk=class{constructor(e,t,n,r){this.property=e,this.timeMs=t,this.setTimeoutSafe=n,this.clearTimeoutSafe=r}isAsync(){return!0}generate(e,t){return this.property.generate(e,t)}shrink(e){return this.property.shrink(e)}async run(e){let t=Dk(this.timeMs,this.setTimeoutSafe,this.clearTimeoutSafe),n=Promise.race([this.property.run(e),t.promise]);return n.then(t.clear,t.clear),n}runBeforeEach(){return Promise.resolve(this.property.runBeforeEach())}runAfterEach(){return Promise.resolve(this.property.runAfterEach())}},yg=class{constructor(e){this.property=e}isAsync(){return this.property.isAsync()}generate(e,t){return this.property.generate(e,void 0)}shrink(e){return this.property.shrink(e)}run(e){return this.property.run(e)}runBeforeEach(){return this.property.runBeforeEach()}runAfterEach(){return this.property.runAfterEach()}},Tm=Array.from,Om=typeof Buffer<"u"?Buffer.isBuffer:void 0,Gn=JSON.stringify,Nm=Number.isNaN,Bk=Object.keys,Uk=Object.getOwnPropertySymbols,jk=Object.getOwnPropertyDescriptor,_m=Object.getPrototypeOf,$m=Number.NEGATIVE_INFINITY,Vk=Number.POSITIVE_INFINITY,mt=Symbol.for("fast-check/toStringMethod");function tc(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&mt in e&&typeof e[mt]=="function"}var Vt=Symbol.for("fast-check/asyncToStringMethod");function nc(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&Vt in e&&typeof e[Vt]=="function"}var Wk=/^Symbol\((.*)\)$/;function zk(e){if(e.description!==void 0)return e.description;let t=Wk.exec(Fe(e));return t&&t[1].length?t[1]:null}function Lm(e){switch(e){case 0:return 1/e===$m?"-0":"0";case $m:return"Number.NEGATIVE_INFINITY";case Vk:return"Number.POSITIVE_INFINITY";default:return e===e?Fe(e):"Number.NaN"}}function Gk(e){let t=-1;for(let n in e){let r=Number(n);if(r!==t+1)return!0;t=r}return t+1!==e.length}function Je(e,t,n){let r=[...t,e];if(typeof e=="object"&&Bt(t,e)!==-1)return"[cyclic]";if(nc(e)){let i=n(e);if(i.state==="fulfilled")return i.value}if(tc(e))try{return e[mt]()}catch{}switch(ku(e)){case"[object Array]":{let i=e;if(i.length>=50&&Gk(i)){let s=[];for(let a in i)Nm(Number(a))||M(s,`${a}:${Je(i[a],r,n)}`);return s.length!==0?`Object.assign(Array(${i.length}),{${le(s,",")}})`:`Array(${i.length})`}let o=le(j(i,s=>Je(s,r,n)),",");return i.length===0||i.length-1 in i?`[${o}]`:`[${o},]`}case"[object BigInt]":return`${e}n`;case"[object Boolean]":{let i=e==!0?"true":"false";return typeof e=="boolean"?i:`new Boolean(${i})`}case"[object Date]":{let i=e;return Nm(Zo(i))?"new Date(NaN)":`new Date(${Gn(jE(i))})`}case"[object Map]":return`new Map(${Je(Array.from(e),r,n)})`;case"[object Null]":return"null";case"[object Number]":return typeof e=="number"?Lm(e):`new Number(${Lm(Number(e))})`;case"[object Object]":{try{let o=e.toString;if(typeof o=="function"&&o!==Object.prototype.toString)return e.toString()}catch{return"[object Object]"}let i=o=>`${o==="__proto__"?'["__proto__"]':typeof o=="symbol"?`[${Je(o,r,n)}]`:Gn(o)}:${Je(e[o],r,n)}`;return"{"+le([..._m(e)===null?["__proto__:null"]:[],...j(Bk(e),i),...j(FE(Uk(e),o=>{let s=jk(e,o);return s&&s.enumerable}),i)],",")+"}"}case"[object Set]":return`new Set(${Je(Array.from(e),r,n)})`;case"[object String]":return typeof e=="string"?Gn(e):`new String(${Gn(e)})`;case"[object Symbol]":{let i=e;if(Vo.keyFor(i)!==void 0)return`Symbol.for(${Gn(Vo.keyFor(i))})`;let o=zk(i);return o===null?"Symbol()":i===(o.startsWith("Symbol.")&&Vo[o.substring(7)])?o:`Symbol(${Gn(o)})`}case"[object Promise]":{let i=n(e);switch(i.state){case"fulfilled":return`Promise.resolve(${Je(i.value,r,n)})`;case"rejected":return`Promise.reject(${Je(i.value,r,n)})`;case"pending":return"new Promise(() => {/*pending*/})";default:return"new Promise(() => {/*unknown*/})"}}case"[object Error]":if(e instanceof Error)return`new Error(${Je(e.message,r,n)})`;break;case"[object Undefined]":return"undefined";case"[object Int8Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Int16Array]":case"[object Uint16Array]":case"[object Int32Array]":case"[object Uint32Array]":case"[object Float32Array]":case"[object Float64Array]":case"[object BigInt64Array]":case"[object BigUint64Array]":{if(typeof Om=="function"&&Om(e))return`Buffer.from(${e.buffer.detached?"/*detached ArrayBuffer*/":Je(Tm(e.values()),r,n)})`;let i=_m(e),o=i&&i.constructor&&i.constructor.name;if(typeof o=="string"){let s=e;return s.buffer.detached?`${o}.from(/*detached ArrayBuffer*/)`:`${o}.from(${Je(Tm(s.values()),r,n)})`}break}}try{return e.toString()}catch{return ku(e)}}function xe(e){return Je(e,[],()=>({state:"unknown",value:void 0}))}function gg(e){let t=Vo(),n=[],r=new jt;function i(){let l=null,u=()=>{l!==null&&clearTimeout(l)};return{delay:new Promise(c=>{l=setTimeout(()=>{l=null,c(t)},0)}),cancel:u}}let o={state:"unknown",value:void 0},s=function(u){let c=u;if(r.has(c))return r.get(c);let d=i(),f=Vt in u?Promise.resolve().then(()=>u[Vt]()):u;return f.catch(()=>{}),n.push(Promise.race([f,d.delay]).then(p=>{p===t?r.set(c,{state:"pending",value:void 0}):r.set(c,{state:"fulfilled",value:p}),d.cancel()},p=>{r.set(c,{state:"rejected",value:p}),d.cancel()})),r.set(c,o),o};function a(){let l=Je(e,[],s);return n.length===0?l:Promise.all(n.splice(0)).then(a)}return a()}async function rc(e){return Promise.resolve(gg(e))}function Dm(e){return e===null?new cn:e}function Hk(...e){return e[1]?e[0].then(Dm):Dm(e[0])}function qk(e,t){return Hk(e,t)}var Fm=class{constructor(e,t){this.property=e,this.skipRuns=t,this.coveredCases=new Map}isAsync(){return this.property.isAsync()}generate(e,t){return this.property.generate(e,t)}shrink(e){return this.property.shrink(e)}run(e){let t=xe(e);if(this.coveredCases.has(t)){let r=this.coveredCases.get(t);return this.skipRuns?qk(r,this.property.isAsync()):r}let n=this.property.run(e);return this.coveredCases.set(t,n),n}runBeforeEach(){return this.property.runBeforeEach()}runAfterEach(){return this.property.runAfterEach()}},Bm=Date.now,iu=setTimeout,ou=clearTimeout;function Kk(e,t){let n=e;return e.isAsync()&&t.timeout!==void 0&&(n=new Fk(n,t.timeout,iu,ou)),t.unbiased&&(n=new yg(n)),t.skipAllAfterTimeLimit!==void 0&&(n=new Mm(n,Bm,t.skipAllAfterTimeLimit,!1,iu,ou)),t.interruptAfterTimeLimit!==void 0&&(n=new Mm(n,Bm,t.interruptAfterTimeLimit,!0,iu,ou)),t.skipEqualValues&&(n=new Fm(n,!0)),t.ignoreEqualValues&&(n=new Fm(n,!1)),n}var Yk=(function(e){return e[e.Success=0]="Success",e[e.Skipped=-1]="Skipped",e[e.Failure=1]="Failure",e})({}),Zk=class bg{constructor(t,n){this.verbosity=t,this.interruptedAsFailure=n,this.rootExecutionTrees=[],this.currentLevelExecutionTrees=this.rootExecutionTrees,this.failure=null,this.numSkips=0,this.numSuccesses=0,this.interrupted=!1}appendExecutionTree(t,n){let r={status:t,value:n,children:[]};return this.currentLevelExecutionTrees.push(r),r}fail(t,n,r){if(this.verbosity>=1){let i=this.appendExecutionTree(1,t);this.currentLevelExecutionTrees=i.children}this.pathToFailure===void 0?this.pathToFailure=`${n}`:this.pathToFailure+=`:${n}`,this.value=t,this.failure=r}skip(t){this.verbosity>=2&&this.appendExecutionTree(-1,t),this.pathToFailure===void 0&&++this.numSkips}success(t){this.verbosity>=2&&this.appendExecutionTree(0,t),this.pathToFailure===void 0&&++this.numSuccesses}interrupt(){this.interrupted=!0}isSuccess(){return this.pathToFailure===void 0}firstFailure(){return this.pathToFailure!==void 0?+Be(this.pathToFailure,":")[0]:-1}numShrinks(){return this.pathToFailure!==void 0?Be(this.pathToFailure,":").length-1:0}extractFailures(){if(this.isSuccess())return[];let t=[],n=this.rootExecutionTrees;for(;n.length>0&&n[n.length-1].status===1;){let r=n[n.length-1];t.push(r.value),n=r.children}return t}static mergePaths(t,n){if(t.length===0)return n;let r=t.split(":"),i=n.split(":"),o=+r[r.length-1]+ +i[0];return[...r.slice(0,r.length-1),`${o}`,...i.slice(1)].join(":")}toRunDetails(t,n,r,i){if(!this.isSuccess())return{failed:!0,interrupted:this.interrupted,numRuns:this.firstFailure()+1-this.numSkips,numSkips:this.numSkips,numShrinks:this.numShrinks(),seed:t,counterexample:this.value,counterexamplePath:bg.mergePaths(n,this.pathToFailure),errorInstance:this.failure.error,failures:this.extractFailures(),executionSummary:this.rootExecutionTrees,verbose:this.verbosity,runConfiguration:i.toParameters()};let o=this.interruptedAsFailure||this.numSuccesses===0;return{failed:this.numSkips>r||this.interrupted&&o,interrupted:this.interrupted,numRuns:this.numSuccesses,numSkips:this.numSkips,numShrinks:0,seed:t,counterexample:null,counterexamplePath:null,error:null,errorInstance:null,failures:[],executionSummary:this.rootExecutionTrees,verbose:this.verbosity,runConfiguration:i.toParameters()}}},Sg=class{constructor(e,t,n,r){this.sourceValues=e,this.shrink=t,this.runExecution=new Zk(n,r),this.currentIdx=-1,this.nextValues=e}[Symbol.iterator](){return this}next(){let e=this.nextValues.next();return e.done||this.runExecution.interrupted?{done:!0,value:void 0}:(this.currentValue=e.value,++this.currentIdx,{done:!1,value:e.value.value_})}handleResult(e){e!==null&&typeof e=="object"&&!cn.isFailure(e)?(this.runExecution.fail(this.currentValue.value_,this.currentIdx,e),this.currentIdx=-1,this.nextValues=this.shrink(this.currentValue)):e!==null?e.interruptExecution?this.runExecution.interrupt():(this.runExecution.skip(this.currentValue.value_),this.sourceValues.skippedOne()):this.runExecution.success(this.currentValue.value_)}},Xk=class{constructor(e,t,n){this.initialValues=e,this.maxInitialIterations=t,this.remainingSkips=n}[Symbol.iterator](){return this}next(){if(--this.maxInitialIterations!==-1&&this.remainingSkips>=0){let e=this.initialValues.next();if(!e.done)return{value:e.value,done:!1}}return{value:void 0,done:!0}}skippedOne(){--this.remainingSkips,++this.maxInitialIterations}},Jk=-2147483648,Qk=2147483647,e2=Math.pow(2,27),t2=Math.pow(2,-53),ic=class wg{constructor(t){this.internalRng=ts(t.clone())}clone(){return new wg(this.internalRng)}next(t){return _o(this.internalRng,0,(1<<t)-1)}nextBoolean(){return _o(this.internalRng,0,1)===1}nextInt(t,n){return _o(this.internalRng,t===void 0?Jk:t,n===void 0?Qk:n)}nextBigInt(t,n){return qp(this.internalRng,t,n)}nextDouble(){let t=this.next(26),n=this.next(27);return(t*e2+n)*t2}getState(){if("getState"in this.internalRng&&typeof this.internalRng.getState=="function")return this.internalRng.getState()}};function n2(e,t,n){return t.jump(),e.generate(new ic(t),n)}function*xg(e,t,n,r){for(let i=0;i!==r.length;++i)yield new T(r[i],void 0);for(let i=0,o=n(t);;++i)yield n2(e,o,i)}function r2(e,t,n){return()=>e.generate(new ic(t),n)}function*vg(e,t,n,r){yield*j(r,s=>()=>new T(s,void 0));let i=0,o=ts(n(t));for(;;)o.jump(),yield r2(e,o,i++)}function Um(e){return e()}function Rg(e,t,n){let r=t,i=e.split(":").map(s=>+s);if(i.length===0)return r.map(Um);if(!i.every(s=>!Number.isNaN(s)))throw new Error(`Unable to replay, got invalid path=${e}`);let o=r.drop(i[0]).map(Um);for(let s of i.slice(1)){let a=o.getNthOrLast(0);if(a===null)throw new Error(`Unable to replay, got wrong path=${e}`);o=n(a).drop(s)}return o}var i2=Object.assign;function o2(e){return e.length===1?`Hint: ${e[0]}`:e.map((t,n)=>`Hint (${n+1}): ${t}`).join(`
|
|
21
21
|
`)}function s2(e,t){return`Encountered failures were:
|
|
22
22
|
- ${e.map(t).join(`
|
|
23
23
|
- `)}`}function oc(e,t){let n=[],r=[];for(let i=e.length-1;i>=0;--i)r.push({depth:1,tree:e[i]});for(;r.length!==0;){let i=r.pop(),o=i.tree,s=i.depth,a=o.status===0?"\x1B[32m\u221A\x1B[0m":o.status===1?"\x1B[31m\xD7\x1B[0m":"\x1B[33m!\x1B[0m",l=s!==0?". ".repeat(s-1):"";n.push(`${l}${a} ${t(o.value)}`);for(let u=o.children.length-1;u>=0;--u)r.push({depth:s+1,tree:o.children[u]})}return`Execution summary:
|
|
@@ -53,7 +53,7 @@ ${o2(i)}`),o}function Ag(e){return Pu(e,xe)}async function Cg(e){let t=[];functi
|
|
|
53
53
|
`)+"`"}};function j0(e){let t=0;return{clone:()=>j0(e),nextTaskIndex:n=>{if(e.length<=t)throw new Error("Invalid schedulerFor defined: too many tasks have been scheduled");let r=n.findIndex(i=>i.taskId===e[t]);if(r===-1)throw new Error("Invalid schedulerFor defined: unable to find next task");return++t,r}}}function Dy(e,t){return new U0(e,j0(t))}function V0(e){let t=e.clone();return{clone:()=>V0(t),nextTaskIndex:n=>e.nextInt(0,n.length-1)}}var rM=class extends ue{constructor(e){super(),this.act=e}generate(e,t){return new T(new U0(this.act,V0(e.clone())),void 0)}canShrinkWithoutContext(e){return!1}shrink(e,t){return L.nil()}};function iM(e){let{act:t=n=>n()}=e||{};return new rM(t)}function oM(e,t){let{act:n=r=>r()}=Array.isArray(e)?t||{}:e||{};return Array.isArray(e)?Dy(n,e):function(r,...i){return Dy(n,i)}}function sM(e={}){return zt(e,E("-9223372036854775808"),E("9223372036854775807"),mE,un)}function aM(e={}){return zt(e,E(0),E("18446744073709551615"),yE,un)}function lM(e,t){return t}var vu=Math.floor,uM=Math.min;function it(e,t){switch(e.type){case"Char":return{astNode:e,minLength:1};case"Repetition":switch(e.quantifier.kind){case"*":{let n=it(e.expression,t);return{astNode:{type:"Repetition",quantifier:{...e.quantifier,kind:"Range",from:0,to:t},expression:n.astNode},minLength:0}}case"+":{let n=it(e.expression,t),r=n.minLength>1?n.minLength:1;return{astNode:{type:"Repetition",quantifier:{...e.quantifier,kind:"Range",from:1,to:vu(t/r)},expression:n.astNode},minLength:n.minLength}}case"?":{let n=it(e.expression,t);return t<n.minLength?{astNode:{type:"Repetition",quantifier:{...e.quantifier,kind:"Range",from:0,to:0},expression:n.astNode},minLength:0}:{astNode:{...e,expression:n.astNode},minLength:0}}case"Range":{let n=e.quantifier.from>1?vu(t/e.quantifier.from):t,r=it(e.expression,n),i=r.minLength>1?r.minLength:1;return e.quantifier.to===void 0||e.quantifier.to*i>t?{astNode:{type:"Repetition",quantifier:{...e.quantifier,kind:"Range",to:vu(t/i)},expression:r.astNode},minLength:e.quantifier.from*r.minLength}:{astNode:{...e,expression:r.astNode},minLength:e.quantifier.from*r.minLength}}default:return lM(e.quantifier,{astNode:e,minLength:0})}case"Quantifier":return{astNode:e,minLength:0};case"Alternative":{let n=0,r=[];for(let o=0;o!==e.expressions.length;++o){let s=t-n,a=it(e.expressions[o],s);n+=a.minLength,M(r,{value:a,allowance:s})}let i=[];for(let o=0;o!==r.length;++o){let s=r[o].value,a=r[o].allowance,l=t-n+s.minLength;M(i,(l!==a?it(s.astNode,l):s).astNode)}return{astNode:{...e,expressions:i},minLength:n}}case"CharacterClass":return{astNode:e,minLength:1};case"ClassRange":return{astNode:e,minLength:1};case"Group":{let n=it(e.expression,t);return{astNode:{...e,expression:n.astNode},minLength:n.minLength}}case"Disjunction":{if(e.left===null){if(e.right===null)return{astNode:e,minLength:0};let i=it(e.right,t),o=i.minLength>t?null:i.astNode;return{astNode:{...e,left:null,right:o},minLength:0}}if(e.right===null){let i=it(e.left,t),o=i.minLength>t?null:i.astNode;return{astNode:{...e,left:o,right:null},minLength:0}}let n=it(e.left,t),r=it(e.right,t);return n.minLength>t?r:r.minLength>t?n:{astNode:{...e,left:n.astNode,right:r.astNode},minLength:uM(n.minLength,r.minLength)}}case"Assertion":return{astNode:e,minLength:0};case"Backreference":return{astNode:e,minLength:0};case"UnicodeProperty":return{astNode:e,minLength:1}}}function cM(e,t){return it(e,t).astNode}function dM(e){return new Error(`Unsupported AST node! Received: ${xe(e)}`)}function qo(e,t,n){if(!t&&!n)return e;let r={hasStart:!1,hasEnd:!1},i=W0(e,t,n,r),o=t&&!r.hasStart,s=n&&!r.hasEnd;if(!o&&!s)return i;let a=[];return o&&(a.push({type:"Assertion",kind:"^"}),a.push({type:"Repetition",quantifier:{type:"Quantifier",kind:"*",greedy:!0},expression:{type:"Char",kind:"meta",symbol:".",value:".",codePoint:NaN}})),a.push(i),s&&(a.push({type:"Repetition",quantifier:{type:"Quantifier",kind:"*",greedy:!0},expression:{type:"Char",kind:"meta",symbol:".",value:".",codePoint:NaN}}),a.push({type:"Assertion",kind:"$"})),{type:"Group",capturing:!1,expression:{type:"Alternative",expressions:a}}}function W0(e,t,n,r){switch(e.type){case"Char":return e;case"Repetition":return e;case"Quantifier":throw new Error("Wrongly defined AST tree, Quantifier nodes not supposed to be scanned!");case"Alternative":return r.hasStart=!0,r.hasEnd=!0,{...e,expressions:e.expressions.map((i,o)=>qo(i,t&&o===0,n&&o===e.expressions.length-1))};case"CharacterClass":return e;case"ClassRange":return e;case"Group":return{...e,expression:W0(e.expression,t,n,r)};case"Disjunction":return r.hasStart=!0,r.hasEnd=!0,{...e,left:e.left!==null?qo(e.left,t,n):null,right:e.right!==null?qo(e.right,t,n):null};case"Assertion":if(e.kind==="^"||e.kind==="Lookahead")return r.hasStart=!0,e;if(e.kind==="$"||e.kind==="Lookbehind")return r.hasEnd=!0,e;throw new Error(`Assertions of kind ${e.kind} not implemented yet!`);case"Backreference":return e;case"UnicodeProperty":return e;default:throw dM(e)}}function fM(e){return qo(e,!0,!0)}function Fy(e,t){return e[t]>="\uD800"&&e[t]<="\uDBFF"&&e[t+1]>="\uDC00"&&e[t+1]<="\uDFFF"?2:1}function Ae(e){return e>="0"&&e<="9"||e>="a"&&e<="f"||e>="A"&&e<="F"}function Yu(e){return e>="0"&&e<="9"}function z0(e,t){for(let n=t;n!==e.length;++n){let r=e[n];if(r==="\\")n+=1;else if(r==="]")return n}throw new Error("Missing closing ']'")}function hM(e,t){let n=0;for(let r=t;r!==e.length;++r){let i=e[r];if(i==="\\")r+=1;else if(i===")"){if(n===0)return r;n-=1}else i==="["?r=z0(e,r):i==="("&&(n+=1)}throw new Error("Missing closing ')'")}function pM(e,t){let n=!1;for(let r=t;r!==e.length;++r){let i=e[r];if(!Yu(i)){if(t===r)return-1;if(i===","){if(n)return-1;n=!0}else return i==="}"?r:-1}}return-1}function mM(e,t,n,r){switch(e[t]){case"[":return r===1?t+1:z0(e,t+1)+1;case"{":{if(r===1)return t+1;let i=pM(e,t+1);return i===-1?t+1:i+1}case"(":return r===1?t+1:hM(e,t+1)+1;case"]":case"}":case")":return t+1;case"\\":{let i=e[t+1];switch(i){case"x":if(Ae(e[t+2])&&Ae(e[t+3]))return t+4;throw new Error(`Unexpected token '${e.substring(t,t+4)}' found`);case"u":if(e[t+2]==="{"){if(!n)return t+2;if(e[t+4]==="}"){if(Ae(e[t+3]))return t+5;throw new Error(`Unexpected token '${e.substring(t,t+5)}' found`)}if(e[t+5]==="}"){if(Ae(e[t+3])&&Ae(e[t+4]))return t+6;throw new Error(`Unexpected token '${e.substring(t,t+6)}' found`)}if(e[t+6]==="}"){if(Ae(e[t+3])&&Ae(e[t+4])&&Ae(e[t+5]))return t+7;throw new Error(`Unexpected token '${e.substring(t,t+7)}' found`)}if(e[t+7]==="}"){if(Ae(e[t+3])&&Ae(e[t+4])&&Ae(e[t+5])&&Ae(e[t+6]))return t+8;throw new Error(`Unexpected token '${e.substring(t,t+8)}' found`)}if(e[t+8]==="}"&&Ae(e[t+3])&&Ae(e[t+4])&&Ae(e[t+5])&&Ae(e[t+6])&&Ae(e[t+7]))return t+9;throw new Error(`Unexpected token '${e.substring(t,t+9)}' found`)}if(Ae(e[t+2])&&Ae(e[t+3])&&Ae(e[t+4])&&Ae(e[t+5]))return t+6;throw new Error(`Unexpected token '${e.substring(t,t+6)}' found`);case"p":case"P":{if(!n)return t+2;let o=t+2;for(;o<e.length&&e[o]!=="}";o+=e[o]==="\\"?2:1);if(e[o]!=="}")throw new Error("Invalid \\P definition");return o+1}case"k":{let o=t+2;for(;o<e.length&&e[o]!==">";++o);if(e[o]!==">"){if(!n)return t+2;throw new Error("Invalid \\k definition")}return o+1}default:if(Yu(i)){let o=n?e.length:Math.min(t+4,e.length),s=t+2;for(;s<o&&Yu(e[s]);++s);return s}return t+(n?Fy(e,t+1):1)+1}}default:return t+(n?Fy(e,t):1)}}function jo(e,t,n,r){let i=mM(e,t,n,r);return e.substring(t,i)}var By={gc:"General_Category",sc:"Script",scx:"Script_Extensions"},rs={ASCII:"ASCII",ASCII_Hex_Digit:"AHex",Alphabetic:"Alpha",Any:"Any",Assigned:"Assigned",Bidi_Control:"Bidi_C",Bidi_Mirrored:"Bidi_M",Case_Ignorable:"CI",Cased:"Cased",Changes_When_Casefolded:"CWCF",Changes_When_Casemapped:"CWCM",Changes_When_Lowercased:"CWL",Changes_When_NFKC_Casefolded:"CWKCF",Changes_When_Titlecased:"CWT",Changes_When_Uppercased:"CWU",Dash:"Dash",Default_Ignorable_Code_Point:"DI",Deprecated:"Dep",Diacritic:"Dia",Emoji:"Emoji",Emoji_Component:"Emoji_Component",Emoji_Modifier:"Emoji_Modifier",Emoji_Modifier_Base:"Emoji_Modifier_Base",Emoji_Presentation:"Emoji_Presentation",Extended_Pictographic:"Extended_Pictographic",Extender:"Ext",Grapheme_Base:"Gr_Base",Grapheme_Extend:"Gr_Ext",Hex_Digit:"Hex",IDS_Binary_Operator:"IDSB",IDS_Trinary_Operator:"IDST",ID_Continue:"IDC",ID_Start:"IDS",Ideographic:"Ideo",Join_Control:"Join_C",Logical_Order_Exception:"LOE",Lowercase:"Lower",Math:"Math",Noncharacter_Code_Point:"NChar",Pattern_Syntax:"Pat_Syn",Pattern_White_Space:"Pat_WS",Quotation_Mark:"QMark",Radical:"Radical",Regional_Indicator:"RI",Sentence_Terminal:"STerm",Soft_Dotted:"SD",Terminal_Punctuation:"Term",Unified_Ideograph:"UIdeo",Uppercase:"Upper",Variation_Selector:"VS",White_Space:"space",XID_Continue:"XIDC",XID_Start:"XIDS"},ti=vc(rs),xc={Cased_Letter:"LC",Close_Punctuation:"Pe",Connector_Punctuation:"Pc",Control:["Cc","cntrl"],Currency_Symbol:"Sc",Dash_Punctuation:"Pd",Decimal_Number:["Nd","digit"],Enclosing_Mark:"Me",Final_Punctuation:"Pf",Format:"Cf",Initial_Punctuation:"Pi",Letter:"L",Letter_Number:"Nl",Line_Separator:"Zl",Lowercase_Letter:"Ll",Mark:["M","Combining_Mark"],Math_Symbol:"Sm",Modifier_Letter:"Lm",Modifier_Symbol:"Sk",Nonspacing_Mark:"Mn",Number:"N",Open_Punctuation:"Ps",Other:"C",Other_Letter:"Lo",Other_Number:"No",Other_Punctuation:"Po",Other_Symbol:"So",Paragraph_Separator:"Zp",Private_Use:"Co",Punctuation:["P","punct"],Separator:"Z",Space_Separator:"Zs",Spacing_Mark:"Mc",Surrogate:"Cs",Symbol:"S",Titlecase_Letter:"Lt",Unassigned:"Cn",Uppercase_Letter:"Lu"},Zu=vc(xc),G0={Adlam:"Adlm",Ahom:"Ahom",Anatolian_Hieroglyphs:"Hluw",Arabic:"Arab",Armenian:"Armn",Avestan:"Avst",Balinese:"Bali",Bamum:"Bamu",Bassa_Vah:"Bass",Batak:"Batk",Bengali:"Beng",Bhaiksuki:"Bhks",Bopomofo:"Bopo",Brahmi:"Brah",Braille:"Brai",Buginese:"Bugi",Buhid:"Buhd",Canadian_Aboriginal:"Cans",Carian:"Cari",Caucasian_Albanian:"Aghb",Chakma:"Cakm",Cham:"Cham",Cherokee:"Cher",Common:"Zyyy",Coptic:["Copt","Qaac"],Cuneiform:"Xsux",Cypriot:"Cprt",Cyrillic:"Cyrl",Deseret:"Dsrt",Devanagari:"Deva",Dogra:"Dogr",Duployan:"Dupl",Egyptian_Hieroglyphs:"Egyp",Elbasan:"Elba",Ethiopic:"Ethi",Georgian:"Geor",Glagolitic:"Glag",Gothic:"Goth",Grantha:"Gran",Greek:"Grek",Gujarati:"Gujr",Gunjala_Gondi:"Gong",Gurmukhi:"Guru",Han:"Hani",Hangul:"Hang",Hanifi_Rohingya:"Rohg",Hanunoo:"Hano",Hatran:"Hatr",Hebrew:"Hebr",Hiragana:"Hira",Imperial_Aramaic:"Armi",Inherited:["Zinh","Qaai"],Inscriptional_Pahlavi:"Phli",Inscriptional_Parthian:"Prti",Javanese:"Java",Kaithi:"Kthi",Kannada:"Knda",Katakana:"Kana",Kayah_Li:"Kali",Kharoshthi:"Khar",Khmer:"Khmr",Khojki:"Khoj",Khudawadi:"Sind",Lao:"Laoo",Latin:"Latn",Lepcha:"Lepc",Limbu:"Limb",Linear_A:"Lina",Linear_B:"Linb",Lisu:"Lisu",Lycian:"Lyci",Lydian:"Lydi",Mahajani:"Mahj",Makasar:"Maka",Malayalam:"Mlym",Mandaic:"Mand",Manichaean:"Mani",Marchen:"Marc",Medefaidrin:"Medf",Masaram_Gondi:"Gonm",Meetei_Mayek:"Mtei",Mende_Kikakui:"Mend",Meroitic_Cursive:"Merc",Meroitic_Hieroglyphs:"Mero",Miao:"Plrd",Modi:"Modi",Mongolian:"Mong",Mro:"Mroo",Multani:"Mult",Myanmar:"Mymr",Nabataean:"Nbat",New_Tai_Lue:"Talu",Newa:"Newa",Nko:"Nkoo",Nushu:"Nshu",Ogham:"Ogam",Ol_Chiki:"Olck",Old_Hungarian:"Hung",Old_Italic:"Ital",Old_North_Arabian:"Narb",Old_Permic:"Perm",Old_Persian:"Xpeo",Old_Sogdian:"Sogo",Old_South_Arabian:"Sarb",Old_Turkic:"Orkh",Oriya:"Orya",Osage:"Osge",Osmanya:"Osma",Pahawh_Hmong:"Hmng",Palmyrene:"Palm",Pau_Cin_Hau:"Pauc",Phags_Pa:"Phag",Phoenician:"Phnx",Psalter_Pahlavi:"Phlp",Rejang:"Rjng",Runic:"Runr",Samaritan:"Samr",Saurashtra:"Saur",Sharada:"Shrd",Shavian:"Shaw",Siddham:"Sidd",SignWriting:"Sgnw",Sinhala:"Sinh",Sogdian:"Sogd",Sora_Sompeng:"Sora",Soyombo:"Soyo",Sundanese:"Sund",Syloti_Nagri:"Sylo",Syriac:"Syrc",Tagalog:"Tglg",Tagbanwa:"Tagb",Tai_Le:"Tale",Tai_Tham:"Lana",Tai_Viet:"Tavt",Takri:"Takr",Tamil:"Taml",Tangut:"Tang",Telugu:"Telu",Thaana:"Thaa",Thai:"Thai",Tibetan:"Tibt",Tifinagh:"Tfng",Tirhuta:"Tirh",Ugaritic:"Ugar",Vai:"Vaii",Warang_Citi:"Wara",Yi:"Yiii",Zanabazar_Square:"Zanb"},Uy=vc(G0);function vc(e){let t={};for(let n of Object.keys(e)){let r=e[n];if(Array.isArray(r))for(let i=0;i!==r.length;++i)t[r[i]]=n;else t[r]=n}return t}function yM(e){return e in xc||e in Zu}function gM(e){return e in rs||e in ti}function jy(e){if(e in By)return By[e];if(e in ti)return ti[e];if(e in rs||e==="General_Category"||e==="Script"||e==="Script_Extensions")return e;throw new Error(`Unknown Unicode property name: ${e}`)}function Vy(e){if(e in Zu)return Zu[e];if(e in Uy)return Uy[e];if(e in ti)return ti[e];if(e in xc||e in G0||e in rs)return e;throw new Error(`Unknown Unicode property value: ${e}`)}function bM(e,t){let n=e.indexOf("=");if(n!==-1){let r=e.substring(0,n),i=e.substring(n+1);return{type:"UnicodeProperty",name:r,value:i,negative:t,shorthand:!1,binary:!1,canonicalName:jy(r),canonicalValue:Vy(i)}}if(yM(e))return{type:"UnicodeProperty",name:"General_Category",value:e,negative:t,shorthand:!0,binary:!1,canonicalName:"General_Category",canonicalValue:Vy(e)};if(gM(e)){let r=jy(e);return{type:"UnicodeProperty",name:e,value:e,negative:t,shorthand:!1,binary:!0,canonicalName:r,canonicalValue:r}}throw new Error(`Invalid Unicode property: ${e}`)}var Ru=String.fromCodePoint;function Au(e){let t=e.pop();if(t===void 0)throw new Error("Unable to extract token preceeding the currently parsed one");return t}function H0(e){return e>="0"&&e<="9"}function Ko(e,t){return{type:"Char",kind:"simple",symbol:e,value:e,codePoint:e.codePointAt(0)||-1,escaped:t}}function qn(e,t){return{type:"Char",kind:"meta",symbol:t,value:e,codePoint:t.codePointAt(0)||-1}}function rn(e,t){if(e.length>1)return{type:"Alternative",expressions:e};if(!t&&e.length===0)throw new Error("Unsupported no token");return e[0]}function Cu(e){if(e[0]==="\\"){let t=e[1];switch(t){case"x":{let n=e.substring(2),r=Number.parseInt(n,16);return{type:"Char",kind:"hex",symbol:Ru(r),value:e,codePoint:r}}case"u":{if(e==="\\u")return Ko("u",!0);let n=e[2]==="{"?e.substring(3,e.length-1):e.substring(2),r=Number.parseInt(n,16);return{type:"Char",kind:"unicode",symbol:Ru(r),value:e,codePoint:r}}case"0":return qn(e,"\0");case"n":return qn(e,`
|
|
54
54
|
`);case"f":return qn(e,"\f");case"r":return qn(e,"\r");case"t":return qn(e," ");case"v":return qn(e,"\v");case"w":case"W":case"d":case"D":case"s":case"S":case"b":case"B":return{type:"Char",kind:"meta",symbol:void 0,value:e,codePoint:NaN};default:if(H0(t)){let n=e.substring(1),r=Number(n);return{type:"Char",kind:"decimal",symbol:Ru(r),value:e,codePoint:r}}if(e.length>2&&(t==="p"||t==="P")){let n=t==="P";return bM(e.substring(3,e.length-1),n)}return Ko(e.substring(1),!0)}}return Ko(e)}function Kn(e,t,n,r){let i=null;for(let o=0,s=jo(t,o,n,0);o!==t.length;o+=s.length,s=jo(t,o,n,0)){let a=s[0];switch(a){case"|":i===null&&(i=[]),i.push(rn(e.splice(0),!0)||null);break;case".":e.push({type:"Char",kind:"meta",symbol:s,value:s,codePoint:NaN});break;case"*":case"+":{let l=Au(e);e.push({type:"Repetition",expression:l,quantifier:{type:"Quantifier",kind:a,greedy:!0}});break}case"?":{let l=Au(e);l.type==="Repetition"?(l.quantifier.greedy=!1,e.push(l)):e.push({type:"Repetition",expression:l,quantifier:{type:"Quantifier",kind:a,greedy:!0}});break}case"{":{if(s==="{"){e.push(Ko(s));break}let l=Au(e),u=s.substring(1,s.length-1).split(","),c=Number(u[0]),d=u.length===1?c:u[1].length!==0?Number(u[1]):void 0;e.push({type:"Repetition",expression:l,quantifier:{type:"Quantifier",kind:"Range",greedy:!0,from:c,to:d}});break}case"[":{let l=s.substring(1,s.length-1),u=[],c,d=!1;for(let f=0,p=jo(l,f,n,1);f!==l.length;f+=p.length,p=jo(l,f,n,1)){if(f===0&&p==="^"){c=!0;continue}let h=Cu(p);if(p==="-")u.push(h),d=!0;else{let m=u.length>=2?u[u.length-2]:void 0;d&&m!==void 0&&m.type==="Char"&&h.type==="Char"?(u.pop(),u.pop(),u.push({type:"ClassRange",from:m,to:h})):u.push(h),d=!1}}e.push({type:"CharacterClass",expressions:u,negative:c});break}case"(":{let l=s.substring(1,s.length-1),u=[];if(l[0]==="?")if(l[1]===":")Kn(u,l.substring(2),n,r),e.push({type:"Group",capturing:!1,expression:rn(u)});else if(l[1]==="="||l[1]==="!")Kn(u,l.substring(2),n,r),e.push({type:"Assertion",kind:"Lookahead",negative:l[1]==="!"?!0:void 0,assertion:rn(u)});else if(l[1]==="<"&&(l[2]==="="||l[2]==="!"))Kn(u,l.substring(3),n,r),e.push({type:"Assertion",kind:"Lookbehind",negative:l[2]==="!"?!0:void 0,assertion:rn(u)});else{let c=l.split(">");if(c.length<2||c[0][1]!=="<")throw new Error(`Unsupported regex content found at ${JSON.stringify(s)}`);let d=++r.lastIndex,f=c[0].substring(2);r.named.set(f,d),Kn(u,c.slice(1).join(">"),n,r),e.push({type:"Group",capturing:!0,nameRaw:f,name:f,number:d,expression:rn(u)})}else{let c=++r.lastIndex;Kn(u,l,n,r),e.push({type:"Group",capturing:!0,number:c,expression:rn(u)})}break}default:if(s==="^")e.push({type:"Assertion",kind:s});else if(s==="$")e.push({type:"Assertion",kind:s});else if(s[0]==="\\"&&H0(s[1])){let l=Number(s.substring(1));n||l<=r.lastIndex?e.push({type:"Backreference",kind:"number",number:l,reference:l}):e.push(Cu(s))}else if(s[0]==="\\"&&s[1]==="k"&&s.length!==2){let l=s.substring(3,s.length-1);e.push({type:"Backreference",kind:"name",number:r.named.get(l)||0,referenceRaw:l,reference:l})}else e.push(Cu(s));break}}if(i!==null){i.push(rn(e.splice(0),!0)||null);let o={type:"Disjunction",left:i[0],right:i[1]};for(let s=2;s<i.length;++s)o={type:"Disjunction",left:o,right:i[s]};e.push(o)}}function SM(e){let t=Bt([...e.flags],"u")!==-1,n=e.source,r=[];return Kn(r,n,t,{lastIndex:0,named:new Map}),rn(r)}var wM=String.fromCodePoint;function xM(e){return e.binary||e.shorthand?e.canonicalValue:`${e.canonicalName}=${e.canonicalValue}`}function Wy(e,t,n,r){let i=-1;for(let o=t;o<=n;++o)if(e.test(wM(o)))i===-1&&(i=o);else if(i!==-1){let s=o-1;r.push(i===s?[s]:[i,s]),i=-1}i!==-1&&r.push(i===n?[n]:[i,n])}function vM(e,t){let n=new RegExp(`^\\${t?"P":"p"}{${e}}$`,"u"),r=[];return Wy(n,0,55295,r),Wy(n,57344,1114111,r),r}var zy=new Map;function RM(e,t){let n=`${t?"P":"p"}:${e}`,r=zy.get(n);if(r!==void 0)return r;let i=vM(e,t);return zy.set(n,i),i}function AM(e){return er(...j(RM(xM(e),e.negative),t=>Ou(t)))}var CM=String.fromCodePoint,Gy=[..."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"],Hy=[..."0123456789"],qy=[...` \r
|
|
55
55
|
\v\f`],Xu=[...`\r
|
|
56
|
-
`],q0=[...""],EM=[...Xu,...q0],vn=()=>Ce({unit:"grapheme-ascii",minLength:1,maxLength:1});function Ky(e){return new P(`Unsupported AST node! Received: ${xe(e)}`)}function on(e,t,n){switch(e.type){case"Char":if(e.kind==="meta")switch(e.value){case"\\w":return It(...Gy);case"\\W":return vn().filter(r=>Bt(Gy,r)===-1);case"\\d":return It(...Hy);case"\\D":return vn().filter(r=>Bt(Hy,r)===-1);case"\\s":return It(...qy);case"\\S":return vn().filter(r=>Bt(qy,r)===-1);case"\\b":case"\\B":throw new P(`Meta character ${e.value} not implemented yet!`);case".":{let r=n.dotAll?q0:EM;return vn().filter(i=>Bt(r,i)===-1)}}if(e.symbol===void 0)throw new P(`Unexpected undefined symbol received for non-meta Char! Received: ${xe(e)}`);return we(e.symbol);case"Repetition":{let r=on(e.expression,t,n);switch(e.quantifier.kind){case"*":return Ce({...t,unit:r});case"+":return Ce({...t,minLength:1,unit:r});case"?":return Ce({...t,minLength:0,maxLength:1,unit:r});case"Range":return Ce({...t,minLength:e.quantifier.from,maxLength:e.quantifier.to,unit:r});default:throw Ky(e.quantifier)}}case"Quantifier":throw new P("Wrongly defined AST tree, Quantifier nodes not supposed to be scanned!");case"Alternative":return D(...j(e.expressions,r=>on(r,t,n))).map(r=>le(r,""));case"CharacterClass":if(e.negative){let r=j(e.expressions,i=>on(i,t,n));return vn().filter(i=>sg(r,o=>!o.canShrinkWithoutContext(i)))}return ke(...j(e.expressions,r=>on(r,t,n)));case"ClassRange":{let r=e.from.codePoint,i=e.to.codePoint;return X({min:r,max:i}).map(o=>CM(o),o=>{if(typeof o!="string")throw new P("Invalid type");if([...o].length!==1)throw new P("Invalid length");return Xn(o,0)})}case"Group":return on(e.expression,t,n);case"Disjunction":return ke(e.left!==null?on(e.left,t,n):we(""),e.right!==null?on(e.right,t,n):we(""));case"Assertion":if(e.kind==="^"||e.kind==="$")return n.multiline?e.kind==="^"?ke(we(""),D(Ce({unit:vn()}),It(...Xu)).map(r=>`${r[0]}${r[1]}`,r=>{if(typeof r!="string"||r.length===0)throw new P("Invalid type");return[me(r,0,r.length-1),r[r.length-1]]})):ke(we(""),D(It(...Xu),Ce({unit:vn()})).map(r=>`${r[0]}${r[1]}`,r=>{if(typeof r!="string"||r.length===0)throw new P("Invalid type");return[r[0],me(r,1)]})):we("");throw new P(`Assertions of kind ${e.kind} not implemented yet!`);case"Backreference":throw new P("Backreference nodes not implemented yet!");case"UnicodeProperty":return AM(e);default:throw Ky(e)}}function kM(e,t={}){for(let a of e.flags)if(a!=="d"&&a!=="g"&&a!=="m"&&a!=="s"&&a!=="u")throw new P(`Unable to use "stringMatching" against a regex using the flag ${a}`);let n=t.maxLength,r={size:t.size,maxLength:n},i={multiline:e.multiline,dotAll:e.dotAll},o=fM(SM(e));n!==void 0&&(o=cM(o,n));let s=on(o,r,i);return n!==void 0?s.filter(a=>[...a].length<=n):s}function IM(e){let t=[];for(let n=0;n!==e.length;++n)t.push(e[n].next());return t}function PM(e,t){for(let n=0;n!==e.length;++n)t[n]=e[n].next()}function MM(e){for(let t=0;t!==e.length;++t)if(e[t].done)return!0;return!1}function*TM(...e){let t=IM(e);for(;!MM(t);)yield t.map(n=>n.value),PM(e,t)}function*OM(e){let t=e;for(;;)yield t,++t}var NM=class extends ue{constructor(e,t){super(),this.arb=e,this.maxShrinks=t}generate(e,t){let n=this.arb.generate(e,t);return this.valueMapper(n,0)}canShrinkWithoutContext(e){return this.arb.canShrinkWithoutContext(e)}shrink(e,t){return this.isSafeContext(t)?this.safeShrink(e,t.originalContext,t.length):this.safeShrink(e,void 0,0)}safeShrink(e,t,n){let r=this.maxShrinks-n;return r<=0?L.nil():new L(TM(this.arb.shrink(e,t),OM(n+1))).take(r).map(i=>this.valueMapper(i[0],i[1]))}valueMapper(e,t){let n={originalContext:e.context,length:t};return new T(e.value,n)}isSafeContext(e){return e!=null&&typeof e=="object"&&"originalContext"in e&&"length"in e}};function _M(e,t){return new NM(e,t)}var $M=$p({Arbitrary:()=>ue,ExecutionStatus:()=>Yk,PreconditionFailure:()=>cn,Random:()=>ic,Stream:()=>L,Value:()=>T,VerbosityLevel:()=>kk,__commitHash:()=>FM,__type:()=>LM,__version:()=>DM,anything:()=>E0,array:()=>oe,assert:()=>g2,asyncDefaultReportMessage:()=>Cg,asyncModelRun:()=>tM,asyncProperty:()=>Ck,asyncStringify:()=>rc,asyncToStringMethod:()=>Vt,base64String:()=>f3,bigInt:()=>un,bigInt64Array:()=>sM,bigUint64Array:()=>aM,boolean:()=>ri,chainUntil:()=>aI,check:()=>kg,clone:()=>fI,cloneIfNeeded:()=>Yn,cloneMethod:()=>Ie,commands:()=>Y3,compareBooleanFunc:()=>d6,compareFunc:()=>h6,configureGlobal:()=>vk,constant:()=>we,constantFrom:()=>It,context:()=>tI,createDepthIdentifier:()=>ac,date:()=>Bg,defaultReportMessage:()=>Ag,dictionary:()=>cc,domain:()=>pc,double:()=>ns,emailAddress:()=>CP,entityGraph:()=>d4,falsy:()=>Q2,float:()=>o0,float32Array:()=>h0,float64Array:()=>p0,func:()=>y6,gen:()=>E2,getDepthContextFor:()=>sc,hasAsyncToStringMethod:()=>nc,hasCloneMethod:()=>Rn,hasToStringMethod:()=>tc,hash:()=>Qo,infiniteStream:()=>o3,int16Array:()=>m0,int32Array:()=>y0,int8Array:()=>g0,integer:()=>X,ipV4:()=>bc,ipV4Extended:()=>u0,ipV6:()=>c0,json:()=>n3,jsonValue:()=>k0,letrec:()=>d0,limitShrink:()=>_M,lorem:()=>S4,map:()=>zu,mapToConstant:()=>er,maxSafeInteger:()=>l0,maxSafeNat:()=>w6,memo:()=>R4,mixedCase:()=>P4,modelRun:()=>eM,nat:()=>sn,noBias:()=>Jo,noShrink:()=>es,object:()=>X4,oneof:()=>ke,option:()=>Wt,pre:()=>JC,property:()=>Ek,readConfigureGlobal:()=>pt,record:()=>Wu,resetConfigureGlobal:()=>Rk,sample:()=>S2,scheduledModelRun:()=>nM,scheduler:()=>iM,schedulerFor:()=>oM,set:()=>R0,shuffledSubarray:()=>g3,sparseArray:()=>v0,statistics:()=>x2,stream:()=>ln,string:()=>Ce,stringMatching:()=>kM,stringify:()=>xe,subarray:()=>y3,toStringMethod:()=>mt,tuple:()=>D,uint16Array:()=>b0,uint32Array:()=>S0,uint8Array:()=>w0,uint8ClampedArray:()=>x0,ulid:()=>C3,uniqueArray:()=>Cn,uuid:()=>O3,webAuthority:()=>T0,webFragments:()=>N0,webPath:()=>$0,webQueryParameters:()=>L0,webSegment:()=>_0,webUrl:()=>G3}),LM="module",DM="4.8.0",FM="c0da76fbcf6470339ad7bb2f0dfcebee06ede56c",$e=$M;var BM=24301;function is(e,t){return e.reduce((n,r)=>WM(n,t[r.idx]?.paramSpaces),new Map)}function nr(e,t){return Object.fromEntries(Object.entries(e.paramSpaces).map(([n,r])=>[n,UM(r,r?.name==null?0:t.get(r.name)??0)]))}var K0=new WeakMap;function UM(e,t){if(e==null)return Y0(void 0,t);let n=K0.get(e)??new Map;K0.set(e,n);let r=n.get(t);if(r!=null)return r;let i=Y0(e,t);return n.set(t,i),i}function jM(e){return e?.values!=null&&e.values.length>0?$e.constantFrom(...e.values):VM(e)}function Y0(e,t){let[n]=$e.sample(jM(e),{numRuns:1,seed:BM+t});if(n==null)throw new Error("arbitrary produced no sample");return n}function VM(e){if(e?.type==="number")return $e.integer();if(e?.type==="boolean")return $e.boolean();let t=e?.generator==null?void 0:GM[e.generator];if(t!=null)return t;let n=e?.constraints?.kind==="string"?e.constraints:void 0;return $e.string({maxLength:n?.maxLength,minLength:n?.minLength??1}).filter(r=>r.trim().length>0&&r===r.trim())}function WM(e,t){return t==null?e:Object.values(t).reduce((n,r)=>r==null?n:new Map([...n,[r.name,(n.get(r.name)??0)+1]]),e)}var zM="abcdefghijklmnopqrstuvwxyz0123456789".match(/./g)??[],tr=e=>$e.array($e.constantFrom(...zM),{maxLength:e,minLength:1}).map(t=>t.join("")),Rc=(e,t)=>$e.array(tr(10),{maxLength:t,minLength:1}).map(n=>n.join(e)),GM={"company.name":Rc(" ",3),"date.iso":HM(),"internet.email":qM(),"internet.url":KM(),"lorem.slug":Rc("-",3),"lorem.word":tr(10),"person.fullName":Rc(" ",2)};function HM(){return $e.date({max:new Date("2030-12-31T23:59:59.999Z"),min:new Date("2020-01-01T00:00:00.000Z"),noInvalidDate:!0}).map(e=>e.toISOString())}function qM(){return $e.tuple(tr(12),tr(10),$e.constantFrom("com","dev","io","org","ai")).map(([e,t,n])=>`${e}@${t}.${n}`)}function KM(){return $e.tuple($e.constantFrom("http","https"),tr(12),$e.constantFrom("app","com","dev","io","org"),$e.array(tr(8),{maxLength:3})).map(([e,t,n,r])=>{let i=r.length===0?"":`/${r.join("/")}`;return`${e}://${t}.${n}${i}`})}var YM=new Map;function os(e){return nr(e,YM)}import{z as J}from"zod";var rr=J.enum(["crash","data-rule","page-rule","frame"]),Z0=J.object({intent:J.string().min(1),test:J.string().min(1)}),ZM=J.union([J.object({kind:J.literal("singleton-mismatch"),singleton:J.string().min(1)}),J.object({entity:J.string().min(1),kind:J.string().min(1)})]),XM=J.discriminatedUnion("kind",[J.object({kind:J.literal("consistency"),layer:rr,mismatch:ZM,step:Z0.nullable()}),J.object({kind:J.literal("pending-check"),layer:rr,source:J.string().min(1),step:Z0}),J.object({intent:J.string().min(1),kind:J.literal("unrunnable"),layer:rr,reason:J.string().min(1),test:J.string().min(1)}),J.object({error:J.string().min(1),kind:J.literal("driver-error"),layer:rr,step:J.string().min(1)}),J.object({kind:J.literal("impossible-action"),layer:rr,step:J.string().min(1)})]);import{z as Ac}from"zod";var X0=Ac.number().min(0).max(10),J0=Ac.object({destructiveActions:X0,maxAttemptLength:Ac.number().int().positive(),mixWorkflows:X0}),Cc={even:{destructiveActions:2,maxAttemptLength:12,mixWorkflows:4}};function Q0(e){return Cc[e]}function Ec(e,t,n){let r=t.reduce((u,c)=>u+c,0),i=t.reduce((u,c)=>[...u,(u.at(-1)??0)+c],[]),o=n()*r,s=i.findIndex(u=>o<u),a=r<=0?Math.floor(n()*e.length):s,l=e[a<0?e.length-1:a];if(l==null)throw new Error("weighted sample drew an empty set");return l}var eb=1;function ss(e){return{startingPoint:e.startingPoint.name,steps:tb(e,e.startingPoint.snapshot,[])}}function tb(e,t,n){if(n.length>=e.strategy.maxAttemptLength)return n;let r=co(e.corpus,{snapshot:t},JM(e.corpus,n));if(r.length===0)return n;let i=QM(e,r,n);return tb(e,i.stepRun.next.snapshot,[...n,{idx:i.idx,params:i.params}])}function JM(e,t){let n=is(t,e);return r=>nr(r,n)}function QM(e,t,n){let r=t.map(i=>eT(e,i,n));return Ec(t,r,e.random)}function eT(e,t,n){let r=e.corpus[t.idx];if(r==null)return eb;let i=$h(r.effectStep)?e.strategy.destructiveActions:0,o=tT(e.corpus,r,n)?e.strategy.mixWorkflows:0;return eb+i+o}function tT(e,t,n){let r=new Set(n.flatMap(i=>{let o=e[i.idx];return o==null?[]:[o.test]}));return r.size>0&&!r.has(t.test)}import{z as se}from"zod";var nb=se.object({baseStateTest:Gi,lockfileFingerprint:se.string(),lockfileHash:se.string().min(1),stepRuns:se.array(se.object({idx:se.number().int().nonnegative(),params:se.record(se.string(),se.union([Tt,se.null()]))}))}),rb=se.object({baseStateRef:se.string().min(1),steps:se.array(se.object({index:se.number().int().nonnegative(),params:se.record(se.string(),se.union([Tt,se.null()])),test:se.string().min(1)}))}),ib=se.object({actions:se.array(se.string()),label:se.string().min(1)}),ob=se.object({kind:se.enum(["aborted","clean","error","flaky","finding"]),reason:se.string().optional(),runId:se.string().optional()});function as(e,{sweep:t}){let n=Dt(Ct(e),r=>G({s:r.test.singletons,w:r.test.world})).map(r=>({name:r.ref,test:r.test}));return t?[...n,...n.flatMap(r=>nT(r))]:n}function ls(e,t,n){return jn(e,t.test,n)}function nT(e){return rT(e.test).map(t=>{let n={...t,as:`${t.as}~2`},r=`${e.name} +${t.entity}`;return{name:r,test:{...e.test,name:r,world:[...e.test.world,n]}}})}function rT(e){return e.world.filter(t=>{let n=G({...e,world:e.world.filter(r=>r!==t)});return!n.includes(`"${t.as}.`)&&!n.includes(`"ref":"${t.as}"`)})}async function us(e){let t=Sn(e);if(t.length===0)return null;let n=as(e,{sweep:!1}),r=await iT(e,n);return r.length===0?null:{corpus:t,startingPoints:r,startingPointTests:new Map(n.map(i=>[i.name,i.test]))}}function sb({lockfileFingerprint:e,lockfileHash:t,prepared:n,random:r,strategy:i}){let o=n.startingPoints[Math.floor(r()*n.startingPoints.length)];if(o==null)return null;let s=ss({corpus:n.corpus,random:r,startingPoint:o,strategy:i}),a=n.startingPointTests.get(s.startingPoint);return a==null||s.steps.length===0?null:{baseStateTest:a,lockfileFingerprint:e,lockfileHash:t,stepRuns:s.steps.map(l=>({idx:l.idx,params:l.params}))}}async function iT(e,t){let n={generate:zr,materialize:ro(zr,e.valueSpaces),params:void 0};return(await Promise.all(t.map(async i=>(await ls(e,i,n)).match(s=>({name:i.name,snapshot:s.snapshot}),()=>null)))).flatMap(i=>i==null?[]:[i])}import{ResultAsync as kc}from"neverthrow";var ii=class extends Error{mountKey;constructor(t){super("client-mount-unmounted"),this.mountKey=t}};function cs(e){return{read:t=>ST(t,e),seedScript:t=>`globalThis[${JSON.stringify(Va)}] = ${JSON.stringify(t)};`}}async function ST(e,t){let n={title:await e.title(),url:$t(e.url()),viewport:vT(e.viewportSize())};if(t.length===0)return n;let r=await e.evaluate(xT,{mountKey:Wi,names:t,timeoutMs:wT});if(r.kind==="unmounted")throw new ii(Wi);return{...n,...r.values}}var wT=5e3;async function xT(e){let t=Date.now()+e.timeoutMs;for(;Reflect.get(globalThis,e.mountKey)==null&&Date.now()<t;)await new Promise(r=>setTimeout(r,25));let n=Reflect.get(globalThis,e.mountKey);return n==null?{kind:"unmounted"}:{kind:"values",values:Object.fromEntries(e.names.map(r=>[r,n.readSingleton(r)??null]))}}function vT(e){return e==null?"":`${String(e.width)}x${String(e.height)}`}function Ic(e,t,n){return{evaluate:r=>kc.fromPromise(ub(RT(e,n,r),`check ${r.kind}`),ab),locateIds:r=>PT(e,r),observe:()=>t.read().andThen(r=>kc.fromPromise(ub(cb(e,n,0),"observe"),ab).map(i=>({snapshot:{...r,singletons:{...r.singletons,...i}}}))),perform:r=>kc.fromPromise(fb(e,r,0),i=>yl(r.kind,i))}}async function RT(e,t,n){try{return await yb(e,t,n)}catch(r){if(db(r))return!1;throw r}}function ab(e){return e instanceof ii?fl(e.mountKey):gl(e)}var AT=[100,250,500];async function cb(e,t,n){try{return await t.read(e)}catch(r){let i=AT[n];if(i==null||!db(r))throw r;return await mb(i),cb(e,t,n+1)}}function db(e){let t=e instanceof Error?e.message:String(e);return/Execution context was destroyed|Cannot find context with specified id|[Ff]rame was detached|frame got detached/.test(t)}var lb=35e3;function ub(e,t){let n,r=new Promise((i,o)=>{n=setTimeout(()=>{o(new Error(`driver op "${t}" exceeded ${String(lb)}ms`))},lb)});return Promise.race([e,r]).finally(()=>{clearTimeout(n)})}var CT=[250,750,2e3];async function fb(e,t,n){try{await ET(e,t)}catch(r){let i=CT[n];if(i==null||!TT(r))throw r;await mb(i),await fb(e,t,n+1)}}async function ET(e,t){if(t.kind==="goto"){await e.goto(ir(t.url,t,"url"),{waitUntil:"domcontentloaded"});return}if(t.kind==="press"&&t.locator==null){await e.keyboard.press(ir(t.key,t,"key"));return}let n=t.kind!=="upload";await kT(e,hb(e,t.locator,{visibleOnly:n}),t)}function ir(e,t,n){if(e==null)throw new Error(`action "${t.kind}" requires ${n}`);return e}function kT(e,t,n){switch(n.kind){case"goto":throw new Error("goto must not be located");case"fill":return t.fill(String(ir(n.value,n,"value")));case"clear":return t.clear();case"click":return t.click();case"dblclick":return t.dblclick();case"check":return t.check();case"uncheck":return t.uncheck();case"hover":return t.hover();case"select":return IT(e,t,String(ir(n.value,n,"value")));case"upload":return t.setInputFiles(ir(n.files,n,"files"));case"press":return t.press(ir(n.key,n,"key"))}}async function IT(e,t,n){if(await t.evaluate(i=>i.tagName==="SELECT")){await t.selectOption(n);return}await t.click(),await t.fill(n),await e.locator(pb("option",n)).filter({visible:!0}).click()}async function PT(e,t){if(t==null)return[];try{let n=ds(e,t,{visibleOnly:!1});if(await n.count()===0)return[];let r=await n.first().evaluate(MT);return r>0?[r]:[]}catch{return[]}}function MT(e){return globalThis.__ripploRrwebMirror?.getId(e)??-1}function hb(e,t,n){if(t==null)throw new Error("action requires a locator");return ds(e,t,n)}function ds(e,t,n){if(t.by==="inside"){let i=ds(e,t.scope,n);return ds(i,t.target,n)}let r=t.by==="testId"?e.getByTestId(t.value):e.locator(pb(t.role,t.name));return n.visibleOnly?r.filter({visible:!0}):r}function pb(e,t){return t==null?`role=${e}`:`role=${e}[name=${JSON.stringify(t)}i]`}function TT(e){let t=e instanceof Error?e.message:String(e);return/net::ERR_|ERR_HTTP_RESPONSE_CODE_FAILURE|ECONNREFUSED|ECONNRESET|socket hang up|fetch failed|page\.goto: Timeout/.test(t)}function mb(e){return new Promise(t=>{setTimeout(t,e)})}async function yb(e,t,n){if(n.kind==="browser")return NT(e,t,n.name,n.value);if(n.kind==="not")return!await yb(e,t,n.inner);let r=hb(e,n.locator,{visibleOnly:!0});return n.kind==="value"?await r.inputValue()===n.value:n.kind==="text"?(await r.textContent()??"").includes(n.value):OT(r,n.kind)}function OT(e,t){return t==="visible"?e.isVisible():t==="disabled"?e.isDisabled():t==="enabled"?e.isEnabled():t==="checked"?e.isChecked():e.evaluate(n=>n===n.ownerDocument.activeElement)}async function NT(e,t,n,r){let o=(await t.read(e))[n];return typeof o=="string"&&o.includes(r)}import _T from"path";var bb={height:720,width:1280};async function fs({baseUrl:e,browser:t,capture:n,clientState:r,engine:i,extraHeaders:o,fixturesDir:s,reader:a,session:l,viewport:u}){let c=await t.newContext({baseURL:e,reducedMotion:"reduce",storageState:l==null?void 0:{cookies:$T(l.cookies,e),origins:l.origins},viewport:u}),d=LT(o,l?.headers);d!=null&&await c.setExtraHTTPHeaders(d),await c.addInitScript(i.seedScript(r));let f=n==null?DT():await n.hub.attach(c,n.runId),p=await c.newPage();return f.onPage(p),{context:c,driver:UT(FT(Ic(p,a,i),s),f),emitAssertion:f.emitAssertion,close:()=>jT({context:c,handle:f})}}async function Pc(e,t){let n=await Sb(e);try{return await t(n)}finally{await n.close()}}function $T(e,t){let n=new URL(t).hostname;return e.map(r=>({...r,domain:n}))}function LT(e,t){return e==null?t:t==null?e:{...e,...t}}function DT(){return{emitAction:()=>{},emitAssertion:()=>{},finish:()=>Promise.resolve(),onPage:()=>{}}}async function Sb(e){let{chromium:t}=await import("playwright");return t.launch({headless:!e})}function hs({headed:e}){let t;return{acquire:async()=>{let i=t;if(i!=null){let o=await i.catch(()=>{});if(o?.isConnected()===!0)return o;t===i&&(t=void 0)}return t??=Sb(e),t},close:async()=>{let i=t;t=void 0,i!=null&&await i.then(o=>o.close()).catch(()=>{})}}}function FT(e,t){return{evaluate:e.evaluate,locateIds:e.locateIds,observe:e.observe,perform:n=>e.perform(BT(n,t))}}function BT(e,t){return e.kind!=="upload"||e.files==null?e:{...e,files:e.files.map(n=>_T.join(t,n))}}function UT(e,t){return{evaluate:e.evaluate,locateIds:e.locateIds,observe:e.observe,perform:n=>(t.emitAction(n),e.perform(n))}}async function jT({context:e,handle:t}){await gb(t.finish()),await gb(e.close())}var VT=15e3;async function gb(e){let t,n=new Promise(r=>{t=setTimeout(r,VT)});await Promise.race([e.catch(()=>{}),n]).finally(()=>{clearTimeout(t)})}import{err as WT,ok as zT,Result as Mc}from"neverthrow";function Tc(e,t,n){return{read:()=>n.read(e.map(r=>r.name),t).andThen(r=>GT(e,r))}}function GT(e,t){return Mc.combine(e.map(n=>HT(n,t.entities[n.name]??[]).map(r=>[n.name,r]))).map(n=>({entities:new Map(n),singletons:t.singletons}))}function HT(e,t){let n=Dr(e);return Mc.combine(t.map(r=>qT(r,e).map(i=>[i,KT(r,n)]))).map(r=>new Map(r))}function qT(e,t){return Mc.combine(t.identity.map(n=>{let r=e[n];return r==null?WT(pl(t.name,n)):zT(String(r))})).map(n=>n.join(":"))}function KT(e,t){let n=t.map(r=>[r,e[r]]).filter(r=>r[1]!=null);return Object.fromEntries(n)}var wb=Ta(wx(),1);import YT from"crypto";import{err as ZT,errAsync as Oc,ok as XT,ResultAsync as or}from"neverthrow";var JT=3e4,QT=[250,750,2e3],eO=[500,1e3,2e3,3e3];function Nc({baseUrl:e,extraHeaders:t,runId:n,secret:r},i){let o=new wb.Webhook(r),s=(a,l,u)=>tO({baseUrl:e,body:l,extraHeaders:t,path:a,retry:u.retry,schema:u.schema,signal:u.signal,webhook:o});return{query:{read:(a,l)=>s("/state",{entities:a,runId:n,singletons:l},{retry:"transient",schema:sl,signal:i}).map(u=>({entities:u.entities,singletons:u.singletons}))},ready:()=>vb(e,t,i,0),setupWorld:a=>s("/setup",{entities:a,runId:n},{retry:"connection",schema:ol,signal:i}).map(l=>l.rows),teardown:()=>s("/teardown",{runId:n},{retry:"connection",schema:al,signal:void 0}).map(()=>{})}}function tO(e){return xb(e.retry,()=>oO(e),0)}function xb(e,t,n){return t().orElse(r=>{let i=QT[n];return i==null||!rO(r,e)?Oc(r):or.fromSafePromise(Rb(i)).andThen(()=>xb(e,t,n+1))})}function vb(e,t,n,r){return or.fromPromise(fetch(e,{headers:t,method:"HEAD",signal:Ab(n)}),i=>Fn("",i)).map(()=>{}).orElse(()=>{let i=eO[r];return i==null||n.aborted?Oc(ml(e)):or.fromSafePromise(Rb(i)).andThen(()=>vb(e,t,n,r+1))})}var nO=new Set(["EAI_AGAIN","ECONNREFUSED","ENOTFOUND"]);function rO(e,t){return e.kind==="aborted"?!1:iO(e)?!0:t==="connection"?!1:e.kind==="engine-network"||e.kind==="engine-http"&&e.status>=500}function iO(e){return e.kind==="engine-network"&&e.code!=null&&nO.has(e.code)}function Rb(e){return new Promise(t=>{setTimeout(t,e)})}function oO({baseUrl:e,body:t,extraHeaders:n,path:r,schema:i,signal:o,webhook:s}){let a=JSON.stringify(t);return or.fromPromise(fetch(`${e}${r}`,{body:a,headers:{...n,"Content-Type":"application/json",...sO(s,a)},method:"PUT",signal:Ab(o)}),l=>Fn(r,l)).andThen(l=>aO(l,r)).andThen(l=>lO(i,l,r)).mapErr(l=>o?.aborted===!0?bl():l)}function sO(e,t){let n=`msg_${YT.randomUUID()}`,r=new Date;return{"webhook-id":n,"webhook-signature":e.sign(n,r,t),"webhook-timestamp":String(Math.floor(r.getTime()/1e3))}}function Ab(e){let t=AbortSignal.timeout(JT);return e==null?t:AbortSignal.any([e,t])}function aO(e,t){return e.ok?or.fromPromise(e.json(),n=>Fn(t,n)):or.fromPromise(e.text().catch(()=>""),n=>Fn(t,n)).andThen(n=>Oc(dl(t,e.status,n)))}function lO(e,t,n){let r=e.safeParse(t);return r.success?XT(r.data):ZT(hl(n,r.error))}import t1 from"path";import{err as As,ok as Cs,ResultAsync as n1}from"neverthrow";import{existsSync as n8}from"fs";import{writeFile as r8}from"fs/promises";import i8 from"path";import{err as Rs,ok as o8}from"neverthrow";import{createRequire as uO}from"module";var cO=uO("/"),ar,dO,fO;try{ar=cO("worker_threads"),dO=ar.Worker,fO=ar.isMarkedAsUntransferable}catch{}var Ue=Uint8Array,sr=Uint16Array,hO=Int32Array,Cb=new Ue([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Eb=new Ue([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),pO=new Ue([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),kb=function(e,t){for(var n=new sr(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new hO(n[30]),r=1;r<30;++r)for(var o=n[r];o<n[r+1];++o)i[o]=o-n[r]<<5|r;return{b:n,r:i}},ar=kb(Cb,2),Ib=ar.b,mO=ar.r;Ib[28]=258,mO[258]=28;var Pb=kb(Eb,0),yO=Pb.b,Xj=Pb.r,Dc=new sr(32768);for(Y=0;Y<32768;++Y)Gt=(Y&43690)>>1|(Y&21845)<<1,Gt=(Gt&52428)>>2|(Gt&13107)<<2,Gt=(Gt&61680)>>4|(Gt&3855)<<4,Dc[Y]=((Gt&65280)>>8|(Gt&255)<<8)>>1;var Gt,Y,oi=(function(e,t,n){for(var r=e.length,i=0,o=new sr(t);i<r;++i)e[i]&&++o[e[i]-1];var s=new sr(t);for(i=1;i<t;++i)s[i]=s[i-1]+o[i-1]<<1;var a;if(n){a=new sr(1<<t);var l=15-t;for(i=0;i<r;++i)if(e[i])for(var u=i<<4|e[i],c=t-e[i],d=s[e[i]-1]++<<c,f=d|(1<<c)-1;d<=f;++d)a[Dc[d]>>l]=u}else for(a=new sr(r),i=0;i<r;++i)e[i]&&(a[i]=Dc[s[e[i]-1]++]>>15-e[i]);return a}),si=new Ue(288);for(Y=0;Y<144;++Y)si[Y]=8;var Y;for(Y=144;Y<256;++Y)si[Y]=9;var Y;for(Y=256;Y<280;++Y)si[Y]=7;var Y;for(Y=280;Y<288;++Y)si[Y]=8;var Y,Mb=new Ue(32);for(Y=0;Y<32;++Y)Mb[Y]=5;var Y;var gO=oi(si,9,1);var bO=oi(Mb,5,1),_c=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},yt=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},$c=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},SO=function(e){return(e+7)/8|0},ps=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Ue(e.subarray(t,n))};var wO=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ge=function(e,t,n){var r=new Error(t||wO[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Ge),!n)throw r;return r},Tb=function(e,t,n,r){var i=e.length,o=r?r.length:0;if(!i||t.f&&!t.l)return n||new Ue(0);var s=!n,a=s||t.i!=2,l=t.i;s&&(n=new Ue(i*3));var u=function(K){var ze=n.length;if(K>ze){var de=new Ue(Math.max(ze*2,K));de.set(n),n=de}},c=t.f||0,d=t.p||0,f=t.b||0,p=t.l,h=t.d,m=t.m,y=t.n,S=i*8;do{if(!p){c=yt(e,d,1);var w=yt(e,d+1,3);if(d+=3,w)if(w==1)p=gO,h=bO,m=9,y=5;else if(w==2){var O=yt(e,d,31)+257,N=yt(e,d+10,15)+4,_=O+yt(e,d+5,31)+1;d+=14;for(var I=new Ue(_),B=new Ue(19),U=0;U<N;++U)B[pO[U]]=yt(e,d+U*3,7);d+=N*3;for(var ne=_c(B),$=(1<<ne)-1,Me=oi(B,ne,1),U=0;U<_;){var qe=Me[yt(e,d,$)];d+=qe&15;var g=qe>>4;if(g<16)I[U++]=g;else{var ae=0,Oe=0;for(g==16?(Oe=3+yt(e,d,3),d+=2,ae=I[U-1]):g==17?(Oe=3+yt(e,d,7),d+=3):g==18&&(Oe=11+yt(e,d,127),d+=7);Oe--;)I[U++]=ae}}var xt=I.subarray(0,O),Ee=I.subarray(O);m=_c(xt),y=_c(Ee),p=oi(xt,m,1),h=oi(Ee,y,1)}else Ge(1);else{var g=SO(d)+4,x=e[g-4]|e[g-3]<<8,k=g+x;if(k>i){l&&Ge(0);break}a&&u(f+x),n.set(e.subarray(g,k),f),t.b=f+=x,t.p=d=k*8,t.f=c;continue}if(d>S){l&&Ge(0);break}}a&&u(f+131072);for(var Di=(1<<m)-1,vr=(1<<y)-1,On=d;;On=d){var ae=p[$c(e,d)&Di],st=ae>>4;if(d+=ae&15,d>S){l&&Ge(0);break}if(ae||Ge(2),st<256)n[f++]=st;else if(st==256){On=d,p=null;break}else{var Rr=st-254;if(st>264){var U=st-257,Xt=Cb[U];Rr=yt(e,d,(1<<Xt)-1)+Ib[U],d+=Xt}var Ar=h[$c(e,d)&vr],at=Ar>>4;Ar||Ge(3),d+=Ar&15;var Ee=yO[at];if(at>3){var Xt=Eb[at];Ee+=$c(e,d)&(1<<Xt)-1,d+=Xt}if(d>S){l&&Ge(0);break}a&&u(f+131072);var vt=f+Rr;if(f<Ee){var Nn=o-Ee,_n=Math.min(Ee,vt);for(Nn+f<0&&Ge(3);f<_n;++f)n[f]=r[Nn+f]}for(;f<vt;++f)n[f]=n[f-Ee]}}t.l=p,t.p=On,t.b=f,t.f=c,p&&(c=1,t.m=m,t.d=h,t.n=y)}while(!c);return f!=n.length&&s?ps(n,0,f):n.subarray(0,f)};var xO=new Ue(0);var Ob=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&Ge(6,"invalid zlib data"),(e[1]>>5&1)==+!t&&Ge(6,"invalid zlib data: "+(e[1]&32?"need":"unexpected")+" dictionary"),(e[1]>>3&4)+2};var Lc=(function(){function e(t,n){typeof t=="function"&&(n=t,t={}),this.ondata=n;var r=t&&t.dictionary&&t.dictionary.subarray(-32768);this.s={i:0,b:r?r.length:0},this.o=new Ue(32768),this.p=new Ue(0),r&&this.o.set(r)}return e.prototype.e=function(t){if(this.ondata||Ge(5),this.d&&Ge(4),!this.p.length)this.p=t;else if(t.length){var n=new Ue(this.p.length+t.length);n.set(this.p),n.set(t,this.p.length),this.p=n}},e.prototype.c=function(t){this.s.i=+(this.d=t||!1);var n=this.s.b,r=Tb(this.p,this.s,this.o);this.ondata(ps(r,n,this.s.b),this.d),this.o=ps(r,this.s.b-32768),this.s.b=this.o.length,this.p=ps(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(t,n){this.e(t),this.c(n)},e})();var Fc=(function(){function e(t,n){Lc.call(this,t,n),this.v=t&&t.dictionary?2:1}return e.prototype.push=function(t,n){if(Lc.prototype.e.call(this,t),this.v){if(this.p.length<6&&!n)return;this.p=this.p.subarray(Ob(this.p,this.v-1)),this.v=0}n&&(this.p.length<4&&Ge(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),Lc.prototype.c.call(this,n)},e})();function Nb(e,t){return Tb(e.subarray(Ob(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var vO=typeof TextDecoder<"u"&&new TextDecoder,RO=0;try{vO.decode(xO,{stream:!0}),RO=1}catch{}function Bc(e,t="utf8"){return new TextDecoder(t).decode(e)}var AO=new TextEncoder;function _b(e){return AO.encode(e)}var CO=1024*8,EO=(()=>{let e=new Uint8Array(4),t=new Uint32Array(e.buffer);return!((t[0]=1)&e[0])})(),Uc={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array},ai=class e{buffer;byteLength;byteOffset;length;offset;lastWrittenByte;littleEndian;_data;_mark;_marks;constructor(t=CO,n={}){let r=!1;typeof t=="number"?t=new ArrayBuffer(t):(r=!0,this.lastWrittenByte=t.byteLength);let i=n.offset?n.offset>>>0:0,o=t.byteLength-i,s=i;(ArrayBuffer.isView(t)||t instanceof e)&&(t.byteLength!==t.buffer.byteLength&&(s=t.byteOffset+i),t=t.buffer),r?this.lastWrittenByte=o:this.lastWrittenByte=0,this.buffer=t,this.length=o,this.byteLength=o,this.byteOffset=s,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,s,o),this._mark=0,this._marks=[]}available(t=1){return this.offset+t<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(t=1){return this.offset+=t,this}back(t=1){return this.offset-=t,this}seek(t){return this.offset=t,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){let t=this._marks.pop();if(t===void 0)throw new Error("Mark stack empty");return this.seek(t),this}rewind(){return this.offset=0,this}ensureAvailable(t=1){if(!this.available(t)){let r=(this.offset+t)*2,i=new Uint8Array(r);i.set(new Uint8Array(this.buffer)),this.buffer=i.buffer,this.length=r,this.byteLength=r,this._data=new DataView(this.buffer)}return this}readBoolean(){return this.readUint8()!==0}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(t=1){return this.readArray(t,"uint8")}readArray(t,n){let r=Uc[n].BYTES_PER_ELEMENT*t,i=this.byteOffset+this.offset,o=this.buffer.slice(i,i+r);if(this.littleEndian===EO&&n!=="uint8"&&n!=="int8"){let a=new Uint8Array(this.buffer.slice(i,i+r));a.reverse();let l=new Uc[n](a.buffer);return this.offset+=r,l.reverse(),l}let s=new Uc[n](o);return this.offset+=r,s}readInt16(){let t=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,t}readUint16(){let t=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,t}readInt32(){let t=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,t}readUint32(){let t=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat32(){let t=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat64(){let t=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t}readBigInt64(){let t=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,t}readBigUint64(){let t=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,t}readChar(){return String.fromCharCode(this.readInt8())}readChars(t=1){let n="";for(let r=0;r<t;r++)n+=this.readChar();return n}readUtf8(t=1){return Bc(this.readBytes(t))}decodeText(t=1,n="utf8"){return Bc(this.readBytes(t),n)}writeBoolean(t){return this.writeUint8(t?255:0),this}writeInt8(t){return this.ensureAvailable(1),this._data.setInt8(this.offset++,t),this._updateLastWrittenByte(),this}writeUint8(t){return this.ensureAvailable(1),this._data.setUint8(this.offset++,t),this._updateLastWrittenByte(),this}writeByte(t){return this.writeUint8(t)}writeBytes(t){this.ensureAvailable(t.length);for(let n=0;n<t.length;n++)this._data.setUint8(this.offset++,t[n]);return this._updateLastWrittenByte(),this}writeInt16(t){return this.ensureAvailable(2),this._data.setInt16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeUint16(t){return this.ensureAvailable(2),this._data.setUint16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeInt32(t){return this.ensureAvailable(4),this._data.setInt32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeUint32(t){return this.ensureAvailable(4),this._data.setUint32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat32(t){return this.ensureAvailable(4),this._data.setFloat32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat64(t){return this.ensureAvailable(8),this._data.setFloat64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigInt64(t){return this.ensureAvailable(8),this._data.setBigInt64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigUint64(t){return this.ensureAvailable(8),this._data.setBigUint64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeChar(t){return this.writeUint8(t.charCodeAt(0))}writeChars(t){for(let n=0;n<t.length;n++)this.writeUint8(t.charCodeAt(n));return this}writeUtf8(t){return this.writeBytes(_b(t))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}getWrittenByteLength(){return this.lastWrittenByte-this.byteOffset}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}};var Lb=[];for(let e=0;e<256;e++){let t=e;for(let n=0;n<8;n++)t&1?t=3988292384^t>>>1:t=t>>>1;Lb[e]=t}var $b=4294967295;function kO(e,t,n){let r=e;for(let i=0;i<n;i++)r=Lb[(r^t[i])&255]^r>>>8;return r}function IO(e,t){return(kO($b,e,t)^$b)>>>0}function jc(e,t,n){let r=e.readUint32(),i=IO(new Uint8Array(e.buffer,e.byteOffset+e.offset-t-4,t),t);if(i!==r)throw new Error(`CRC mismatch for chunk ${n}. Expected ${r}, found ${i}`)}function ms(e,t,n){for(let r=0;r<n;r++)t[r]=e[r]}function ys(e,t,n,r){let i=0;for(;i<r;i++)t[i]=e[i];for(;i<n;i++)t[i]=e[i]+t[i-r]&255}function gs(e,t,n,r){let i=0;if(n.length===0)for(;i<r;i++)t[i]=e[i];else for(;i<r;i++)t[i]=e[i]+n[i]&255}function bs(e,t,n,r,i){let o=0;if(n.length===0){for(;o<i;o++)t[o]=e[o];for(;o<r;o++)t[o]=e[o]+(t[o-i]>>1)&255}else{for(;o<i;o++)t[o]=e[o]+(n[o]>>1)&255;for(;o<r;o++)t[o]=e[o]+(t[o-i]+n[o]>>1)&255}}function Ss(e,t,n,r,i){let o=0;if(n.length===0){for(;o<i;o++)t[o]=e[o];for(;o<r;o++)t[o]=e[o]+t[o-i]&255}else{for(;o<i;o++)t[o]=e[o]+n[o]&255;for(;o<r;o++)t[o]=e[o]+PO(t[o-i],n[o],n[o-i])&255}}function PO(e,t,n){let r=e+t-n,i=Math.abs(r-e),o=Math.abs(r-t),s=Math.abs(r-n);return i<=o&&i<=s?e:o<=s?t:n}function Db(e,t,n,r,i,o){switch(e){case 0:ms(t,n,i);break;case 1:ys(t,n,i,o);break;case 2:gs(t,n,r,i);break;case 3:bs(t,n,r,i,o);break;case 4:Ss(t,n,r,i,o);break;default:throw new Error(`Unsupported filter: ${e}`)}}var MO=new Uint16Array([255]),TO=new Uint8Array(MO.buffer),OO=TO[0]===255;function Fb(e){let{data:t,width:n,height:r,channels:i,depth:o}=e,s=[{x:0,y:0,xStep:8,yStep:8},{x:4,y:0,xStep:8,yStep:8},{x:0,y:4,xStep:4,yStep:8},{x:2,y:0,xStep:4,yStep:4},{x:0,y:2,xStep:2,yStep:4},{x:1,y:0,xStep:2,yStep:2},{x:0,y:1,xStep:1,yStep:2}],a=Math.ceil(o/8)*i,l=new Uint8Array(r*n*a),u=0;for(let c=0;c<7;c++){let d=s[c],f=Math.ceil((n-d.x)/d.xStep),p=Math.ceil((r-d.y)/d.yStep);if(f<=0||p<=0)continue;let h=f*a,m=new Uint8Array(h);for(let y=0;y<p;y++){let S=t[u++],w=t.subarray(u,u+h);u+=h;let g=new Uint8Array(h);Db(S,w,g,m,h,a),m.set(g);for(let x=0;x<f;x++){let k=d.x+x*d.xStep,O=d.y+y*d.yStep;if(!(k>=n||O>=r))for(let N=0;N<a;N++)l[(O*n+k)*a+N]=g[x*a+N]}}}if(o===16){let c=new Uint16Array(l.buffer);if(OO)for(let d=0;d<c.length;d++)c[d]=NO(c[d]);return c}else return l}function NO(e){return(e&255)<<8|e>>8&255}var _O=new Uint16Array([255]),$O=new Uint8Array(_O.buffer),LO=$O[0]===255,DO=new Uint8Array(0);function Vc(e){let{data:t,width:n,height:r,channels:i,depth:o}=e,s=Math.ceil(o/8)*i,a=Math.ceil(o/8*i*n),l=new Uint8Array(r*a),u=DO,c=0,d,f;for(let p=0;p<r;p++){switch(d=t.subarray(c+1,c+1+a),f=l.subarray(p*a,(p+1)*a),t[c]){case 0:ms(d,f,a);break;case 1:ys(d,f,a,s);break;case 2:gs(d,f,u,a);break;case 3:bs(d,f,u,a,s);break;case 4:Ss(d,f,u,a,s);break;default:throw new Error(`Unsupported filter: ${t[c]}`)}u=f,c+=a+1}if(o===16){let p=new Uint16Array(l.buffer);if(LO)for(let h=0;h<p.length;h++)p[h]=FO(p[h]);return p}else return l}function FO(e){return(e&255)<<8|e>>8&255}var ws=Uint8Array.of(137,80,78,71,13,10,26,10);function Wc(e){if(!Bb(e.readBytes(ws.length)))throw new Error("wrong PNG signature")}function Bb(e){if(e.length<ws.length)return!1;for(let t=0;t<ws.length;t++)if(e[t]!==ws[t])return!1;return!0}var Ub="tEXt",UO=0,jb=new TextDecoder("latin1");function jO(e){if(WO(e),e.length===0||e.length>79)throw new Error("keyword length must be between 1 and 79")}var VO=/^[\u0000-\u00FF]*$/;function WO(e){if(!VO.test(e))throw new Error("invalid latin1 text")}function Vb(e,t,n){let r=zc(t);e[r]=zO(t,n-r.length-1)}function zc(e){for(e.mark();e.readByte()!==UO;);let t=e.offset;e.reset();let n=jb.decode(e.readBytes(t-e.offset-1));return e.skip(1),jO(n),n}function zO(e,t){return jb.decode(e.readBytes(t))}var je={UNKNOWN:-1,GREYSCALE:0,TRUECOLOUR:2,INDEXED_COLOUR:3,GREYSCALE_ALPHA:4,TRUECOLOUR_ALPHA:6},li={UNKNOWN:-1,DEFLATE:0},xs={UNKNOWN:-1,ADAPTIVE:0},ui={UNKNOWN:-1,NO_INTERLACE:0,ADAM7:1},ci={NONE:0,BACKGROUND:1,PREVIOUS:2},vs={SOURCE:0,OVER:1};var di=class extends ai{_checkCrc;_inflator;_png;_apng;_end;_hasPalette;_palette;_hasTransparency;_transparency;_compressionMethod;_filterMethod;_interlaceMethod;_colorType;_isAnimated;_numberOfFrames;_numberOfPlays;_frames;_writingDataChunks;_chunks;_inflatorResult;constructor(t,n={}){super(t);let{checkCrc:r=!1}=n;this._checkCrc=r,this._inflator=new Fc((i,o)=>{if(this._chunks.push(i),o){let s=this._chunks.reduce((l,u)=>l+u.length,0);this._inflatorResult=new Uint8Array(s);let a=0;for(let l of this._chunks)this._inflatorResult.set(l,a),a+=l.length;this._chunks=[]}}),this._chunks=[],this._png={width:-1,height:-1,channels:-1,data:new Uint8Array(0),depth:1,text:{}},this._apng={width:-1,height:-1,channels:-1,depth:1,numberOfFrames:1,numberOfPlays:0,text:{},frames:[]},this._end=!1,this._hasPalette=!1,this._palette=[],this._hasTransparency=!1,this._transparency=new Uint16Array(0),this._compressionMethod=li.UNKNOWN,this._filterMethod=xs.UNKNOWN,this._interlaceMethod=ui.UNKNOWN,this._colorType=je.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this._inflatorResult=new Uint8Array(0),this.setBigEndian()}decode(){for(Wc(this);!this._end;){let t=this.readUint32(),n=this.readChars(4);this.decodeChunk(t,n)}return this._inflator.push(new Uint8Array(0),!0),this.decodeImage(),this._png}decodeApng(){for(Wc(this);!this._end;){let t=this.readUint32(),n=this.readChars(4);this.decodeApngChunk(t,n)}return this.decodeApngImage(),this._apng}decodeChunk(t,n){let r=this.offset;switch(n){case"IHDR":this.decodeIHDR();break;case"PLTE":this.decodePLTE(t);break;case"IDAT":this.decodeIDAT(t);break;case"IEND":this._end=!0;break;case"tRNS":this.decodetRNS(t);break;case"iCCP":this.decodeiCCP(t);break;case Ub:Vb(this._png.text,this,t);break;case"pHYs":this.decodepHYs();break;default:this.skip(t);break}if(this.offset-r!==t)throw new Error(`Length mismatch while decoding chunk ${n}`);this._checkCrc?jc(this,t+4,n):this.skip(4)}decodeApngChunk(t,n){let r=this.offset;switch(n!=="fdAT"&&n!=="IDAT"&&this._writingDataChunks&&this.pushDataToFrame(),n){case"acTL":this.decodeACTL();break;case"fcTL":this.decodeFCTL();break;case"fdAT":this.decodeFDAT(t);break;default:this.decodeChunk(t,n),this.offset=r+t;break}if(this.offset-r!==t)throw new Error(`Length mismatch while decoding chunk ${n}`);this._checkCrc?jc(this,t+4,n):this.skip(4)}decodeIHDR(){let t=this._png;t.width=this.readUint32(),t.height=this.readUint32(),t.depth=GO(this.readUint8());let n=this.readUint8();this._colorType=n;let r;switch(n){case je.GREYSCALE:r=1;break;case je.TRUECOLOUR:r=3;break;case je.INDEXED_COLOUR:r=1;break;case je.GREYSCALE_ALPHA:r=2;break;case je.TRUECOLOUR_ALPHA:r=4;break;case je.UNKNOWN:default:throw new Error(`Unknown color type: ${n}`)}if(this._png.channels=r,this._compressionMethod=this.readUint8(),this._compressionMethod!==li.DEFLATE)throw new Error(`Unsupported compression method: ${this._compressionMethod}`);this._filterMethod=this.readUint8(),this._interlaceMethod=this.readUint8()}decodeACTL(){this._numberOfFrames=this.readUint32(),this._numberOfPlays=this.readUint32(),this._isAnimated=!0}decodeFCTL(){let t={sequenceNumber:this.readUint32(),width:this.readUint32(),height:this.readUint32(),xOffset:this.readUint32(),yOffset:this.readUint32(),delayNumber:this.readUint16(),delayDenominator:this.readUint16(),disposeOp:this.readUint8(),blendOp:this.readUint8(),data:new Uint8Array(0)};this._frames.push(t)}decodePLTE(t){if(t%3!==0)throw new RangeError(`PLTE field length must be a multiple of 3. Got ${t}`);let n=t/3;this._hasPalette=!0;let r=[];this._palette=r;for(let i=0;i<n;i++)r.push([this.readUint8(),this.readUint8(),this.readUint8()])}decodeIDAT(t){this._writingDataChunks=!0;let n=t,r=this.offset+this.byteOffset;try{this._inflator.push(new Uint8Array(this.buffer,r,n),!1)}catch(i){throw new Error("Error while decompressing the data:",{cause:i})}this.skip(t)}decodeFDAT(t){this._writingDataChunks=!0;let n=t,r=this.offset+this.byteOffset;r+=4,n-=4;try{this._inflator.push(new Uint8Array(this.buffer,r,n),!1)}catch(i){throw new Error("Error while decompressing the data:",{cause:i})}this.skip(t)}decodetRNS(t){switch(this._colorType){case je.GREYSCALE:case je.TRUECOLOUR:{if(t%2!==0)throw new RangeError(`tRNS chunk length must be a multiple of 2. Got ${t}`);if(t/2>this._png.width*this._png.height)throw new Error(`tRNS chunk contains more alpha values than there are pixels (${t/2} vs ${this._png.width*this._png.height})`);this._hasTransparency=!0,this._transparency=new Uint16Array(t/2);for(let n=0;n<t/2;n++)this._transparency[n]=this.readUint16();break}case je.INDEXED_COLOUR:{if(t>this._palette.length)throw new Error(`tRNS chunk contains more alpha values than there are palette colors (${t} vs ${this._palette.length})`);let n=0;for(;n<t;n++){let r=this.readByte();this._palette[n].push(r)}for(;n<this._palette.length;n++)this._palette[n].push(255);break}case je.UNKNOWN:case je.GREYSCALE_ALPHA:case je.TRUECOLOUR_ALPHA:default:throw new Error(`tRNS chunk is not supported for color type ${this._colorType}`)}}decodeiCCP(t){let n=zc(this),r=this.readUint8();if(r!==li.DEFLATE)throw new Error(`Unsupported iCCP compression method: ${r}`);let i=this.readBytes(t-n.length-2);this._png.iccEmbeddedProfile={name:n,profile:Nb(i)}}decodepHYs(){let t=this.readUint32(),n=this.readUint32(),r=this.readByte();this._png.resolution={x:t,y:n,unit:r}}decodeApngImage(){this._apng.width=this._png.width,this._apng.height=this._png.height,this._apng.channels=this._png.channels,this._apng.depth=this._png.depth,this._apng.numberOfFrames=this._numberOfFrames,this._apng.numberOfPlays=this._numberOfPlays,this._apng.text=this._png.text,this._apng.resolution=this._png.resolution;for(let t=0;t<this._numberOfFrames;t++){let n={sequenceNumber:this._frames[t].sequenceNumber,delayNumber:this._frames[t].delayNumber,delayDenominator:this._frames[t].delayDenominator,data:this._apng.depth===8?new Uint8Array(this._apng.width*this._apng.height*this._apng.channels):new Uint16Array(this._apng.width*this._apng.height*this._apng.channels)},r=this._frames.at(t);if(r){if(r.data=Vc({data:r.data,width:r.width,height:r.height,channels:this._apng.channels,depth:this._apng.depth}),this._hasPalette&&(this._apng.palette=this._palette),this._hasTransparency&&(this._apng.transparency=this._transparency),t===0||r.xOffset===0&&r.yOffset===0&&r.width===this._png.width&&r.height===this._png.height)n.data=r.data;else{let i=this._apng.frames.at(t-1);this.disposeFrame(r,i,n),this.addFrameDataToCanvas(n,r)}this._apng.frames.push(n)}}return this._apng}disposeFrame(t,n,r){switch(t.disposeOp){case ci.NONE:break;case ci.BACKGROUND:for(let i=0;i<this._png.height;i++)for(let o=0;o<this._png.width;o++){let s=(i*t.width+o)*this._png.channels;for(let a=0;a<this._png.channels;a++)r.data[s+a]=0}break;case ci.PREVIOUS:r.data.set(n.data);break;default:throw new Error("Unknown disposeOp")}}addFrameDataToCanvas(t,n){let r=1<<this._png.depth,i=(o,s)=>{let a=((o+n.yOffset)*this._png.width+n.xOffset+s)*this._png.channels,l=(o*n.width+s)*this._png.channels;return{index:a,frameIndex:l}};switch(n.blendOp){case vs.SOURCE:for(let o=0;o<n.height;o++)for(let s=0;s<n.width;s++){let{index:a,frameIndex:l}=i(o,s);for(let u=0;u<this._png.channels;u++)t.data[a+u]=n.data[l+u]}break;case vs.OVER:for(let o=0;o<n.height;o++)for(let s=0;s<n.width;s++){let{index:a,frameIndex:l}=i(o,s);for(let u=0;u<this._png.channels;u++){let c=n.data[l+this._png.channels-1]/r,d=u%(this._png.channels-1)===0?1:n.data[l+u],f=Math.floor(c*d+(1-c)*t.data[a+u]);t.data[a+u]+=f}}break;default:throw new Error("Unknown blendOp")}}decodeImage(){let t=this._inflatorResult;if(this._filterMethod!==xs.ADAPTIVE)throw new Error(`Filter method ${this._filterMethod} not supported`);if(this._interlaceMethod===ui.NO_INTERLACE)this._png.data=Vc({data:t,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else if(this._interlaceMethod===ui.ADAM7)this._png.data=Fb({data:t,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else throw new Error(`Interlace method ${this._interlaceMethod} not supported`);this._hasPalette&&(this._png.palette=this._palette),this._hasTransparency&&(this._png.transparency=this._transparency)}pushDataToFrame(){this._inflator.push(new Uint8Array(0),!0);let t=this._inflatorResult,n=this._frames.at(-1);n?n.data=t:this._frames.push({sequenceNumber:0,width:this._png.width,height:this._png.height,xOffset:0,yOffset:0,delayNumber:0,delayDenominator:0,disposeOp:ci.NONE,blendOp:vs.SOURCE,data:t}),this._inflator=new Fc((r,i)=>{if(this._chunks.push(r),i){let o=this._chunks.reduce((a,l)=>a+l.length,0);this._inflatorResult=new Uint8Array(o);let s=0;for(let a of this._chunks)this._inflatorResult.set(a,s),s+=a.length;this._chunks=[]}}),this._chunks=[],this._writingDataChunks=!1}};function GO(e){if(e!==1&&e!==2&&e!==4&&e!==8&&e!==16)throw new Error(`invalid bit depth: ${e}`);return e}function Wb(e,t){return new di(e,t).decode()}import{createRequire as HO}from"module";import{readFile as Gc}from"fs/promises";import{fileURLToPath as qO}from"url";import{z as et}from"zod";var KO={height:800,width:1280},YO=et.object({event:et.looseObject({timestamp:et.number(),type:et.number()}),kind:et.literal("rrweb")});async function Gb(e){return(await Gc(e,"utf8")).split(`
|
|
56
|
+
`],q0=[...""],EM=[...Xu,...q0],vn=()=>Ce({unit:"grapheme-ascii",minLength:1,maxLength:1});function Ky(e){return new P(`Unsupported AST node! Received: ${xe(e)}`)}function on(e,t,n){switch(e.type){case"Char":if(e.kind==="meta")switch(e.value){case"\\w":return It(...Gy);case"\\W":return vn().filter(r=>Bt(Gy,r)===-1);case"\\d":return It(...Hy);case"\\D":return vn().filter(r=>Bt(Hy,r)===-1);case"\\s":return It(...qy);case"\\S":return vn().filter(r=>Bt(qy,r)===-1);case"\\b":case"\\B":throw new P(`Meta character ${e.value} not implemented yet!`);case".":{let r=n.dotAll?q0:EM;return vn().filter(i=>Bt(r,i)===-1)}}if(e.symbol===void 0)throw new P(`Unexpected undefined symbol received for non-meta Char! Received: ${xe(e)}`);return we(e.symbol);case"Repetition":{let r=on(e.expression,t,n);switch(e.quantifier.kind){case"*":return Ce({...t,unit:r});case"+":return Ce({...t,minLength:1,unit:r});case"?":return Ce({...t,minLength:0,maxLength:1,unit:r});case"Range":return Ce({...t,minLength:e.quantifier.from,maxLength:e.quantifier.to,unit:r});default:throw Ky(e.quantifier)}}case"Quantifier":throw new P("Wrongly defined AST tree, Quantifier nodes not supposed to be scanned!");case"Alternative":return D(...j(e.expressions,r=>on(r,t,n))).map(r=>le(r,""));case"CharacterClass":if(e.negative){let r=j(e.expressions,i=>on(i,t,n));return vn().filter(i=>sg(r,o=>!o.canShrinkWithoutContext(i)))}return ke(...j(e.expressions,r=>on(r,t,n)));case"ClassRange":{let r=e.from.codePoint,i=e.to.codePoint;return X({min:r,max:i}).map(o=>CM(o),o=>{if(typeof o!="string")throw new P("Invalid type");if([...o].length!==1)throw new P("Invalid length");return Xn(o,0)})}case"Group":return on(e.expression,t,n);case"Disjunction":return ke(e.left!==null?on(e.left,t,n):we(""),e.right!==null?on(e.right,t,n):we(""));case"Assertion":if(e.kind==="^"||e.kind==="$")return n.multiline?e.kind==="^"?ke(we(""),D(Ce({unit:vn()}),It(...Xu)).map(r=>`${r[0]}${r[1]}`,r=>{if(typeof r!="string"||r.length===0)throw new P("Invalid type");return[me(r,0,r.length-1),r[r.length-1]]})):ke(we(""),D(It(...Xu),Ce({unit:vn()})).map(r=>`${r[0]}${r[1]}`,r=>{if(typeof r!="string"||r.length===0)throw new P("Invalid type");return[r[0],me(r,1)]})):we("");throw new P(`Assertions of kind ${e.kind} not implemented yet!`);case"Backreference":throw new P("Backreference nodes not implemented yet!");case"UnicodeProperty":return AM(e);default:throw Ky(e)}}function kM(e,t={}){for(let a of e.flags)if(a!=="d"&&a!=="g"&&a!=="m"&&a!=="s"&&a!=="u")throw new P(`Unable to use "stringMatching" against a regex using the flag ${a}`);let n=t.maxLength,r={size:t.size,maxLength:n},i={multiline:e.multiline,dotAll:e.dotAll},o=fM(SM(e));n!==void 0&&(o=cM(o,n));let s=on(o,r,i);return n!==void 0?s.filter(a=>[...a].length<=n):s}function IM(e){let t=[];for(let n=0;n!==e.length;++n)t.push(e[n].next());return t}function PM(e,t){for(let n=0;n!==e.length;++n)t[n]=e[n].next()}function MM(e){for(let t=0;t!==e.length;++t)if(e[t].done)return!0;return!1}function*TM(...e){let t=IM(e);for(;!MM(t);)yield t.map(n=>n.value),PM(e,t)}function*OM(e){let t=e;for(;;)yield t,++t}var NM=class extends ue{constructor(e,t){super(),this.arb=e,this.maxShrinks=t}generate(e,t){let n=this.arb.generate(e,t);return this.valueMapper(n,0)}canShrinkWithoutContext(e){return this.arb.canShrinkWithoutContext(e)}shrink(e,t){return this.isSafeContext(t)?this.safeShrink(e,t.originalContext,t.length):this.safeShrink(e,void 0,0)}safeShrink(e,t,n){let r=this.maxShrinks-n;return r<=0?L.nil():new L(TM(this.arb.shrink(e,t),OM(n+1))).take(r).map(i=>this.valueMapper(i[0],i[1]))}valueMapper(e,t){let n={originalContext:e.context,length:t};return new T(e.value,n)}isSafeContext(e){return e!=null&&typeof e=="object"&&"originalContext"in e&&"length"in e}};function _M(e,t){return new NM(e,t)}var $M=$p({Arbitrary:()=>ue,ExecutionStatus:()=>Yk,PreconditionFailure:()=>cn,Random:()=>ic,Stream:()=>L,Value:()=>T,VerbosityLevel:()=>kk,__commitHash:()=>FM,__type:()=>LM,__version:()=>DM,anything:()=>E0,array:()=>oe,assert:()=>g2,asyncDefaultReportMessage:()=>Cg,asyncModelRun:()=>tM,asyncProperty:()=>Ck,asyncStringify:()=>rc,asyncToStringMethod:()=>Vt,base64String:()=>f3,bigInt:()=>un,bigInt64Array:()=>sM,bigUint64Array:()=>aM,boolean:()=>ri,chainUntil:()=>aI,check:()=>kg,clone:()=>fI,cloneIfNeeded:()=>Yn,cloneMethod:()=>Ie,commands:()=>Y3,compareBooleanFunc:()=>d6,compareFunc:()=>h6,configureGlobal:()=>vk,constant:()=>we,constantFrom:()=>It,context:()=>tI,createDepthIdentifier:()=>ac,date:()=>Bg,defaultReportMessage:()=>Ag,dictionary:()=>cc,domain:()=>pc,double:()=>ns,emailAddress:()=>CP,entityGraph:()=>d4,falsy:()=>Q2,float:()=>o0,float32Array:()=>h0,float64Array:()=>p0,func:()=>y6,gen:()=>E2,getDepthContextFor:()=>sc,hasAsyncToStringMethod:()=>nc,hasCloneMethod:()=>Rn,hasToStringMethod:()=>tc,hash:()=>Qo,infiniteStream:()=>o3,int16Array:()=>m0,int32Array:()=>y0,int8Array:()=>g0,integer:()=>X,ipV4:()=>bc,ipV4Extended:()=>u0,ipV6:()=>c0,json:()=>n3,jsonValue:()=>k0,letrec:()=>d0,limitShrink:()=>_M,lorem:()=>S4,map:()=>zu,mapToConstant:()=>er,maxSafeInteger:()=>l0,maxSafeNat:()=>w6,memo:()=>R4,mixedCase:()=>P4,modelRun:()=>eM,nat:()=>sn,noBias:()=>Jo,noShrink:()=>es,object:()=>X4,oneof:()=>ke,option:()=>Wt,pre:()=>JC,property:()=>Ek,readConfigureGlobal:()=>pt,record:()=>Wu,resetConfigureGlobal:()=>Rk,sample:()=>S2,scheduledModelRun:()=>nM,scheduler:()=>iM,schedulerFor:()=>oM,set:()=>R0,shuffledSubarray:()=>g3,sparseArray:()=>v0,statistics:()=>x2,stream:()=>ln,string:()=>Ce,stringMatching:()=>kM,stringify:()=>xe,subarray:()=>y3,toStringMethod:()=>mt,tuple:()=>D,uint16Array:()=>b0,uint32Array:()=>S0,uint8Array:()=>w0,uint8ClampedArray:()=>x0,ulid:()=>C3,uniqueArray:()=>Cn,uuid:()=>O3,webAuthority:()=>T0,webFragments:()=>N0,webPath:()=>$0,webQueryParameters:()=>L0,webSegment:()=>_0,webUrl:()=>G3}),LM="module",DM="4.8.0",FM="c0da76fbcf6470339ad7bb2f0dfcebee06ede56c",$e=$M;var BM=24301;function is(e,t){return e.reduce((n,r)=>WM(n,t[r.idx]?.paramSpaces),new Map)}function nr(e,t){return Object.fromEntries(Object.entries(e.paramSpaces).map(([n,r])=>[n,UM(r,r?.name==null?0:t.get(r.name)??0)]))}var K0=new WeakMap;function UM(e,t){if(e==null)return Y0(void 0,t);let n=K0.get(e)??new Map;K0.set(e,n);let r=n.get(t);if(r!=null)return r;let i=Y0(e,t);return n.set(t,i),i}function jM(e){return e?.values!=null&&e.values.length>0?$e.constantFrom(...e.values):VM(e)}function Y0(e,t){let[n]=$e.sample(jM(e),{numRuns:1,seed:BM+t});if(n==null)throw new Error("arbitrary produced no sample");return n}function VM(e){if(e?.type==="number")return $e.integer();if(e?.type==="boolean")return $e.boolean();let t=e?.generator==null?void 0:GM[e.generator];if(t!=null)return t;let n=e?.constraints?.kind==="string"?e.constraints:void 0;return $e.string({maxLength:n?.maxLength,minLength:n?.minLength??1}).filter(r=>r.trim().length>0&&r===r.trim())}function WM(e,t){return t==null?e:Object.values(t).reduce((n,r)=>r==null?n:new Map([...n,[r.name,(n.get(r.name)??0)+1]]),e)}var zM="abcdefghijklmnopqrstuvwxyz0123456789".match(/./g)??[],tr=e=>$e.array($e.constantFrom(...zM),{maxLength:e,minLength:1}).map(t=>t.join("")),Rc=(e,t)=>$e.array(tr(10),{maxLength:t,minLength:1}).map(n=>n.join(e)),GM={"company.name":Rc(" ",3),"date.iso":HM(),"internet.email":qM(),"internet.url":KM(),"lorem.slug":Rc("-",3),"lorem.word":tr(10),"person.fullName":Rc(" ",2)};function HM(){return $e.date({max:new Date("2030-12-31T23:59:59.999Z"),min:new Date("2020-01-01T00:00:00.000Z"),noInvalidDate:!0}).map(e=>e.toISOString())}function qM(){return $e.tuple(tr(12),tr(10),$e.constantFrom("com","dev","io","org","ai")).map(([e,t,n])=>`${e}@${t}.${n}`)}function KM(){return $e.tuple($e.constantFrom("http","https"),tr(12),$e.constantFrom("app","com","dev","io","org"),$e.array(tr(8),{maxLength:3})).map(([e,t,n,r])=>{let i=r.length===0?"":`/${r.join("/")}`;return`${e}://${t}.${n}${i}`})}var YM=new Map;function os(e){return nr(e,YM)}import{z as J}from"zod";var rr=J.enum(["crash","data-rule","page-rule","frame"]),Z0=J.object({intent:J.string().min(1),test:J.string().min(1)}),ZM=J.union([J.object({kind:J.literal("singleton-mismatch"),singleton:J.string().min(1)}),J.object({entity:J.string().min(1),kind:J.string().min(1)})]),XM=J.discriminatedUnion("kind",[J.object({kind:J.literal("consistency"),layer:rr,mismatch:ZM,step:Z0.nullable()}),J.object({kind:J.literal("pending-check"),layer:rr,source:J.string().min(1),step:Z0}),J.object({intent:J.string().min(1),kind:J.literal("unrunnable"),layer:rr,reason:J.string().min(1),test:J.string().min(1)}),J.object({error:J.string().min(1),kind:J.literal("driver-error"),layer:rr,step:J.string().min(1)}),J.object({kind:J.literal("impossible-action"),layer:rr,step:J.string().min(1)})]);import{z as Ac}from"zod";var X0=Ac.number().min(0).max(10),J0=Ac.object({destructiveActions:X0,maxAttemptLength:Ac.number().int().positive(),mixWorkflows:X0}),Cc={even:{destructiveActions:2,maxAttemptLength:12,mixWorkflows:4}};function Q0(e){return Cc[e]}function Ec(e,t,n){let r=t.reduce((u,c)=>u+c,0),i=t.reduce((u,c)=>[...u,(u.at(-1)??0)+c],[]),o=n()*r,s=i.findIndex(u=>o<u),a=r<=0?Math.floor(n()*e.length):s,l=e[a<0?e.length-1:a];if(l==null)throw new Error("weighted sample drew an empty set");return l}var eb=1;function ss(e){return{startingPoint:e.startingPoint.name,steps:tb(e,e.startingPoint.snapshot,[])}}function tb(e,t,n){if(n.length>=e.strategy.maxAttemptLength)return n;let r=co(e.corpus,{snapshot:t},JM(e.corpus,n));if(r.length===0)return n;let i=QM(e,r,n);return tb(e,i.stepRun.next.snapshot,[...n,{idx:i.idx,params:i.params}])}function JM(e,t){let n=is(t,e);return r=>nr(r,n)}function QM(e,t,n){let r=t.map(i=>eT(e,i,n));return Ec(t,r,e.random)}function eT(e,t,n){let r=e.corpus[t.idx];if(r==null)return eb;let i=$h(r.effectStep)?e.strategy.destructiveActions:0,o=tT(e.corpus,r,n)?e.strategy.mixWorkflows:0;return eb+i+o}function tT(e,t,n){let r=new Set(n.flatMap(i=>{let o=e[i.idx];return o==null?[]:[o.test]}));return r.size>0&&!r.has(t.test)}import{z as se}from"zod";var nb=se.object({baseStateTest:Gi,lockfileFingerprint:se.string(),lockfileHash:se.string().min(1),stepRuns:se.array(se.object({idx:se.number().int().nonnegative(),params:se.record(se.string(),se.union([Tt,se.null()]))}))}),rb=se.object({baseStateRef:se.string().min(1),steps:se.array(se.object({index:se.number().int().nonnegative(),params:se.record(se.string(),se.union([Tt,se.null()])),test:se.string().min(1)}))}),ib=se.object({actions:se.array(se.string()),label:se.string().min(1)}),ob=se.object({kind:se.enum(["aborted","clean","error","flaky","finding"]),reason:se.string().optional(),runId:se.string().optional()});function as(e,{sweep:t}){let n=Dt(Ct(e),r=>G({s:r.test.singletons,w:r.test.world})).map(r=>({name:r.ref,test:r.test}));return t?[...n,...n.flatMap(r=>nT(r))]:n}function ls(e,t,n){return jn(e,t.test,n)}function nT(e){return rT(e.test).map(t=>{let n={...t,as:`${t.as}~2`},r=`${e.name} +${t.entity}`;return{name:r,test:{...e.test,name:r,world:[...e.test.world,n]}}})}function rT(e){return e.world.filter(t=>{let n=G({...e,world:e.world.filter(r=>r!==t)});return!n.includes(`"${t.as}.`)&&!n.includes(`"ref":"${t.as}"`)})}async function us(e){let t=Sn(e);if(t.length===0)return null;let n=as(e,{sweep:!1}),r=await iT(e,n);return r.length===0?null:{corpus:t,startingPoints:r,startingPointTests:new Map(n.map(i=>[i.name,i.test]))}}function sb({lockfileFingerprint:e,lockfileHash:t,prepared:n,random:r,strategy:i}){let o=n.startingPoints[Math.floor(r()*n.startingPoints.length)];if(o==null)return null;let s=ss({corpus:n.corpus,random:r,startingPoint:o,strategy:i}),a=n.startingPointTests.get(s.startingPoint);return a==null||s.steps.length===0?null:{baseStateTest:a,lockfileFingerprint:e,lockfileHash:t,stepRuns:s.steps.map(l=>({idx:l.idx,params:l.params}))}}async function iT(e,t){let n={generate:zr,materialize:ro(zr,e.valueSpaces),params:void 0};return(await Promise.all(t.map(async i=>(await ls(e,i,n)).match(s=>({name:i.name,snapshot:s.snapshot}),()=>null)))).flatMap(i=>i==null?[]:[i])}import{ResultAsync as kc}from"neverthrow";var ii=class extends Error{mountKey;constructor(t){super("client-mount-unmounted"),this.mountKey=t}};function cs(e){return{read:t=>ST(t,e),seedScript:t=>`globalThis[${JSON.stringify(Va)}] = ${JSON.stringify(t)};`}}async function ST(e,t){let n={title:await e.title(),url:$t(e.url()),viewport:vT(e.viewportSize())};if(t.length===0)return n;let r=await e.evaluate(xT,{mountKey:Wi,names:t,timeoutMs:wT});if(r.kind==="unmounted")throw new ii(Wi);return{...n,...r.values}}var wT=5e3;async function xT(e){let t=Date.now()+e.timeoutMs;for(;Reflect.get(globalThis,e.mountKey)==null&&Date.now()<t;)await new Promise(r=>setTimeout(r,25));let n=Reflect.get(globalThis,e.mountKey);return n==null?{kind:"unmounted"}:{kind:"values",values:Object.fromEntries(e.names.map(r=>[r,n.readSingleton(r)??null]))}}function vT(e){return e==null?"":`${String(e.width)}x${String(e.height)}`}function Ic(e,t,n){return{evaluate:r=>kc.fromPromise(ub(RT(e,n,r),`check ${r.kind}`),ab),locateIds:r=>PT(e,r),observe:()=>t.read().andThen(r=>kc.fromPromise(ub(cb(e,n,0),"observe"),ab).map(i=>({snapshot:{...r,singletons:{...r.singletons,...i}}}))),perform:r=>kc.fromPromise(fb(e,r,0),i=>yl(r.kind,i))}}async function RT(e,t,n){try{return await yb(e,t,n)}catch(r){if(db(r))return!1;throw r}}function ab(e){return e instanceof ii?fl(e.mountKey):gl(e)}var AT=[100,250,500];async function cb(e,t,n){try{return await t.read(e)}catch(r){let i=AT[n];if(i==null||!db(r))throw r;return await mb(i),cb(e,t,n+1)}}function db(e){let t=e instanceof Error?e.message:String(e);return/Execution context was destroyed|Cannot find context with specified id|[Ff]rame was detached|frame got detached/.test(t)}var lb=35e3;function ub(e,t){let n,r=new Promise((i,o)=>{n=setTimeout(()=>{o(new Error(`driver op "${t}" exceeded ${String(lb)}ms`))},lb)});return Promise.race([e,r]).finally(()=>{clearTimeout(n)})}var CT=[250,750,2e3];async function fb(e,t,n){try{await ET(e,t)}catch(r){let i=CT[n];if(i==null||!TT(r))throw r;await mb(i),await fb(e,t,n+1)}}async function ET(e,t){if(t.kind==="goto"){await e.goto(ir(t.url,t,"url"),{waitUntil:"domcontentloaded"});return}if(t.kind==="press"&&t.locator==null){await e.keyboard.press(ir(t.key,t,"key"));return}let n=t.kind!=="upload";await kT(e,hb(e,t.locator,{visibleOnly:n}),t)}function ir(e,t,n){if(e==null)throw new Error(`action "${t.kind}" requires ${n}`);return e}function kT(e,t,n){switch(n.kind){case"goto":throw new Error("goto must not be located");case"fill":return t.fill(String(ir(n.value,n,"value")));case"clear":return t.clear();case"click":return t.click();case"dblclick":return t.dblclick();case"check":return t.check();case"uncheck":return t.uncheck();case"hover":return t.hover();case"select":return IT(e,t,String(ir(n.value,n,"value")));case"upload":return t.setInputFiles(ir(n.files,n,"files"));case"press":return t.press(ir(n.key,n,"key"))}}async function IT(e,t,n){if(await t.evaluate(i=>i.tagName==="SELECT")){await t.selectOption(n);return}await t.click(),await t.fill(n),await e.locator(pb("option",n)).filter({visible:!0}).click()}async function PT(e,t){if(t==null)return[];try{let n=ds(e,t,{visibleOnly:!1});if(await n.count()===0)return[];let r=await n.first().evaluate(MT);return r>0?[r]:[]}catch{return[]}}function MT(e){return globalThis.__ripploRrwebMirror?.getId(e)??-1}function hb(e,t,n){if(t==null)throw new Error("action requires a locator");return ds(e,t,n)}function ds(e,t,n){if(t.by==="inside"){let i=ds(e,t.scope,n);return ds(i,t.target,n)}let r=t.by==="testId"?e.getByTestId(t.value):e.locator(pb(t.role,t.name));return n.visibleOnly?r.filter({visible:!0}):r}function pb(e,t){return t==null?`role=${e}`:`role=${e}[name=${JSON.stringify(t)}i]`}function TT(e){let t=e instanceof Error?e.message:String(e);return/net::ERR_|ERR_HTTP_RESPONSE_CODE_FAILURE|ECONNREFUSED|ECONNRESET|socket hang up|fetch failed|page\.goto: Timeout/.test(t)}function mb(e){return new Promise(t=>{setTimeout(t,e)})}async function yb(e,t,n){if(n.kind==="browser")return NT(e,t,n.name,n.value);if(n.kind==="not")return!await yb(e,t,n.inner);let r=hb(e,n.locator,{visibleOnly:!0});return n.kind==="value"?await r.inputValue()===n.value:n.kind==="text"?(await r.textContent()??"").includes(n.value):OT(r,n.kind)}function OT(e,t){return t==="visible"?e.isVisible():t==="disabled"?e.isDisabled():t==="enabled"?e.isEnabled():t==="checked"?e.isChecked():e.evaluate(n=>n===n.ownerDocument.activeElement)}async function NT(e,t,n,r){let o=(await t.read(e))[n];return typeof o=="string"&&o.includes(r)}import _T from"path";var bb={height:720,width:1280};async function fs({baseUrl:e,browser:t,capture:n,clientState:r,engine:i,extraHeaders:o,fixturesDir:s,reader:a,session:l,viewport:u}){let c=await t.newContext({baseURL:e,reducedMotion:"reduce",storageState:l==null?void 0:{cookies:$T(l.cookies,e),origins:l.origins},viewport:u}),d=LT(o,l?.headers);d!=null&&await c.setExtraHTTPHeaders(d),await c.addInitScript(i.seedScript(r));let f=n==null?DT():await n.hub.attach(c,n.runId),p=await c.newPage();return f.onPage(p),{context:c,driver:UT(FT(Ic(p,a,i),s),f),emitAssertion:f.emitAssertion,close:()=>jT({context:c,handle:f})}}async function Pc(e,t){let n=await Sb(e);try{return await t(n)}finally{await n.close()}}function $T(e,t){let n=new URL(t).hostname;return e.map(r=>({...r,domain:n}))}function LT(e,t){return e==null?t:t==null?e:{...e,...t}}function DT(){return{emitAction:()=>{},emitAssertion:()=>{},finish:()=>Promise.resolve(),onPage:()=>{}}}async function Sb(e){let{chromium:t}=await import("playwright");return t.launch({headless:!e})}function hs({headed:e}){let t;return{acquire:async()=>{let i=t;if(i!=null){let o=await i.catch(()=>{});if(o?.isConnected()===!0)return o;t===i&&(t=void 0)}return t??=Sb(e),t},close:async()=>{let i=t;t=void 0,i!=null&&await i.then(o=>o.close()).catch(()=>{})}}}function FT(e,t){return{evaluate:e.evaluate,locateIds:e.locateIds,observe:e.observe,perform:n=>e.perform(BT(n,t))}}function BT(e,t){return e.kind!=="upload"||e.files==null?e:{...e,files:e.files.map(n=>_T.join(t,n))}}function UT(e,t){return{evaluate:e.evaluate,locateIds:e.locateIds,observe:e.observe,perform:n=>(t.emitAction(n),e.perform(n))}}async function jT({context:e,handle:t}){await gb(t.finish()),await gb(e.close())}var VT=15e3;async function gb(e){let t,n=new Promise(r=>{t=setTimeout(r,VT)});await Promise.race([e.catch(()=>{}),n]).finally(()=>{clearTimeout(t)})}import{err as WT,ok as zT,Result as Mc}from"neverthrow";function Tc(e,t,n){return{read:()=>n.read(e.map(r=>r.name),t).andThen(r=>GT(e,r))}}function GT(e,t){return Mc.combine(e.map(n=>HT(n,t.entities[n.name]??[]).map(r=>[n.name,r]))).map(n=>({entities:new Map(n),singletons:t.singletons}))}function HT(e,t){let n=Dr(e);return Mc.combine(t.map(r=>qT(r,e).map(i=>[i,KT(r,n)]))).map(r=>new Map(r))}function qT(e,t){return Mc.combine(t.identity.map(n=>{let r=e[n];return r==null?WT(pl(t.name,n)):zT(String(r))})).map(n=>n.join(":"))}function KT(e,t){let n=t.map(r=>[r,e[r]]).filter(r=>r[1]!=null);return Object.fromEntries(n)}var wb=Ta(wx(),1);import YT from"crypto";import{err as ZT,errAsync as Oc,ok as XT,ResultAsync as or}from"neverthrow";var JT=3e4,QT=[250,750,2e3],eO=[500,1e3,2e3,3e3];function Nc({baseUrl:e,extraHeaders:t,runId:n,secret:r},i){let o=new wb.Webhook(r),s=(a,l,u)=>tO({baseUrl:e,body:l,extraHeaders:t,path:a,retry:u.retry,schema:u.schema,signal:u.signal,webhook:o});return{query:{read:(a,l)=>s("/state",{entities:a,runId:n,singletons:l},{retry:"transient",schema:sl,signal:i}).map(u=>({entities:u.entities,singletons:u.singletons}))},ready:()=>vb(e,t,i,0),setupWorld:a=>s("/setup",{entities:a,runId:n},{retry:"connection",schema:ol,signal:i}).map(l=>l.rows),teardown:()=>s("/teardown",{runId:n},{retry:"connection",schema:al,signal:void 0}).map(()=>{})}}function tO(e){return xb(e.retry,()=>oO(e),0)}function xb(e,t,n){return t().orElse(r=>{let i=QT[n];return i==null||!rO(r,e)?Oc(r):or.fromSafePromise(Rb(i)).andThen(()=>xb(e,t,n+1))})}function vb(e,t,n,r){return or.fromPromise(fetch(e,{headers:t,method:"HEAD",signal:Ab(n)}),i=>Fn("",i)).map(()=>{}).orElse(()=>{let i=eO[r];return i==null||n.aborted?Oc(ml(e)):or.fromSafePromise(Rb(i)).andThen(()=>vb(e,t,n,r+1))})}var nO=new Set(["EAI_AGAIN","ECONNREFUSED","ENOTFOUND"]);function rO(e,t){return e.kind==="aborted"?!1:iO(e)?!0:t==="connection"?!1:e.kind==="engine-network"||e.kind==="engine-http"&&e.status>=500}function iO(e){return e.kind==="engine-network"&&e.code!=null&&nO.has(e.code)}function Rb(e){return new Promise(t=>{setTimeout(t,e)})}function oO({baseUrl:e,body:t,extraHeaders:n,path:r,schema:i,signal:o,webhook:s}){let a=JSON.stringify(t);return or.fromPromise(fetch(`${e}${r}`,{body:a,headers:{...n,"Content-Type":"application/json",...sO(s,a)},method:"PUT",signal:Ab(o)}),l=>Fn(r,l)).andThen(l=>aO(l,r)).andThen(l=>lO(i,l,r)).mapErr(l=>o?.aborted===!0?bl():l)}function sO(e,t){let n=`msg_${YT.randomUUID()}`,r=new Date;return{"webhook-id":n,"webhook-signature":e.sign(n,r,t),"webhook-timestamp":String(Math.floor(r.getTime()/1e3))}}function Ab(e){let t=AbortSignal.timeout(JT);return e==null?t:AbortSignal.any([e,t])}function aO(e,t){return e.ok?or.fromPromise(e.json(),n=>Fn(t,n)):or.fromPromise(e.text().catch(()=>""),n=>Fn(t,n)).andThen(n=>Oc(dl(t,e.status,n)))}function lO(e,t,n){let r=e.safeParse(t);return r.success?XT(r.data):ZT(hl(n,r.error))}import t1 from"path";import{err as As,ok as Cs,ResultAsync as n1}from"neverthrow";import{existsSync as n8}from"fs";import{writeFile as r8}from"fs/promises";import i8 from"path";import{err as Rs,ok as o8}from"neverthrow";import{createRequire as uO}from"module";var cO=uO("/"),ar,dO,fO;try{ar=cO("worker_threads"),dO=ar.Worker,fO=ar.isMarkedAsUntransferable}catch{}var Ue=Uint8Array,sr=Uint16Array,hO=Int32Array,Cb=new Ue([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Eb=new Ue([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),pO=new Ue([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),kb=function(e,t){for(var n=new sr(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new hO(n[30]),r=1;r<30;++r)for(var o=n[r];o<n[r+1];++o)i[o]=o-n[r]<<5|r;return{b:n,r:i}},ar=kb(Cb,2),Ib=ar.b,mO=ar.r;Ib[28]=258,mO[258]=28;var Pb=kb(Eb,0),yO=Pb.b,Jj=Pb.r,Dc=new sr(32768);for(Y=0;Y<32768;++Y)Gt=(Y&43690)>>1|(Y&21845)<<1,Gt=(Gt&52428)>>2|(Gt&13107)<<2,Gt=(Gt&61680)>>4|(Gt&3855)<<4,Dc[Y]=((Gt&65280)>>8|(Gt&255)<<8)>>1;var Gt,Y,oi=(function(e,t,n){for(var r=e.length,i=0,o=new sr(t);i<r;++i)e[i]&&++o[e[i]-1];var s=new sr(t);for(i=1;i<t;++i)s[i]=s[i-1]+o[i-1]<<1;var a;if(n){a=new sr(1<<t);var l=15-t;for(i=0;i<r;++i)if(e[i])for(var u=i<<4|e[i],c=t-e[i],d=s[e[i]-1]++<<c,f=d|(1<<c)-1;d<=f;++d)a[Dc[d]>>l]=u}else for(a=new sr(r),i=0;i<r;++i)e[i]&&(a[i]=Dc[s[e[i]-1]++]>>15-e[i]);return a}),si=new Ue(288);for(Y=0;Y<144;++Y)si[Y]=8;var Y;for(Y=144;Y<256;++Y)si[Y]=9;var Y;for(Y=256;Y<280;++Y)si[Y]=7;var Y;for(Y=280;Y<288;++Y)si[Y]=8;var Y,Mb=new Ue(32);for(Y=0;Y<32;++Y)Mb[Y]=5;var Y;var gO=oi(si,9,1);var bO=oi(Mb,5,1),_c=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},yt=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},$c=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},SO=function(e){return(e+7)/8|0},ps=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Ue(e.subarray(t,n))};var wO=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ge=function(e,t,n){var r=new Error(t||wO[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Ge),!n)throw r;return r},Tb=function(e,t,n,r){var i=e.length,o=r?r.length:0;if(!i||t.f&&!t.l)return n||new Ue(0);var s=!n,a=s||t.i!=2,l=t.i;s&&(n=new Ue(i*3));var u=function(K){var ze=n.length;if(K>ze){var de=new Ue(Math.max(ze*2,K));de.set(n),n=de}},c=t.f||0,d=t.p||0,f=t.b||0,p=t.l,h=t.d,m=t.m,y=t.n,S=i*8;do{if(!p){c=yt(e,d,1);var w=yt(e,d+1,3);if(d+=3,w)if(w==1)p=gO,h=bO,m=9,y=5;else if(w==2){var O=yt(e,d,31)+257,N=yt(e,d+10,15)+4,_=O+yt(e,d+5,31)+1;d+=14;for(var I=new Ue(_),B=new Ue(19),U=0;U<N;++U)B[pO[U]]=yt(e,d+U*3,7);d+=N*3;for(var ne=_c(B),$=(1<<ne)-1,Me=oi(B,ne,1),U=0;U<_;){var qe=Me[yt(e,d,$)];d+=qe&15;var g=qe>>4;if(g<16)I[U++]=g;else{var ae=0,Oe=0;for(g==16?(Oe=3+yt(e,d,3),d+=2,ae=I[U-1]):g==17?(Oe=3+yt(e,d,7),d+=3):g==18&&(Oe=11+yt(e,d,127),d+=7);Oe--;)I[U++]=ae}}var xt=I.subarray(0,O),Ee=I.subarray(O);m=_c(xt),y=_c(Ee),p=oi(xt,m,1),h=oi(Ee,y,1)}else Ge(1);else{var g=SO(d)+4,x=e[g-4]|e[g-3]<<8,k=g+x;if(k>i){l&&Ge(0);break}a&&u(f+x),n.set(e.subarray(g,k),f),t.b=f+=x,t.p=d=k*8,t.f=c;continue}if(d>S){l&&Ge(0);break}}a&&u(f+131072);for(var Di=(1<<m)-1,vr=(1<<y)-1,On=d;;On=d){var ae=p[$c(e,d)&Di],st=ae>>4;if(d+=ae&15,d>S){l&&Ge(0);break}if(ae||Ge(2),st<256)n[f++]=st;else if(st==256){On=d,p=null;break}else{var Rr=st-254;if(st>264){var U=st-257,Xt=Cb[U];Rr=yt(e,d,(1<<Xt)-1)+Ib[U],d+=Xt}var Ar=h[$c(e,d)&vr],at=Ar>>4;Ar||Ge(3),d+=Ar&15;var Ee=yO[at];if(at>3){var Xt=Eb[at];Ee+=$c(e,d)&(1<<Xt)-1,d+=Xt}if(d>S){l&&Ge(0);break}a&&u(f+131072);var vt=f+Rr;if(f<Ee){var Nn=o-Ee,_n=Math.min(Ee,vt);for(Nn+f<0&&Ge(3);f<_n;++f)n[f]=r[Nn+f]}for(;f<vt;++f)n[f]=n[f-Ee]}}t.l=p,t.p=On,t.b=f,t.f=c,p&&(c=1,t.m=m,t.d=h,t.n=y)}while(!c);return f!=n.length&&s?ps(n,0,f):n.subarray(0,f)};var xO=new Ue(0);var Ob=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&Ge(6,"invalid zlib data"),(e[1]>>5&1)==+!t&&Ge(6,"invalid zlib data: "+(e[1]&32?"need":"unexpected")+" dictionary"),(e[1]>>3&4)+2};var Lc=(function(){function e(t,n){typeof t=="function"&&(n=t,t={}),this.ondata=n;var r=t&&t.dictionary&&t.dictionary.subarray(-32768);this.s={i:0,b:r?r.length:0},this.o=new Ue(32768),this.p=new Ue(0),r&&this.o.set(r)}return e.prototype.e=function(t){if(this.ondata||Ge(5),this.d&&Ge(4),!this.p.length)this.p=t;else if(t.length){var n=new Ue(this.p.length+t.length);n.set(this.p),n.set(t,this.p.length),this.p=n}},e.prototype.c=function(t){this.s.i=+(this.d=t||!1);var n=this.s.b,r=Tb(this.p,this.s,this.o);this.ondata(ps(r,n,this.s.b),this.d),this.o=ps(r,this.s.b-32768),this.s.b=this.o.length,this.p=ps(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(t,n){this.e(t),this.c(n)},e})();var Fc=(function(){function e(t,n){Lc.call(this,t,n),this.v=t&&t.dictionary?2:1}return e.prototype.push=function(t,n){if(Lc.prototype.e.call(this,t),this.v){if(this.p.length<6&&!n)return;this.p=this.p.subarray(Ob(this.p,this.v-1)),this.v=0}n&&(this.p.length<4&&Ge(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),Lc.prototype.c.call(this,n)},e})();function Nb(e,t){return Tb(e.subarray(Ob(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var vO=typeof TextDecoder<"u"&&new TextDecoder,RO=0;try{vO.decode(xO,{stream:!0}),RO=1}catch{}function Bc(e,t="utf8"){return new TextDecoder(t).decode(e)}var AO=new TextEncoder;function _b(e){return AO.encode(e)}var CO=1024*8,EO=(()=>{let e=new Uint8Array(4),t=new Uint32Array(e.buffer);return!((t[0]=1)&e[0])})(),Uc={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array},ai=class e{buffer;byteLength;byteOffset;length;offset;lastWrittenByte;littleEndian;_data;_mark;_marks;constructor(t=CO,n={}){let r=!1;typeof t=="number"?t=new ArrayBuffer(t):(r=!0,this.lastWrittenByte=t.byteLength);let i=n.offset?n.offset>>>0:0,o=t.byteLength-i,s=i;(ArrayBuffer.isView(t)||t instanceof e)&&(t.byteLength!==t.buffer.byteLength&&(s=t.byteOffset+i),t=t.buffer),r?this.lastWrittenByte=o:this.lastWrittenByte=0,this.buffer=t,this.length=o,this.byteLength=o,this.byteOffset=s,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,s,o),this._mark=0,this._marks=[]}available(t=1){return this.offset+t<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(t=1){return this.offset+=t,this}back(t=1){return this.offset-=t,this}seek(t){return this.offset=t,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){let t=this._marks.pop();if(t===void 0)throw new Error("Mark stack empty");return this.seek(t),this}rewind(){return this.offset=0,this}ensureAvailable(t=1){if(!this.available(t)){let r=(this.offset+t)*2,i=new Uint8Array(r);i.set(new Uint8Array(this.buffer)),this.buffer=i.buffer,this.length=r,this.byteLength=r,this._data=new DataView(this.buffer)}return this}readBoolean(){return this.readUint8()!==0}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(t=1){return this.readArray(t,"uint8")}readArray(t,n){let r=Uc[n].BYTES_PER_ELEMENT*t,i=this.byteOffset+this.offset,o=this.buffer.slice(i,i+r);if(this.littleEndian===EO&&n!=="uint8"&&n!=="int8"){let a=new Uint8Array(this.buffer.slice(i,i+r));a.reverse();let l=new Uc[n](a.buffer);return this.offset+=r,l.reverse(),l}let s=new Uc[n](o);return this.offset+=r,s}readInt16(){let t=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,t}readUint16(){let t=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,t}readInt32(){let t=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,t}readUint32(){let t=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat32(){let t=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat64(){let t=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t}readBigInt64(){let t=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,t}readBigUint64(){let t=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,t}readChar(){return String.fromCharCode(this.readInt8())}readChars(t=1){let n="";for(let r=0;r<t;r++)n+=this.readChar();return n}readUtf8(t=1){return Bc(this.readBytes(t))}decodeText(t=1,n="utf8"){return Bc(this.readBytes(t),n)}writeBoolean(t){return this.writeUint8(t?255:0),this}writeInt8(t){return this.ensureAvailable(1),this._data.setInt8(this.offset++,t),this._updateLastWrittenByte(),this}writeUint8(t){return this.ensureAvailable(1),this._data.setUint8(this.offset++,t),this._updateLastWrittenByte(),this}writeByte(t){return this.writeUint8(t)}writeBytes(t){this.ensureAvailable(t.length);for(let n=0;n<t.length;n++)this._data.setUint8(this.offset++,t[n]);return this._updateLastWrittenByte(),this}writeInt16(t){return this.ensureAvailable(2),this._data.setInt16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeUint16(t){return this.ensureAvailable(2),this._data.setUint16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeInt32(t){return this.ensureAvailable(4),this._data.setInt32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeUint32(t){return this.ensureAvailable(4),this._data.setUint32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat32(t){return this.ensureAvailable(4),this._data.setFloat32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat64(t){return this.ensureAvailable(8),this._data.setFloat64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigInt64(t){return this.ensureAvailable(8),this._data.setBigInt64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigUint64(t){return this.ensureAvailable(8),this._data.setBigUint64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeChar(t){return this.writeUint8(t.charCodeAt(0))}writeChars(t){for(let n=0;n<t.length;n++)this.writeUint8(t.charCodeAt(n));return this}writeUtf8(t){return this.writeBytes(_b(t))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}getWrittenByteLength(){return this.lastWrittenByte-this.byteOffset}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}};var Lb=[];for(let e=0;e<256;e++){let t=e;for(let n=0;n<8;n++)t&1?t=3988292384^t>>>1:t=t>>>1;Lb[e]=t}var $b=4294967295;function kO(e,t,n){let r=e;for(let i=0;i<n;i++)r=Lb[(r^t[i])&255]^r>>>8;return r}function IO(e,t){return(kO($b,e,t)^$b)>>>0}function jc(e,t,n){let r=e.readUint32(),i=IO(new Uint8Array(e.buffer,e.byteOffset+e.offset-t-4,t),t);if(i!==r)throw new Error(`CRC mismatch for chunk ${n}. Expected ${r}, found ${i}`)}function ms(e,t,n){for(let r=0;r<n;r++)t[r]=e[r]}function ys(e,t,n,r){let i=0;for(;i<r;i++)t[i]=e[i];for(;i<n;i++)t[i]=e[i]+t[i-r]&255}function gs(e,t,n,r){let i=0;if(n.length===0)for(;i<r;i++)t[i]=e[i];else for(;i<r;i++)t[i]=e[i]+n[i]&255}function bs(e,t,n,r,i){let o=0;if(n.length===0){for(;o<i;o++)t[o]=e[o];for(;o<r;o++)t[o]=e[o]+(t[o-i]>>1)&255}else{for(;o<i;o++)t[o]=e[o]+(n[o]>>1)&255;for(;o<r;o++)t[o]=e[o]+(t[o-i]+n[o]>>1)&255}}function Ss(e,t,n,r,i){let o=0;if(n.length===0){for(;o<i;o++)t[o]=e[o];for(;o<r;o++)t[o]=e[o]+t[o-i]&255}else{for(;o<i;o++)t[o]=e[o]+n[o]&255;for(;o<r;o++)t[o]=e[o]+PO(t[o-i],n[o],n[o-i])&255}}function PO(e,t,n){let r=e+t-n,i=Math.abs(r-e),o=Math.abs(r-t),s=Math.abs(r-n);return i<=o&&i<=s?e:o<=s?t:n}function Db(e,t,n,r,i,o){switch(e){case 0:ms(t,n,i);break;case 1:ys(t,n,i,o);break;case 2:gs(t,n,r,i);break;case 3:bs(t,n,r,i,o);break;case 4:Ss(t,n,r,i,o);break;default:throw new Error(`Unsupported filter: ${e}`)}}var MO=new Uint16Array([255]),TO=new Uint8Array(MO.buffer),OO=TO[0]===255;function Fb(e){let{data:t,width:n,height:r,channels:i,depth:o}=e,s=[{x:0,y:0,xStep:8,yStep:8},{x:4,y:0,xStep:8,yStep:8},{x:0,y:4,xStep:4,yStep:8},{x:2,y:0,xStep:4,yStep:4},{x:0,y:2,xStep:2,yStep:4},{x:1,y:0,xStep:2,yStep:2},{x:0,y:1,xStep:1,yStep:2}],a=Math.ceil(o/8)*i,l=new Uint8Array(r*n*a),u=0;for(let c=0;c<7;c++){let d=s[c],f=Math.ceil((n-d.x)/d.xStep),p=Math.ceil((r-d.y)/d.yStep);if(f<=0||p<=0)continue;let h=f*a,m=new Uint8Array(h);for(let y=0;y<p;y++){let S=t[u++],w=t.subarray(u,u+h);u+=h;let g=new Uint8Array(h);Db(S,w,g,m,h,a),m.set(g);for(let x=0;x<f;x++){let k=d.x+x*d.xStep,O=d.y+y*d.yStep;if(!(k>=n||O>=r))for(let N=0;N<a;N++)l[(O*n+k)*a+N]=g[x*a+N]}}}if(o===16){let c=new Uint16Array(l.buffer);if(OO)for(let d=0;d<c.length;d++)c[d]=NO(c[d]);return c}else return l}function NO(e){return(e&255)<<8|e>>8&255}var _O=new Uint16Array([255]),$O=new Uint8Array(_O.buffer),LO=$O[0]===255,DO=new Uint8Array(0);function Vc(e){let{data:t,width:n,height:r,channels:i,depth:o}=e,s=Math.ceil(o/8)*i,a=Math.ceil(o/8*i*n),l=new Uint8Array(r*a),u=DO,c=0,d,f;for(let p=0;p<r;p++){switch(d=t.subarray(c+1,c+1+a),f=l.subarray(p*a,(p+1)*a),t[c]){case 0:ms(d,f,a);break;case 1:ys(d,f,a,s);break;case 2:gs(d,f,u,a);break;case 3:bs(d,f,u,a,s);break;case 4:Ss(d,f,u,a,s);break;default:throw new Error(`Unsupported filter: ${t[c]}`)}u=f,c+=a+1}if(o===16){let p=new Uint16Array(l.buffer);if(LO)for(let h=0;h<p.length;h++)p[h]=FO(p[h]);return p}else return l}function FO(e){return(e&255)<<8|e>>8&255}var ws=Uint8Array.of(137,80,78,71,13,10,26,10);function Wc(e){if(!Bb(e.readBytes(ws.length)))throw new Error("wrong PNG signature")}function Bb(e){if(e.length<ws.length)return!1;for(let t=0;t<ws.length;t++)if(e[t]!==ws[t])return!1;return!0}var Ub="tEXt",UO=0,jb=new TextDecoder("latin1");function jO(e){if(WO(e),e.length===0||e.length>79)throw new Error("keyword length must be between 1 and 79")}var VO=/^[\u0000-\u00FF]*$/;function WO(e){if(!VO.test(e))throw new Error("invalid latin1 text")}function Vb(e,t,n){let r=zc(t);e[r]=zO(t,n-r.length-1)}function zc(e){for(e.mark();e.readByte()!==UO;);let t=e.offset;e.reset();let n=jb.decode(e.readBytes(t-e.offset-1));return e.skip(1),jO(n),n}function zO(e,t){return jb.decode(e.readBytes(t))}var je={UNKNOWN:-1,GREYSCALE:0,TRUECOLOUR:2,INDEXED_COLOUR:3,GREYSCALE_ALPHA:4,TRUECOLOUR_ALPHA:6},li={UNKNOWN:-1,DEFLATE:0},xs={UNKNOWN:-1,ADAPTIVE:0},ui={UNKNOWN:-1,NO_INTERLACE:0,ADAM7:1},ci={NONE:0,BACKGROUND:1,PREVIOUS:2},vs={SOURCE:0,OVER:1};var di=class extends ai{_checkCrc;_inflator;_png;_apng;_end;_hasPalette;_palette;_hasTransparency;_transparency;_compressionMethod;_filterMethod;_interlaceMethod;_colorType;_isAnimated;_numberOfFrames;_numberOfPlays;_frames;_writingDataChunks;_chunks;_inflatorResult;constructor(t,n={}){super(t);let{checkCrc:r=!1}=n;this._checkCrc=r,this._inflator=new Fc((i,o)=>{if(this._chunks.push(i),o){let s=this._chunks.reduce((l,u)=>l+u.length,0);this._inflatorResult=new Uint8Array(s);let a=0;for(let l of this._chunks)this._inflatorResult.set(l,a),a+=l.length;this._chunks=[]}}),this._chunks=[],this._png={width:-1,height:-1,channels:-1,data:new Uint8Array(0),depth:1,text:{}},this._apng={width:-1,height:-1,channels:-1,depth:1,numberOfFrames:1,numberOfPlays:0,text:{},frames:[]},this._end=!1,this._hasPalette=!1,this._palette=[],this._hasTransparency=!1,this._transparency=new Uint16Array(0),this._compressionMethod=li.UNKNOWN,this._filterMethod=xs.UNKNOWN,this._interlaceMethod=ui.UNKNOWN,this._colorType=je.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this._inflatorResult=new Uint8Array(0),this.setBigEndian()}decode(){for(Wc(this);!this._end;){let t=this.readUint32(),n=this.readChars(4);this.decodeChunk(t,n)}return this._inflator.push(new Uint8Array(0),!0),this.decodeImage(),this._png}decodeApng(){for(Wc(this);!this._end;){let t=this.readUint32(),n=this.readChars(4);this.decodeApngChunk(t,n)}return this.decodeApngImage(),this._apng}decodeChunk(t,n){let r=this.offset;switch(n){case"IHDR":this.decodeIHDR();break;case"PLTE":this.decodePLTE(t);break;case"IDAT":this.decodeIDAT(t);break;case"IEND":this._end=!0;break;case"tRNS":this.decodetRNS(t);break;case"iCCP":this.decodeiCCP(t);break;case Ub:Vb(this._png.text,this,t);break;case"pHYs":this.decodepHYs();break;default:this.skip(t);break}if(this.offset-r!==t)throw new Error(`Length mismatch while decoding chunk ${n}`);this._checkCrc?jc(this,t+4,n):this.skip(4)}decodeApngChunk(t,n){let r=this.offset;switch(n!=="fdAT"&&n!=="IDAT"&&this._writingDataChunks&&this.pushDataToFrame(),n){case"acTL":this.decodeACTL();break;case"fcTL":this.decodeFCTL();break;case"fdAT":this.decodeFDAT(t);break;default:this.decodeChunk(t,n),this.offset=r+t;break}if(this.offset-r!==t)throw new Error(`Length mismatch while decoding chunk ${n}`);this._checkCrc?jc(this,t+4,n):this.skip(4)}decodeIHDR(){let t=this._png;t.width=this.readUint32(),t.height=this.readUint32(),t.depth=GO(this.readUint8());let n=this.readUint8();this._colorType=n;let r;switch(n){case je.GREYSCALE:r=1;break;case je.TRUECOLOUR:r=3;break;case je.INDEXED_COLOUR:r=1;break;case je.GREYSCALE_ALPHA:r=2;break;case je.TRUECOLOUR_ALPHA:r=4;break;case je.UNKNOWN:default:throw new Error(`Unknown color type: ${n}`)}if(this._png.channels=r,this._compressionMethod=this.readUint8(),this._compressionMethod!==li.DEFLATE)throw new Error(`Unsupported compression method: ${this._compressionMethod}`);this._filterMethod=this.readUint8(),this._interlaceMethod=this.readUint8()}decodeACTL(){this._numberOfFrames=this.readUint32(),this._numberOfPlays=this.readUint32(),this._isAnimated=!0}decodeFCTL(){let t={sequenceNumber:this.readUint32(),width:this.readUint32(),height:this.readUint32(),xOffset:this.readUint32(),yOffset:this.readUint32(),delayNumber:this.readUint16(),delayDenominator:this.readUint16(),disposeOp:this.readUint8(),blendOp:this.readUint8(),data:new Uint8Array(0)};this._frames.push(t)}decodePLTE(t){if(t%3!==0)throw new RangeError(`PLTE field length must be a multiple of 3. Got ${t}`);let n=t/3;this._hasPalette=!0;let r=[];this._palette=r;for(let i=0;i<n;i++)r.push([this.readUint8(),this.readUint8(),this.readUint8()])}decodeIDAT(t){this._writingDataChunks=!0;let n=t,r=this.offset+this.byteOffset;try{this._inflator.push(new Uint8Array(this.buffer,r,n),!1)}catch(i){throw new Error("Error while decompressing the data:",{cause:i})}this.skip(t)}decodeFDAT(t){this._writingDataChunks=!0;let n=t,r=this.offset+this.byteOffset;r+=4,n-=4;try{this._inflator.push(new Uint8Array(this.buffer,r,n),!1)}catch(i){throw new Error("Error while decompressing the data:",{cause:i})}this.skip(t)}decodetRNS(t){switch(this._colorType){case je.GREYSCALE:case je.TRUECOLOUR:{if(t%2!==0)throw new RangeError(`tRNS chunk length must be a multiple of 2. Got ${t}`);if(t/2>this._png.width*this._png.height)throw new Error(`tRNS chunk contains more alpha values than there are pixels (${t/2} vs ${this._png.width*this._png.height})`);this._hasTransparency=!0,this._transparency=new Uint16Array(t/2);for(let n=0;n<t/2;n++)this._transparency[n]=this.readUint16();break}case je.INDEXED_COLOUR:{if(t>this._palette.length)throw new Error(`tRNS chunk contains more alpha values than there are palette colors (${t} vs ${this._palette.length})`);let n=0;for(;n<t;n++){let r=this.readByte();this._palette[n].push(r)}for(;n<this._palette.length;n++)this._palette[n].push(255);break}case je.UNKNOWN:case je.GREYSCALE_ALPHA:case je.TRUECOLOUR_ALPHA:default:throw new Error(`tRNS chunk is not supported for color type ${this._colorType}`)}}decodeiCCP(t){let n=zc(this),r=this.readUint8();if(r!==li.DEFLATE)throw new Error(`Unsupported iCCP compression method: ${r}`);let i=this.readBytes(t-n.length-2);this._png.iccEmbeddedProfile={name:n,profile:Nb(i)}}decodepHYs(){let t=this.readUint32(),n=this.readUint32(),r=this.readByte();this._png.resolution={x:t,y:n,unit:r}}decodeApngImage(){this._apng.width=this._png.width,this._apng.height=this._png.height,this._apng.channels=this._png.channels,this._apng.depth=this._png.depth,this._apng.numberOfFrames=this._numberOfFrames,this._apng.numberOfPlays=this._numberOfPlays,this._apng.text=this._png.text,this._apng.resolution=this._png.resolution;for(let t=0;t<this._numberOfFrames;t++){let n={sequenceNumber:this._frames[t].sequenceNumber,delayNumber:this._frames[t].delayNumber,delayDenominator:this._frames[t].delayDenominator,data:this._apng.depth===8?new Uint8Array(this._apng.width*this._apng.height*this._apng.channels):new Uint16Array(this._apng.width*this._apng.height*this._apng.channels)},r=this._frames.at(t);if(r){if(r.data=Vc({data:r.data,width:r.width,height:r.height,channels:this._apng.channels,depth:this._apng.depth}),this._hasPalette&&(this._apng.palette=this._palette),this._hasTransparency&&(this._apng.transparency=this._transparency),t===0||r.xOffset===0&&r.yOffset===0&&r.width===this._png.width&&r.height===this._png.height)n.data=r.data;else{let i=this._apng.frames.at(t-1);this.disposeFrame(r,i,n),this.addFrameDataToCanvas(n,r)}this._apng.frames.push(n)}}return this._apng}disposeFrame(t,n,r){switch(t.disposeOp){case ci.NONE:break;case ci.BACKGROUND:for(let i=0;i<this._png.height;i++)for(let o=0;o<this._png.width;o++){let s=(i*t.width+o)*this._png.channels;for(let a=0;a<this._png.channels;a++)r.data[s+a]=0}break;case ci.PREVIOUS:r.data.set(n.data);break;default:throw new Error("Unknown disposeOp")}}addFrameDataToCanvas(t,n){let r=1<<this._png.depth,i=(o,s)=>{let a=((o+n.yOffset)*this._png.width+n.xOffset+s)*this._png.channels,l=(o*n.width+s)*this._png.channels;return{index:a,frameIndex:l}};switch(n.blendOp){case vs.SOURCE:for(let o=0;o<n.height;o++)for(let s=0;s<n.width;s++){let{index:a,frameIndex:l}=i(o,s);for(let u=0;u<this._png.channels;u++)t.data[a+u]=n.data[l+u]}break;case vs.OVER:for(let o=0;o<n.height;o++)for(let s=0;s<n.width;s++){let{index:a,frameIndex:l}=i(o,s);for(let u=0;u<this._png.channels;u++){let c=n.data[l+this._png.channels-1]/r,d=u%(this._png.channels-1)===0?1:n.data[l+u],f=Math.floor(c*d+(1-c)*t.data[a+u]);t.data[a+u]+=f}}break;default:throw new Error("Unknown blendOp")}}decodeImage(){let t=this._inflatorResult;if(this._filterMethod!==xs.ADAPTIVE)throw new Error(`Filter method ${this._filterMethod} not supported`);if(this._interlaceMethod===ui.NO_INTERLACE)this._png.data=Vc({data:t,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else if(this._interlaceMethod===ui.ADAM7)this._png.data=Fb({data:t,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else throw new Error(`Interlace method ${this._interlaceMethod} not supported`);this._hasPalette&&(this._png.palette=this._palette),this._hasTransparency&&(this._png.transparency=this._transparency)}pushDataToFrame(){this._inflator.push(new Uint8Array(0),!0);let t=this._inflatorResult,n=this._frames.at(-1);n?n.data=t:this._frames.push({sequenceNumber:0,width:this._png.width,height:this._png.height,xOffset:0,yOffset:0,delayNumber:0,delayDenominator:0,disposeOp:ci.NONE,blendOp:vs.SOURCE,data:t}),this._inflator=new Fc((r,i)=>{if(this._chunks.push(r),i){let o=this._chunks.reduce((a,l)=>a+l.length,0);this._inflatorResult=new Uint8Array(o);let s=0;for(let a of this._chunks)this._inflatorResult.set(a,s),s+=a.length;this._chunks=[]}}),this._chunks=[],this._writingDataChunks=!1}};function GO(e){if(e!==1&&e!==2&&e!==4&&e!==8&&e!==16)throw new Error(`invalid bit depth: ${e}`);return e}function Wb(e,t){return new di(e,t).decode()}import{createRequire as HO}from"module";import{readFile as Gc}from"fs/promises";import{fileURLToPath as qO}from"url";import{z as et}from"zod";var KO={height:800,width:1280},YO=et.object({event:et.looseObject({timestamp:et.number(),type:et.number()}),kind:et.literal("rrweb")});async function Gb(e){return(await Gc(e,"utf8")).split(`
|
|
57
57
|
`).filter(n=>n.length>0).map(n=>qb(n)).map(n=>YO.safeParse(n)).flatMap(n=>n.success?[n.data.event]:[])}var ZO=et.object({kind:et.literal("action"),timestamp:et.number()});async function Hb(e){return(await Gc(e,"utf8")).split(`
|
|
58
58
|
`).filter(n=>n.length>0).map(n=>qb(n)).map(n=>ZO.safeParse(n)).flatMap(n=>n.success?[n.data.timestamp]:[])}function qb(e){try{return JSON.parse(e)}catch{return null}}var XO=et.object({data:et.looseObject({height:et.number(),width:et.number()}),type:et.literal(4)});function Kb(e){let t=e.flatMap(n=>{let r=XO.safeParse(n);return r.success?[r.data]:[]})[0];return t==null?KO:{height:t.data.height,width:t.data.width}}var JO='<svg xmlns="http://www.w3.org/2000/svg" width="17" height="22" viewBox="0 0 17 22"><path d="M1 1 L1 17 L5.4 12.8 L8.5 20 L11 19 L8 11.8 L14 11.8 Z" fill="black" stroke="white" stroke-width="1.3"/></svg>',QO=`.replayer-mouse-tail { display: none; }
|
|
59
59
|
.replayer-mouse {
|
|
@@ -83,7 +83,7 @@ iframe { border: none; }
|
|
|
83
83
|
showWarning: false,
|
|
84
84
|
});
|
|
85
85
|
globalThis.__ripploClipReplayer = replayer;
|
|
86
|
-
})()`}async function f8({offsetMs:e,page:t}){await t.evaluate(h8(e)),await t.evaluate(Xb());let n=t.locator(".replayer-wrapper").first();return(await n.count()>0?n:t).screenshot({type:"png"})}function h8(e){return`globalThis.__ripploClipReplayer?.pause(${String(e+.5)})`}function p8({applyPalette:e,delayMs:t,gif:n,hold:r,png:i,quantize:o,started:s}){let{channels:a,data:l,height:u,width:c}=Wb(i);if(!(l instanceof Uint8Array))throw new TypeError("clip frame is not 8-bit");let d=y8({channels:a,data:l,height:u,width:c});if(!s&&!r&&m8(d))return!1;let f=o(d,256),p=e(d,f);return n.writeFrame(p,c,u,{delay:r?t+a8:t,palette:f}),!0}function m8(e){let t=e[0]??0,n=e[1]??0,r=e[2]??0,i=4*l8,o=Math.floor(e.length/i);return Array.from({length:o}).every((s,a)=>{let l=a*i;return Math.abs((e[l]??0)-t)<=Hc&&Math.abs((e[l+1]??0)-n)<=Hc&&Math.abs((e[l+2]??0)-r)<=Hc})}function y8({channels:e,data:t,height:n,width:r}){if(e===4)return t;if(e!==3)throw new TypeError(`unsupported clip frame channel count: ${String(e)}`);let i=r*n,o=new Uint8Array(i*4);return Array.from({length:i}).forEach((s,a)=>{o.set(t.subarray(a*3,a*3+3),a*4),o[a*4+3]=255}),o}function fi(e){return{aborted:!0,findings:[],ran:[],teardown:e}}function qc(e,t){return new n1(v8(e,t))}function g8(e,t){return new n1(b8(e,t))}async function b8(e,t){let n=S8(e),r=o1({lockfile:e.lockfile,options:e.options,runId:e.runId,signal:t}),i=async o=>{try{return Cs(await w8({established:o,params:e,signal:t}))}catch(s){return await o.teardown().match(tt,tt),As(pn(s))}};return i1(r,n).match(i,async o=>(await Kc(r.teardown),As(o)))}function S8(e){return{capture:!1,lockfile:e.lockfile,onEvent:void 0,options:e.options,params:e.params,runId:e.runId,sequence:void 0,test:e.test}}async function w8({established:e,params:t,signal:n}){let r=hs({headed:!0}),i=await r.acquire(),o=await fs({baseUrl:t.options.baseUrl,browser:i,capture:null,clientState:e.clientState,engine:cs(s1(t.lockfile)),extraHeaders:Yc(t.options.tunnelAuth),fixturesDir:t.options.fixturesDir,reader:e.reader,session:e.auth,viewport:null}),s=Gr(t.lockfile),a=await Wr({canon:Mr(t.lockfile),classify:Pr(t.lockfile),dataRules:s.dataRules,driver:o.driver,initialState:{snapshot:e.snapshot},onAssertion:o.emitAssertion,onEvent:tt,pageRules:mo(s.pageRules,rt(t.test)),sequence:r1(t.lockfile,t.test,t.params),stopAfterStep:t.stopAfterStep},n);return a.findings.length>0?(await o.close(),await r.close(),await e.teardown().match(tt,tt),{findings:a.findings,kind:"failed"}):(await x8(o.context),await e.teardown().match(tt,tt),await r.close(),{kind:"handed-over",ran:a.ran.length})}function x8(e){return new Promise(t=>{e.on("close",()=>{t()})})}async function v8({browser:e,hub:t,request:n},r){if(r.aborted)return Cs(fi("skipped"));let i=o1({lockfile:n.lockfile,options:n.options,runId:n.runId,signal:r}),o=async s=>{try{return Cs(await A8({browser:e,established:s,hub:t,request:n,signal:r}))}catch(a){return As(pn(a))}};return i1(i,n).match(o,s=>R8(s,i.teardown))}async function R8(e,t){return e.kind!=="aborted"?As(e):Cs(fi(await Kc(t)))}function Kc(e){return e().match(()=>"done",()=>"failed")}async function A8(e){let t=await E8(e);if(t.kind==="completed")return await e.established.teardown().match(tt,Sl),e.request.capture&&await C8(e.hub,e.request.runId),{aborted:!1,...t.result};let n=await Kc(e.established.teardown);if(t.kind==="aborted")return fi(n);throw t.error}async function C8(e,t){let n=t1.join(e.debugDir,t);await e1({jsonlPath:t1.join(n,"behavior.jsonl"),outDir:n,runId:t,scale:void 0})}async function E8({browser:e,established:t,hub:n,request:r,signal:i}){try{Lt(i);let{close:o,driver:s,emitAssertion:a}=await fs({baseUrl:r.options.baseUrl,browser:e,capture:r.capture?{hub:n,runId:r.runId}:null,clientState:t.clientState,engine:cs(s1(r.lockfile)),extraHeaders:Yc(r.options.tunnelAuth),fixturesDir:r.options.fixturesDir,reader:t.reader,session:t.auth,viewport:bb});try{r.onEvent?.({aliases:t.aliases,generated:t.generated,generatedSingletons:t.generatedSingletons,kind:"world"});let l=Gr(r.lockfile);return{kind:"completed",result:await Wr({canon:Mr(r.lockfile),classify:Pr(r.lockfile),dataRules:l.dataRules,driver:s,initialState:{snapshot:t.snapshot},onAssertion:a,onEvent:r.onEvent??tt,pageRules:mo(l.pageRules,rt(r.test)),sequence:r.sequence??r1(r.lockfile,r.test,r.params),stopAfterStep:void 0},i)}}finally{await o()}}catch(o){return wl(o)?{kind:"aborted"}:{error:o,kind:"threw"}}}function r1(e,t,n){return Fr(e,t).map(r=>({params:{...os(r),...n},transition:r}))}function i1(e,t){return e.ready().andThen(()=>jn(t.lockfile,t.test,{generate:Eo(Co(t.options.generate,t.runId),new Date().toISOString()),materialize:e.materialize,params:t.params}).map(n=>({aliases:n.aliases,auth:n.auth,clientState:n.clientState,generated:n.generated,generatedSingletons:n.generatedSingletons,reader:e.reader,snapshot:n.snapshot,teardown:e.teardown})))}function o1({lockfile:e,options:t,runId:n,signal:r}){let i=Nc({baseUrl:t.engineUrl,extraHeaders:Yc(t.tunnelAuth),runId:n,secret:t.secret},r);return{materialize:io(i.setupWorld),reader:Tc(e.entities,k8(e),i.query),ready:i.ready,teardown:i.teardown}}function Yc(e){if(e!=null)return{"CF-Access-Client-Id":e.clientId,"CF-Access-Client-Secret":e.clientSecret}}function k8(e){return e.singletons.filter(t=>t.source==="backend").map(t=>t.name)}function s1(e){return e.singletons.filter(t=>t.source==="client").map(t=>t.name)}import{err as V$,ok as W$,ResultAsync as z$}from"neverthrow";import mx from"path";import{z as wt}from"zod";import I8 from"path";import{z as hi}from"zod";var P8=["unspecified","internal","server","client","producer","consumer"],M8=["unset","ok","error"];function a1(e){return P8[e]??"unspecified"}function l1(e){return M8[e]??"unset"}var dW=hi.looseObject({data:hi.looseObject({source:hi.number().optional()}).optional(),timestamp:hi.number(),type:hi.number()});function u1({debugDir:e,runId:t,worker:n}){let r=I8.join(e,t,"behavior.jsonl");return n.open({file:r,runId:t}),{close:i=>n.close({noticeLineIfNoRrweb:i?.noticeIfNoRrweb==null?"":JSON.stringify(T8(i.noticeIfNoRrweb)),runId:t}),emit:i=>{let o={...i,timestamp:O8(i.timeNanos)};n.line({line:JSON.stringify(o),runId:t,timeNanos:i.timeNanos})},emitRrwebBatch:i=>{n.rrwebBatch({data:i,runId:t})}}}function lr(e){return String(BigInt(Math.round(e))*1000000n)}function T8(e){return{kind:"notice",message:e,source:"capture",timeNanos:"0"}}function O8(e){return Number(BigInt(e)/1000000n)}import{existsSync as N8}from"fs";import{createRequire as _8}from"module";import{fileURLToPath as $8}from"url";import{Worker as L8}from"worker_threads";var D8=_8(import.meta.url);function c1(e){let t=new L8(F8(),{workerData:e});t.unref();let n=new Map,r={next:0};t.on("message",o=>{let s=n.get(o.seq);s!=null&&(n.delete(o.seq),s())});let i=o=>{t.postMessage(o)};return{close:({noticeLineIfNoRrweb:o,runId:s})=>{let a=r.next;return r.next+=1,new Promise(l=>{n.set(a,l),i({noticeLineIfNoRrweb:o,runId:s,seq:a,t:"close"})})},line:({line:o,runId:s,timeNanos:a})=>{i({line:o,runId:s,t:"line",timeNanos:a})},open:({file:o,runId:s})=>{i({file:o,runId:s,t:"open"})},rrwebBatch:({data:o,runId:s})=>{i({data:o,runId:s,t:"rrweb-batch"})},terminate:async()=>{await t.terminate()}}}function F8(){try{return D8.resolve("@ripplo/runtime/capture-worker")}catch{let e=["../../dist/capture-worker.js","./capture-worker.js"].map(n=>$8(new URL(n,import.meta.url))),t=e.find(n=>N8(n));if(t==null)throw new Error(`capture-worker.js not found; looked at: ${e.join(", ")}`);return t}}import{readFile as B8}from"fs/promises";import{createRequire as U8}from"module";import{fileURLToPath as j8}from"url";var V8=U8(import.meta.url);function Zc(e,t){try{return V8.resolve(e)}catch{return j8(new URL(`assets/${t}`,import.meta.url))}}var W8=Zc("@ripplo/browser-trace/bundle","browser-trace.js");async function f1(e,t){await e.addInitScript(`globalThis.__ripploRunId = ${JSON.stringify(t)};`),await e.addInitScript(await z8())}var d1;function z8(){return d1??=B8(W8,{encoding:"utf8"}),d1}import{createServer as G8}from"http";import{mkdir as H8,rm as q8,writeFile as K8}from"fs/promises";import Y8 from"path";import{z as Q}from"zod";var Z8="otlp-port",p1=Q.object({key:Q.string(),value:Q.object({boolValue:Q.boolean().optional(),doubleValue:Q.number().optional(),intValue:Q.union([Q.string(),Q.number()]).optional(),stringValue:Q.string().optional()})}),X8=Q.object({attributes:Q.array(p1).default([]),endTimeUnixNano:Q.string(),kind:Q.number().default(0),name:Q.string(),parentSpanId:Q.string().optional(),spanId:Q.string(),startTimeUnixNano:Q.string(),status:Q.object({code:Q.number(),message:Q.string().optional()}).optional(),traceId:Q.string()}),J8=Q.object({resourceSpans:Q.array(Q.object({resource:Q.object({attributes:Q.array(p1).default([])}).optional(),scopeSpans:Q.array(Q.object({spans:Q.array(X8).default([])})).default([])})).default([])});async function Xc({localDir:e,onRrwebBatch:t,onSpan:n,writePortFile:r}){let{port:i,server:o}=await Q8({onRrwebBatch:t,onSpan:n}),s=Y8.join(e,Z8);return r&&(await H8(e,{recursive:!0}),await K8(s,String(i),{encoding:"utf8"})),{port:i,stop:async()=>{r&&await q8(s,{force:!0}),await iN(o)}}}function Q8(e){return new Promise((t,n)=>{let r=G8((i,o)=>{eN(i,o,e)});r.on("error",n),r.listen(0,()=>{let i=r.address();if(i==null||typeof i=="string"){n(new Error("otlp_receiver_no_port"));return}t({port:i.port,server:r})})})}function eN(e,t,n){let r=tN(e.url);if(r!=null){h1(e).then(i=>{n.onRrwebBatch(r,i),Es(t)}).catch(()=>{Es(t)});return}h1(e).then(i=>{nN(J8.parse(JSON.parse(i.toString("utf8"))),n.onSpan),Es(t)}).catch(()=>{Es(t)})}function tN(e){if(e==null||!e.startsWith("/rrweb/"))return;let t=decodeURIComponent(e.slice(7));return t.length===0?void 0:t}function h1(e){return new Promise((t,n)=>{let r=[];e.on("data",i=>{r.push(i)}),e.on("end",()=>{t(Buffer.concat(r))}),e.on("error",n)})}function Es(e){e.writeHead(200,{"content-type":"application/json"}),e.end("{}")}function nN(e,t){e.resourceSpans.flatMap(n=>n.scopeSpans).flatMap(n=>n.spans).forEach(n=>{t({attributes:rN(n.attributes),durationMs:Number((BigInt(n.endTimeUnixNano)-BigInt(n.startTimeUnixNano))/1000000n),kind:"span",name:n.name,parentSpanId:n.parentSpanId,source:"server",spanId:n.spanId,spanKind:a1(n.kind),status:{code:l1(n.status?.code??0),message:n.status?.message},timeNanos:n.startTimeUnixNano,traceId:n.traceId})})}function rN(e){return Object.fromEntries(e.map(({key:t,value:n})=>[t,String(n.stringValue??n.intValue??n.doubleValue??n.boolValue??"")]))}function iN(e){return new Promise((t,n)=>{e.close(r=>{if(r==null){t();return}n(r)}),e.closeAllConnections()})}import{readFile as k$}from"fs/promises";var oN=Object.defineProperty,sN=(e,t,n)=>t in e?oN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,R=(e,t,n)=>sN(e,typeof t!="symbol"?t+"":t,n),m1,aN=Object.defineProperty,lN=(e,t,n)=>t in e?aN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,y1=(e,t,n)=>lN(e,typeof t!="symbol"?t+"":t,n),Pe=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(Pe||{}),g1={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},b1={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},ks={},uN=()=>!!globalThis.Zone;function tf(e){if(ks[e])return ks[e];let t=globalThis[e],n=t.prototype,r=e in g1?g1[e]:void 0,i=!!(r&&r.every(a=>{var l,u;return!!((u=(l=Object.getOwnPropertyDescriptor(n,a))==null?void 0:l.get)!=null&&u.toString().includes("[native code]"))})),o=e in b1?b1[e]:void 0,s=!!(o&&o.every(a=>{var l;return typeof n[a]=="function"&&((l=n[a])==null?void 0:l.toString().includes("[native code]"))}));if(i&&s&&!uN())return ks[e]=t.prototype,t.prototype;try{let a=document.createElement("iframe");document.body.appendChild(a);let l=a.contentWindow;if(!l)return t.prototype;let u=l[e].prototype;return document.body.removeChild(a),u?ks[e]=u:n}catch{return n}}var Jc={};function Yt(e,t,n){var r;let i=`${e}.${String(n)}`;if(Jc[i])return Jc[i].call(t);let o=tf(e),s=(r=Object.getOwnPropertyDescriptor(o,n))==null?void 0:r.get;return s?(Jc[i]=s,s.call(t)):t[n]}var Qc={};function mS(e,t,n){let r=`${e}.${String(n)}`;if(Qc[r])return Qc[r].bind(t);let o=tf(e)[n];return typeof o!="function"?t[n]:(Qc[r]=o,o.bind(t))}function cN(e){return Yt("Node",e,"ownerDocument")}function dN(e){return Yt("Node",e,"childNodes")}function fN(e){return Yt("Node",e,"parentNode")}function hN(e){return Yt("Node",e,"parentElement")}function pN(e){return Yt("Node",e,"textContent")}function mN(e,t){return mS("Node",e,"contains")(t)}function yN(e){return mS("Node",e,"getRootNode")()}function gN(e){return!e||!("host"in e)?null:Yt("ShadowRoot",e,"host")}function bN(e){return e.styleSheets}function SN(e){return!e||!("shadowRoot"in e)?null:Yt("Element",e,"shadowRoot")}function wN(e,t){return Yt("Element",e,"querySelector")(t)}function xN(e,t){return Yt("Element",e,"querySelectorAll")(t)}function vN(){return tf("MutationObserver").constructor}function RN(e,t,n){try{if(!(t in e))return()=>{};let r=e[t],i=n(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}var Le={ownerDocument:cN,childNodes:dN,parentNode:fN,parentElement:hN,textContent:pN,contains:mN,getRootNode:yN,host:gN,styleSheets:bN,shadowRoot:SN,querySelector:wN,querySelectorAll:xN,mutationObserver:vN,patch:RN};function yS(e){return e.nodeType===e.ELEMENT_NODE}function Si(e){let t=e&&"host"in e&&"mode"in e&&Le.host(e)||null;return!!(t&&"shadowRoot"in t&&Le.shadowRoot(t)===e)}function wi(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function AN(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function CN(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let n=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}function fd(e){try{let t=e.rules||e.cssRules;if(!t)return null;let n=e.href;!n&&e.ownerNode&&(n=e.ownerNode.baseURI);let r=Array.from(t,i=>gS(i,n)).join("");return AN(r)}catch{return null}}function gS(e,t){if(kN(e)){let n;try{n=fd(e.styleSheet)||CN(e)}catch{n=e.cssText}return e.styleSheet.href?oa(n,e.styleSheet.href):n}else{let n=e.cssText;return IN(e)&&e.selectorText.includes(":")&&(n=EN(n)),t?oa(n,t):n}}function EN(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function kN(e){return"styleSheet"in e}function IN(e){return"selectorText"in e}var na=class{constructor(){y1(this,"idNodeMap",new Map),y1(this,"nodeMetaMap",new WeakMap)}getId(t){var n;return t?((n=this.getMeta(t))==null?void 0:n.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let n=this.getId(t);this.idNodeMap.delete(n),t.childNodes&&t.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,n){let r=n.id;this.idNodeMap.set(r,t),this.nodeMetaMap.set(t,n)}replace(t,n){let r=this.getNode(t);if(r){let i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(n,i)}this.idNodeMap.set(t,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function PN(){return new na}function ra({element:e,maskInputOptions:t,tagName:n,type:r,value:i,maskInputFn:o}){let s=i||"",a=r&&kn(r);return(t[n.toLowerCase()]||a&&t[a])&&(o?s=o(s,e):s="*".repeat(s.length)),s}function kn(e){return e.toLowerCase()}var S1="__rrweb_original__";function MN(e){let t=e.getContext("2d");if(!t)return!0;let n=50;for(let r=0;r<e.width;r+=n)for(let i=0;i<e.height;i+=n){let o=t.getImageData,s=S1 in o?o[S1]:o;if(new Uint32Array(s.call(t,r,i,Math.min(n,e.width-r),Math.min(n,e.height-i)).data.buffer).some(l=>l!==0))return!1}return!0}function ia(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?kn(t):null}function bS(e,t){let n;try{n=new URL(e,t??window.location.href)}catch{return null}let r=/\.([0-9a-z]+)(?:$)/i,i=n.pathname.match(r);return i?.[1]??null}function TN(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var ON=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,NN=/^(?:[a-z+]+:)?\/\//i,_N=/^www\..*/i,$N=/^(data:)([^,]*),(.*)/i;function oa(e,t){return(e||"").replace(ON,(n,r,i,o,s,a)=>{let l=i||s||a,u=r||o||"";if(!l)return n;if(NN.test(l)||_N.test(l))return`url(${u}${l}${u})`;if($N.test(l))return`url(${u}${l}${u})`;if(l[0]==="/")return`url(${u}${TN(t)+l}${u})`;let c=t.split("/"),d=l.split("/");c.pop();for(let f of d)f!=="."&&(f===".."?c.pop():c.push(f));return`url(${u}${c.join("/")}${u})`})}function Is(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function LN(e,t,n=!1){let r=Array.from(t.childNodes),i=[],o=0;if(r.length>1&&e&&typeof e=="string"){let s=Is(e,n),a=s.length/e.length;for(let l=1;l<r.length;l++)if(r[l].textContent&&typeof r[l].textContent=="string"){let u=Is(r[l].textContent,n),c=100,d=3;for(;d<u.length&&(u[d].match(/[a-zA-Z0-9]/)||u.indexOf(u.substring(0,d),1)!==-1);d++);for(;d<u.length;d++){let f=u.substring(0,d),p=s.split(f),h=-1;if(p.length===2)h=p[0].length;else if(p.length>2&&p[0]===""&&r[l-1].textContent!=="")h=s.indexOf(f,1);else if(p.length===1){if(f=f.substring(0,f.length-1),p=s.split(f),p.length<=1)return i.push(e),i;d=c+1}else d===u.length-1&&(h=s.indexOf(f));if(p.length>=2&&d>c){let m=r[l-1].textContent;if(m&&typeof m=="string"){let y=Is(m).length;h=s.indexOf(f,y)}h===-1&&(h=p[0].length)}if(h!==-1){let m=Math.floor(h/a);for(;m>0&&m<e.length;){if(o+=1,o>50*r.length)return i.push(e),i;let y=Is(e.substring(0,m),n);if(y.length===h){i.push(e.substring(0,m)),e=e.substring(m),s=s.substring(h);break}else y.length<h?m+=Math.max(1,Math.floor((h-y.length)/a)):m-=Math.max(1,Math.floor((y.length-h)*a))}break}}}}return i.push(e),i}function DN(e,t){return LN(e,t).join("/* rr_split */")}var FN=1,BN=new RegExp("[^a-z0-9-_:]"),vi=-2;function SS(){return FN++}function UN(e){if(e instanceof HTMLFormElement)return"form";let t=kn(e.tagName);return BN.test(t)?"div":t}var ur,w1,jN=/^[^ \t\n\r\u000c]+/,VN=/^[, \t\n\r\u000c]+/;function WN(e,t){if(t.trim()==="")return t;let n=0;function r(o){let s,a=o.exec(t.substring(n));return a?(s=a[0],n+=s.length,s):""}let i=[];for(;r(VN),!(n>=t.length);){let o=r(jN);if(o.slice(-1)===",")o=fr(e,o.substring(0,o.length-1)),i.push(o);else{let s="";o=fr(e,o);let a=!1;for(;;){let l=t.charAt(n);if(l===""){i.push((o+s).trim());break}else if(a)l===")"&&(a=!1);else if(l===","){n+=1,i.push((o+s).trim());break}else l==="("&&(a=!0);s+=l,n+=1}}}return i.join(", ")}var x1=new WeakMap;function fr(e,t){return!t||t.trim()===""?t:nf(e,t)}function zN(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function nf(e,t){let n=x1.get(e);if(n||(n=e.createElement("a"),x1.set(e,n)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return n.setAttribute("href",t),n.href}function wS(e,t,n,r){return r&&(n==="src"||n==="href"&&!(t==="use"&&r[0]==="#")||n==="xlink:href"&&r[0]!=="#"||n==="background"&&["table","td","th"].includes(t)?fr(e,r):n==="srcset"?WN(e,r):n==="style"?oa(r,nf(e)):t==="object"&&n==="data"?fr(e,r):r)}function xS(e,t,n){return["video","audio"].includes(e)&&t==="autoplay"}function GN(e,t,n){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let r=e.classList.length;r--;){let i=e.classList[r];if(t.test(i))return!0}if(n)return e.matches(n)}catch{}return!1}function sa(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?sa(Le.parentNode(e),t,n):!1;for(let r=e.classList.length;r--;){let i=e.classList[r];if(t.test(i))return!0}return n?sa(Le.parentNode(e),t,n):!1}function vS(e,t,n,r){let i;if(yS(e)){if(i=e,!Le.childNodes(i).length)return!1}else{if(Le.parentElement(e)===null)return!1;i=Le.parentElement(e)}try{if(typeof t=="string"){if(r){if(i.closest(`.${t}`))return!0}else if(i.classList.contains(t))return!0}else if(sa(i,t,r))return!0;if(n){if(r){if(i.closest(n))return!0}else if(i.matches(n))return!0}}catch{}return!1}function HN(e,t,n){let r=e.contentWindow;if(!r)return;let i=!1,o;try{o=r.document.readyState}catch{return}if(o!=="complete"){let a=setTimeout(()=>{i||(t(),i=!0)},n);e.addEventListener("load",()=>{clearTimeout(a),i=!0,t()});return}let s="about:blank";if(r.location.href!==s||e.src===s||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function qN(e,t,n){let r=!1,i;try{i=e.sheet}catch{return}if(i)return;let o=setTimeout(()=>{r||(t(),r=!0)},n);e.addEventListener("load",()=>{clearTimeout(o),r=!0,t()})}function KN(e,t){let{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:s,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:u,maskInputFn:c,dataURLOptions:d={},inlineImages:f,recordCanvas:p,keepIframeSrcFn:h,newlyAddedElement:m=!1,cssCaptured:y=!1}=t,S=YN(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:Pe.Document,childNodes:[],compatMode:e.compatMode}:{type:Pe.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Pe.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:S};case e.ELEMENT_NODE:return XN(e,{doc:n,blockClass:i,blockSelector:o,inlineStylesheet:a,maskInputOptions:l,maskInputFn:c,dataURLOptions:d,inlineImages:f,recordCanvas:p,keepIframeSrcFn:h,newlyAddedElement:m,rootId:S});case e.TEXT_NODE:return ZN(e,{doc:n,needsMask:s,maskTextFn:u,rootId:S,cssCaptured:y});case e.CDATA_SECTION_NODE:return{type:Pe.CDATA,textContent:"",rootId:S};case e.COMMENT_NODE:return{type:Pe.Comment,textContent:Le.textContent(e)||"",rootId:S};default:return!1}}function YN(e,t){if(!t.hasNode(e))return;let n=t.getId(e);return n===1?void 0:n}function ZN(e,t){let{needsMask:n,maskTextFn:r,rootId:i,cssCaptured:o}=t,s=Le.parentNode(e),a=s&&s.tagName,l="",u=a==="STYLE"?!0:void 0,c=a==="SCRIPT"?!0:void 0;return c?l="SCRIPT_PLACEHOLDER":o||(l=Le.textContent(e),u&&l&&(l=oa(l,nf(t.doc)))),!u&&!c&&l&&n&&(l=r?r(l,Le.parentElement(e)):l.replace(/[\S]/g,"*")),{type:Pe.Text,textContent:l||"",rootId:i}}function XN(e,t){let{doc:n,blockClass:r,blockSelector:i,inlineStylesheet:o,maskInputOptions:s={},maskInputFn:a,dataURLOptions:l={},inlineImages:u,recordCanvas:c,keepIframeSrcFn:d,newlyAddedElement:f=!1,rootId:p}=t,h=GN(e,r,i),m=UN(e),y={},S=e.attributes.length;for(let g=0;g<S;g++){let x=e.attributes[g];xS(m,x.name,x.value)||(y[x.name]=wS(n,m,kn(x.name),x.value))}if(m==="link"&&o){let g=Array.from(n.styleSheets).find(k=>k.href===e.href),x=null;g&&(x=fd(g)),x&&(delete y.rel,delete y.href,y._cssText=x)}if(m==="style"&&e.sheet){let g=fd(e.sheet);g&&(e.childNodes.length>1&&(g=DN(g,e)),y._cssText=g)}if(["input","textarea","select"].includes(m)){let g=e.value,x=e.checked;y.type!=="radio"&&y.type!=="checkbox"&&y.type!=="submit"&&y.type!=="button"&&g?y.value=ra({element:e,type:ia(e),tagName:m,value:g,maskInputOptions:s,maskInputFn:a}):x&&(y.checked=x)}if(m==="option"&&(e.selected&&!s.select?y.selected=!0:delete y.selected),m==="dialog"&&e.open&&(y.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),m==="canvas"&&c){if(e.__context==="2d")MN(e)||(y.rr_dataURL=e.toDataURL(l.type,l.quality));else if(!("__context"in e)){let g=e.toDataURL(l.type,l.quality),x=n.createElement("canvas");x.width=e.width,x.height=e.height;let k=x.toDataURL(l.type,l.quality);g!==k&&(y.rr_dataURL=g)}}if(m==="img"&&u){ur||(ur=n.createElement("canvas"),w1=ur.getContext("2d"));let g=e,x=g.currentSrc||g.getAttribute("src")||"<unknown-src>",k=g.crossOrigin,O=()=>{g.removeEventListener("load",O);try{ur.width=g.naturalWidth,ur.height=g.naturalHeight,w1.drawImage(g,0,0),y.rr_dataURL=ur.toDataURL(l.type,l.quality)}catch(N){if(g.crossOrigin!=="anonymous"){g.crossOrigin="anonymous",g.complete&&g.naturalWidth!==0?O():g.addEventListener("load",O);return}else console.warn(`Cannot inline img src=${x}! Error: ${N}`)}g.crossOrigin==="anonymous"&&(k?y.crossOrigin=k:g.removeAttribute("crossorigin"))};g.complete&&g.naturalWidth!==0?O():g.addEventListener("load",O)}if(["audio","video"].includes(m)){let g=y;g.rr_mediaState=e.paused?"paused":"played",g.rr_mediaCurrentTime=e.currentTime,g.rr_mediaPlaybackRate=e.playbackRate,g.rr_mediaMuted=e.muted,g.rr_mediaLoop=e.loop,g.rr_mediaVolume=e.volume}if(f||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop)),h){let{width:g,height:x}=e.getBoundingClientRect();y={class:y.class,rr_width:`${g}px`,rr_height:`${x}px`}}m==="iframe"&&!d(y.src)&&(e.contentDocument||(y.rr_src=y.src),delete y.src);let w;try{customElements.get(m)&&(w=!0)}catch{}return{type:Pe.Element,tagName:m,attributes:y,childNodes:[],isSVG:zN(e)||void 0,needBlock:h,rootId:p,isCustom:w}}function ce(e){return e==null?"":e.toLowerCase()}function RS(e){return e===!0||e==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:e==="all",headMetaDescKeywords:e==="all",headTitleMutations:e==="all"}:e||{}}function JN(e,t){if(t.comment&&e.type===Pe.Comment)return!0;if(e.type===Pe.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"&&e.attributes.as==="script"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&bS(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(ce(e.attributes.name).match(/^msapplication-tile(image|color)$/)||ce(e.attributes.name)==="application-name"||ce(e.attributes.rel)==="icon"||ce(e.attributes.rel)==="apple-touch-icon"||ce(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&ce(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(ce(e.attributes.property).match(/^(og|twitter|fb):/)||ce(e.attributes.name).match(/^(og|twitter):/)||ce(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(ce(e.attributes.name)==="robots"||ce(e.attributes.name)==="googlebot"||ce(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(ce(e.attributes.name)==="author"||ce(e.attributes.name)==="generator"||ce(e.attributes.name)==="framework"||ce(e.attributes.name)==="publisher"||ce(e.attributes.name)==="progid"||ce(e.attributes.property).match(/^article:/)||ce(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(ce(e.attributes.name)==="google-site-verification"||ce(e.attributes.name)==="yandex-verification"||ce(e.attributes.name)==="csrf-token"||ce(e.attributes.name)==="p:domain_verify"||ce(e.attributes.name)==="verify-v1"||ce(e.attributes.name)==="verification"||ce(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function hr(e,t){let{doc:n,mirror:r,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:u=!0,maskInputOptions:c={},maskTextFn:d,maskInputFn:f,slimDOMOptions:p,dataURLOptions:h={},inlineImages:m=!1,recordCanvas:y=!1,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:g=5e3,onStylesheetLoad:x,stylesheetLoadTimeout:k=5e3,keepIframeSrcFn:O=()=>!1,newlyAddedElement:N=!1,cssCaptured:_=!1}=t,{needsMask:I}=t,{preserveWhiteSpace:B=!0}=t;I||(I=vS(e,s,a,I===void 0));let U=KN(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:I,inlineStylesheet:u,maskInputOptions:c,maskTextFn:d,maskInputFn:f,dataURLOptions:h,inlineImages:m,recordCanvas:y,keepIframeSrcFn:O,newlyAddedElement:N,cssCaptured:_});if(!U)return console.warn(e,"not serialized"),null;let ne;r.hasNode(e)?ne=r.getId(e):JN(U,p)||!B&&U.type===Pe.Text&&!U.textContent.replace(/^\s+|\s+$/gm,"").length?ne=vi:ne=SS();let $=Object.assign(U,{id:ne});if(r.add(e,$),ne===vi)return null;S&&S(e);let Me=!l;if($.type===Pe.Element){Me=Me&&!$.needBlock,delete $.needBlock;let ae=Le.shadowRoot(e);ae&&wi(ae)&&($.isShadowHost=!0)}if(($.type===Pe.Document||$.type===Pe.Element)&&Me){p.headWhitespace&&$.type===Pe.Element&&$.tagName==="head"&&(B=!1);let ae={doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:I,maskTextClass:s,maskTextSelector:a,skipChild:l,inlineStylesheet:u,maskInputOptions:c,maskTextFn:d,maskInputFn:f,slimDOMOptions:p,dataURLOptions:h,inlineImages:m,recordCanvas:y,preserveWhiteSpace:B,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:g,onStylesheetLoad:x,stylesheetLoadTimeout:k,keepIframeSrcFn:O,cssCaptured:!1};if(!($.type===Pe.Element&&$.tagName==="textarea"&&$.attributes.value!==void 0)){$.type===Pe.Element&&$.attributes._cssText!==void 0&&typeof $.attributes._cssText=="string"&&(ae.cssCaptured=!0);for(let xt of Array.from(Le.childNodes(e))){let Ee=hr(xt,ae);Ee&&$.childNodes.push(Ee)}}let Oe=null;if(yS(e)&&(Oe=Le.shadowRoot(e)))for(let xt of Array.from(Le.childNodes(Oe))){let Ee=hr(xt,ae);Ee&&(wi(Oe)&&(Ee.isShadow=!0),$.childNodes.push(Ee))}}let qe=Le.parentNode(e);return qe&&Si(qe)&&wi(qe)&&($.isShadow=!0),$.type===Pe.Element&&$.tagName==="iframe"&&HN(e,()=>{let ae=e.contentDocument;if(ae&&w){let Oe=hr(ae,{doc:ae,mirror:r,blockClass:i,blockSelector:o,needsMask:I,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:d,maskInputFn:f,slimDOMOptions:p,dataURLOptions:h,inlineImages:m,recordCanvas:y,preserveWhiteSpace:B,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:g,onStylesheetLoad:x,stylesheetLoadTimeout:k,keepIframeSrcFn:O});Oe&&w(e,Oe)}},g),$.type===Pe.Element&&$.tagName==="link"&&typeof $.attributes.rel=="string"&&($.attributes.rel==="stylesheet"||$.attributes.rel==="preload"&&typeof $.attributes.href=="string"&&bS($.attributes.href)==="css")&&qN(e,()=>{if(x){let ae=hr(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:I,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:d,maskInputFn:f,slimDOMOptions:p,dataURLOptions:h,inlineImages:m,recordCanvas:y,preserveWhiteSpace:B,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:g,onStylesheetLoad:x,stylesheetLoadTimeout:k,keepIframeSrcFn:O});ae&&x(e,ae)}},k),$}function QN(e,t){let{mirror:n=new na,blockClass:r="rr-block",blockSelector:i=null,maskTextClass:o="rr-mask",maskTextSelector:s=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:u=!1,maskAllInputs:c=!1,maskTextFn:d,maskInputFn:f,slimDOM:p=!1,dataURLOptions:h,preserveWhiteSpace:m,onSerialize:y,onIframeLoad:S,iframeLoadTimeout:w,onStylesheetLoad:g,stylesheetLoadTimeout:x,keepIframeSrcFn:k=()=>!1}=t||{},O=c===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:c===!1?{password:!0}:c,N=RS(p);return hr(e,{doc:e,mirror:n,blockClass:r,blockSelector:i,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:a,maskInputOptions:O,maskTextFn:d,maskInputFn:f,slimDOMOptions:N,dataURLOptions:h,inlineImages:l,recordCanvas:u,preserveWhiteSpace:m,onSerialize:y,onIframeLoad:S,iframeLoadTimeout:w,onStylesheetLoad:g,stylesheetLoadTimeout:x,keepIframeSrcFn:k,newlyAddedElement:!1})}var e7=/(max|min)-device-(width|height)/,IW=new RegExp(e7.source,"g");function t7(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function n7(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var rf={exports:{}},fe=String,AS=function(){return{isColorSupported:!1,reset:fe,bold:fe,dim:fe,italic:fe,underline:fe,inverse:fe,hidden:fe,strikethrough:fe,black:fe,red:fe,green:fe,yellow:fe,blue:fe,magenta:fe,cyan:fe,white:fe,gray:fe,bgBlack:fe,bgRed:fe,bgGreen:fe,bgYellow:fe,bgBlue:fe,bgMagenta:fe,bgCyan:fe,bgWhite:fe}};rf.exports=AS();rf.exports.createColors=AS;var r7=rf.exports,i7={},o7=Object.freeze(Object.defineProperty({__proto__:null,default:i7},Symbol.toStringTag,{value:"Module"})),bt=n7(o7),v1=r7,R1=bt,hd=class CS extends Error{constructor(t,n,r,i,o,s){super(t),this.name="CssSyntaxError",this.reason=t,o&&(this.file=o),i&&(this.source=i),s&&(this.plugin=s),typeof n<"u"&&typeof r<"u"&&(typeof n=="number"?(this.line=n,this.column=r):(this.line=n.line,this.column=n.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,CS)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(t){if(!this.source)return"";let n=this.source;t==null&&(t=v1.isColorSupported),R1&&t&&(n=R1(n));let r=n.split(/\r?\n/),i=Math.max(this.line-3,0),o=Math.min(this.line+2,r.length),s=String(o).length,a,l;if(t){let{bold:u,gray:c,red:d}=v1.createColors(!0);a=f=>u(d(f)),l=f=>c(f)}else a=l=u=>u;return r.slice(i,o).map((u,c)=>{let d=i+1+c,f=" "+(" "+d).slice(-s)+" | ";if(d===this.line){let p=l(f.replace(/\d/g," "))+u.slice(0,this.column-1).replace(/[^\t]/g," ");return a(">")+l(f)+u+`
|
|
86
|
+
})()`}async function f8({offsetMs:e,page:t}){await t.evaluate(h8(e)),await t.evaluate(Xb());let n=t.locator(".replayer-wrapper").first();return(await n.count()>0?n:t).screenshot({type:"png"})}function h8(e){return`globalThis.__ripploClipReplayer?.pause(${String(e+.5)})`}function p8({applyPalette:e,delayMs:t,gif:n,hold:r,png:i,quantize:o,started:s}){let{channels:a,data:l,height:u,width:c}=Wb(i);if(!(l instanceof Uint8Array))throw new TypeError("clip frame is not 8-bit");let d=y8({channels:a,data:l,height:u,width:c});if(!s&&!r&&m8(d))return!1;let f=o(d,256),p=e(d,f);return n.writeFrame(p,c,u,{delay:r?t+a8:t,palette:f}),!0}function m8(e){let t=e[0]??0,n=e[1]??0,r=e[2]??0,i=4*l8,o=Math.floor(e.length/i);return Array.from({length:o}).every((s,a)=>{let l=a*i;return Math.abs((e[l]??0)-t)<=Hc&&Math.abs((e[l+1]??0)-n)<=Hc&&Math.abs((e[l+2]??0)-r)<=Hc})}function y8({channels:e,data:t,height:n,width:r}){if(e===4)return t;if(e!==3)throw new TypeError(`unsupported clip frame channel count: ${String(e)}`);let i=r*n,o=new Uint8Array(i*4);return Array.from({length:i}).forEach((s,a)=>{o.set(t.subarray(a*3,a*3+3),a*4),o[a*4+3]=255}),o}function fi(e){return{aborted:!0,findings:[],ran:[],teardown:e}}function qc(e,t){return new n1(v8(e,t))}function g8(e,t){return new n1(b8(e,t))}async function b8(e,t){let n=S8(e),r=o1({lockfile:e.lockfile,options:e.options,runId:e.runId,signal:t}),i=async o=>{try{return Cs(await w8({established:o,params:e,signal:t}))}catch(s){return await o.teardown().match(tt,tt),As(pn(s))}};return i1(r,n).match(i,async o=>(await Kc(r.teardown),As(o)))}function S8(e){return{capture:!1,lockfile:e.lockfile,onEvent:void 0,onPhase:void 0,options:e.options,params:e.params,runId:e.runId,sequence:void 0,test:e.test}}async function w8({established:e,params:t,signal:n}){let r=hs({headed:!0}),i=await r.acquire(),o=await fs({baseUrl:t.options.baseUrl,browser:i,capture:null,clientState:e.clientState,engine:cs(s1(t.lockfile)),extraHeaders:Yc(t.options.tunnelAuth),fixturesDir:t.options.fixturesDir,reader:e.reader,session:e.auth,viewport:null}),s=Gr(t.lockfile),a=await Wr({canon:Mr(t.lockfile),classify:Pr(t.lockfile),dataRules:s.dataRules,driver:o.driver,initialState:{snapshot:e.snapshot},onAssertion:o.emitAssertion,onEvent:tt,pageRules:mo(s.pageRules,rt(t.test)),sequence:r1(t.lockfile,t.test,t.params),stopAfterStep:t.stopAfterStep},n);return a.findings.length>0?(await o.close(),await r.close(),await e.teardown().match(tt,tt),{findings:a.findings,kind:"failed"}):(await x8(o.context),await e.teardown().match(tt,tt),await r.close(),{kind:"handed-over",ran:a.ran.length})}function x8(e){return new Promise(t=>{e.on("close",()=>{t()})})}async function v8({browser:e,hub:t,request:n},r){if(r.aborted)return Cs(fi("skipped"));let i=o1({lockfile:n.lockfile,options:n.options,runId:n.runId,signal:r}),o=async s=>{try{return Cs(await A8({browser:e,established:s,hub:t,request:n,signal:r}))}catch(a){return As(pn(a))}};return i1(i,n).match(o,s=>R8(s,i.teardown))}async function R8(e,t){return e.kind!=="aborted"?As(e):Cs(fi(await Kc(t)))}function Kc(e){return e().match(()=>"done",()=>"failed")}async function A8(e){let t=await E8(e);if(t.kind==="completed"){let r=Date.now();return await e.established.teardown().match(tt,Sl),e.request.onPhase?.("teardown",Date.now()-r),e.request.capture&&await C8(e.hub,e.request.runId),{aborted:!1,...t.result}}let n=await Kc(e.established.teardown);if(t.kind==="aborted")return fi(n);throw t.error}async function C8(e,t){let n=t1.join(e.debugDir,t);await e1({jsonlPath:t1.join(n,"behavior.jsonl"),outDir:n,runId:t,scale:void 0})}async function E8({browser:e,established:t,hub:n,request:r,signal:i}){try{Lt(i);let o=Date.now(),{close:s,driver:a,emitAssertion:l}=await fs({baseUrl:r.options.baseUrl,browser:e,capture:r.capture?{hub:n,runId:r.runId}:null,clientState:t.clientState,engine:cs(s1(r.lockfile)),extraHeaders:Yc(r.options.tunnelAuth),fixturesDir:r.options.fixturesDir,reader:t.reader,session:t.auth,viewport:bb});r.onPhase?.("browser",Date.now()-o);try{r.onEvent?.({aliases:t.aliases,generated:t.generated,generatedSingletons:t.generatedSingletons,kind:"world"});let u=Gr(r.lockfile),c=Date.now(),d=await Wr({canon:Mr(r.lockfile),classify:Pr(r.lockfile),dataRules:u.dataRules,driver:a,initialState:{snapshot:t.snapshot},onAssertion:l,onEvent:r.onEvent??tt,pageRules:mo(u.pageRules,rt(r.test)),sequence:r.sequence??r1(r.lockfile,r.test,r.params),stopAfterStep:void 0},i);return r.onPhase?.("drive",Date.now()-c),{kind:"completed",result:d}}finally{await s()}}catch(o){return wl(o)?{kind:"aborted"}:{error:o,kind:"threw"}}}function r1(e,t,n){return Fr(e,t).map(r=>({params:{...os(r),...n},transition:r}))}function i1(e,t){let n=Date.now();return e.ready().andThen(()=>{t.onPhase?.("engine",Date.now()-n);let r=Date.now();return jn(t.lockfile,t.test,{generate:Eo(Co(t.options.generate,t.runId),new Date().toISOString()),materialize:e.materialize,params:t.params}).map(i=>(t.onPhase?.("world",Date.now()-r),{aliases:i.aliases,auth:i.auth,clientState:i.clientState,generated:i.generated,generatedSingletons:i.generatedSingletons,reader:e.reader,snapshot:i.snapshot,teardown:e.teardown}))})}function o1({lockfile:e,options:t,runId:n,signal:r}){let i=Nc({baseUrl:t.engineUrl,extraHeaders:Yc(t.tunnelAuth),runId:n,secret:t.secret},r);return{materialize:io(i.setupWorld),reader:Tc(e.entities,k8(e),i.query),ready:i.ready,teardown:i.teardown}}function Yc(e){if(e!=null)return{"CF-Access-Client-Id":e.clientId,"CF-Access-Client-Secret":e.clientSecret}}function k8(e){return e.singletons.filter(t=>t.source==="backend").map(t=>t.name)}function s1(e){return e.singletons.filter(t=>t.source==="client").map(t=>t.name)}import{err as V$,ok as W$,ResultAsync as z$}from"neverthrow";import mx from"path";import{z as wt}from"zod";import I8 from"path";import{z as hi}from"zod";var P8=["unspecified","internal","server","client","producer","consumer"],M8=["unset","ok","error"];function a1(e){return P8[e]??"unspecified"}function l1(e){return M8[e]??"unset"}var fW=hi.looseObject({data:hi.looseObject({source:hi.number().optional()}).optional(),timestamp:hi.number(),type:hi.number()});function u1({debugDir:e,runId:t,worker:n}){let r=I8.join(e,t,"behavior.jsonl");return n.open({file:r,runId:t}),{close:i=>n.close({noticeLineIfNoRrweb:i?.noticeIfNoRrweb==null?"":JSON.stringify(T8(i.noticeIfNoRrweb)),runId:t}),emit:i=>{let o={...i,timestamp:O8(i.timeNanos)};n.line({line:JSON.stringify(o),runId:t,timeNanos:i.timeNanos})},emitRrwebBatch:i=>{n.rrwebBatch({data:i,runId:t})}}}function lr(e){return String(BigInt(Math.round(e))*1000000n)}function T8(e){return{kind:"notice",message:e,source:"capture",timeNanos:"0"}}function O8(e){return Number(BigInt(e)/1000000n)}import{existsSync as N8}from"fs";import{createRequire as _8}from"module";import{fileURLToPath as $8}from"url";import{Worker as L8}from"worker_threads";var D8=_8(import.meta.url);function c1(e){let t=new L8(F8(),{workerData:e});t.unref();let n=new Map,r={next:0};t.on("message",o=>{let s=n.get(o.seq);s!=null&&(n.delete(o.seq),s())});let i=o=>{t.postMessage(o)};return{close:({noticeLineIfNoRrweb:o,runId:s})=>{let a=r.next;return r.next+=1,new Promise(l=>{n.set(a,l),i({noticeLineIfNoRrweb:o,runId:s,seq:a,t:"close"})})},line:({line:o,runId:s,timeNanos:a})=>{i({line:o,runId:s,t:"line",timeNanos:a})},open:({file:o,runId:s})=>{i({file:o,runId:s,t:"open"})},rrwebBatch:({data:o,runId:s})=>{i({data:o,runId:s,t:"rrweb-batch"})},terminate:async()=>{await t.terminate()}}}function F8(){try{return D8.resolve("@ripplo/runtime/capture-worker")}catch{let e=["../../dist/capture-worker.js","./capture-worker.js"].map(n=>$8(new URL(n,import.meta.url))),t=e.find(n=>N8(n));if(t==null)throw new Error(`capture-worker.js not found; looked at: ${e.join(", ")}`);return t}}import{readFile as B8}from"fs/promises";import{createRequire as U8}from"module";import{fileURLToPath as j8}from"url";var V8=U8(import.meta.url);function Zc(e,t){try{return V8.resolve(e)}catch{return j8(new URL(`assets/${t}`,import.meta.url))}}var W8=Zc("@ripplo/browser-trace/bundle","browser-trace.js");async function f1(e,t){await e.addInitScript(`globalThis.__ripploRunId = ${JSON.stringify(t)};`),await e.addInitScript(await z8())}var d1;function z8(){return d1??=B8(W8,{encoding:"utf8"}),d1}import{createServer as G8}from"http";import{mkdir as H8,rm as q8,writeFile as K8}from"fs/promises";import Y8 from"path";import{z as Q}from"zod";var Z8="otlp-port",p1=Q.object({key:Q.string(),value:Q.object({boolValue:Q.boolean().optional(),doubleValue:Q.number().optional(),intValue:Q.union([Q.string(),Q.number()]).optional(),stringValue:Q.string().optional()})}),X8=Q.object({attributes:Q.array(p1).default([]),endTimeUnixNano:Q.string(),kind:Q.number().default(0),name:Q.string(),parentSpanId:Q.string().optional(),spanId:Q.string(),startTimeUnixNano:Q.string(),status:Q.object({code:Q.number(),message:Q.string().optional()}).optional(),traceId:Q.string()}),J8=Q.object({resourceSpans:Q.array(Q.object({resource:Q.object({attributes:Q.array(p1).default([])}).optional(),scopeSpans:Q.array(Q.object({spans:Q.array(X8).default([])})).default([])})).default([])});async function Xc({localDir:e,onRrwebBatch:t,onSpan:n,writePortFile:r}){let{port:i,server:o}=await Q8({onRrwebBatch:t,onSpan:n}),s=Y8.join(e,Z8);return r&&(await H8(e,{recursive:!0}),await K8(s,String(i),{encoding:"utf8"})),{port:i,stop:async()=>{r&&await q8(s,{force:!0}),await iN(o)}}}function Q8(e){return new Promise((t,n)=>{let r=G8((i,o)=>{eN(i,o,e)});r.on("error",n),r.listen(0,()=>{let i=r.address();if(i==null||typeof i=="string"){n(new Error("otlp_receiver_no_port"));return}t({port:i.port,server:r})})})}function eN(e,t,n){let r=tN(e.url);if(r!=null){h1(e).then(i=>{n.onRrwebBatch(r,i),Es(t)}).catch(()=>{Es(t)});return}h1(e).then(i=>{nN(J8.parse(JSON.parse(i.toString("utf8"))),n.onSpan),Es(t)}).catch(()=>{Es(t)})}function tN(e){if(e==null||!e.startsWith("/rrweb/"))return;let t=decodeURIComponent(e.slice(7));return t.length===0?void 0:t}function h1(e){return new Promise((t,n)=>{let r=[];e.on("data",i=>{r.push(i)}),e.on("end",()=>{t(Buffer.concat(r))}),e.on("error",n)})}function Es(e){e.writeHead(200,{"content-type":"application/json"}),e.end("{}")}function nN(e,t){e.resourceSpans.flatMap(n=>n.scopeSpans).flatMap(n=>n.spans).forEach(n=>{t({attributes:rN(n.attributes),durationMs:Number((BigInt(n.endTimeUnixNano)-BigInt(n.startTimeUnixNano))/1000000n),kind:"span",name:n.name,parentSpanId:n.parentSpanId,source:"server",spanId:n.spanId,spanKind:a1(n.kind),status:{code:l1(n.status?.code??0),message:n.status?.message},timeNanos:n.startTimeUnixNano,traceId:n.traceId})})}function rN(e){return Object.fromEntries(e.map(({key:t,value:n})=>[t,String(n.stringValue??n.intValue??n.doubleValue??n.boolValue??"")]))}function iN(e){return new Promise((t,n)=>{e.close(r=>{if(r==null){t();return}n(r)}),e.closeAllConnections()})}import{readFile as k$}from"fs/promises";var oN=Object.defineProperty,sN=(e,t,n)=>t in e?oN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,R=(e,t,n)=>sN(e,typeof t!="symbol"?t+"":t,n),m1,aN=Object.defineProperty,lN=(e,t,n)=>t in e?aN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,y1=(e,t,n)=>lN(e,typeof t!="symbol"?t+"":t,n),Pe=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(Pe||{}),g1={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},b1={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},ks={},uN=()=>!!globalThis.Zone;function tf(e){if(ks[e])return ks[e];let t=globalThis[e],n=t.prototype,r=e in g1?g1[e]:void 0,i=!!(r&&r.every(a=>{var l,u;return!!((u=(l=Object.getOwnPropertyDescriptor(n,a))==null?void 0:l.get)!=null&&u.toString().includes("[native code]"))})),o=e in b1?b1[e]:void 0,s=!!(o&&o.every(a=>{var l;return typeof n[a]=="function"&&((l=n[a])==null?void 0:l.toString().includes("[native code]"))}));if(i&&s&&!uN())return ks[e]=t.prototype,t.prototype;try{let a=document.createElement("iframe");document.body.appendChild(a);let l=a.contentWindow;if(!l)return t.prototype;let u=l[e].prototype;return document.body.removeChild(a),u?ks[e]=u:n}catch{return n}}var Jc={};function Yt(e,t,n){var r;let i=`${e}.${String(n)}`;if(Jc[i])return Jc[i].call(t);let o=tf(e),s=(r=Object.getOwnPropertyDescriptor(o,n))==null?void 0:r.get;return s?(Jc[i]=s,s.call(t)):t[n]}var Qc={};function mS(e,t,n){let r=`${e}.${String(n)}`;if(Qc[r])return Qc[r].bind(t);let o=tf(e)[n];return typeof o!="function"?t[n]:(Qc[r]=o,o.bind(t))}function cN(e){return Yt("Node",e,"ownerDocument")}function dN(e){return Yt("Node",e,"childNodes")}function fN(e){return Yt("Node",e,"parentNode")}function hN(e){return Yt("Node",e,"parentElement")}function pN(e){return Yt("Node",e,"textContent")}function mN(e,t){return mS("Node",e,"contains")(t)}function yN(e){return mS("Node",e,"getRootNode")()}function gN(e){return!e||!("host"in e)?null:Yt("ShadowRoot",e,"host")}function bN(e){return e.styleSheets}function SN(e){return!e||!("shadowRoot"in e)?null:Yt("Element",e,"shadowRoot")}function wN(e,t){return Yt("Element",e,"querySelector")(t)}function xN(e,t){return Yt("Element",e,"querySelectorAll")(t)}function vN(){return tf("MutationObserver").constructor}function RN(e,t,n){try{if(!(t in e))return()=>{};let r=e[t],i=n(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}var Le={ownerDocument:cN,childNodes:dN,parentNode:fN,parentElement:hN,textContent:pN,contains:mN,getRootNode:yN,host:gN,styleSheets:bN,shadowRoot:SN,querySelector:wN,querySelectorAll:xN,mutationObserver:vN,patch:RN};function yS(e){return e.nodeType===e.ELEMENT_NODE}function Si(e){let t=e&&"host"in e&&"mode"in e&&Le.host(e)||null;return!!(t&&"shadowRoot"in t&&Le.shadowRoot(t)===e)}function wi(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function AN(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function CN(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let n=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}function fd(e){try{let t=e.rules||e.cssRules;if(!t)return null;let n=e.href;!n&&e.ownerNode&&(n=e.ownerNode.baseURI);let r=Array.from(t,i=>gS(i,n)).join("");return AN(r)}catch{return null}}function gS(e,t){if(kN(e)){let n;try{n=fd(e.styleSheet)||CN(e)}catch{n=e.cssText}return e.styleSheet.href?oa(n,e.styleSheet.href):n}else{let n=e.cssText;return IN(e)&&e.selectorText.includes(":")&&(n=EN(n)),t?oa(n,t):n}}function EN(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function kN(e){return"styleSheet"in e}function IN(e){return"selectorText"in e}var na=class{constructor(){y1(this,"idNodeMap",new Map),y1(this,"nodeMetaMap",new WeakMap)}getId(t){var n;return t?((n=this.getMeta(t))==null?void 0:n.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let n=this.getId(t);this.idNodeMap.delete(n),t.childNodes&&t.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,n){let r=n.id;this.idNodeMap.set(r,t),this.nodeMetaMap.set(t,n)}replace(t,n){let r=this.getNode(t);if(r){let i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(n,i)}this.idNodeMap.set(t,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function PN(){return new na}function ra({element:e,maskInputOptions:t,tagName:n,type:r,value:i,maskInputFn:o}){let s=i||"",a=r&&kn(r);return(t[n.toLowerCase()]||a&&t[a])&&(o?s=o(s,e):s="*".repeat(s.length)),s}function kn(e){return e.toLowerCase()}var S1="__rrweb_original__";function MN(e){let t=e.getContext("2d");if(!t)return!0;let n=50;for(let r=0;r<e.width;r+=n)for(let i=0;i<e.height;i+=n){let o=t.getImageData,s=S1 in o?o[S1]:o;if(new Uint32Array(s.call(t,r,i,Math.min(n,e.width-r),Math.min(n,e.height-i)).data.buffer).some(l=>l!==0))return!1}return!0}function ia(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?kn(t):null}function bS(e,t){let n;try{n=new URL(e,t??window.location.href)}catch{return null}let r=/\.([0-9a-z]+)(?:$)/i,i=n.pathname.match(r);return i?.[1]??null}function TN(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var ON=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,NN=/^(?:[a-z+]+:)?\/\//i,_N=/^www\..*/i,$N=/^(data:)([^,]*),(.*)/i;function oa(e,t){return(e||"").replace(ON,(n,r,i,o,s,a)=>{let l=i||s||a,u=r||o||"";if(!l)return n;if(NN.test(l)||_N.test(l))return`url(${u}${l}${u})`;if($N.test(l))return`url(${u}${l}${u})`;if(l[0]==="/")return`url(${u}${TN(t)+l}${u})`;let c=t.split("/"),d=l.split("/");c.pop();for(let f of d)f!=="."&&(f===".."?c.pop():c.push(f));return`url(${u}${c.join("/")}${u})`})}function Is(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function LN(e,t,n=!1){let r=Array.from(t.childNodes),i=[],o=0;if(r.length>1&&e&&typeof e=="string"){let s=Is(e,n),a=s.length/e.length;for(let l=1;l<r.length;l++)if(r[l].textContent&&typeof r[l].textContent=="string"){let u=Is(r[l].textContent,n),c=100,d=3;for(;d<u.length&&(u[d].match(/[a-zA-Z0-9]/)||u.indexOf(u.substring(0,d),1)!==-1);d++);for(;d<u.length;d++){let f=u.substring(0,d),p=s.split(f),h=-1;if(p.length===2)h=p[0].length;else if(p.length>2&&p[0]===""&&r[l-1].textContent!=="")h=s.indexOf(f,1);else if(p.length===1){if(f=f.substring(0,f.length-1),p=s.split(f),p.length<=1)return i.push(e),i;d=c+1}else d===u.length-1&&(h=s.indexOf(f));if(p.length>=2&&d>c){let m=r[l-1].textContent;if(m&&typeof m=="string"){let y=Is(m).length;h=s.indexOf(f,y)}h===-1&&(h=p[0].length)}if(h!==-1){let m=Math.floor(h/a);for(;m>0&&m<e.length;){if(o+=1,o>50*r.length)return i.push(e),i;let y=Is(e.substring(0,m),n);if(y.length===h){i.push(e.substring(0,m)),e=e.substring(m),s=s.substring(h);break}else y.length<h?m+=Math.max(1,Math.floor((h-y.length)/a)):m-=Math.max(1,Math.floor((y.length-h)*a))}break}}}}return i.push(e),i}function DN(e,t){return LN(e,t).join("/* rr_split */")}var FN=1,BN=new RegExp("[^a-z0-9-_:]"),vi=-2;function SS(){return FN++}function UN(e){if(e instanceof HTMLFormElement)return"form";let t=kn(e.tagName);return BN.test(t)?"div":t}var ur,w1,jN=/^[^ \t\n\r\u000c]+/,VN=/^[, \t\n\r\u000c]+/;function WN(e,t){if(t.trim()==="")return t;let n=0;function r(o){let s,a=o.exec(t.substring(n));return a?(s=a[0],n+=s.length,s):""}let i=[];for(;r(VN),!(n>=t.length);){let o=r(jN);if(o.slice(-1)===",")o=fr(e,o.substring(0,o.length-1)),i.push(o);else{let s="";o=fr(e,o);let a=!1;for(;;){let l=t.charAt(n);if(l===""){i.push((o+s).trim());break}else if(a)l===")"&&(a=!1);else if(l===","){n+=1,i.push((o+s).trim());break}else l==="("&&(a=!0);s+=l,n+=1}}}return i.join(", ")}var x1=new WeakMap;function fr(e,t){return!t||t.trim()===""?t:nf(e,t)}function zN(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function nf(e,t){let n=x1.get(e);if(n||(n=e.createElement("a"),x1.set(e,n)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return n.setAttribute("href",t),n.href}function wS(e,t,n,r){return r&&(n==="src"||n==="href"&&!(t==="use"&&r[0]==="#")||n==="xlink:href"&&r[0]!=="#"||n==="background"&&["table","td","th"].includes(t)?fr(e,r):n==="srcset"?WN(e,r):n==="style"?oa(r,nf(e)):t==="object"&&n==="data"?fr(e,r):r)}function xS(e,t,n){return["video","audio"].includes(e)&&t==="autoplay"}function GN(e,t,n){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let r=e.classList.length;r--;){let i=e.classList[r];if(t.test(i))return!0}if(n)return e.matches(n)}catch{}return!1}function sa(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?sa(Le.parentNode(e),t,n):!1;for(let r=e.classList.length;r--;){let i=e.classList[r];if(t.test(i))return!0}return n?sa(Le.parentNode(e),t,n):!1}function vS(e,t,n,r){let i;if(yS(e)){if(i=e,!Le.childNodes(i).length)return!1}else{if(Le.parentElement(e)===null)return!1;i=Le.parentElement(e)}try{if(typeof t=="string"){if(r){if(i.closest(`.${t}`))return!0}else if(i.classList.contains(t))return!0}else if(sa(i,t,r))return!0;if(n){if(r){if(i.closest(n))return!0}else if(i.matches(n))return!0}}catch{}return!1}function HN(e,t,n){let r=e.contentWindow;if(!r)return;let i=!1,o;try{o=r.document.readyState}catch{return}if(o!=="complete"){let a=setTimeout(()=>{i||(t(),i=!0)},n);e.addEventListener("load",()=>{clearTimeout(a),i=!0,t()});return}let s="about:blank";if(r.location.href!==s||e.src===s||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function qN(e,t,n){let r=!1,i;try{i=e.sheet}catch{return}if(i)return;let o=setTimeout(()=>{r||(t(),r=!0)},n);e.addEventListener("load",()=>{clearTimeout(o),r=!0,t()})}function KN(e,t){let{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:s,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:u,maskInputFn:c,dataURLOptions:d={},inlineImages:f,recordCanvas:p,keepIframeSrcFn:h,newlyAddedElement:m=!1,cssCaptured:y=!1}=t,S=YN(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:Pe.Document,childNodes:[],compatMode:e.compatMode}:{type:Pe.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Pe.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:S};case e.ELEMENT_NODE:return XN(e,{doc:n,blockClass:i,blockSelector:o,inlineStylesheet:a,maskInputOptions:l,maskInputFn:c,dataURLOptions:d,inlineImages:f,recordCanvas:p,keepIframeSrcFn:h,newlyAddedElement:m,rootId:S});case e.TEXT_NODE:return ZN(e,{doc:n,needsMask:s,maskTextFn:u,rootId:S,cssCaptured:y});case e.CDATA_SECTION_NODE:return{type:Pe.CDATA,textContent:"",rootId:S};case e.COMMENT_NODE:return{type:Pe.Comment,textContent:Le.textContent(e)||"",rootId:S};default:return!1}}function YN(e,t){if(!t.hasNode(e))return;let n=t.getId(e);return n===1?void 0:n}function ZN(e,t){let{needsMask:n,maskTextFn:r,rootId:i,cssCaptured:o}=t,s=Le.parentNode(e),a=s&&s.tagName,l="",u=a==="STYLE"?!0:void 0,c=a==="SCRIPT"?!0:void 0;return c?l="SCRIPT_PLACEHOLDER":o||(l=Le.textContent(e),u&&l&&(l=oa(l,nf(t.doc)))),!u&&!c&&l&&n&&(l=r?r(l,Le.parentElement(e)):l.replace(/[\S]/g,"*")),{type:Pe.Text,textContent:l||"",rootId:i}}function XN(e,t){let{doc:n,blockClass:r,blockSelector:i,inlineStylesheet:o,maskInputOptions:s={},maskInputFn:a,dataURLOptions:l={},inlineImages:u,recordCanvas:c,keepIframeSrcFn:d,newlyAddedElement:f=!1,rootId:p}=t,h=GN(e,r,i),m=UN(e),y={},S=e.attributes.length;for(let g=0;g<S;g++){let x=e.attributes[g];xS(m,x.name,x.value)||(y[x.name]=wS(n,m,kn(x.name),x.value))}if(m==="link"&&o){let g=Array.from(n.styleSheets).find(k=>k.href===e.href),x=null;g&&(x=fd(g)),x&&(delete y.rel,delete y.href,y._cssText=x)}if(m==="style"&&e.sheet){let g=fd(e.sheet);g&&(e.childNodes.length>1&&(g=DN(g,e)),y._cssText=g)}if(["input","textarea","select"].includes(m)){let g=e.value,x=e.checked;y.type!=="radio"&&y.type!=="checkbox"&&y.type!=="submit"&&y.type!=="button"&&g?y.value=ra({element:e,type:ia(e),tagName:m,value:g,maskInputOptions:s,maskInputFn:a}):x&&(y.checked=x)}if(m==="option"&&(e.selected&&!s.select?y.selected=!0:delete y.selected),m==="dialog"&&e.open&&(y.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),m==="canvas"&&c){if(e.__context==="2d")MN(e)||(y.rr_dataURL=e.toDataURL(l.type,l.quality));else if(!("__context"in e)){let g=e.toDataURL(l.type,l.quality),x=n.createElement("canvas");x.width=e.width,x.height=e.height;let k=x.toDataURL(l.type,l.quality);g!==k&&(y.rr_dataURL=g)}}if(m==="img"&&u){ur||(ur=n.createElement("canvas"),w1=ur.getContext("2d"));let g=e,x=g.currentSrc||g.getAttribute("src")||"<unknown-src>",k=g.crossOrigin,O=()=>{g.removeEventListener("load",O);try{ur.width=g.naturalWidth,ur.height=g.naturalHeight,w1.drawImage(g,0,0),y.rr_dataURL=ur.toDataURL(l.type,l.quality)}catch(N){if(g.crossOrigin!=="anonymous"){g.crossOrigin="anonymous",g.complete&&g.naturalWidth!==0?O():g.addEventListener("load",O);return}else console.warn(`Cannot inline img src=${x}! Error: ${N}`)}g.crossOrigin==="anonymous"&&(k?y.crossOrigin=k:g.removeAttribute("crossorigin"))};g.complete&&g.naturalWidth!==0?O():g.addEventListener("load",O)}if(["audio","video"].includes(m)){let g=y;g.rr_mediaState=e.paused?"paused":"played",g.rr_mediaCurrentTime=e.currentTime,g.rr_mediaPlaybackRate=e.playbackRate,g.rr_mediaMuted=e.muted,g.rr_mediaLoop=e.loop,g.rr_mediaVolume=e.volume}if(f||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop)),h){let{width:g,height:x}=e.getBoundingClientRect();y={class:y.class,rr_width:`${g}px`,rr_height:`${x}px`}}m==="iframe"&&!d(y.src)&&(e.contentDocument||(y.rr_src=y.src),delete y.src);let w;try{customElements.get(m)&&(w=!0)}catch{}return{type:Pe.Element,tagName:m,attributes:y,childNodes:[],isSVG:zN(e)||void 0,needBlock:h,rootId:p,isCustom:w}}function ce(e){return e==null?"":e.toLowerCase()}function RS(e){return e===!0||e==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:e==="all",headMetaDescKeywords:e==="all",headTitleMutations:e==="all"}:e||{}}function JN(e,t){if(t.comment&&e.type===Pe.Comment)return!0;if(e.type===Pe.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"&&e.attributes.as==="script"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&bS(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(ce(e.attributes.name).match(/^msapplication-tile(image|color)$/)||ce(e.attributes.name)==="application-name"||ce(e.attributes.rel)==="icon"||ce(e.attributes.rel)==="apple-touch-icon"||ce(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&ce(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(ce(e.attributes.property).match(/^(og|twitter|fb):/)||ce(e.attributes.name).match(/^(og|twitter):/)||ce(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(ce(e.attributes.name)==="robots"||ce(e.attributes.name)==="googlebot"||ce(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(ce(e.attributes.name)==="author"||ce(e.attributes.name)==="generator"||ce(e.attributes.name)==="framework"||ce(e.attributes.name)==="publisher"||ce(e.attributes.name)==="progid"||ce(e.attributes.property).match(/^article:/)||ce(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(ce(e.attributes.name)==="google-site-verification"||ce(e.attributes.name)==="yandex-verification"||ce(e.attributes.name)==="csrf-token"||ce(e.attributes.name)==="p:domain_verify"||ce(e.attributes.name)==="verify-v1"||ce(e.attributes.name)==="verification"||ce(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function hr(e,t){let{doc:n,mirror:r,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:u=!0,maskInputOptions:c={},maskTextFn:d,maskInputFn:f,slimDOMOptions:p,dataURLOptions:h={},inlineImages:m=!1,recordCanvas:y=!1,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:g=5e3,onStylesheetLoad:x,stylesheetLoadTimeout:k=5e3,keepIframeSrcFn:O=()=>!1,newlyAddedElement:N=!1,cssCaptured:_=!1}=t,{needsMask:I}=t,{preserveWhiteSpace:B=!0}=t;I||(I=vS(e,s,a,I===void 0));let U=KN(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:I,inlineStylesheet:u,maskInputOptions:c,maskTextFn:d,maskInputFn:f,dataURLOptions:h,inlineImages:m,recordCanvas:y,keepIframeSrcFn:O,newlyAddedElement:N,cssCaptured:_});if(!U)return console.warn(e,"not serialized"),null;let ne;r.hasNode(e)?ne=r.getId(e):JN(U,p)||!B&&U.type===Pe.Text&&!U.textContent.replace(/^\s+|\s+$/gm,"").length?ne=vi:ne=SS();let $=Object.assign(U,{id:ne});if(r.add(e,$),ne===vi)return null;S&&S(e);let Me=!l;if($.type===Pe.Element){Me=Me&&!$.needBlock,delete $.needBlock;let ae=Le.shadowRoot(e);ae&&wi(ae)&&($.isShadowHost=!0)}if(($.type===Pe.Document||$.type===Pe.Element)&&Me){p.headWhitespace&&$.type===Pe.Element&&$.tagName==="head"&&(B=!1);let ae={doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:I,maskTextClass:s,maskTextSelector:a,skipChild:l,inlineStylesheet:u,maskInputOptions:c,maskTextFn:d,maskInputFn:f,slimDOMOptions:p,dataURLOptions:h,inlineImages:m,recordCanvas:y,preserveWhiteSpace:B,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:g,onStylesheetLoad:x,stylesheetLoadTimeout:k,keepIframeSrcFn:O,cssCaptured:!1};if(!($.type===Pe.Element&&$.tagName==="textarea"&&$.attributes.value!==void 0)){$.type===Pe.Element&&$.attributes._cssText!==void 0&&typeof $.attributes._cssText=="string"&&(ae.cssCaptured=!0);for(let xt of Array.from(Le.childNodes(e))){let Ee=hr(xt,ae);Ee&&$.childNodes.push(Ee)}}let Oe=null;if(yS(e)&&(Oe=Le.shadowRoot(e)))for(let xt of Array.from(Le.childNodes(Oe))){let Ee=hr(xt,ae);Ee&&(wi(Oe)&&(Ee.isShadow=!0),$.childNodes.push(Ee))}}let qe=Le.parentNode(e);return qe&&Si(qe)&&wi(qe)&&($.isShadow=!0),$.type===Pe.Element&&$.tagName==="iframe"&&HN(e,()=>{let ae=e.contentDocument;if(ae&&w){let Oe=hr(ae,{doc:ae,mirror:r,blockClass:i,blockSelector:o,needsMask:I,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:d,maskInputFn:f,slimDOMOptions:p,dataURLOptions:h,inlineImages:m,recordCanvas:y,preserveWhiteSpace:B,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:g,onStylesheetLoad:x,stylesheetLoadTimeout:k,keepIframeSrcFn:O});Oe&&w(e,Oe)}},g),$.type===Pe.Element&&$.tagName==="link"&&typeof $.attributes.rel=="string"&&($.attributes.rel==="stylesheet"||$.attributes.rel==="preload"&&typeof $.attributes.href=="string"&&bS($.attributes.href)==="css")&&qN(e,()=>{if(x){let ae=hr(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:I,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:d,maskInputFn:f,slimDOMOptions:p,dataURLOptions:h,inlineImages:m,recordCanvas:y,preserveWhiteSpace:B,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:g,onStylesheetLoad:x,stylesheetLoadTimeout:k,keepIframeSrcFn:O});ae&&x(e,ae)}},k),$}function QN(e,t){let{mirror:n=new na,blockClass:r="rr-block",blockSelector:i=null,maskTextClass:o="rr-mask",maskTextSelector:s=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:u=!1,maskAllInputs:c=!1,maskTextFn:d,maskInputFn:f,slimDOM:p=!1,dataURLOptions:h,preserveWhiteSpace:m,onSerialize:y,onIframeLoad:S,iframeLoadTimeout:w,onStylesheetLoad:g,stylesheetLoadTimeout:x,keepIframeSrcFn:k=()=>!1}=t||{},O=c===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:c===!1?{password:!0}:c,N=RS(p);return hr(e,{doc:e,mirror:n,blockClass:r,blockSelector:i,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:a,maskInputOptions:O,maskTextFn:d,maskInputFn:f,slimDOMOptions:N,dataURLOptions:h,inlineImages:l,recordCanvas:u,preserveWhiteSpace:m,onSerialize:y,onIframeLoad:S,iframeLoadTimeout:w,onStylesheetLoad:g,stylesheetLoadTimeout:x,keepIframeSrcFn:k,newlyAddedElement:!1})}var e7=/(max|min)-device-(width|height)/,PW=new RegExp(e7.source,"g");function t7(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function n7(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var rf={exports:{}},fe=String,AS=function(){return{isColorSupported:!1,reset:fe,bold:fe,dim:fe,italic:fe,underline:fe,inverse:fe,hidden:fe,strikethrough:fe,black:fe,red:fe,green:fe,yellow:fe,blue:fe,magenta:fe,cyan:fe,white:fe,gray:fe,bgBlack:fe,bgRed:fe,bgGreen:fe,bgYellow:fe,bgBlue:fe,bgMagenta:fe,bgCyan:fe,bgWhite:fe}};rf.exports=AS();rf.exports.createColors=AS;var r7=rf.exports,i7={},o7=Object.freeze(Object.defineProperty({__proto__:null,default:i7},Symbol.toStringTag,{value:"Module"})),bt=n7(o7),v1=r7,R1=bt,hd=class CS extends Error{constructor(t,n,r,i,o,s){super(t),this.name="CssSyntaxError",this.reason=t,o&&(this.file=o),i&&(this.source=i),s&&(this.plugin=s),typeof n<"u"&&typeof r<"u"&&(typeof n=="number"?(this.line=n,this.column=r):(this.line=n.line,this.column=n.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,CS)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(t){if(!this.source)return"";let n=this.source;t==null&&(t=v1.isColorSupported),R1&&t&&(n=R1(n));let r=n.split(/\r?\n/),i=Math.max(this.line-3,0),o=Math.min(this.line+2,r.length),s=String(o).length,a,l;if(t){let{bold:u,gray:c,red:d}=v1.createColors(!0);a=f=>u(d(f)),l=f=>c(f)}else a=l=u=>u;return r.slice(i,o).map((u,c)=>{let d=i+1+c,f=" "+(" "+d).slice(-s)+" | ";if(d===this.line){let p=l(f.replace(/\d/g," "))+u.slice(0,this.column-1).replace(/[^\t]/g," ");return a(">")+l(f)+u+`
|
|
87
87
|
`+p+a("^")}return" "+l(f)+u}).join(`
|
|
88
88
|
`)}toString(){let t=this.showSourceCode();return t&&(t=`
|
|
89
89
|
|
|
@@ -141,9 +141,9 @@ You tried to parse Less with the standard CSS parser; try again with the postcss
|
|
|
141
141
|
https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(t+`: \u91CC\u9762 postcss.plugin \u88AB\u5F03\u7528. \u8FC1\u79FB\u6307\u5357:
|
|
142
142
|
https://www.w3ctech.com/topic/2226`));let a=n(...s);return a.postcssPlugin=t,a.postcssVersion=new Rf().version,a}let o;return Object.defineProperty(i,"postcss",{get(){return o||(o=i()),o}}),i.process=function(s,a,l){return te([i(l)]).process(s,a)},i};te.stringify=M_;te.parse=$_;te.fromJSON=T_;te.list=L_;te.comment=e=>new Uw(e);te.atRule=e=>new jw(e);te.decl=e=>new Fw(e);te.rule=e=>new Vw(e);te.root=e=>new Ww(e);te.document=e=>new Bw(e);te.CssSyntaxError=k_;te.Declaration=Fw;te.Container=P_;te.Processor=Rf;te.Document=Bw;te.Comment=Uw;te.Warning=O_;te.AtRule=jw;te.Result=N_;te.Input=__;te.Rule=Vw;te.Root=Ww;te.Node=D_;I_.registerPostcss(te);var F_=te;te.default=te;var ge=K5(F_);ge.stringify;ge.fromJSON;ge.plugin;ge.parse;ge.list;ge.document;ge.comment;ge.atRule;ge.rule;ge.decl;ge.root;ge.CssSyntaxError;ge.Declaration;ge.Container;ge.Processor;ge.Document;ge.Comment;ge.Warning;ge.AtRule;ge.Result;ge.Input;ge.Rule;ge.Root;ge.Node;var Wd=class e{constructor(...t){ot(this,"parentElement",null),ot(this,"parentNode",null),ot(this,"ownerDocument"),ot(this,"firstChild",null),ot(this,"lastChild",null),ot(this,"previousSibling",null),ot(this,"nextSibling",null),ot(this,"ELEMENT_NODE",1),ot(this,"TEXT_NODE",3),ot(this,"nodeType"),ot(this,"nodeName"),ot(this,"RRNodeType")}get childNodes(){let t=[],n=this.firstChild;for(;n;)t.push(n),n=n.nextSibling;return t}contains(t){if(t instanceof e){if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0}else return!1;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,n){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};var nS={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},rS={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},qs={},B_=()=>!!globalThis.Zone;function Af(e){if(qs[e])return qs[e];let t=globalThis[e],n=t.prototype,r=e in nS?nS[e]:void 0,i=!!(r&&r.every(a=>{var l,u;return!!((u=(l=Object.getOwnPropertyDescriptor(n,a))==null?void 0:l.get)!=null&&u.toString().includes("[native code]"))})),o=e in rS?rS[e]:void 0,s=!!(o&&o.every(a=>{var l;return typeof n[a]=="function"&&((l=n[a])==null?void 0:l.toString().includes("[native code]"))}));if(i&&s&&!B_())return qs[e]=t.prototype,t.prototype;try{let a=document.createElement("iframe");document.body.appendChild(a);let l=a.contentWindow;if(!l)return t.prototype;let u=l[e].prototype;return document.body.removeChild(a),u?qs[e]=u:n}catch{return n}}var ld={};function Zt(e,t,n){var r;let i=`${e}.${String(n)}`;if(ld[i])return ld[i].call(t);let o=Af(e),s=(r=Object.getOwnPropertyDescriptor(o,n))==null?void 0:r.get;return s?(ld[i]=s,s.call(t)):t[n]}var ud={};function zw(e,t,n){let r=`${e}.${String(n)}`;if(ud[r])return ud[r].bind(t);let o=Af(e)[n];return typeof o!="function"?t[n]:(ud[r]=o,o.bind(t))}function U_(e){return Zt("Node",e,"ownerDocument")}function j_(e){return Zt("Node",e,"childNodes")}function V_(e){return Zt("Node",e,"parentNode")}function W_(e){return Zt("Node",e,"parentElement")}function z_(e){return Zt("Node",e,"textContent")}function G_(e,t){return zw("Node",e,"contains")(t)}function H_(e){return zw("Node",e,"getRootNode")()}function q_(e){return!e||!("host"in e)?null:Zt("ShadowRoot",e,"host")}function K_(e){return e.styleSheets}function Y_(e){return!e||!("shadowRoot"in e)?null:Zt("Element",e,"shadowRoot")}function Z_(e,t){return Zt("Element",e,"querySelector")(t)}function X_(e,t){return Zt("Element",e,"querySelectorAll")(t)}function Gw(){return Af("MutationObserver").constructor}function Mn(e,t,n){try{if(!(t in e))return()=>{};let r=e[t],i=n(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}var F={ownerDocument:U_,childNodes:j_,parentNode:V_,parentElement:W_,textContent:z_,contains:G_,getRootNode:H_,host:q_,styleSheets:K_,shadowRoot:Y_,querySelector:Z_,querySelectorAll:X_,mutationObserver:Gw,patch:Mn};function Ve(e,t,n=document){let r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}var cr=`Please stop import mirror directly. Instead of that,\r
|
|
143
143
|
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
|
|
144
|
-
or you can use record.mirror to access the mirror instance during recording.`,iS={map:{},getId(){return console.error(cr),-1},getNode(){return console.error(cr),null},removeNodeFromMap(){console.error(cr)},has(){return console.error(cr),!1},reset(){console.error(cr)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(iS=new Proxy(iS,{get(e,t,n){return t==="map"&&console.error(cr),Reflect.get(e,t,n)}}));function Ti(e,t,n={}){let r=null,i=0;return function(...o){let s=Date.now();!i&&n.leading===!1&&(i=s);let a=t-(s-i),l=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),i=s,e.apply(l,o)):!r&&n.trailing!==!1&&(r=setTimeout(()=>{i=n.leading===!1?0:Date.now(),r=null,e.apply(l,o)},a))}}function Pa(e,t,n,r,i=window){let o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set(s){setTimeout(()=>{n.set.call(this,s)},0),o&&o.set&&o.set.call(this,s)}}),()=>Pa(e,t,o||{},!0)}var ma=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(ma=()=>new Date().getTime());function Hw(e){var t,n,r,i;let o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:o.documentElement.scrollLeft||o?.body&&((t=F.parentElement(o.body))==null?void 0:t.scrollLeft)||((n=o?.body)==null?void 0:n.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:o?.documentElement.scrollTop||o?.body&&((r=F.parentElement(o.body))==null?void 0:r.scrollTop)||((i=o?.body)==null?void 0:i.scrollTop)||0}}function qw(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Kw(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Yw(e){return e?e.nodeType===e.ELEMENT_NODE?e:F.parentElement(e):null}function We(e,t,n,r){if(!e)return!1;let i=Yw(e);if(!i)return!1;try{if(typeof t=="string"){if(i.classList.contains(t)||r&&i.closest("."+t)!==null)return!0}else if(sa(i,t,r))return!0}catch{}return!!(n&&(i.matches(n)||r&&i.closest(n)!==null))}function J_(e,t){return t.getId(e)!==-1}function cd(e,t,n){return e.tagName==="TITLE"&&n.headTitleMutations?!0:t.getId(e)===vi}function Zw(e,t){if(Si(e))return!1;let n=t.getId(e);if(!t.has(n))return!0;let r=F.parentNode(e);return r&&r.nodeType===e.DOCUMENT_NODE?!1:r?Zw(r,t):!0}function zd(e){return!!e.changedTouches}function Q_(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function Xw(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function Jw(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Gd(e){return e?e instanceof Wd&&"shadowRoot"in e?!!e.shadowRoot:!!F.shadowRoot(e):!1}var Hd=class{constructor(){R(this,"id",1),R(this,"styleIDMap",new WeakMap),R(this,"idStyleMap",new Map)}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,n){if(this.has(t))return this.getId(t);let r;return n===void 0?r=this.id++:r=n,this.styleIDMap.set(t,r),this.idStyleMap.set(r,t),r}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Qw(e){var t;let n=null;return"getRootNode"in e&&((t=F.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&F.host(F.getRootNode(e))&&(n=F.host(F.getRootNode(e))),n}function e$(e){let t=e,n;for(;n=Qw(t);)t=n;return t}function t$(e){let t=F.ownerDocument(e);if(!t)return!1;let n=e$(e);return F.contains(t,n)}function ex(e){let t=F.ownerDocument(e);return t?F.contains(t,e)||t$(e):!1}var z=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(z||{}),V=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(V||{}),He=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(He||{}),Ht=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Ht||{}),xr=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(xr||{}),dr=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(dr||{});var tx=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(tx||{});function oS(e){return"__ln"in e}var qd=class{constructor(){R(this,"length",0),R(this,"head",null),R(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let n=this.head;for(let r=0;r<t;r++)n=n?.next||null;return n}addNode(t){let n={value:t,previous:null,next:null};if(t.__ln=n,t.previousSibling&&oS(t.previousSibling)){let r=t.previousSibling.__ln.next;n.next=r,n.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=n,r&&(r.previous=n)}else if(t.nextSibling&&oS(t.nextSibling)&&t.nextSibling.__ln.previous){let r=t.nextSibling.__ln.previous;n.previous=r,n.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=n,r&&(r.next=n)}else this.head&&(this.head.previous=n),n.next=this.head,this.head=n;n.next===null&&(this.tail=n),this.length++}removeNode(t){let n=t.__ln;this.head&&(n.previous?(n.previous.next=n.next,n.next?n.next.previous=n.previous:this.tail=n.previous):(this.head=n.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}},sS=(e,t)=>`${e}@${t}`,Kd=class{constructor(){R(this,"frozen",!1),R(this,"locked",!1),R(this,"texts",[]),R(this,"attributes",[]),R(this,"attributeMap",new WeakMap),R(this,"removes",[]),R(this,"mapRemoves",[]),R(this,"movedMap",{}),R(this,"addedSet",new Set),R(this,"movedSet",new Set),R(this,"droppedSet",new Set),R(this,"removesSubTreeCache",new Set),R(this,"mutationCb"),R(this,"blockClass"),R(this,"blockSelector"),R(this,"maskTextClass"),R(this,"maskTextSelector"),R(this,"inlineStylesheet"),R(this,"maskInputOptions"),R(this,"maskTextFn"),R(this,"maskInputFn"),R(this,"keepIframeSrcFn"),R(this,"recordCanvas"),R(this,"inlineImages"),R(this,"slimDOMOptions"),R(this,"dataURLOptions"),R(this,"doc"),R(this,"mirror"),R(this,"iframeManager"),R(this,"stylesheetManager"),R(this,"shadowDomManager"),R(this,"canvasManager"),R(this,"processedNodeManager"),R(this,"unattachedDoc"),R(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),R(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],n=new Set,r=new qd,i=l=>{let u=l,c=vi;for(;c===vi;)u=u&&u.nextSibling,c=u&&this.mirror.getId(u);return c},o=l=>{let u=F.parentNode(l);if(!u||!ex(l))return;let c=!1;if(l.nodeType===Node.TEXT_NODE){let h=u.tagName;if(h==="TEXTAREA")return;h==="STYLE"&&this.addedSet.has(u)&&(c=!0)}let d=Si(u)?this.mirror.getId(Qw(l)):this.mirror.getId(u),f=i(l);if(d===-1||f===-1)return r.addNode(l);let p=hr(l,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:h=>{Xw(h,this.mirror)&&this.iframeManager.addIframe(h),Jw(h,this.mirror)&&this.stylesheetManager.trackLinkElement(h),Gd(l)&&this.shadowDomManager.addShadowRoot(F.shadowRoot(l),this.doc)},onIframeLoad:(h,m)=>{this.iframeManager.attachIframe(h,m),this.shadowDomManager.observeAttachShadow(h)},onStylesheetLoad:(h,m)=>{this.stylesheetManager.attachLinkElement(h,m)},cssCaptured:c});p&&(t.push({parentId:d,nextId:f,node:p}),n.add(p.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let l of this.movedSet)aS(this.removesSubTreeCache,l,this.mirror)&&!this.movedSet.has(F.parentNode(l))||o(l);for(let l of this.addedSet)!lS(this.droppedSet,l)&&!aS(this.removesSubTreeCache,l,this.mirror)||lS(this.movedSet,l)?o(l):this.droppedSet.add(l);let s=null;for(;r.length;){let l=null;if(s){let u=this.mirror.getId(F.parentNode(s.value)),c=i(s.value);u!==-1&&c!==-1&&(l=s)}if(!l){let u=r.tail;for(;u;){let c=u;if(u=u.previous,c){let d=this.mirror.getId(F.parentNode(c.value));if(i(c.value)===-1)continue;if(d!==-1){l=c;break}else{let p=c.value,h=F.parentNode(p);if(h&&h.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let m=F.host(h);if(this.mirror.getId(m)!==-1){l=c;break}}}}}}if(!l){for(;r.head;)r.removeNode(r.head.value);break}s=l.previous,r.removeNode(l.value),o(l.value)}let a={texts:this.texts.map(l=>{let u=l.node,c=F.parentNode(u);return c&&c.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(c),{id:this.mirror.getId(u),value:l.value}}).filter(l=>!n.has(l.id)).filter(l=>this.mirror.has(l.id)),attributes:this.attributes.map(l=>{let{attributes:u}=l;if(typeof u.style=="string"){let c=JSON.stringify(l.styleDiff),d=JSON.stringify(l._unchangedStyles);c.length<u.style.length&&(c+d).split("var(").length===u.style.split("var(").length&&(u.style=l.styleDiff)}return{id:this.mirror.getId(l.node),attributes:u}}).filter(l=>!n.has(l.id)).filter(l=>this.mirror.has(l.id)),removes:this.removes,adds:t};!a.texts.length&&!a.attributes.length&&!a.removes.length&&!a.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(a))}),R(this,"genTextAreaValueMutation",t=>{let n=this.attributeMap.get(t);n||(n={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(n),this.attributeMap.set(t,n));let r=Array.from(F.childNodes(t),i=>F.textContent(i)||"").join("");n.attributes.value=ra({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:ia(t),value:r,maskInputFn:this.maskInputFn})}),R(this,"processMutation",t=>{if(!cd(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let n=F.textContent(t.target);!We(t.target,this.blockClass,this.blockSelector,!1)&&n!==t.oldValue&&this.texts.push({value:vS(t.target,this.maskTextClass,this.maskTextSelector,!0)&&n?this.maskTextFn?this.maskTextFn(n,Yw(t.target)):n.replace(/[\S]/g,"*"):n,node:t.target});break}case"attributes":{let n=t.target,r=t.attributeName,i=t.target.getAttribute(r);if(r==="value"){let s=ia(n);i=ra({element:n,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:s,value:i,maskInputFn:this.maskInputFn})}if(We(t.target,this.blockClass,this.blockSelector,!1)||i===t.oldValue)return;let o=this.attributeMap.get(t.target);if(n.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(i))if(!n.contentDocument)r="rr_src";else return;if(o||(o={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o),this.attributeMap.set(t.target,o)),r==="type"&&n.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&n.setAttribute("data-rr-is-password","true"),!xS(n.tagName,r))if(o.attributes[r]=wS(this.doc,kn(n.tagName),kn(r),i),r==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let s=this.unattachedDoc.createElement("span");t.oldValue&&s.setAttribute("style",t.oldValue);for(let a of Array.from(n.style)){let l=n.style.getPropertyValue(a),u=n.style.getPropertyPriority(a);l!==s.style.getPropertyValue(a)||u!==s.style.getPropertyPriority(a)?u===""?o.styleDiff[a]=l:o.styleDiff[a]=[l,u]:o._unchangedStyles[a]=[l,u]}for(let a of Array.from(s.style))n.style.getPropertyValue(a)===""&&(o.styleDiff[a]=!1)}else r==="open"&&n.tagName==="DIALOG"&&(n.matches("dialog:modal")?o.attributes.rr_open_mode="modal":o.attributes.rr_open_mode="non-modal");break}case"childList":{if(We(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(n=>this.genAdds(n,t.target)),t.removedNodes.forEach(n=>{let r=this.mirror.getId(n),i=Si(t.target)?this.mirror.getId(F.host(t.target)):this.mirror.getId(t.target);We(t.target,this.blockClass,this.blockSelector,!1)||cd(n,this.mirror,this.slimDOMOptions)||!J_(n,this.mirror)||(this.addedSet.has(n)?(Yd(this.addedSet,n),this.droppedSet.add(n)):this.addedSet.has(t.target)&&r===-1||Zw(t.target,this.mirror)||(this.movedSet.has(n)&&this.movedMap[sS(r,i)]?Yd(this.movedSet,n):(this.removes.push({parentId:i,id:r,isShadow:Si(t.target)&&wi(t.target)?!0:void 0}),n$(n,this.removesSubTreeCache))),this.mapRemoves.push(n))});break}}}),R(this,"genAdds",(t,n)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(cd(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let r=null;n&&this.mirror.hasNode(n)&&(r=this.mirror.getId(n)),r&&r!==-1&&(this.movedMap[sS(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);We(t,this.blockClass,this.blockSelector,!1)||(F.childNodes(t).forEach(r=>this.genAdds(r)),Gd(t)&&F.childNodes(F.shadowRoot(t)).forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,t)}))}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(n=>{this[n]=t[n]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}};function Yd(e,t){e.delete(t),F.childNodes(t).forEach(n=>Yd(e,n))}function n$(e,t){let n=[e];for(;n.length;){let r=n.pop();t.has(r)||(t.add(r),F.childNodes(r).forEach(i=>n.push(i)))}}function aS(e,t,n){return e.size===0?!1:r$(e,t)}function r$(e,t,n){let r=F.parentNode(t);return r?e.has(r):!1}function lS(e,t){return e.size===0?!1:nx(e,t)}function nx(e,t){let n=F.parentNode(t);return n?e.has(n)?!0:nx(e,n):!1}var xi;function i$(e){xi=e}function o$(){xi=void 0}var q=e=>xi?(...n)=>{try{return e(...n)}catch(r){if(xi&&xi(r)===!0)return;throw r}}:e,En=[];function Li(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function rx(e,t){let n=new Kd;En.push(n),n.init(e);let r=new(Gw())(q(n.processMutations.bind(n)));return r.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function s$({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(t.mousemove===!1)return()=>{};let i=typeof t.mousemove=="number"?t.mousemove:50,o=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,s=[],a,l=Ti(q(d=>{let f=Date.now()-a;e(s.map(p=>(p.timeOffset-=f,p)),d),s=[],a=null}),o),u=q(Ti(q(d=>{let f=Li(d),{clientX:p,clientY:h}=zd(d)?d.changedTouches[0]:d;a||(a=ma()),s.push({x:p,y:h,id:r.getId(f),timeOffset:ma()-a}),l(typeof DragEvent<"u"&&d instanceof DragEvent?V.Drag:d instanceof MouseEvent?V.MouseMove:V.TouchMove)}),i,{trailing:!1})),c=[Ve("mousemove",u,n),Ve("touchmove",u,n),Ve("drag",u,n)];return q(()=>{c.forEach(d=>d())})}function a$({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){if(o.mouseInteraction===!1)return()=>{};let s=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,a=[],l=null,u=c=>d=>{let f=Li(d);if(We(f,r,i,!0))return;let p=null,h=c;if("pointerType"in d){switch(d.pointerType){case"mouse":p=Ht.Mouse;break;case"touch":p=Ht.Touch;break;case"pen":p=Ht.Pen;break}p===Ht.Touch?He[c]===He.MouseDown?h="TouchStart":He[c]===He.MouseUp&&(h="TouchEnd"):Ht.Pen}else zd(d)&&(p=Ht.Touch);p!==null?(l=p,(h.startsWith("Touch")&&p===Ht.Touch||h.startsWith("Mouse")&&p===Ht.Mouse)&&(p=null)):He[c]===He.Click&&(p=l,l=null);let m=zd(d)?d.changedTouches[0]:d;if(!m)return;let y=n.getId(f),{clientX:S,clientY:w}=m;q(e)({type:He[h],id:y,x:S,y:w,...p!==null&&{pointerType:p}})};return Object.keys(He).filter(c=>Number.isNaN(Number(c))&&!c.endsWith("_Departed")&&s[c]!==!1).forEach(c=>{let d=kn(c),f=u(c);if(window.PointerEvent)switch(He[c]){case He.MouseDown:case He.MouseUp:d=d.replace("mouse","pointer");break;case He.TouchStart:case He.TouchEnd:return}a.push(Ve(d,f,t))}),q(()=>{a.forEach(c=>c())})}function ix({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){let s=q(Ti(q(a=>{let l=Li(a);if(!l||We(l,r,i,!0))return;let u=n.getId(l);if(l===t&&t.defaultView){let c=Hw(t.defaultView);e({id:u,x:c.left,y:c.top})}else e({id:u,x:l.scrollLeft,y:l.scrollTop})}),o.scroll||100));return Ve("scroll",s,t)}function l$({viewportResizeCb:e},{win:t}){let n=-1,r=-1,i=q(Ti(q(()=>{let o=qw(),s=Kw();(n!==o||r!==s)&&(e({width:Number(s),height:Number(o)}),n=o,r=s)}),200));return Ve("resize",i,t)}var u$=["INPUT","TEXTAREA","SELECT"],uS=new WeakMap;function c$({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,ignoreClass:o,ignoreSelector:s,maskInputOptions:a,maskInputFn:l,sampling:u,userTriggeredOnInput:c}){function d(w){let g=Li(w),x=w.isTrusted,k=g&&g.tagName;if(g&&k==="OPTION"&&(g=F.parentElement(g)),!g||!k||u$.indexOf(k)<0||We(g,r,i,!0)||g.classList.contains(o)||s&&g.matches(s))return;let O=g.value,N=!1,_=ia(g)||"";_==="radio"||_==="checkbox"?N=g.checked:(a[k.toLowerCase()]||a[_])&&(O=ra({element:g,maskInputOptions:a,tagName:k,type:_,value:O,maskInputFn:l})),f(g,c?{text:O,isChecked:N,userTriggered:x}:{text:O,isChecked:N});let I=g.name;_==="radio"&&I&&N&&t.querySelectorAll(`input[type="radio"][name="${I}"]`).forEach(B=>{if(B!==g){let U=B.value;f(B,c?{text:U,isChecked:!N,userTriggered:!1}:{text:U,isChecked:!N})}})}function f(w,g){let x=uS.get(w);if(!x||x.text!==g.text||x.isChecked!==g.isChecked){uS.set(w,g);let k=n.getId(w);q(e)({...g,id:k})}}let h=(u.input==="last"?["change"]:["input","change"]).map(w=>Ve(w,q(d),t)),m=t.defaultView;if(!m)return()=>{h.forEach(w=>w())};let y=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),S=[[m.HTMLInputElement.prototype,"value"],[m.HTMLInputElement.prototype,"checked"],[m.HTMLSelectElement.prototype,"value"],[m.HTMLTextAreaElement.prototype,"value"],[m.HTMLSelectElement.prototype,"selectedIndex"],[m.HTMLOptionElement.prototype,"selected"]];return y&&y.set&&h.push(...S.map(w=>Pa(w[0],w[1],{set(){q(d)({target:this,isTrusted:!1})}},!1,m))),q(()=>{h.forEach(w=>w())})}function ya(e){let t=[];function n(r,i){if(Ks("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||Ks("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||Ks("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||Ks("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){let s=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(s)}else if(r.parentStyleSheet){let s=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(s)}return i}return n(e,t)}function dn(e,t,n){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:r}):{}}function d$({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};let i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:q((c,d,f)=>{let[p,h]=f,{id:m,styleId:y}=dn(d,t,n.styleMirror);return(m&&m!==-1||y&&y!==-1)&&e({id:m,styleId:y,adds:[{rule:p,index:h}]}),c.apply(d,f)})}),r.CSSStyleSheet.prototype.addRule=function(c,d,f=this.cssRules.length){let p=`${c} { ${d} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[p,f])};let o=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:q((c,d,f)=>{let[p]=f,{id:h,styleId:m}=dn(d,t,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,removes:[{index:p}]}),c.apply(d,f)})}),r.CSSStyleSheet.prototype.removeRule=function(c){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[c])};let s;r.CSSStyleSheet.prototype.replace&&(s=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:q((c,d,f)=>{let[p]=f,{id:h,styleId:m}=dn(d,t,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,replace:p}),c.apply(d,f)})}));let a;r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:q((c,d,f)=>{let[p]=f,{id:h,styleId:m}=dn(d,t,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,replaceSync:p}),c.apply(d,f)})}));let l={};Ys("CSSGroupingRule")?l.CSSGroupingRule=r.CSSGroupingRule:(Ys("CSSMediaRule")&&(l.CSSMediaRule=r.CSSMediaRule),Ys("CSSConditionRule")&&(l.CSSConditionRule=r.CSSConditionRule),Ys("CSSSupportsRule")&&(l.CSSSupportsRule=r.CSSSupportsRule));let u={};return Object.entries(l).forEach(([c,d])=>{u[c]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=new Proxy(u[c].insertRule,{apply:q((f,p,h)=>{let[m,y]=h,{id:S,styleId:w}=dn(p.parentStyleSheet,t,n.styleMirror);return(S&&S!==-1||w&&w!==-1)&&e({id:S,styleId:w,adds:[{rule:m,index:[...ya(p),y||0]}]}),f.apply(p,h)})}),d.prototype.deleteRule=new Proxy(u[c].deleteRule,{apply:q((f,p,h)=>{let[m]=h,{id:y,styleId:S}=dn(p.parentStyleSheet,t,n.styleMirror);return(y&&y!==-1||S&&S!==-1)&&e({id:y,styleId:S,removes:[{index:[...ya(p),m]}]}),f.apply(p,h)})})}),q(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=o,s&&(r.CSSStyleSheet.prototype.replace=s),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([c,d])=>{d.prototype.insertRule=u[c].insertRule,d.prototype.deleteRule=u[c].deleteRule})})}function ox({mirror:e,stylesheetManager:t},n){var r,i,o;let s=null;n.nodeName==="#document"?s=e.getId(n):s=e.getId(F.host(n));let a=n.nodeName==="#document"?(r=n.defaultView)==null?void 0:r.Document:(o=(i=n.ownerDocument)==null?void 0:i.defaultView)==null?void 0:o.ShadowRoot,l=a?.prototype?Object.getOwnPropertyDescriptor(a?.prototype,"adoptedStyleSheets"):void 0;return s===null||s===-1||!a||!l?()=>{}:(Object.defineProperty(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var u;return(u=l.get)==null?void 0:u.call(this)},set(u){var c;let d=(c=l.set)==null?void 0:c.call(this,u);if(s!==null&&s!==-1)try{t.adoptStyleSheets(u,s)}catch{}return d}}),q(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))}function f$({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){let o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:q((a,l,u)=>{var c;let[d,f,p]=u;if(n.has(d))return o.apply(l,[d,f,p]);let{id:h,styleId:m}=dn((c=l.parentRule)==null?void 0:c.parentStyleSheet,t,r.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,set:{property:d,value:f,priority:p},index:ya(l.parentRule)}),a.apply(l,u)})});let s=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:q((a,l,u)=>{var c;let[d]=u;if(n.has(d))return s.apply(l,[d]);let{id:f,styleId:p}=dn((c=l.parentRule)==null?void 0:c.parentStyleSheet,t,r.styleMirror);return(f&&f!==-1||p&&p!==-1)&&e({id:f,styleId:p,remove:{property:d},index:ya(l.parentRule)}),a.apply(l,u)})}),q(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s})}function h$({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:i,doc:o}){let s=q(l=>Ti(q(u=>{let c=Li(u);if(!c||We(c,t,n,!0))return;let{currentTime:d,volume:f,muted:p,playbackRate:h,loop:m}=c;e({type:l,id:r.getId(c),currentTime:d,volume:f,muted:p,playbackRate:h,loop:m})}),i.media||500)),a=[Ve("play",s(dr.Play),o),Ve("pause",s(dr.Pause),o),Ve("seeked",s(dr.Seeked),o),Ve("volumechange",s(dr.VolumeChange),o),Ve("ratechange",s(dr.RateChange),o)];return q(()=>{a.forEach(l=>l())})}function p$({fontCb:e,doc:t}){let n=t.defaultView;if(!n)return()=>{};let r=[],i=new WeakMap,o=n.FontFace;n.FontFace=function(l,u,c){let d=new o(l,u,c);return i.set(d,{family:l,buffer:typeof u!="string",descriptors:c,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),d};let s=Mn(t.fonts,"add",function(a){return function(l){return setTimeout(q(()=>{let u=i.get(l);u&&(e(u),i.delete(l))}),0),a.apply(this,[l])}});return r.push(()=>{n.FontFace=o}),r.push(s),q(()=>{r.forEach(a=>a())})}function m$(e){let{doc:t,mirror:n,blockClass:r,blockSelector:i,selectionCb:o}=e,s=!0,a=q(()=>{let l=t.getSelection();if(!l||s&&l?.isCollapsed)return;s=l.isCollapsed||!1;let u=[],c=l.rangeCount||0;for(let d=0;d<c;d++){let f=l.getRangeAt(d),{startContainer:p,startOffset:h,endContainer:m,endOffset:y}=f;We(p,r,i,!0)||We(m,r,i,!0)||u.push({start:n.getId(p),startOffset:h,end:n.getId(m),endOffset:y})}o({ranges:u})});return a(),Ve("selectionchange",a)}function y$({doc:e,customElementCb:t}){let n=e.defaultView;return!n||!n.customElements?()=>{}:Mn(n.customElements,"define",function(i){return function(o,s,a){try{t({define:{name:o}})}catch{console.warn(`Custom element callback failed for ${o}`)}return i.apply(this,[o,s,a])}})}function g$(e,t){let{mutationCb:n,mousemoveCb:r,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:s,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:d,fontCb:f,selectionCb:p,customElementCb:h}=e;e.mutationCb=(...m)=>{t.mutation&&t.mutation(...m),n(...m)},e.mousemoveCb=(...m)=>{t.mousemove&&t.mousemove(...m),r(...m)},e.mouseInteractionCb=(...m)=>{t.mouseInteraction&&t.mouseInteraction(...m),i(...m)},e.scrollCb=(...m)=>{t.scroll&&t.scroll(...m),o(...m)},e.viewportResizeCb=(...m)=>{t.viewportResize&&t.viewportResize(...m),s(...m)},e.inputCb=(...m)=>{t.input&&t.input(...m),a(...m)},e.mediaInteractionCb=(...m)=>{t.mediaInteaction&&t.mediaInteaction(...m),l(...m)},e.styleSheetRuleCb=(...m)=>{t.styleSheetRule&&t.styleSheetRule(...m),u(...m)},e.styleDeclarationCb=(...m)=>{t.styleDeclaration&&t.styleDeclaration(...m),c(...m)},e.canvasMutationCb=(...m)=>{t.canvasMutation&&t.canvasMutation(...m),d(...m)},e.fontCb=(...m)=>{t.font&&t.font(...m),f(...m)},e.selectionCb=(...m)=>{t.selection&&t.selection(...m),p(...m)},e.customElementCb=(...m)=>{t.customElement&&t.customElement(...m),h(...m)}}function b$(e,t={}){let n=e.doc.defaultView;if(!n)return()=>{};g$(e,t);let r;e.recordDOM&&(r=rx(e,e.doc));let i=s$(e),o=a$(e),s=ix(e),a=l$(e,{win:n}),l=c$(e),u=h$(e),c=()=>{},d=()=>{},f=()=>{},p=()=>{};e.recordDOM&&(c=d$(e,{win:n}),d=ox(e,e.doc),f=f$(e,{win:n}),e.collectFonts&&(p=p$(e)));let h=m$(e),m=y$(e),y=[];for(let S of e.plugins)y.push(S.observer(S.callback,n,S.options));return q(()=>{En.forEach(S=>S.reset()),r?.disconnect(),i(),o(),s(),a(),l(),u(),c(),d(),f(),p(),h(),m(),y.forEach(S=>S())})}function Ks(e){return typeof window[e]<"u"}function Ys(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var ga=class{constructor(t){R(this,"iframeIdToRemoteIdMap",new WeakMap),R(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,n,r,i){let o=r||this.getIdToRemoteIdMap(t),s=i||this.getRemoteIdToIdMap(t),a=o.get(n);return a||(a=this.generateIdFn(),o.set(n,a),s.set(a,n)),a}getIds(t,n){let r=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return n.map(o=>this.getId(t,o,r,i))}getRemoteId(t,n,r){let i=r||this.getRemoteIdToIdMap(t);if(typeof n!="number")return n;let o=i.get(n);return o||-1}getRemoteIds(t,n){let r=this.getRemoteIdToIdMap(t);return n.map(i=>this.getRemoteId(t,i,r))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let n=this.iframeIdToRemoteIdMap.get(t);return n||(n=new Map,this.iframeIdToRemoteIdMap.set(t,n)),n}getRemoteIdToIdMap(t){let n=this.iframeRemoteIdToIdMap.get(t);return n||(n=new Map,this.iframeRemoteIdToIdMap.set(t,n)),n}},Zd=class{constructor(t){R(this,"iframes",new WeakMap),R(this,"crossOriginIframeMap",new WeakMap),R(this,"crossOriginIframeMirror",new ga(SS)),R(this,"crossOriginIframeStyleMirror"),R(this,"crossOriginIframeRootIdMap",new WeakMap),R(this,"mirror"),R(this,"mutationCb"),R(this,"wrappedEmit"),R(this,"loadListener"),R(this,"stylesheetManager"),R(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new ga(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,n){var r,i;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:n}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=t.contentWindow)==null||r.addEventListener("message",this.handleMessage.bind(this))),(i=this.loadListener)==null||i.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){let n=t;if(n.data.type!=="rrweb"||n.origin!==n.data.origin||!t.source)return;let i=this.crossOriginIframeMap.get(t.source);if(!i)return;let o=this.transformCrossOriginEvent(i,n.data.event);o&&this.wrappedEmit(o,n.data.isCheckout)}transformCrossOriginEvent(t,n){var r;switch(n.type){case z.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(n.data.node,t);let i=n.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(n.data.node,i),{timestamp:n.timestamp,type:z.IncrementalSnapshot,data:{source:V.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:n.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case z.Meta:case z.Load:case z.DomContentLoaded:return!1;case z.Plugin:return n;case z.Custom:return this.replaceIds(n.data.payload,t,["id","parentId","previousId","nextId"]),n;case z.IncrementalSnapshot:switch(n.data.source){case V.Mutation:return n.data.adds.forEach(i=>{this.replaceIds(i,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,t);let o=this.crossOriginIframeRootIdMap.get(t);o&&this.patchRootIdOnNode(i.node,o)}),n.data.removes.forEach(i=>{this.replaceIds(i,t,["parentId","id"])}),n.data.attributes.forEach(i=>{this.replaceIds(i,t,["id"])}),n.data.texts.forEach(i=>{this.replaceIds(i,t,["id"])}),n;case V.Drag:case V.TouchMove:case V.MouseMove:return n.data.positions.forEach(i=>{this.replaceIds(i,t,["id"])}),n;case V.ViewportResize:return!1;case V.MediaInteraction:case V.MouseInteraction:case V.Scroll:case V.CanvasMutation:case V.Input:return this.replaceIds(n.data,t,["id"]),n;case V.StyleSheetRule:case V.StyleDeclaration:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleId"]),n;case V.Font:return n;case V.Selection:return n.data.ranges.forEach(i=>{this.replaceIds(i,t,["start","end"])}),n;case V.AdoptedStyleSheet:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleIds"]),(r=n.data.styles)==null||r.forEach(i=>{this.replaceStyleIds(i,t,["styleId"])}),n}}return!1}replace(t,n,r,i){for(let o of i)!Array.isArray(n[o])&&typeof n[o]!="number"||(Array.isArray(n[o])?n[o]=t.getIds(r,n[o]):n[o]=t.getId(r,n[o]));return n}replaceIds(t,n,r){return this.replace(this.crossOriginIframeMirror,t,n,r)}replaceStyleIds(t,n,r){return this.replace(this.crossOriginIframeStyleMirror,t,n,r)}replaceIdOnNode(t,n){this.replaceIds(t,n,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(r=>{this.replaceIdOnNode(r,n)})}patchRootIdOnNode(t,n){t.type!==tx.Document&&!t.rootId&&(t.rootId=n),"childNodes"in t&&t.childNodes.forEach(r=>{this.patchRootIdOnNode(r,n)})}},Xd=class{constructor(t){R(this,"shadowDoms",new WeakSet),R(this,"mutationCb"),R(this,"scrollCb"),R(this,"bypassOptions"),R(this,"mirror"),R(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,n){if(!wi(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);let r=rx({...this.bypassOptions,doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(ix({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(F.host(t))),this.restoreHandlers.push(ox({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,n){let r=this;this.restoreHandlers.push(Mn(t.prototype,"attachShadow",function(i){return function(o){let s=i.call(this,o),a=F.shadowRoot(this);return a&&ex(this)&&r.addShadowRoot(a,n),s}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},pr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",S$=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(bi=0;bi<pr.length;bi++)S$[pr.charCodeAt(bi)]=bi;var bi,w$=function(e){var t=new Uint8Array(e),n,r=t.length,i="";for(n=0;n<r;n+=3)i+=pr[t[n]>>2],i+=pr[(t[n]&3)<<4|t[n+1]>>4],i+=pr[(t[n+1]&15)<<2|t[n+2]>>6],i+=pr[t[n+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i};var cS=new Map;function x$(e,t){let n=cS.get(e);return n||(n=new Map,cS.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}var sx=(e,t,n)=>{if(!e||!(lx(e,t)||typeof e=="object"))return;let r=e.constructor.name,i=x$(n,r),o=i.indexOf(e);return o===-1&&(o=i.length,i.push(e)),o};function ea(e,t,n){if(e instanceof Array)return e.map(r=>ea(r,t,n));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){let r=e.constructor.name,i=w$(e);return{rr_type:r,base64:i}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[ea(e.buffer,t,n),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let r=e.constructor.name,{src:i}=e;return{rr_type:r,src:i}}else if(e instanceof HTMLCanvasElement){let r="HTMLImageElement",i=e.toDataURL();return{rr_type:r,src:i}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[ea(e.data,t,n),e.width,e.height]};if(lx(e,t)||typeof e=="object"){let r=e.constructor.name,i=sx(e,t,n);return{rr_type:r,index:i}}}}return e}var ax=(e,t,n)=>e.map(r=>ea(r,t,n)),lx=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof t[i]=="function").find(i=>e instanceof t[i]);function v$(e,t,n,r){let i=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let s of o)try{if(typeof t.CanvasRenderingContext2D.prototype[s]!="function")continue;let a=Mn(t.CanvasRenderingContext2D.prototype,s,function(l){return function(...u){return We(this.canvas,n,r,!0)||setTimeout(()=>{let c=ax(u,t,this);e(this.canvas,{type:xr["2D"],property:s,args:c})},0),l.apply(this,u)}});i.push(a)}catch{let a=Pa(t.CanvasRenderingContext2D.prototype,s,{set(l){e(this.canvas,{type:xr["2D"],property:s,args:[l],setter:!0})}});i.push(a)}return()=>{i.forEach(s=>s())}}function R$(e){return e==="experimental-webgl"?"webgl":e}function dS(e,t,n,r){let i=[];try{let o=Mn(e.HTMLCanvasElement.prototype,"getContext",function(s){return function(a,...l){if(!We(this,t,n,!0)){let u=R$(a);if("__context"in this||(this.__context=u),r&&["webgl","webgl2"].includes(u))if(l[0]&&typeof l[0]=="object"){let c=l[0];c.preserveDrawingBuffer||(c.preserveDrawingBuffer=!0)}else l.splice(0,1,{preserveDrawingBuffer:!0})}return s.apply(this,[a,...l])}});i.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(o=>o())}}function fS(e,t,n,r,i,o){let s=[],a=Object.getOwnPropertyNames(e);for(let l of a)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if(typeof e[l]!="function")continue;let u=Mn(e,l,function(c){return function(...d){let f=c.apply(this,d);if(sx(f,o,this),"tagName"in this.canvas&&!We(this.canvas,r,i,!0)){let p=ax(d,o,this),h={type:t,property:l,args:p};n(this.canvas,h)}return f}});s.push(u)}catch{let u=Pa(e,l,{set(c){n(this.canvas,{type:t,property:l,args:[c],setter:!0})}});s.push(u)}return s}function A$(e,t,n,r){let i=[];return i.push(...fS(t.WebGLRenderingContext.prototype,xr.WebGL,e,n,r,t)),typeof t.WebGL2RenderingContext<"u"&&i.push(...fS(t.WebGL2RenderingContext.prototype,xr.WebGL2,e,n,r,t)),()=>{i.forEach(o=>o())}}var ux="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",C$=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),hS=typeof window<"u"&&window.Blob&&new Blob([C$(ux)],{type:"text/javascript;charset=utf-8"});function E$(e){let t;try{if(t=hS&&(window.URL||window.webkitURL).createObjectURL(hS),!t)throw"";let n=new Worker(t,{name:e?.name});return n.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker("data:text/javascript;base64,"+ux,{name:e?.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var Jd=class{constructor(t){R(this,"pendingCanvasMutations",new Map),R(this,"rafStamps",{latestId:0,invokeId:null}),R(this,"mirror"),R(this,"mutationCb"),R(this,"resetObservers"),R(this,"frozen",!1),R(this,"locked",!1),R(this,"processMutation",(l,u)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(l)||this.pendingCanvasMutations.set(l,[]),this.pendingCanvasMutations.get(l).push(u)});let{sampling:n="all",win:r,blockClass:i,blockSelector:o,recordCanvas:s,dataURLOptions:a}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,s&&n==="all"&&this.initCanvasMutationObserver(r,i,o),s&&typeof n=="number"&&this.initCanvasFPSObserver(n,r,i,o,{dataURLOptions:a})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(t,n,r,i,o){let s=dS(n,r,i,!0),a=new Map,l=new E$;l.onmessage=h=>{let{id:m}=h.data;if(a.set(m,!1),!("base64"in h.data))return;let{base64:y,type:S,width:w,height:g}=h.data;this.mutationCb({id:m,type:xr["2D"],commands:[{property:"clearRect",args:[0,0,w,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:y}],type:S}]},0,0]}]})};let u=1e3/t,c=0,d,f=()=>{let h=[];return n.document.querySelectorAll("canvas").forEach(m=>{We(m,r,i,!0)||h.push(m)}),h},p=h=>{if(c&&h-c<u){d=requestAnimationFrame(p);return}c=h,f().forEach(async m=>{var y;let S=this.mirror.getId(m);if(a.get(S)||m.width===0||m.height===0)return;if(a.set(S,!0),["webgl","webgl2"].includes(m.__context)){let g=m.getContext(m.__context);((y=g?.getContextAttributes())==null?void 0:y.preserveDrawingBuffer)===!1&&g.clear(g.COLOR_BUFFER_BIT)}let w=await createImageBitmap(m);l.postMessage({id:S,bitmap:w,width:m.width,height:m.height,dataURLOptions:o.dataURLOptions},[w])}),d=requestAnimationFrame(p)};d=requestAnimationFrame(p),this.resetObservers=()=>{s(),cancelAnimationFrame(d)}}initCanvasMutationObserver(t,n,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=dS(t,n,r,!1),o=v$(this.processMutation.bind(this),t,n,r),s=A$(this.processMutation.bind(this),t,n,r);this.resetObservers=()=>{i(),o(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let t=n=>{this.rafStamps.latestId=n,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,n)=>{let r=this.mirror.getId(n);this.flushPendingCanvasMutationFor(n,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,n){if(this.frozen||this.locked)return;let r=this.pendingCanvasMutations.get(t);if(!r||n===-1)return;let i=r.map(s=>{let{type:a,...l}=s;return l}),{type:o}=r[0];this.mutationCb({id:n,type:o,commands:i}),this.pendingCanvasMutations.delete(t)}},Qd=class{constructor(t){R(this,"trackedLinkElements",new WeakSet),R(this,"mutationCb"),R(this,"adoptedStyleSheetCb"),R(this,"styleMirror",new Hd),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,n){"_cssText"in n.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:n.id,attributes:n.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,n){if(t.length===0)return;let r={id:n,styleIds:[]},i=[];for(let o of t){let s;this.styleMirror.has(o)?s=this.styleMirror.getId(o):(s=this.styleMirror.add(o),i.push({styleId:s,rules:Array.from(o.rules||CSSRule,(a,l)=>({rule:gS(a,o.href),index:l}))})),r.styleIds.push(s)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},ef=class{constructor(){R(this,"nodeMap",new WeakMap),R(this,"active",!1)}inOtherBuffer(t,n){let r=this.nodeMap.get(t);return r&&Array.from(r).some(i=>i!==n)}add(t,n){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(n))}destroy(){}},ve,ta,dd,ba=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((m1=e.contentWindow)==null?void 0:m1.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var gt=PN();function Tn(e={}){let{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:s="rr-ignore",ignoreSelector:a=null,maskTextClass:l="rr-mask",maskTextSelector:u=null,inlineStylesheet:c=!0,maskAllInputs:d,maskInputOptions:f,slimDOMOptions:p,maskInputFn:h,maskTextFn:m,hooks:y,packFn:S,sampling:w={},dataURLOptions:g={},mousemoveWait:x,recordDOM:k=!0,recordCanvas:O=!1,recordCrossOriginIframes:N=!1,recordAfter:_=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:I=!1,collectFonts:B=!1,inlineImages:U=!1,plugins:ne,keepIframeSrcFn:$=()=>!1,ignoreCSSAttributes:Me=new Set([]),errorHandler:qe}=e;i$(qe);let ae=N?window.parent===window:!0,Oe=!1;if(!ae)try{window.parent.document&&(Oe=!1)}catch{Oe=!0}if(ae&&!t)throw new Error("emit function is required");if(!ae&&!Oe)return()=>{};x!==void 0&&w.mousemove===void 0&&(w.mousemove=x),gt.reset();let xt=d===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:f!==void 0?f:{password:!0},Ee=RS(p);Q_();let Di,vr=0,On=K=>{for(let ze of ne||[])ze.eventProcessor&&(K=ze.eventProcessor(K));return S&&!Oe&&(K=S(K)),K};ve=(K,ze)=>{var de;let be=K;if(be.timestamp=ma(),(de=En[0])!=null&&de.isFrozen()&&be.type!==z.FullSnapshot&&!(be.type===z.IncrementalSnapshot&&be.data.source===V.Mutation)&&En.forEach(Ke=>Ke.unfreeze()),ae)t?.(On(be),ze);else if(Oe){let Ke={type:"rrweb",event:On(be),origin:window.location.origin,isCheckout:ze};window.parent.postMessage(Ke,"*")}if(be.type===z.FullSnapshot)Di=be,vr=0;else if(be.type===z.IncrementalSnapshot){if(be.data.source===V.Mutation&&be.data.isAttachIframe)return;vr++;let Ke=r&&vr>=r,re=n&&be.timestamp-Di.timestamp>n;(Ke||re)&&ta(!0)}};let st=K=>{ve({type:z.IncrementalSnapshot,data:{source:V.Mutation,...K}})},Rr=K=>ve({type:z.IncrementalSnapshot,data:{source:V.Scroll,...K}}),Xt=K=>ve({type:z.IncrementalSnapshot,data:{source:V.CanvasMutation,...K}}),Ar=K=>ve({type:z.IncrementalSnapshot,data:{source:V.AdoptedStyleSheet,...K}}),at=new Qd({mutationCb:st,adoptedStyleSheetCb:Ar}),vt=new Zd({mirror:gt,mutationCb:st,stylesheetManager:at,recordCrossOriginIframes:N,wrappedEmit:ve});for(let K of ne||[])K.getMirror&&K.getMirror({nodeMirror:gt,crossOriginIframeMirror:vt.crossOriginIframeMirror,crossOriginIframeStyleMirror:vt.crossOriginIframeStyleMirror});let Nn=new ef;dd=new Jd({recordCanvas:O,mutationCb:Xt,win:window,blockClass:i,blockSelector:o,mirror:gt,sampling:w.canvas,dataURLOptions:g});let _n=new Xd({mutationCb:st,scrollCb:Rr,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:u,inlineStylesheet:c,maskInputOptions:xt,dataURLOptions:g,maskTextFn:m,maskInputFn:h,recordCanvas:O,inlineImages:U,sampling:w,slimDOMOptions:Ee,iframeManager:vt,stylesheetManager:at,canvasManager:dd,keepIframeSrcFn:$,processedNodeManager:Nn},mirror:gt});ta=(K=!1)=>{if(!k)return;ve({type:z.Meta,data:{href:window.location.href,width:Kw(),height:qw()}},K),at.reset(),_n.init(),En.forEach(de=>de.lock());let ze=QN(document,{mirror:gt,blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:u,inlineStylesheet:c,maskAllInputs:xt,maskTextFn:m,maskInputFn:h,slimDOM:Ee,dataURLOptions:g,recordCanvas:O,inlineImages:U,onSerialize:de=>{Xw(de,gt)&&vt.addIframe(de),Jw(de,gt)&&at.trackLinkElement(de),Gd(de)&&_n.addShadowRoot(F.shadowRoot(de),document)},onIframeLoad:(de,be)=>{vt.attachIframe(de,be),_n.observeAttachShadow(de)},onStylesheetLoad:(de,be)=>{at.attachLinkElement(de,be)},keepIframeSrcFn:$});if(!ze)return console.warn("Failed to snapshot the document");ve({type:z.FullSnapshot,data:{node:ze,initialOffset:Hw(window)}},K),En.forEach(de=>de.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&at.adoptStyleSheets(document.adoptedStyleSheets,gt.getId(document))};try{let K=[],ze=be=>{var Ke;return q(b$)({mutationCb:st,mousemoveCb:(re,Ma)=>ve({type:z.IncrementalSnapshot,data:{source:Ma,positions:re}}),mouseInteractionCb:re=>ve({type:z.IncrementalSnapshot,data:{source:V.MouseInteraction,...re}}),scrollCb:Rr,viewportResizeCb:re=>ve({type:z.IncrementalSnapshot,data:{source:V.ViewportResize,...re}}),inputCb:re=>ve({type:z.IncrementalSnapshot,data:{source:V.Input,...re}}),mediaInteractionCb:re=>ve({type:z.IncrementalSnapshot,data:{source:V.MediaInteraction,...re}}),styleSheetRuleCb:re=>ve({type:z.IncrementalSnapshot,data:{source:V.StyleSheetRule,...re}}),styleDeclarationCb:re=>ve({type:z.IncrementalSnapshot,data:{source:V.StyleDeclaration,...re}}),canvasMutationCb:Xt,fontCb:re=>ve({type:z.IncrementalSnapshot,data:{source:V.Font,...re}}),selectionCb:re=>{ve({type:z.IncrementalSnapshot,data:{source:V.Selection,...re}})},customElementCb:re=>{ve({type:z.IncrementalSnapshot,data:{source:V.CustomElement,...re}})},blockClass:i,ignoreClass:s,ignoreSelector:a,maskTextClass:l,maskTextSelector:u,maskInputOptions:xt,inlineStylesheet:c,sampling:w,recordDOM:k,recordCanvas:O,inlineImages:U,userTriggeredOnInput:I,collectFonts:B,doc:be,maskInputFn:h,maskTextFn:m,keepIframeSrcFn:$,blockSelector:o,slimDOMOptions:Ee,dataURLOptions:g,mirror:gt,iframeManager:vt,stylesheetManager:at,shadowDomManager:_n,processedNodeManager:Nn,canvasManager:dd,ignoreCSSAttributes:Me,plugins:((Ke=ne?.filter(re=>re.observer))==null?void 0:Ke.map(re=>({observer:re.observer,options:re.options,callback:Ma=>ve({type:z.Plugin,data:{plugin:re.name,payload:Ma}})})))||[]},y)};vt.addLoadListener(be=>{try{K.push(ze(be.contentDocument))}catch(Ke){console.warn(Ke)}});let de=()=>{ta(),K.push(ze(document)),ba=!0};return["interactive","complete"].includes(document.readyState)?de():(K.push(Ve("DOMContentLoaded",()=>{ve({type:z.DomContentLoaded,data:{}}),_==="DOMContentLoaded"&&de()})),K.push(Ve("load",()=>{ve({type:z.Load,data:{}}),_==="load"&&de()},window))),()=>{K.forEach(be=>{try{be()}catch(Ke){String(Ke).toLowerCase().includes("cross-origin")||console.warn(Ke)}}),Nn.destroy(),ba=!1,o$()}}catch(K){console.warn(K)}}Tn.addCustomEvent=(e,t)=>{if(!ba)throw new Error("please add custom event after start recording");ve({type:z.Custom,data:{tag:e,payload:t}})};Tn.freezePage=()=>{En.forEach(e=>e.freeze())};Tn.takeFullSnapshot=e=>{if(!ba)throw new Error("please take full snapshot after start recording");ta(e)};Tn.mirror=gt;var pS;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(pS||(pS={}));var az=5*1e3;var{addCustomEvent:lz}=Tn,{freezePage:uz}=Tn,{takeFullSnapshot:cz}=Tn;var fx="__ripploEmitRrwebEvent";function hx(){return{eventTypes:cx(z),incrementalSources:cx(V)}}function cx(e){return Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="number").map(([t,n])=>[n,t]))}var I$=Zc("@ripplo/rrweb-bundle/bundle","rrweb.js"),dx;function px(){return dx??=k$(I$,{encoding:"utf8"}),dx}async function Ef({clientVersion:e,debugDir:t,writeOtlpPortFile:n}){let r=new Map,i=c1(hx()),o=await Xc({localDir:mx.join(mx.dirname(t),".local"),writePortFile:n,onRrwebBatch:(l,u)=>{r.get(l)?.emitRrwebBatch(u)},onSpan:l=>{let u=l.attributes["ripplo.run"];u!=null&&r.get(u)?.emit(l)}}),s=await px();return{attach:async(l,u)=>{let c=u1({debugDir:t,runId:u,worker:i});c.emit({clientVersion:e,kind:"meta",source:"capture",timeNanos:"0"}),r.set(u,c),await f1(l,u),await l.addInitScript(`globalThis.__ripploCapturePort = ${String(o.port)};`),await M$(l,c),await N$(l,c);let d=[];return{emitAction:f=>{L$(c,f)},emitAssertion:f=>{D$(c,f)},finish:()=>_$(c,{pages:d,registry:r,runId:u}),onPage:f=>{d.push(f),$$(c,s,f)}}},debugDir:t,close:async()=>{await o.stop(),await i.terminate()},injectSpan:(l,u)=>{r.get(l)?.emit(u)}}}async function P$(e){await Promise.all(e.map(t=>t.evaluate("globalThis.__ripploFlushRrweb ? globalThis.__ripploFlushRrweb() : undefined").catch(()=>{})))}async function M$(e,t){await e.exposeBinding(fx,(n,r)=>{let i=typeof r=="string"?r:JSON.stringify(r);t.emitRrwebBatch(Buffer.from(i,"utf8"))})}var T$="__ripploEventPush",O$=wt.discriminatedUnion("kind",[wt.object({kind:wt.literal("console"),level:wt.string(),text:wt.string(),timestamp:wt.number()}),wt.object({kind:wt.literal("error"),message:wt.string(),stack:wt.string().optional(),timestamp:wt.number()})]);async function N$(e,t){await e.exposeBinding(T$,(n,r)=>{let i=O$.safeParse(r);if(!i.success)return;let o=i.data;if(o.kind==="console"){t.emit({kind:"console",level:o.level,source:"browser",text:o.text,timeNanos:lr(o.timestamp)});return}t.emit({kind:"error",message:o.message,source:"browser",stack:o.stack,timeNanos:lr(o.timestamp)})})}async function _$(e,t){await P$(t.pages),t.registry.delete(t.runId),await e.close({noticeIfNoRrweb:"rrweb capture unavailable: recorder never pushed an event \u2014 page never loaded the recorder (blank page, failed navigation, or CSP block)"})}function $$(e,t,n){n.on("load",()=>{n.addScriptTag({content:t}).catch(()=>{})}),n.on("response",r=>{j$(e,r)})}function L$(e,t){e.emit({action:t.kind,kind:"action",source:"test",target:F$(t),timeNanos:lr(Date.now()),value:B$(t)})}function D$(e,t){let n=To(t);e.emit({kind:"assertion",label:n.label,outcome:t.outcome,source:"test",step:n.step,timeNanos:lr(Date.now())})}function F$(e){if(e.url!=null)return e.url;if(e.locator!=null)return Cf(e.locator)}function Cf(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${Cf(e.scope)} \u25B8 ${Cf(e.target)}`:`${e.role} ${e.name??""}`.trim()}function B$(e){return e.value!=null?typeof e.value=="object"?JSON.stringify(e.value):String(e.value):e.key}var U$=/^http:\/\/127\.0\.0\.1:\d+\/rrweb\//;function j$(e,t){let n=t.request(),r=n.resourceType();if(r!=="fetch"&&r!=="xhr"||U$.test(n.url()))return;let i=n.headers().traceparent?.split("-"),o=n.timing().startTime;e.emit({kind:"network",method:n.method(),resourceType:r,source:"browser",spanId:i?.[2],status:t.status(),timeNanos:lr(o>0?o:Date.now()),traceId:i?.[1],url:t.url()})}function G$({clientVersion:e,debugDir:t,headed:n,writeOtlpPortFile:r}){let i=hs({headed:n}),o,s,a=async()=>(o??=Ef({clientVersion:e,debugDir:t,writeOtlpPortFile:r}),s=await o,s),l=async(d,f)=>{if(f.aborted)return W$(fi("skipped"));try{let p=await a();return d.options.headed&&!n?await Pc(!0,async h=>qc({browser:h,hub:p,request:d},f)):await qc({browser:await i.acquire(),hub:p,request:d},f)}catch(p){return V$(pn(p))}};return{close:async()=>{await i.close();let d=o;o=void 0,s=void 0,d!=null&&await d.then(f=>f.close()).catch(()=>{})},prewarm:async()=>{await a(),await i.acquire()},injectSpan:(d,f)=>{s?.injectSpan(d,f)},runOnce:(d,f)=>new z$(l(d,f))}}async function H$(e,t){let n=await Sx({attemptIndex:0,capture:!1,params:e,stepRuns:e.stepRuns},t);return n.kind!=="completed"?gx(n):n.findings.length===0?{kind:"clean"}:q$(e,kf(e.baseState.name,n.findings),t)}function gx(e){return e.kind==="error"?{error:e.error,kind:"error"}:{kind:e.kind}}async function q$(e,t,n){let r=await Sx({attemptIndex:1,capture:!0,params:e,stepRuns:e.stepRuns},n);return r.kind!=="completed"?gx(r):kf(e.baseState.name,r.findings).signature!==t.signature?{kind:"flaky"}:{baseState:e.baseState.name,captureEvents:r.events,kind:"finding",runId:r.runId,signature:t.signature,verifierLayer:t.layer}}function bx(e){return e.kind==="driver-error"||e.kind==="unrunnable"?"crash":e.kind==="pending-check"?e.source.kind==="data-rule"?"data-rule":e.source.kind==="page-rule"?"page-rule":"frame":"frame"}async function Sx({attemptIndex:e,capture:t,params:n,stepRuns:r},i){let o=n.runIdFor(e),s=[];return(await n.session.runOnce({capture:t,lockfile:n.lockfile,onEvent:t?l=>{s.push(l)}:void 0,options:n.options,params:void 0,runId:o,sequence:K$(n,r),test:n.baseState.test},i)).match(l=>l.aborted?{kind:"aborted"}:{events:s,findings:l.findings,kind:"completed",runId:o},l=>({error:l,kind:"error"}))}function K$(e,t){return t.map(n=>{let r=e.corpus[n.idx];if(r==null)throw new Error("transition index out of corpus range");return{params:n.params,transition:r}})}function kf(e,t){let r=t.map(i=>({line:Yl(i),part:Z$(i)})).toSorted((i,o)=>G(i.part).localeCompare(G(o.part))).map(i=>i.part);return{layer:Y$(r),signature:G({baseState:e,parts:r.map(i=>G(i))})}}var yx={crash:0,"data-rule":1,frame:3,"page-rule":2};function Y$(e){return e.map(n=>n.layer).toSorted((n,r)=>yx[n]-yx[r]).at(0)??"frame"}function Z$(e){let t=bx(e);switch(e.kind){case"consistency":return{kind:"consistency",layer:t,mismatch:X$(e.mismatch),step:e.step==null?null:{intent:e.step.intent,test:e.step.test}};case"pending-check":return{kind:"pending-check",layer:t,source:e.source.kind,step:{intent:e.step.intent,test:e.step.test}};case"unrunnable":return{intent:e.intent,kind:"unrunnable",layer:t,reason:e.reason,test:e.test};case"driver-error":return{error:e.error.kind,kind:"driver-error",layer:t,step:e.step.intent};case"impossible-action":return{kind:"impossible-action",layer:t,step:e.step.intent}}}function X$(e){return e.kind==="singleton-mismatch"?{kind:e.kind,singleton:e.singleton}:{entity:e.entity,kind:e.kind}}async function J$({lockfile:e,options:t,repro:n,runId:r,session:i,signal:o}){let s=await us(e);if(s==null)return{kind:"unplannable"};let a=[...s.startingPointTests.values()].find(c=>rt(c)===n.baseStateRef);if(a==null)return{kind:"unplannable"};let l=n.steps.map(c=>{let d=s.corpus.find(f=>f.test===c.test&&f.index===c.index);return d==null?null:{params:c.params,transition:d}});return l.some(c=>c==null)?{kind:"unplannable"}:(await i.runOnce({capture:!1,lockfile:e,onEvent:void 0,options:t,params:void 0,runId:r,sequence:l.filter(c=>c!=null),test:a},o)).match(c=>c.aborted?{kind:"aborted"}:c.findings.length>0?{findings:c.findings,kind:"still-fails"}:{kind:"resolved"},c=>({kind:"state-unavailable",reason:c.kind}))}function Yz(e){switch(e.kind){case"empty-response":return"ripplo daemon: cloud tunnel provisioning returned no result. Check server logs and retry.";case"server-error":return`ripplo daemon: cloud tunnel provisioning failed (${e.typename}). Run \`npx ripplo doctor\` to check your setup.`}}function Zz(e){switch(e.kind){case"already-running":return`ripplo daemon: daemon already running (socket ${e.socketPath}).`;case"bind-failed":return`ripplo daemon: failed to bind IPC socket: ${e.message}`}}function Xz({projectId:e,serverUrl:t}){return[`Project "${e}" (from .ripplo/project.json) was not found on ${t}, or this account does not have access to it.`,"Run `npx ripplo projects list` to see your projects, then update .ripplo/project.json (or re-run `npx ripplo init --project <id>`)."].join(`
|
|
145
|
-
`)}function
|
|
146
|
-
daemon: cannot subscribe to run dispatch${s} \u2014 server-side, restarting the daemon will not help`}return o}function
|
|
144
|
+
or you can use record.mirror to access the mirror instance during recording.`,iS={map:{},getId(){return console.error(cr),-1},getNode(){return console.error(cr),null},removeNodeFromMap(){console.error(cr)},has(){return console.error(cr),!1},reset(){console.error(cr)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(iS=new Proxy(iS,{get(e,t,n){return t==="map"&&console.error(cr),Reflect.get(e,t,n)}}));function Ti(e,t,n={}){let r=null,i=0;return function(...o){let s=Date.now();!i&&n.leading===!1&&(i=s);let a=t-(s-i),l=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),i=s,e.apply(l,o)):!r&&n.trailing!==!1&&(r=setTimeout(()=>{i=n.leading===!1?0:Date.now(),r=null,e.apply(l,o)},a))}}function Pa(e,t,n,r,i=window){let o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set(s){setTimeout(()=>{n.set.call(this,s)},0),o&&o.set&&o.set.call(this,s)}}),()=>Pa(e,t,o||{},!0)}var ma=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(ma=()=>new Date().getTime());function Hw(e){var t,n,r,i;let o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:o.documentElement.scrollLeft||o?.body&&((t=F.parentElement(o.body))==null?void 0:t.scrollLeft)||((n=o?.body)==null?void 0:n.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:o?.documentElement.scrollTop||o?.body&&((r=F.parentElement(o.body))==null?void 0:r.scrollTop)||((i=o?.body)==null?void 0:i.scrollTop)||0}}function qw(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Kw(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Yw(e){return e?e.nodeType===e.ELEMENT_NODE?e:F.parentElement(e):null}function We(e,t,n,r){if(!e)return!1;let i=Yw(e);if(!i)return!1;try{if(typeof t=="string"){if(i.classList.contains(t)||r&&i.closest("."+t)!==null)return!0}else if(sa(i,t,r))return!0}catch{}return!!(n&&(i.matches(n)||r&&i.closest(n)!==null))}function J_(e,t){return t.getId(e)!==-1}function cd(e,t,n){return e.tagName==="TITLE"&&n.headTitleMutations?!0:t.getId(e)===vi}function Zw(e,t){if(Si(e))return!1;let n=t.getId(e);if(!t.has(n))return!0;let r=F.parentNode(e);return r&&r.nodeType===e.DOCUMENT_NODE?!1:r?Zw(r,t):!0}function zd(e){return!!e.changedTouches}function Q_(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function Xw(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function Jw(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Gd(e){return e?e instanceof Wd&&"shadowRoot"in e?!!e.shadowRoot:!!F.shadowRoot(e):!1}var Hd=class{constructor(){R(this,"id",1),R(this,"styleIDMap",new WeakMap),R(this,"idStyleMap",new Map)}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,n){if(this.has(t))return this.getId(t);let r;return n===void 0?r=this.id++:r=n,this.styleIDMap.set(t,r),this.idStyleMap.set(r,t),r}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Qw(e){var t;let n=null;return"getRootNode"in e&&((t=F.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&F.host(F.getRootNode(e))&&(n=F.host(F.getRootNode(e))),n}function e$(e){let t=e,n;for(;n=Qw(t);)t=n;return t}function t$(e){let t=F.ownerDocument(e);if(!t)return!1;let n=e$(e);return F.contains(t,n)}function ex(e){let t=F.ownerDocument(e);return t?F.contains(t,e)||t$(e):!1}var z=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(z||{}),V=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(V||{}),He=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(He||{}),Ht=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Ht||{}),xr=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(xr||{}),dr=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(dr||{});var tx=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(tx||{});function oS(e){return"__ln"in e}var qd=class{constructor(){R(this,"length",0),R(this,"head",null),R(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let n=this.head;for(let r=0;r<t;r++)n=n?.next||null;return n}addNode(t){let n={value:t,previous:null,next:null};if(t.__ln=n,t.previousSibling&&oS(t.previousSibling)){let r=t.previousSibling.__ln.next;n.next=r,n.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=n,r&&(r.previous=n)}else if(t.nextSibling&&oS(t.nextSibling)&&t.nextSibling.__ln.previous){let r=t.nextSibling.__ln.previous;n.previous=r,n.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=n,r&&(r.next=n)}else this.head&&(this.head.previous=n),n.next=this.head,this.head=n;n.next===null&&(this.tail=n),this.length++}removeNode(t){let n=t.__ln;this.head&&(n.previous?(n.previous.next=n.next,n.next?n.next.previous=n.previous:this.tail=n.previous):(this.head=n.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}},sS=(e,t)=>`${e}@${t}`,Kd=class{constructor(){R(this,"frozen",!1),R(this,"locked",!1),R(this,"texts",[]),R(this,"attributes",[]),R(this,"attributeMap",new WeakMap),R(this,"removes",[]),R(this,"mapRemoves",[]),R(this,"movedMap",{}),R(this,"addedSet",new Set),R(this,"movedSet",new Set),R(this,"droppedSet",new Set),R(this,"removesSubTreeCache",new Set),R(this,"mutationCb"),R(this,"blockClass"),R(this,"blockSelector"),R(this,"maskTextClass"),R(this,"maskTextSelector"),R(this,"inlineStylesheet"),R(this,"maskInputOptions"),R(this,"maskTextFn"),R(this,"maskInputFn"),R(this,"keepIframeSrcFn"),R(this,"recordCanvas"),R(this,"inlineImages"),R(this,"slimDOMOptions"),R(this,"dataURLOptions"),R(this,"doc"),R(this,"mirror"),R(this,"iframeManager"),R(this,"stylesheetManager"),R(this,"shadowDomManager"),R(this,"canvasManager"),R(this,"processedNodeManager"),R(this,"unattachedDoc"),R(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),R(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],n=new Set,r=new qd,i=l=>{let u=l,c=vi;for(;c===vi;)u=u&&u.nextSibling,c=u&&this.mirror.getId(u);return c},o=l=>{let u=F.parentNode(l);if(!u||!ex(l))return;let c=!1;if(l.nodeType===Node.TEXT_NODE){let h=u.tagName;if(h==="TEXTAREA")return;h==="STYLE"&&this.addedSet.has(u)&&(c=!0)}let d=Si(u)?this.mirror.getId(Qw(l)):this.mirror.getId(u),f=i(l);if(d===-1||f===-1)return r.addNode(l);let p=hr(l,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:h=>{Xw(h,this.mirror)&&this.iframeManager.addIframe(h),Jw(h,this.mirror)&&this.stylesheetManager.trackLinkElement(h),Gd(l)&&this.shadowDomManager.addShadowRoot(F.shadowRoot(l),this.doc)},onIframeLoad:(h,m)=>{this.iframeManager.attachIframe(h,m),this.shadowDomManager.observeAttachShadow(h)},onStylesheetLoad:(h,m)=>{this.stylesheetManager.attachLinkElement(h,m)},cssCaptured:c});p&&(t.push({parentId:d,nextId:f,node:p}),n.add(p.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let l of this.movedSet)aS(this.removesSubTreeCache,l,this.mirror)&&!this.movedSet.has(F.parentNode(l))||o(l);for(let l of this.addedSet)!lS(this.droppedSet,l)&&!aS(this.removesSubTreeCache,l,this.mirror)||lS(this.movedSet,l)?o(l):this.droppedSet.add(l);let s=null;for(;r.length;){let l=null;if(s){let u=this.mirror.getId(F.parentNode(s.value)),c=i(s.value);u!==-1&&c!==-1&&(l=s)}if(!l){let u=r.tail;for(;u;){let c=u;if(u=u.previous,c){let d=this.mirror.getId(F.parentNode(c.value));if(i(c.value)===-1)continue;if(d!==-1){l=c;break}else{let p=c.value,h=F.parentNode(p);if(h&&h.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let m=F.host(h);if(this.mirror.getId(m)!==-1){l=c;break}}}}}}if(!l){for(;r.head;)r.removeNode(r.head.value);break}s=l.previous,r.removeNode(l.value),o(l.value)}let a={texts:this.texts.map(l=>{let u=l.node,c=F.parentNode(u);return c&&c.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(c),{id:this.mirror.getId(u),value:l.value}}).filter(l=>!n.has(l.id)).filter(l=>this.mirror.has(l.id)),attributes:this.attributes.map(l=>{let{attributes:u}=l;if(typeof u.style=="string"){let c=JSON.stringify(l.styleDiff),d=JSON.stringify(l._unchangedStyles);c.length<u.style.length&&(c+d).split("var(").length===u.style.split("var(").length&&(u.style=l.styleDiff)}return{id:this.mirror.getId(l.node),attributes:u}}).filter(l=>!n.has(l.id)).filter(l=>this.mirror.has(l.id)),removes:this.removes,adds:t};!a.texts.length&&!a.attributes.length&&!a.removes.length&&!a.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(a))}),R(this,"genTextAreaValueMutation",t=>{let n=this.attributeMap.get(t);n||(n={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(n),this.attributeMap.set(t,n));let r=Array.from(F.childNodes(t),i=>F.textContent(i)||"").join("");n.attributes.value=ra({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:ia(t),value:r,maskInputFn:this.maskInputFn})}),R(this,"processMutation",t=>{if(!cd(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let n=F.textContent(t.target);!We(t.target,this.blockClass,this.blockSelector,!1)&&n!==t.oldValue&&this.texts.push({value:vS(t.target,this.maskTextClass,this.maskTextSelector,!0)&&n?this.maskTextFn?this.maskTextFn(n,Yw(t.target)):n.replace(/[\S]/g,"*"):n,node:t.target});break}case"attributes":{let n=t.target,r=t.attributeName,i=t.target.getAttribute(r);if(r==="value"){let s=ia(n);i=ra({element:n,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:s,value:i,maskInputFn:this.maskInputFn})}if(We(t.target,this.blockClass,this.blockSelector,!1)||i===t.oldValue)return;let o=this.attributeMap.get(t.target);if(n.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(i))if(!n.contentDocument)r="rr_src";else return;if(o||(o={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o),this.attributeMap.set(t.target,o)),r==="type"&&n.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&n.setAttribute("data-rr-is-password","true"),!xS(n.tagName,r))if(o.attributes[r]=wS(this.doc,kn(n.tagName),kn(r),i),r==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let s=this.unattachedDoc.createElement("span");t.oldValue&&s.setAttribute("style",t.oldValue);for(let a of Array.from(n.style)){let l=n.style.getPropertyValue(a),u=n.style.getPropertyPriority(a);l!==s.style.getPropertyValue(a)||u!==s.style.getPropertyPriority(a)?u===""?o.styleDiff[a]=l:o.styleDiff[a]=[l,u]:o._unchangedStyles[a]=[l,u]}for(let a of Array.from(s.style))n.style.getPropertyValue(a)===""&&(o.styleDiff[a]=!1)}else r==="open"&&n.tagName==="DIALOG"&&(n.matches("dialog:modal")?o.attributes.rr_open_mode="modal":o.attributes.rr_open_mode="non-modal");break}case"childList":{if(We(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(n=>this.genAdds(n,t.target)),t.removedNodes.forEach(n=>{let r=this.mirror.getId(n),i=Si(t.target)?this.mirror.getId(F.host(t.target)):this.mirror.getId(t.target);We(t.target,this.blockClass,this.blockSelector,!1)||cd(n,this.mirror,this.slimDOMOptions)||!J_(n,this.mirror)||(this.addedSet.has(n)?(Yd(this.addedSet,n),this.droppedSet.add(n)):this.addedSet.has(t.target)&&r===-1||Zw(t.target,this.mirror)||(this.movedSet.has(n)&&this.movedMap[sS(r,i)]?Yd(this.movedSet,n):(this.removes.push({parentId:i,id:r,isShadow:Si(t.target)&&wi(t.target)?!0:void 0}),n$(n,this.removesSubTreeCache))),this.mapRemoves.push(n))});break}}}),R(this,"genAdds",(t,n)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(cd(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let r=null;n&&this.mirror.hasNode(n)&&(r=this.mirror.getId(n)),r&&r!==-1&&(this.movedMap[sS(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);We(t,this.blockClass,this.blockSelector,!1)||(F.childNodes(t).forEach(r=>this.genAdds(r)),Gd(t)&&F.childNodes(F.shadowRoot(t)).forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,t)}))}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(n=>{this[n]=t[n]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}};function Yd(e,t){e.delete(t),F.childNodes(t).forEach(n=>Yd(e,n))}function n$(e,t){let n=[e];for(;n.length;){let r=n.pop();t.has(r)||(t.add(r),F.childNodes(r).forEach(i=>n.push(i)))}}function aS(e,t,n){return e.size===0?!1:r$(e,t)}function r$(e,t,n){let r=F.parentNode(t);return r?e.has(r):!1}function lS(e,t){return e.size===0?!1:nx(e,t)}function nx(e,t){let n=F.parentNode(t);return n?e.has(n)?!0:nx(e,n):!1}var xi;function i$(e){xi=e}function o$(){xi=void 0}var q=e=>xi?(...n)=>{try{return e(...n)}catch(r){if(xi&&xi(r)===!0)return;throw r}}:e,En=[];function Li(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function rx(e,t){let n=new Kd;En.push(n),n.init(e);let r=new(Gw())(q(n.processMutations.bind(n)));return r.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function s$({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(t.mousemove===!1)return()=>{};let i=typeof t.mousemove=="number"?t.mousemove:50,o=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,s=[],a,l=Ti(q(d=>{let f=Date.now()-a;e(s.map(p=>(p.timeOffset-=f,p)),d),s=[],a=null}),o),u=q(Ti(q(d=>{let f=Li(d),{clientX:p,clientY:h}=zd(d)?d.changedTouches[0]:d;a||(a=ma()),s.push({x:p,y:h,id:r.getId(f),timeOffset:ma()-a}),l(typeof DragEvent<"u"&&d instanceof DragEvent?V.Drag:d instanceof MouseEvent?V.MouseMove:V.TouchMove)}),i,{trailing:!1})),c=[Ve("mousemove",u,n),Ve("touchmove",u,n),Ve("drag",u,n)];return q(()=>{c.forEach(d=>d())})}function a$({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){if(o.mouseInteraction===!1)return()=>{};let s=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,a=[],l=null,u=c=>d=>{let f=Li(d);if(We(f,r,i,!0))return;let p=null,h=c;if("pointerType"in d){switch(d.pointerType){case"mouse":p=Ht.Mouse;break;case"touch":p=Ht.Touch;break;case"pen":p=Ht.Pen;break}p===Ht.Touch?He[c]===He.MouseDown?h="TouchStart":He[c]===He.MouseUp&&(h="TouchEnd"):Ht.Pen}else zd(d)&&(p=Ht.Touch);p!==null?(l=p,(h.startsWith("Touch")&&p===Ht.Touch||h.startsWith("Mouse")&&p===Ht.Mouse)&&(p=null)):He[c]===He.Click&&(p=l,l=null);let m=zd(d)?d.changedTouches[0]:d;if(!m)return;let y=n.getId(f),{clientX:S,clientY:w}=m;q(e)({type:He[h],id:y,x:S,y:w,...p!==null&&{pointerType:p}})};return Object.keys(He).filter(c=>Number.isNaN(Number(c))&&!c.endsWith("_Departed")&&s[c]!==!1).forEach(c=>{let d=kn(c),f=u(c);if(window.PointerEvent)switch(He[c]){case He.MouseDown:case He.MouseUp:d=d.replace("mouse","pointer");break;case He.TouchStart:case He.TouchEnd:return}a.push(Ve(d,f,t))}),q(()=>{a.forEach(c=>c())})}function ix({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){let s=q(Ti(q(a=>{let l=Li(a);if(!l||We(l,r,i,!0))return;let u=n.getId(l);if(l===t&&t.defaultView){let c=Hw(t.defaultView);e({id:u,x:c.left,y:c.top})}else e({id:u,x:l.scrollLeft,y:l.scrollTop})}),o.scroll||100));return Ve("scroll",s,t)}function l$({viewportResizeCb:e},{win:t}){let n=-1,r=-1,i=q(Ti(q(()=>{let o=qw(),s=Kw();(n!==o||r!==s)&&(e({width:Number(s),height:Number(o)}),n=o,r=s)}),200));return Ve("resize",i,t)}var u$=["INPUT","TEXTAREA","SELECT"],uS=new WeakMap;function c$({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,ignoreClass:o,ignoreSelector:s,maskInputOptions:a,maskInputFn:l,sampling:u,userTriggeredOnInput:c}){function d(w){let g=Li(w),x=w.isTrusted,k=g&&g.tagName;if(g&&k==="OPTION"&&(g=F.parentElement(g)),!g||!k||u$.indexOf(k)<0||We(g,r,i,!0)||g.classList.contains(o)||s&&g.matches(s))return;let O=g.value,N=!1,_=ia(g)||"";_==="radio"||_==="checkbox"?N=g.checked:(a[k.toLowerCase()]||a[_])&&(O=ra({element:g,maskInputOptions:a,tagName:k,type:_,value:O,maskInputFn:l})),f(g,c?{text:O,isChecked:N,userTriggered:x}:{text:O,isChecked:N});let I=g.name;_==="radio"&&I&&N&&t.querySelectorAll(`input[type="radio"][name="${I}"]`).forEach(B=>{if(B!==g){let U=B.value;f(B,c?{text:U,isChecked:!N,userTriggered:!1}:{text:U,isChecked:!N})}})}function f(w,g){let x=uS.get(w);if(!x||x.text!==g.text||x.isChecked!==g.isChecked){uS.set(w,g);let k=n.getId(w);q(e)({...g,id:k})}}let h=(u.input==="last"?["change"]:["input","change"]).map(w=>Ve(w,q(d),t)),m=t.defaultView;if(!m)return()=>{h.forEach(w=>w())};let y=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),S=[[m.HTMLInputElement.prototype,"value"],[m.HTMLInputElement.prototype,"checked"],[m.HTMLSelectElement.prototype,"value"],[m.HTMLTextAreaElement.prototype,"value"],[m.HTMLSelectElement.prototype,"selectedIndex"],[m.HTMLOptionElement.prototype,"selected"]];return y&&y.set&&h.push(...S.map(w=>Pa(w[0],w[1],{set(){q(d)({target:this,isTrusted:!1})}},!1,m))),q(()=>{h.forEach(w=>w())})}function ya(e){let t=[];function n(r,i){if(Ks("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||Ks("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||Ks("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||Ks("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){let s=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(s)}else if(r.parentStyleSheet){let s=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(s)}return i}return n(e,t)}function dn(e,t,n){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:r}):{}}function d$({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};let i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:q((c,d,f)=>{let[p,h]=f,{id:m,styleId:y}=dn(d,t,n.styleMirror);return(m&&m!==-1||y&&y!==-1)&&e({id:m,styleId:y,adds:[{rule:p,index:h}]}),c.apply(d,f)})}),r.CSSStyleSheet.prototype.addRule=function(c,d,f=this.cssRules.length){let p=`${c} { ${d} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[p,f])};let o=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:q((c,d,f)=>{let[p]=f,{id:h,styleId:m}=dn(d,t,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,removes:[{index:p}]}),c.apply(d,f)})}),r.CSSStyleSheet.prototype.removeRule=function(c){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[c])};let s;r.CSSStyleSheet.prototype.replace&&(s=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:q((c,d,f)=>{let[p]=f,{id:h,styleId:m}=dn(d,t,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,replace:p}),c.apply(d,f)})}));let a;r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:q((c,d,f)=>{let[p]=f,{id:h,styleId:m}=dn(d,t,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,replaceSync:p}),c.apply(d,f)})}));let l={};Ys("CSSGroupingRule")?l.CSSGroupingRule=r.CSSGroupingRule:(Ys("CSSMediaRule")&&(l.CSSMediaRule=r.CSSMediaRule),Ys("CSSConditionRule")&&(l.CSSConditionRule=r.CSSConditionRule),Ys("CSSSupportsRule")&&(l.CSSSupportsRule=r.CSSSupportsRule));let u={};return Object.entries(l).forEach(([c,d])=>{u[c]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=new Proxy(u[c].insertRule,{apply:q((f,p,h)=>{let[m,y]=h,{id:S,styleId:w}=dn(p.parentStyleSheet,t,n.styleMirror);return(S&&S!==-1||w&&w!==-1)&&e({id:S,styleId:w,adds:[{rule:m,index:[...ya(p),y||0]}]}),f.apply(p,h)})}),d.prototype.deleteRule=new Proxy(u[c].deleteRule,{apply:q((f,p,h)=>{let[m]=h,{id:y,styleId:S}=dn(p.parentStyleSheet,t,n.styleMirror);return(y&&y!==-1||S&&S!==-1)&&e({id:y,styleId:S,removes:[{index:[...ya(p),m]}]}),f.apply(p,h)})})}),q(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=o,s&&(r.CSSStyleSheet.prototype.replace=s),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([c,d])=>{d.prototype.insertRule=u[c].insertRule,d.prototype.deleteRule=u[c].deleteRule})})}function ox({mirror:e,stylesheetManager:t},n){var r,i,o;let s=null;n.nodeName==="#document"?s=e.getId(n):s=e.getId(F.host(n));let a=n.nodeName==="#document"?(r=n.defaultView)==null?void 0:r.Document:(o=(i=n.ownerDocument)==null?void 0:i.defaultView)==null?void 0:o.ShadowRoot,l=a?.prototype?Object.getOwnPropertyDescriptor(a?.prototype,"adoptedStyleSheets"):void 0;return s===null||s===-1||!a||!l?()=>{}:(Object.defineProperty(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var u;return(u=l.get)==null?void 0:u.call(this)},set(u){var c;let d=(c=l.set)==null?void 0:c.call(this,u);if(s!==null&&s!==-1)try{t.adoptStyleSheets(u,s)}catch{}return d}}),q(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))}function f$({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){let o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:q((a,l,u)=>{var c;let[d,f,p]=u;if(n.has(d))return o.apply(l,[d,f,p]);let{id:h,styleId:m}=dn((c=l.parentRule)==null?void 0:c.parentStyleSheet,t,r.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,set:{property:d,value:f,priority:p},index:ya(l.parentRule)}),a.apply(l,u)})});let s=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:q((a,l,u)=>{var c;let[d]=u;if(n.has(d))return s.apply(l,[d]);let{id:f,styleId:p}=dn((c=l.parentRule)==null?void 0:c.parentStyleSheet,t,r.styleMirror);return(f&&f!==-1||p&&p!==-1)&&e({id:f,styleId:p,remove:{property:d},index:ya(l.parentRule)}),a.apply(l,u)})}),q(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s})}function h$({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:i,doc:o}){let s=q(l=>Ti(q(u=>{let c=Li(u);if(!c||We(c,t,n,!0))return;let{currentTime:d,volume:f,muted:p,playbackRate:h,loop:m}=c;e({type:l,id:r.getId(c),currentTime:d,volume:f,muted:p,playbackRate:h,loop:m})}),i.media||500)),a=[Ve("play",s(dr.Play),o),Ve("pause",s(dr.Pause),o),Ve("seeked",s(dr.Seeked),o),Ve("volumechange",s(dr.VolumeChange),o),Ve("ratechange",s(dr.RateChange),o)];return q(()=>{a.forEach(l=>l())})}function p$({fontCb:e,doc:t}){let n=t.defaultView;if(!n)return()=>{};let r=[],i=new WeakMap,o=n.FontFace;n.FontFace=function(l,u,c){let d=new o(l,u,c);return i.set(d,{family:l,buffer:typeof u!="string",descriptors:c,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),d};let s=Mn(t.fonts,"add",function(a){return function(l){return setTimeout(q(()=>{let u=i.get(l);u&&(e(u),i.delete(l))}),0),a.apply(this,[l])}});return r.push(()=>{n.FontFace=o}),r.push(s),q(()=>{r.forEach(a=>a())})}function m$(e){let{doc:t,mirror:n,blockClass:r,blockSelector:i,selectionCb:o}=e,s=!0,a=q(()=>{let l=t.getSelection();if(!l||s&&l?.isCollapsed)return;s=l.isCollapsed||!1;let u=[],c=l.rangeCount||0;for(let d=0;d<c;d++){let f=l.getRangeAt(d),{startContainer:p,startOffset:h,endContainer:m,endOffset:y}=f;We(p,r,i,!0)||We(m,r,i,!0)||u.push({start:n.getId(p),startOffset:h,end:n.getId(m),endOffset:y})}o({ranges:u})});return a(),Ve("selectionchange",a)}function y$({doc:e,customElementCb:t}){let n=e.defaultView;return!n||!n.customElements?()=>{}:Mn(n.customElements,"define",function(i){return function(o,s,a){try{t({define:{name:o}})}catch{console.warn(`Custom element callback failed for ${o}`)}return i.apply(this,[o,s,a])}})}function g$(e,t){let{mutationCb:n,mousemoveCb:r,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:s,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:d,fontCb:f,selectionCb:p,customElementCb:h}=e;e.mutationCb=(...m)=>{t.mutation&&t.mutation(...m),n(...m)},e.mousemoveCb=(...m)=>{t.mousemove&&t.mousemove(...m),r(...m)},e.mouseInteractionCb=(...m)=>{t.mouseInteraction&&t.mouseInteraction(...m),i(...m)},e.scrollCb=(...m)=>{t.scroll&&t.scroll(...m),o(...m)},e.viewportResizeCb=(...m)=>{t.viewportResize&&t.viewportResize(...m),s(...m)},e.inputCb=(...m)=>{t.input&&t.input(...m),a(...m)},e.mediaInteractionCb=(...m)=>{t.mediaInteaction&&t.mediaInteaction(...m),l(...m)},e.styleSheetRuleCb=(...m)=>{t.styleSheetRule&&t.styleSheetRule(...m),u(...m)},e.styleDeclarationCb=(...m)=>{t.styleDeclaration&&t.styleDeclaration(...m),c(...m)},e.canvasMutationCb=(...m)=>{t.canvasMutation&&t.canvasMutation(...m),d(...m)},e.fontCb=(...m)=>{t.font&&t.font(...m),f(...m)},e.selectionCb=(...m)=>{t.selection&&t.selection(...m),p(...m)},e.customElementCb=(...m)=>{t.customElement&&t.customElement(...m),h(...m)}}function b$(e,t={}){let n=e.doc.defaultView;if(!n)return()=>{};g$(e,t);let r;e.recordDOM&&(r=rx(e,e.doc));let i=s$(e),o=a$(e),s=ix(e),a=l$(e,{win:n}),l=c$(e),u=h$(e),c=()=>{},d=()=>{},f=()=>{},p=()=>{};e.recordDOM&&(c=d$(e,{win:n}),d=ox(e,e.doc),f=f$(e,{win:n}),e.collectFonts&&(p=p$(e)));let h=m$(e),m=y$(e),y=[];for(let S of e.plugins)y.push(S.observer(S.callback,n,S.options));return q(()=>{En.forEach(S=>S.reset()),r?.disconnect(),i(),o(),s(),a(),l(),u(),c(),d(),f(),p(),h(),m(),y.forEach(S=>S())})}function Ks(e){return typeof window[e]<"u"}function Ys(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var ga=class{constructor(t){R(this,"iframeIdToRemoteIdMap",new WeakMap),R(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,n,r,i){let o=r||this.getIdToRemoteIdMap(t),s=i||this.getRemoteIdToIdMap(t),a=o.get(n);return a||(a=this.generateIdFn(),o.set(n,a),s.set(a,n)),a}getIds(t,n){let r=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return n.map(o=>this.getId(t,o,r,i))}getRemoteId(t,n,r){let i=r||this.getRemoteIdToIdMap(t);if(typeof n!="number")return n;let o=i.get(n);return o||-1}getRemoteIds(t,n){let r=this.getRemoteIdToIdMap(t);return n.map(i=>this.getRemoteId(t,i,r))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let n=this.iframeIdToRemoteIdMap.get(t);return n||(n=new Map,this.iframeIdToRemoteIdMap.set(t,n)),n}getRemoteIdToIdMap(t){let n=this.iframeRemoteIdToIdMap.get(t);return n||(n=new Map,this.iframeRemoteIdToIdMap.set(t,n)),n}},Zd=class{constructor(t){R(this,"iframes",new WeakMap),R(this,"crossOriginIframeMap",new WeakMap),R(this,"crossOriginIframeMirror",new ga(SS)),R(this,"crossOriginIframeStyleMirror"),R(this,"crossOriginIframeRootIdMap",new WeakMap),R(this,"mirror"),R(this,"mutationCb"),R(this,"wrappedEmit"),R(this,"loadListener"),R(this,"stylesheetManager"),R(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new ga(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,n){var r,i;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:n}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=t.contentWindow)==null||r.addEventListener("message",this.handleMessage.bind(this))),(i=this.loadListener)==null||i.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){let n=t;if(n.data.type!=="rrweb"||n.origin!==n.data.origin||!t.source)return;let i=this.crossOriginIframeMap.get(t.source);if(!i)return;let o=this.transformCrossOriginEvent(i,n.data.event);o&&this.wrappedEmit(o,n.data.isCheckout)}transformCrossOriginEvent(t,n){var r;switch(n.type){case z.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(n.data.node,t);let i=n.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(n.data.node,i),{timestamp:n.timestamp,type:z.IncrementalSnapshot,data:{source:V.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:n.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case z.Meta:case z.Load:case z.DomContentLoaded:return!1;case z.Plugin:return n;case z.Custom:return this.replaceIds(n.data.payload,t,["id","parentId","previousId","nextId"]),n;case z.IncrementalSnapshot:switch(n.data.source){case V.Mutation:return n.data.adds.forEach(i=>{this.replaceIds(i,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,t);let o=this.crossOriginIframeRootIdMap.get(t);o&&this.patchRootIdOnNode(i.node,o)}),n.data.removes.forEach(i=>{this.replaceIds(i,t,["parentId","id"])}),n.data.attributes.forEach(i=>{this.replaceIds(i,t,["id"])}),n.data.texts.forEach(i=>{this.replaceIds(i,t,["id"])}),n;case V.Drag:case V.TouchMove:case V.MouseMove:return n.data.positions.forEach(i=>{this.replaceIds(i,t,["id"])}),n;case V.ViewportResize:return!1;case V.MediaInteraction:case V.MouseInteraction:case V.Scroll:case V.CanvasMutation:case V.Input:return this.replaceIds(n.data,t,["id"]),n;case V.StyleSheetRule:case V.StyleDeclaration:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleId"]),n;case V.Font:return n;case V.Selection:return n.data.ranges.forEach(i=>{this.replaceIds(i,t,["start","end"])}),n;case V.AdoptedStyleSheet:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleIds"]),(r=n.data.styles)==null||r.forEach(i=>{this.replaceStyleIds(i,t,["styleId"])}),n}}return!1}replace(t,n,r,i){for(let o of i)!Array.isArray(n[o])&&typeof n[o]!="number"||(Array.isArray(n[o])?n[o]=t.getIds(r,n[o]):n[o]=t.getId(r,n[o]));return n}replaceIds(t,n,r){return this.replace(this.crossOriginIframeMirror,t,n,r)}replaceStyleIds(t,n,r){return this.replace(this.crossOriginIframeStyleMirror,t,n,r)}replaceIdOnNode(t,n){this.replaceIds(t,n,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(r=>{this.replaceIdOnNode(r,n)})}patchRootIdOnNode(t,n){t.type!==tx.Document&&!t.rootId&&(t.rootId=n),"childNodes"in t&&t.childNodes.forEach(r=>{this.patchRootIdOnNode(r,n)})}},Xd=class{constructor(t){R(this,"shadowDoms",new WeakSet),R(this,"mutationCb"),R(this,"scrollCb"),R(this,"bypassOptions"),R(this,"mirror"),R(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,n){if(!wi(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);let r=rx({...this.bypassOptions,doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(ix({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(F.host(t))),this.restoreHandlers.push(ox({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,n){let r=this;this.restoreHandlers.push(Mn(t.prototype,"attachShadow",function(i){return function(o){let s=i.call(this,o),a=F.shadowRoot(this);return a&&ex(this)&&r.addShadowRoot(a,n),s}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},pr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",S$=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(bi=0;bi<pr.length;bi++)S$[pr.charCodeAt(bi)]=bi;var bi,w$=function(e){var t=new Uint8Array(e),n,r=t.length,i="";for(n=0;n<r;n+=3)i+=pr[t[n]>>2],i+=pr[(t[n]&3)<<4|t[n+1]>>4],i+=pr[(t[n+1]&15)<<2|t[n+2]>>6],i+=pr[t[n+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i};var cS=new Map;function x$(e,t){let n=cS.get(e);return n||(n=new Map,cS.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}var sx=(e,t,n)=>{if(!e||!(lx(e,t)||typeof e=="object"))return;let r=e.constructor.name,i=x$(n,r),o=i.indexOf(e);return o===-1&&(o=i.length,i.push(e)),o};function ea(e,t,n){if(e instanceof Array)return e.map(r=>ea(r,t,n));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){let r=e.constructor.name,i=w$(e);return{rr_type:r,base64:i}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[ea(e.buffer,t,n),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let r=e.constructor.name,{src:i}=e;return{rr_type:r,src:i}}else if(e instanceof HTMLCanvasElement){let r="HTMLImageElement",i=e.toDataURL();return{rr_type:r,src:i}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[ea(e.data,t,n),e.width,e.height]};if(lx(e,t)||typeof e=="object"){let r=e.constructor.name,i=sx(e,t,n);return{rr_type:r,index:i}}}}return e}var ax=(e,t,n)=>e.map(r=>ea(r,t,n)),lx=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof t[i]=="function").find(i=>e instanceof t[i]);function v$(e,t,n,r){let i=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let s of o)try{if(typeof t.CanvasRenderingContext2D.prototype[s]!="function")continue;let a=Mn(t.CanvasRenderingContext2D.prototype,s,function(l){return function(...u){return We(this.canvas,n,r,!0)||setTimeout(()=>{let c=ax(u,t,this);e(this.canvas,{type:xr["2D"],property:s,args:c})},0),l.apply(this,u)}});i.push(a)}catch{let a=Pa(t.CanvasRenderingContext2D.prototype,s,{set(l){e(this.canvas,{type:xr["2D"],property:s,args:[l],setter:!0})}});i.push(a)}return()=>{i.forEach(s=>s())}}function R$(e){return e==="experimental-webgl"?"webgl":e}function dS(e,t,n,r){let i=[];try{let o=Mn(e.HTMLCanvasElement.prototype,"getContext",function(s){return function(a,...l){if(!We(this,t,n,!0)){let u=R$(a);if("__context"in this||(this.__context=u),r&&["webgl","webgl2"].includes(u))if(l[0]&&typeof l[0]=="object"){let c=l[0];c.preserveDrawingBuffer||(c.preserveDrawingBuffer=!0)}else l.splice(0,1,{preserveDrawingBuffer:!0})}return s.apply(this,[a,...l])}});i.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(o=>o())}}function fS(e,t,n,r,i,o){let s=[],a=Object.getOwnPropertyNames(e);for(let l of a)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if(typeof e[l]!="function")continue;let u=Mn(e,l,function(c){return function(...d){let f=c.apply(this,d);if(sx(f,o,this),"tagName"in this.canvas&&!We(this.canvas,r,i,!0)){let p=ax(d,o,this),h={type:t,property:l,args:p};n(this.canvas,h)}return f}});s.push(u)}catch{let u=Pa(e,l,{set(c){n(this.canvas,{type:t,property:l,args:[c],setter:!0})}});s.push(u)}return s}function A$(e,t,n,r){let i=[];return i.push(...fS(t.WebGLRenderingContext.prototype,xr.WebGL,e,n,r,t)),typeof t.WebGL2RenderingContext<"u"&&i.push(...fS(t.WebGL2RenderingContext.prototype,xr.WebGL2,e,n,r,t)),()=>{i.forEach(o=>o())}}var ux="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",C$=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),hS=typeof window<"u"&&window.Blob&&new Blob([C$(ux)],{type:"text/javascript;charset=utf-8"});function E$(e){let t;try{if(t=hS&&(window.URL||window.webkitURL).createObjectURL(hS),!t)throw"";let n=new Worker(t,{name:e?.name});return n.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker("data:text/javascript;base64,"+ux,{name:e?.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var Jd=class{constructor(t){R(this,"pendingCanvasMutations",new Map),R(this,"rafStamps",{latestId:0,invokeId:null}),R(this,"mirror"),R(this,"mutationCb"),R(this,"resetObservers"),R(this,"frozen",!1),R(this,"locked",!1),R(this,"processMutation",(l,u)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(l)||this.pendingCanvasMutations.set(l,[]),this.pendingCanvasMutations.get(l).push(u)});let{sampling:n="all",win:r,blockClass:i,blockSelector:o,recordCanvas:s,dataURLOptions:a}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,s&&n==="all"&&this.initCanvasMutationObserver(r,i,o),s&&typeof n=="number"&&this.initCanvasFPSObserver(n,r,i,o,{dataURLOptions:a})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(t,n,r,i,o){let s=dS(n,r,i,!0),a=new Map,l=new E$;l.onmessage=h=>{let{id:m}=h.data;if(a.set(m,!1),!("base64"in h.data))return;let{base64:y,type:S,width:w,height:g}=h.data;this.mutationCb({id:m,type:xr["2D"],commands:[{property:"clearRect",args:[0,0,w,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:y}],type:S}]},0,0]}]})};let u=1e3/t,c=0,d,f=()=>{let h=[];return n.document.querySelectorAll("canvas").forEach(m=>{We(m,r,i,!0)||h.push(m)}),h},p=h=>{if(c&&h-c<u){d=requestAnimationFrame(p);return}c=h,f().forEach(async m=>{var y;let S=this.mirror.getId(m);if(a.get(S)||m.width===0||m.height===0)return;if(a.set(S,!0),["webgl","webgl2"].includes(m.__context)){let g=m.getContext(m.__context);((y=g?.getContextAttributes())==null?void 0:y.preserveDrawingBuffer)===!1&&g.clear(g.COLOR_BUFFER_BIT)}let w=await createImageBitmap(m);l.postMessage({id:S,bitmap:w,width:m.width,height:m.height,dataURLOptions:o.dataURLOptions},[w])}),d=requestAnimationFrame(p)};d=requestAnimationFrame(p),this.resetObservers=()=>{s(),cancelAnimationFrame(d)}}initCanvasMutationObserver(t,n,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=dS(t,n,r,!1),o=v$(this.processMutation.bind(this),t,n,r),s=A$(this.processMutation.bind(this),t,n,r);this.resetObservers=()=>{i(),o(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let t=n=>{this.rafStamps.latestId=n,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,n)=>{let r=this.mirror.getId(n);this.flushPendingCanvasMutationFor(n,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,n){if(this.frozen||this.locked)return;let r=this.pendingCanvasMutations.get(t);if(!r||n===-1)return;let i=r.map(s=>{let{type:a,...l}=s;return l}),{type:o}=r[0];this.mutationCb({id:n,type:o,commands:i}),this.pendingCanvasMutations.delete(t)}},Qd=class{constructor(t){R(this,"trackedLinkElements",new WeakSet),R(this,"mutationCb"),R(this,"adoptedStyleSheetCb"),R(this,"styleMirror",new Hd),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,n){"_cssText"in n.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:n.id,attributes:n.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,n){if(t.length===0)return;let r={id:n,styleIds:[]},i=[];for(let o of t){let s;this.styleMirror.has(o)?s=this.styleMirror.getId(o):(s=this.styleMirror.add(o),i.push({styleId:s,rules:Array.from(o.rules||CSSRule,(a,l)=>({rule:gS(a,o.href),index:l}))})),r.styleIds.push(s)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},ef=class{constructor(){R(this,"nodeMap",new WeakMap),R(this,"active",!1)}inOtherBuffer(t,n){let r=this.nodeMap.get(t);return r&&Array.from(r).some(i=>i!==n)}add(t,n){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(n))}destroy(){}},ve,ta,dd,ba=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((m1=e.contentWindow)==null?void 0:m1.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var gt=PN();function Tn(e={}){let{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:s="rr-ignore",ignoreSelector:a=null,maskTextClass:l="rr-mask",maskTextSelector:u=null,inlineStylesheet:c=!0,maskAllInputs:d,maskInputOptions:f,slimDOMOptions:p,maskInputFn:h,maskTextFn:m,hooks:y,packFn:S,sampling:w={},dataURLOptions:g={},mousemoveWait:x,recordDOM:k=!0,recordCanvas:O=!1,recordCrossOriginIframes:N=!1,recordAfter:_=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:I=!1,collectFonts:B=!1,inlineImages:U=!1,plugins:ne,keepIframeSrcFn:$=()=>!1,ignoreCSSAttributes:Me=new Set([]),errorHandler:qe}=e;i$(qe);let ae=N?window.parent===window:!0,Oe=!1;if(!ae)try{window.parent.document&&(Oe=!1)}catch{Oe=!0}if(ae&&!t)throw new Error("emit function is required");if(!ae&&!Oe)return()=>{};x!==void 0&&w.mousemove===void 0&&(w.mousemove=x),gt.reset();let xt=d===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:f!==void 0?f:{password:!0},Ee=RS(p);Q_();let Di,vr=0,On=K=>{for(let ze of ne||[])ze.eventProcessor&&(K=ze.eventProcessor(K));return S&&!Oe&&(K=S(K)),K};ve=(K,ze)=>{var de;let be=K;if(be.timestamp=ma(),(de=En[0])!=null&&de.isFrozen()&&be.type!==z.FullSnapshot&&!(be.type===z.IncrementalSnapshot&&be.data.source===V.Mutation)&&En.forEach(Ke=>Ke.unfreeze()),ae)t?.(On(be),ze);else if(Oe){let Ke={type:"rrweb",event:On(be),origin:window.location.origin,isCheckout:ze};window.parent.postMessage(Ke,"*")}if(be.type===z.FullSnapshot)Di=be,vr=0;else if(be.type===z.IncrementalSnapshot){if(be.data.source===V.Mutation&&be.data.isAttachIframe)return;vr++;let Ke=r&&vr>=r,re=n&&be.timestamp-Di.timestamp>n;(Ke||re)&&ta(!0)}};let st=K=>{ve({type:z.IncrementalSnapshot,data:{source:V.Mutation,...K}})},Rr=K=>ve({type:z.IncrementalSnapshot,data:{source:V.Scroll,...K}}),Xt=K=>ve({type:z.IncrementalSnapshot,data:{source:V.CanvasMutation,...K}}),Ar=K=>ve({type:z.IncrementalSnapshot,data:{source:V.AdoptedStyleSheet,...K}}),at=new Qd({mutationCb:st,adoptedStyleSheetCb:Ar}),vt=new Zd({mirror:gt,mutationCb:st,stylesheetManager:at,recordCrossOriginIframes:N,wrappedEmit:ve});for(let K of ne||[])K.getMirror&&K.getMirror({nodeMirror:gt,crossOriginIframeMirror:vt.crossOriginIframeMirror,crossOriginIframeStyleMirror:vt.crossOriginIframeStyleMirror});let Nn=new ef;dd=new Jd({recordCanvas:O,mutationCb:Xt,win:window,blockClass:i,blockSelector:o,mirror:gt,sampling:w.canvas,dataURLOptions:g});let _n=new Xd({mutationCb:st,scrollCb:Rr,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:u,inlineStylesheet:c,maskInputOptions:xt,dataURLOptions:g,maskTextFn:m,maskInputFn:h,recordCanvas:O,inlineImages:U,sampling:w,slimDOMOptions:Ee,iframeManager:vt,stylesheetManager:at,canvasManager:dd,keepIframeSrcFn:$,processedNodeManager:Nn},mirror:gt});ta=(K=!1)=>{if(!k)return;ve({type:z.Meta,data:{href:window.location.href,width:Kw(),height:qw()}},K),at.reset(),_n.init(),En.forEach(de=>de.lock());let ze=QN(document,{mirror:gt,blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:u,inlineStylesheet:c,maskAllInputs:xt,maskTextFn:m,maskInputFn:h,slimDOM:Ee,dataURLOptions:g,recordCanvas:O,inlineImages:U,onSerialize:de=>{Xw(de,gt)&&vt.addIframe(de),Jw(de,gt)&&at.trackLinkElement(de),Gd(de)&&_n.addShadowRoot(F.shadowRoot(de),document)},onIframeLoad:(de,be)=>{vt.attachIframe(de,be),_n.observeAttachShadow(de)},onStylesheetLoad:(de,be)=>{at.attachLinkElement(de,be)},keepIframeSrcFn:$});if(!ze)return console.warn("Failed to snapshot the document");ve({type:z.FullSnapshot,data:{node:ze,initialOffset:Hw(window)}},K),En.forEach(de=>de.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&at.adoptStyleSheets(document.adoptedStyleSheets,gt.getId(document))};try{let K=[],ze=be=>{var Ke;return q(b$)({mutationCb:st,mousemoveCb:(re,Ma)=>ve({type:z.IncrementalSnapshot,data:{source:Ma,positions:re}}),mouseInteractionCb:re=>ve({type:z.IncrementalSnapshot,data:{source:V.MouseInteraction,...re}}),scrollCb:Rr,viewportResizeCb:re=>ve({type:z.IncrementalSnapshot,data:{source:V.ViewportResize,...re}}),inputCb:re=>ve({type:z.IncrementalSnapshot,data:{source:V.Input,...re}}),mediaInteractionCb:re=>ve({type:z.IncrementalSnapshot,data:{source:V.MediaInteraction,...re}}),styleSheetRuleCb:re=>ve({type:z.IncrementalSnapshot,data:{source:V.StyleSheetRule,...re}}),styleDeclarationCb:re=>ve({type:z.IncrementalSnapshot,data:{source:V.StyleDeclaration,...re}}),canvasMutationCb:Xt,fontCb:re=>ve({type:z.IncrementalSnapshot,data:{source:V.Font,...re}}),selectionCb:re=>{ve({type:z.IncrementalSnapshot,data:{source:V.Selection,...re}})},customElementCb:re=>{ve({type:z.IncrementalSnapshot,data:{source:V.CustomElement,...re}})},blockClass:i,ignoreClass:s,ignoreSelector:a,maskTextClass:l,maskTextSelector:u,maskInputOptions:xt,inlineStylesheet:c,sampling:w,recordDOM:k,recordCanvas:O,inlineImages:U,userTriggeredOnInput:I,collectFonts:B,doc:be,maskInputFn:h,maskTextFn:m,keepIframeSrcFn:$,blockSelector:o,slimDOMOptions:Ee,dataURLOptions:g,mirror:gt,iframeManager:vt,stylesheetManager:at,shadowDomManager:_n,processedNodeManager:Nn,canvasManager:dd,ignoreCSSAttributes:Me,plugins:((Ke=ne?.filter(re=>re.observer))==null?void 0:Ke.map(re=>({observer:re.observer,options:re.options,callback:Ma=>ve({type:z.Plugin,data:{plugin:re.name,payload:Ma}})})))||[]},y)};vt.addLoadListener(be=>{try{K.push(ze(be.contentDocument))}catch(Ke){console.warn(Ke)}});let de=()=>{ta(),K.push(ze(document)),ba=!0};return["interactive","complete"].includes(document.readyState)?de():(K.push(Ve("DOMContentLoaded",()=>{ve({type:z.DomContentLoaded,data:{}}),_==="DOMContentLoaded"&&de()})),K.push(Ve("load",()=>{ve({type:z.Load,data:{}}),_==="load"&&de()},window))),()=>{K.forEach(be=>{try{be()}catch(Ke){String(Ke).toLowerCase().includes("cross-origin")||console.warn(Ke)}}),Nn.destroy(),ba=!1,o$()}}catch(K){console.warn(K)}}Tn.addCustomEvent=(e,t)=>{if(!ba)throw new Error("please add custom event after start recording");ve({type:z.Custom,data:{tag:e,payload:t}})};Tn.freezePage=()=>{En.forEach(e=>e.freeze())};Tn.takeFullSnapshot=e=>{if(!ba)throw new Error("please take full snapshot after start recording");ta(e)};Tn.mirror=gt;var pS;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(pS||(pS={}));var lz=5*1e3;var{addCustomEvent:uz}=Tn,{freezePage:cz}=Tn,{takeFullSnapshot:dz}=Tn;var fx="__ripploEmitRrwebEvent";function hx(){return{eventTypes:cx(z),incrementalSources:cx(V)}}function cx(e){return Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="number").map(([t,n])=>[n,t]))}var I$=Zc("@ripplo/rrweb-bundle/bundle","rrweb.js"),dx;function px(){return dx??=k$(I$,{encoding:"utf8"}),dx}async function Ef({clientVersion:e,debugDir:t,writeOtlpPortFile:n}){let r=new Map,i=c1(hx()),o=await Xc({localDir:mx.join(mx.dirname(t),".local"),writePortFile:n,onRrwebBatch:(l,u)=>{r.get(l)?.emitRrwebBatch(u)},onSpan:l=>{let u=l.attributes["ripplo.run"];u!=null&&r.get(u)?.emit(l)}}),s=await px();return{attach:async(l,u)=>{let c=u1({debugDir:t,runId:u,worker:i});c.emit({clientVersion:e,kind:"meta",source:"capture",timeNanos:"0"}),r.set(u,c),await f1(l,u),await l.addInitScript(`globalThis.__ripploCapturePort = ${String(o.port)};`),await M$(l,c),await N$(l,c);let d=[];return{emitAction:f=>{L$(c,f)},emitAssertion:f=>{D$(c,f)},finish:()=>_$(c,{pages:d,registry:r,runId:u}),onPage:f=>{d.push(f),$$(c,s,f)}}},debugDir:t,close:async()=>{await o.stop(),await i.terminate()},injectSpan:(l,u)=>{r.get(l)?.emit(u)}}}async function P$(e){await Promise.all(e.map(t=>t.evaluate("globalThis.__ripploFlushRrweb ? globalThis.__ripploFlushRrweb() : undefined").catch(()=>{})))}async function M$(e,t){await e.exposeBinding(fx,(n,r)=>{let i=typeof r=="string"?r:JSON.stringify(r);t.emitRrwebBatch(Buffer.from(i,"utf8"))})}var T$="__ripploEventPush",O$=wt.discriminatedUnion("kind",[wt.object({kind:wt.literal("console"),level:wt.string(),text:wt.string(),timestamp:wt.number()}),wt.object({kind:wt.literal("error"),message:wt.string(),stack:wt.string().optional(),timestamp:wt.number()})]);async function N$(e,t){await e.exposeBinding(T$,(n,r)=>{let i=O$.safeParse(r);if(!i.success)return;let o=i.data;if(o.kind==="console"){t.emit({kind:"console",level:o.level,source:"browser",text:o.text,timeNanos:lr(o.timestamp)});return}t.emit({kind:"error",message:o.message,source:"browser",stack:o.stack,timeNanos:lr(o.timestamp)})})}async function _$(e,t){await P$(t.pages),t.registry.delete(t.runId),await e.close({noticeIfNoRrweb:"rrweb capture unavailable: recorder never pushed an event \u2014 page never loaded the recorder (blank page, failed navigation, or CSP block)"})}function $$(e,t,n){n.on("load",()=>{n.addScriptTag({content:t}).catch(()=>{})}),n.on("response",r=>{j$(e,r)})}function L$(e,t){e.emit({action:t.kind,kind:"action",source:"test",target:F$(t),timeNanos:lr(Date.now()),value:B$(t)})}function D$(e,t){let n=To(t);e.emit({kind:"assertion",label:n.label,outcome:t.outcome,source:"test",step:n.step,timeNanos:lr(Date.now())})}function F$(e){if(e.url!=null)return e.url;if(e.locator!=null)return Cf(e.locator)}function Cf(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${Cf(e.scope)} \u25B8 ${Cf(e.target)}`:`${e.role} ${e.name??""}`.trim()}function B$(e){return e.value!=null?typeof e.value=="object"?JSON.stringify(e.value):String(e.value):e.key}var U$=/^http:\/\/127\.0\.0\.1:\d+\/rrweb\//;function j$(e,t){let n=t.request(),r=n.resourceType();if(r!=="fetch"&&r!=="xhr"||U$.test(n.url()))return;let i=n.headers().traceparent?.split("-"),o=n.timing().startTime;e.emit({kind:"network",method:n.method(),resourceType:r,source:"browser",spanId:i?.[2],status:t.status(),timeNanos:lr(o>0?o:Date.now()),traceId:i?.[1],url:t.url()})}function G$({clientVersion:e,debugDir:t,headed:n,writeOtlpPortFile:r}){let i=hs({headed:n}),o,s,a=async()=>(o??=Ef({clientVersion:e,debugDir:t,writeOtlpPortFile:r}),s=await o,s),l=async(d,f)=>{if(f.aborted)return W$(fi("skipped"));try{let p=await a();return d.options.headed&&!n?await Pc(!0,async h=>qc({browser:h,hub:p,request:d},f)):await qc({browser:await i.acquire(),hub:p,request:d},f)}catch(p){return V$(pn(p))}};return{close:async()=>{await i.close();let d=o;o=void 0,s=void 0,d!=null&&await d.then(f=>f.close()).catch(()=>{})},prewarm:async()=>{await a(),await i.acquire()},injectSpan:(d,f)=>{s?.injectSpan(d,f)},runOnce:(d,f)=>new z$(l(d,f))}}function H$(e){let t=n=>e.find(r=>r.phase===n)?.ms??0;return{browserMs:t("browser"),driveMs:t("drive"),engineMs:t("engine"),teardownMs:t("teardown"),worldMs:t("world")}}async function q$(e,t){let n=await Sx({attemptIndex:0,capture:!1,params:e,stepRuns:e.stepRuns},t);return n.kind!=="completed"?gx(n):n.findings.length===0?{kind:"clean",timing:{confirm:void 0,detect:n.timing}}:K$(e,kf(e.baseState.name,n.findings),n.timing,t)}function gx(e){return e.kind==="error"?{error:e.error,kind:"error"}:{kind:e.kind}}async function K$(e,t,n,r){let i=await Sx({attemptIndex:1,capture:!0,params:e,stepRuns:e.stepRuns},r);if(i.kind!=="completed")return gx(i);let o={confirm:i.timing,detect:n};return kf(e.baseState.name,i.findings).signature!==t.signature?{kind:"flaky",timing:o}:{baseState:e.baseState.name,captureEvents:i.events,kind:"finding",runId:i.runId,signature:t.signature,timing:o,verifierLayer:t.layer}}function bx(e){return e.kind==="driver-error"||e.kind==="unrunnable"?"crash":e.kind==="pending-check"?e.source.kind==="data-rule"?"data-rule":e.source.kind==="page-rule"?"page-rule":"frame":"frame"}async function Sx({attemptIndex:e,capture:t,params:n,stepRuns:r},i){let o=n.runIdFor(e),s=[],a=[];return(await n.session.runOnce({capture:t,lockfile:n.lockfile,onEvent:t?u=>{s.push(u)}:void 0,options:n.options,params:void 0,runId:o,sequence:Y$(n,r),test:n.baseState.test,onPhase:(u,c)=>{a.push({ms:c,phase:u})}},i)).match(u=>u.aborted?{kind:"aborted"}:{events:s,findings:u.findings,kind:"completed",runId:o,timing:H$(a)},u=>({error:u,kind:"error"}))}function Y$(e,t){return t.map(n=>{let r=e.corpus[n.idx];if(r==null)throw new Error("transition index out of corpus range");return{params:n.params,transition:r}})}function kf(e,t){let r=t.map(i=>({line:Yl(i),part:X$(i)})).toSorted((i,o)=>G(i.part).localeCompare(G(o.part))).map(i=>i.part);return{layer:Z$(r),signature:G({baseState:e,parts:r.map(i=>G(i))})}}var yx={crash:0,"data-rule":1,frame:3,"page-rule":2};function Z$(e){return e.map(n=>n.layer).toSorted((n,r)=>yx[n]-yx[r]).at(0)??"frame"}function X$(e){let t=bx(e);switch(e.kind){case"consistency":return{kind:"consistency",layer:t,mismatch:J$(e.mismatch),step:e.step==null?null:{intent:e.step.intent,test:e.step.test}};case"pending-check":return{kind:"pending-check",layer:t,source:e.source.kind,step:{intent:e.step.intent,test:e.step.test}};case"unrunnable":return{intent:e.intent,kind:"unrunnable",layer:t,reason:e.reason,test:e.test};case"driver-error":return{error:e.error.kind,kind:"driver-error",layer:t,step:e.step.intent};case"impossible-action":return{kind:"impossible-action",layer:t,step:e.step.intent}}}function J$(e){return e.kind==="singleton-mismatch"?{kind:e.kind,singleton:e.singleton}:{entity:e.entity,kind:e.kind}}async function Q$({lockfile:e,options:t,repro:n,runId:r,session:i,signal:o}){let s=await us(e);if(s==null)return{kind:"unplannable"};let a=[...s.startingPointTests.values()].find(c=>rt(c)===n.baseStateRef);if(a==null)return{kind:"unplannable"};let l=n.steps.map(c=>{let d=s.corpus.find(f=>f.test===c.test&&f.index===c.index);return d==null?null:{params:c.params,transition:d}});return l.some(c=>c==null)?{kind:"unplannable"}:(await i.runOnce({capture:!1,lockfile:e,onEvent:void 0,onPhase:void 0,options:t,params:void 0,runId:r,sequence:l.filter(c=>c!=null),test:a},o)).match(c=>c.aborted?{kind:"aborted"}:c.findings.length>0?{findings:c.findings,kind:"still-fails"}:{kind:"resolved"},c=>({kind:"state-unavailable",reason:c.kind}))}function Zz(e){switch(e.kind){case"empty-response":return"ripplo daemon: cloud tunnel provisioning returned no result. Check server logs and retry.";case"server-error":return`ripplo daemon: cloud tunnel provisioning failed (${e.typename}). Run \`npx ripplo doctor\` to check your setup.`}}function Xz(e){switch(e.kind){case"already-running":return`ripplo daemon: daemon already running (socket ${e.socketPath}).`;case"bind-failed":return`ripplo daemon: failed to bind IPC socket: ${e.message}`}}function Jz({projectId:e,serverUrl:t}){return[`Project "${e}" (from .ripplo/project.json) was not found on ${t}, or this account does not have access to it.`,"Run `npx ripplo projects list` to see your projects, then update .ripplo/project.json (or re-run `npx ripplo init --project <id>`)."].join(`
|
|
145
|
+
`)}function Qz(){return"Not signed in. Run `npx ripplo auth login`, then start the daemon again."}function eG({devSessionId:e,executor:t,tunnelHostname:n,version:r}){let i=t==="cloud"?`cloud executor via ${n??"?"}`:"local executor";return`ripplo daemon: v${r} ready as ${i} for session ${e} (syncs on every \`npx ripplo run\` \u2014 Ctrl-C to stop)`}function tG({cwd:e,pid:t}){return`ripplo daemon: another daemon is already running for this project${t==null?"":` (pid ${String(t)})`} (cwd ${e}).`}function nG(){return"ripplo daemon: lock compromised \u2014 another daemon likely took over this project. Shutting down."}function rG(e){if(e.kind==="not-running")return"daemon: not running";if(e.kind==="unresponsive")return`daemon: running but no reply within ${String(e.timeoutMs/1e3)}s \u2014 likely busy executing runs, retry when the batch drains`;let{status:t}=e,n=t.version==null?"version unknown (pre-0.7.8)":`v${t.version}`,r=`${String(t.active)} active, ${String(t.queued)} queued`,i=`explorer: ${t.explorer}, ${String(t.exploring)} exploring`,o=`daemon: running (${n} | ${r} | ${i} | ${eL(t.progress)})`;if(t.sseHealth!=null&&!t.sseHealth.ok){let s=t.sseHealth.detail==null?"":`: ${t.sseHealth.detail}`;return`${o}
|
|
146
|
+
daemon: cannot subscribe to run dispatch${s} \u2014 server-side, restarting the daemon will not help`}return o}function eL(e){return e.attempts===0?"explore: idle":`explore: ${String(e.attempts)} attempts, ${String(e.findings)} findings`}function iG(e){let t=e.daemonVersion==null?"an older version":`v${e.daemonVersion}`;return e.kind==="restarted"?`ripplo: daemon was ${t} \u2014 restarted on the current version`:`ripplo: daemon ${t} is older than this CLI but has runs in flight \u2014 restart it when idle to update`}function oG(e){switch(e.kind){case"pass":return{kind:"pass"};case"findings":return{findingLines:e.findings.map(t=>Oo({evidencePath:`.ripplo/debug/${e.runId}/behavior.jsonl`,finding:t})),kind:"findings"};case"error":return{detail:en(e.error),kind:"error"};case"dispatch-failed":return{kind:"dispatch-error",reason:{detail:e.reason,type:"generic"}}}}export{Ua as a,Nx as b,_x as c,Bf as d,Lx as e,el as f,tv as g,nv as h,Qf as i,en as j,rt as k,Ct as l,Sn as m,fp as n,yp as o,zr as p,Ne as q,Oo as r,Pp as s,Mp as t,Tp as u,Gr as v,Q0 as w,nb as x,rb as y,ob as z,us as A,sb as B,Gb as C,Kb as D,Yb as E,Zb as F,Xb as G,Jb as H,Qb as I,g8 as J,Xc as K,G$ as L,q$ as M,Q$ as N,Zz as O,Xz as P,Jz as Q,Qz as R,eG as S,tG as T,nG as U,rG as V,eL as W,iG as X,oG as Y};
|
|
147
147
|
/*! Bundled license information:
|
|
148
148
|
|
|
149
149
|
rrweb/dist/rrweb.js:
|