ripplo 0.7.4 → 0.7.5

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/index.js CHANGED
@@ -1,70 +1,35 @@
1
1
  #!/usr/bin/env node
2
- var NE=Object.create;var Rh=Object.defineProperty;var $E=Object.getOwnPropertyDescriptor;var DE=Object.getOwnPropertyNames;var _E=Object.getPrototypeOf,jE=Object.prototype.hasOwnProperty;var sn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var FE=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of DE(t))!jE.call(e,o)&&o!==r&&Rh(e,o,{get:()=>t[o],enumerable:!(n=$E(t,o))||n.enumerable});return e};var Ti=(e,t,r)=>(r=e!=null?NE(_E(e)):{},FE(t||!e||!e.__esModule?Rh(r,"default",{value:e,enumerable:!0}):r,e));var Mh=sn(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});Li.timingSafeEqual=void 0;function Oh(e,t=""){if(!e)throw new Error(t)}function gP(e,t){if(e.byteLength!==t.byteLength)return!1;e instanceof DataView||(e=new DataView(ArrayBuffer.isView(e)?e.buffer:e)),t instanceof DataView||(t=new DataView(ArrayBuffer.isView(t)?t.buffer:t)),Oh(e instanceof DataView),Oh(t instanceof DataView);let r=e.byteLength,n=0,o=-1;for(;++o<r;)n|=e.getUint8(o)^t.getUint8(o);return n===0}Li.timingSafeEqual=gP});var $h=sn(it=>{"use strict";var yP=it&&it.__extends||(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty(it,"__esModule",{value:!0});var _e=256,Zl=(function(){function e(t){t===void 0&&(t="="),this._paddingCharacter=t}return e.prototype.encodedLength=function(t){return this._paddingCharacter?(t+2)/3*4|0:(t*8+5)/6|0},e.prototype.encode=function(t){for(var r="",n=0;n<t.length-2;n+=3){var o=t[n]<<16|t[n+1]<<8|t[n+2];r+=this._encodeByte(o>>>18&63),r+=this._encodeByte(o>>>12&63),r+=this._encodeByte(o>>>6&63),r+=this._encodeByte(o>>>0&63)}var i=t.length-n;if(i>0){var o=t[n]<<16|(i===2?t[n+1]<<8:0);r+=this._encodeByte(o>>>18&63),r+=this._encodeByte(o>>>12&63),i===2?r+=this._encodeByte(o>>>6&63):r+=this._paddingCharacter||"",r+=this._paddingCharacter||""}return r},e.prototype.maxDecodedLength=function(t){return this._paddingCharacter?t/4*3|0:(t*6+7)/8|0},e.prototype.decodedLength=function(t){return this.maxDecodedLength(t.length-this._getPaddingLength(t))},e.prototype.decode=function(t){if(t.length===0)return new Uint8Array(0);for(var r=this._getPaddingLength(t),n=t.length-r,o=new Uint8Array(this.maxDecodedLength(n)),i=0,s=0,a=0,l=0,c=0,u=0,d=0;s<n-4;s+=4)l=this._decodeChar(t.charCodeAt(s+0)),c=this._decodeChar(t.charCodeAt(s+1)),u=this._decodeChar(t.charCodeAt(s+2)),d=this._decodeChar(t.charCodeAt(s+3)),o[i++]=l<<2|c>>>4,o[i++]=c<<4|u>>>2,o[i++]=u<<6|d,a|=l&_e,a|=c&_e,a|=u&_e,a|=d&_e;if(s<n-1&&(l=this._decodeChar(t.charCodeAt(s)),c=this._decodeChar(t.charCodeAt(s+1)),o[i++]=l<<2|c>>>4,a|=l&_e,a|=c&_e),s<n-2&&(u=this._decodeChar(t.charCodeAt(s+2)),o[i++]=c<<4|u>>>2,a|=u&_e),s<n-3&&(d=this._decodeChar(t.charCodeAt(s+3)),o[i++]=u<<6|d,a|=d&_e),a!==0)throw new Error("Base64Coder: incorrect characters for decoding");return o},e.prototype._encodeByte=function(t){var r=t;return r+=65,r+=25-t>>>8&6,r+=51-t>>>8&-75,r+=61-t>>>8&-15,r+=62-t>>>8&3,String.fromCharCode(r)},e.prototype._decodeChar=function(t){var r=_e;return r+=(42-t&t-44)>>>8&-_e+t-43+62,r+=(46-t&t-48)>>>8&-_e+t-47+63,r+=(47-t&t-58)>>>8&-_e+t-48+52,r+=(64-t&t-91)>>>8&-_e+t-65+0,r+=(96-t&t-123)>>>8&-_e+t-97+26,r},e.prototype._getPaddingLength=function(t){var r=0;if(this._paddingCharacter){for(var n=t.length-1;n>=0&&t[n]===this._paddingCharacter;n--)r++;if(t.length<4||r>2)throw new Error("Base64Coder: incorrect padding")}return r},e})();it.Coder=Zl;var no=new Zl;function bP(e){return no.encode(e)}it.encode=bP;function wP(e){return no.decode(e)}it.decode=wP;var Lh=(function(e){yP(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype._encodeByte=function(r){var n=r;return n+=65,n+=25-r>>>8&6,n+=51-r>>>8&-75,n+=61-r>>>8&-13,n+=62-r>>>8&49,String.fromCharCode(n)},t.prototype._decodeChar=function(r){var n=_e;return n+=(44-r&r-46)>>>8&-_e+r-45+62,n+=(94-r&r-96)>>>8&-_e+r-95+63,n+=(47-r&r-58)>>>8&-_e+r-48+52,n+=(64-r&r-91)>>>8&-_e+r-65+0,n+=(96-r&r-123)>>>8&-_e+r-97+26,n},t})(Zl);it.URLSafeCoder=Lh;var Nh=new Lh;function SP(e){return Nh.encode(e)}it.encodeURLSafe=SP;function vP(e){return Nh.decode(e)}it.decodeURLSafe=vP;it.encodedLength=function(e){return no.encodedLength(e)};it.maxDecodedLength=function(e){return no.maxDecodedLength(e)};it.decodedLength=function(e){return no.decodedLength(e)}});var _h=sn((Dh,Ni)=>{"use strict";(function(e,t){var r={};t(r);var n=r.default;for(var o in r)n[o]=r[o];typeof Ni=="object"&&typeof Ni.exports=="object"?Ni.exports=n:typeof define=="function"&&define.amd?define(function(){return n}):e.sha256=n})(Dh,function(e){"use strict";e.__esModule=!0,e.digestLength=32,e.blockSize=64;var t=new Uint32Array([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]);function r(d,p,h,f,m){for(var g,w,S,y,v,C,M,I,E,x,B,ee,te;m>=64;){for(g=p[0],w=p[1],S=p[2],y=p[3],v=p[4],C=p[5],M=p[6],I=p[7],x=0;x<16;x++)B=f+x*4,d[x]=(h[B]&255)<<24|(h[B+1]&255)<<16|(h[B+2]&255)<<8|h[B+3]&255;for(x=16;x<64;x++)E=d[x-2],ee=(E>>>17|E<<15)^(E>>>19|E<<13)^E>>>10,E=d[x-15],te=(E>>>7|E<<25)^(E>>>18|E<<14)^E>>>3,d[x]=(ee+d[x-7]|0)+(te+d[x-16]|0);for(x=0;x<64;x++)ee=(((v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7))+(v&C^~v&M)|0)+(I+(t[x]+d[x]|0)|0)|0,te=((g>>>2|g<<30)^(g>>>13|g<<19)^(g>>>22|g<<10))+(g&w^g&S^w&S)|0,I=M,M=C,C=v,v=y+ee|0,y=S,S=w,w=g,g=ee+te|0;p[0]+=g,p[1]+=w,p[2]+=S,p[3]+=y,p[4]+=v,p[5]+=C,p[6]+=M,p[7]+=I,f+=64,m-=64}return f}var n=(function(){function d(){this.digestLength=e.digestLength,this.blockSize=e.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return d.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},d.prototype.clean=function(){for(var p=0;p<this.buffer.length;p++)this.buffer[p]=0;for(var p=0;p<this.temp.length;p++)this.temp[p]=0;this.reset()},d.prototype.update=function(p,h){if(h===void 0&&(h=p.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var f=0;if(this.bytesHashed+=h,this.bufferLength>0){for(;this.bufferLength<64&&h>0;)this.buffer[this.bufferLength++]=p[f++],h--;this.bufferLength===64&&(r(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(h>=64&&(f=r(this.temp,this.state,p,f,h),h%=64);h>0;)this.buffer[this.bufferLength++]=p[f++],h--;return this},d.prototype.finish=function(p){if(!this.finished){var h=this.bytesHashed,f=this.bufferLength,m=h/536870912|0,g=h<<3,w=h%64<56?64:128;this.buffer[f]=128;for(var S=f+1;S<w-8;S++)this.buffer[S]=0;this.buffer[w-8]=m>>>24&255,this.buffer[w-7]=m>>>16&255,this.buffer[w-6]=m>>>8&255,this.buffer[w-5]=m>>>0&255,this.buffer[w-4]=g>>>24&255,this.buffer[w-3]=g>>>16&255,this.buffer[w-2]=g>>>8&255,this.buffer[w-1]=g>>>0&255,r(this.temp,this.state,this.buffer,0,w),this.finished=!0}for(var S=0;S<8;S++)p[S*4+0]=this.state[S]>>>24&255,p[S*4+1]=this.state[S]>>>16&255,p[S*4+2]=this.state[S]>>>8&255,p[S*4+3]=this.state[S]>>>0&255;return this},d.prototype.digest=function(){var p=new Uint8Array(this.digestLength);return this.finish(p),p},d.prototype._saveState=function(p){for(var h=0;h<this.state.length;h++)p[h]=this.state[h]},d.prototype._restoreState=function(p,h){for(var f=0;f<this.state.length;f++)this.state[f]=p[f];this.bytesHashed=h,this.finished=!1,this.bufferLength=0},d})();e.Hash=n;var o=(function(){function d(p){this.inner=new n,this.outer=new n,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var h=new Uint8Array(this.blockSize);if(p.length>this.blockSize)new n().update(p).finish(h).clean();else for(var f=0;f<p.length;f++)h[f]=p[f];for(var f=0;f<h.length;f++)h[f]^=54;this.inner.update(h);for(var f=0;f<h.length;f++)h[f]^=106;this.outer.update(h),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var f=0;f<h.length;f++)h[f]=0}return d.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},d.prototype.clean=function(){for(var p=0;p<this.istate.length;p++)this.ostate[p]=this.istate[p]=0;this.inner.clean(),this.outer.clean()},d.prototype.update=function(p){return this.inner.update(p),this},d.prototype.finish=function(p){return this.outer.finished?this.outer.finish(p):(this.inner.finish(p),this.outer.update(p,this.digestLength).finish(p)),this},d.prototype.digest=function(){var p=new Uint8Array(this.digestLength);return this.finish(p),p},d})();e.HMAC=o;function i(d){var p=new n().update(d),h=p.digest();return p.clean(),h}e.hash=i,e.default=i;function s(d,p){var h=new o(d).update(p),f=h.digest();return h.clean(),f}e.hmac=s;function a(d,p,h,f){var m=f[0];if(m===0)throw new Error("hkdf: cannot expand more");p.reset(),m>1&&p.update(d),h&&p.update(h),p.update(f),p.finish(d),f[0]++}var l=new Uint8Array(e.digestLength);function c(d,p,h,f){p===void 0&&(p=l),f===void 0&&(f=32);for(var m=new Uint8Array([1]),g=s(p,d),w=new o(g),S=new Uint8Array(w.digestLength),y=S.length,v=new Uint8Array(f),C=0;C<f;C++)y===S.length&&(a(S,w,h,m),y=0),v[C]=S[y++];return w.clean(),S.fill(0),m.fill(0),v}e.hkdf=c;function u(d,p,h,f){for(var m=new o(d),g=m.digestLength,w=new Uint8Array(4),S=new Uint8Array(g),y=new Uint8Array(g),v=new Uint8Array(f),C=0;C*g<f;C++){var M=C+1;w[0]=M>>>24&255,w[1]=M>>>16&255,w[2]=M>>>8&255,w[3]=M>>>0&255,m.reset(),m.update(p),m.update(w),m.finish(y);for(var I=0;I<g;I++)S[I]=y[I];for(var I=2;I<=h;I++){m.reset(),m.update(y).finish(y);for(var E=0;E<g;E++)S[E]^=y[E]}for(var I=0;I<g&&C*g+I<f;I++)v[C*g+I]=S[I]}for(var C=0;C<g;C++)S[C]=y[C]=0;for(var C=0;C<4;C++)w[C]=0;return m.clean(),v}e.pbkdf2=u})});var ec=sn(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.Webhook=an.WebhookVerificationError=void 0;var xP=Mh(),jh=$h(),kP=_h(),Fh=300,Ql=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="ExtendableError",this.stack=new Error(t).stack}},hr=class e extends Ql{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name="WebhookVerificationError"}};an.WebhookVerificationError=hr;var $i=class e{constructor(t,r){if(!t)throw new Error("Secret can't be empty.");if(r?.format==="raw")t instanceof Uint8Array?this.key=t:this.key=Uint8Array.from(t,n=>n.charCodeAt(0));else{if(typeof t!="string")throw new Error("Expected secret to be of type string");t.startsWith(e.prefix)&&(t=t.substring(e.prefix.length)),this.key=jh.decode(t)}}verify(t,r){let n={};for(let p of Object.keys(r))n[p.toLowerCase()]=r[p];let o=n["webhook-id"],i=n["webhook-signature"],s=n["webhook-timestamp"];if(!i||!o||!s)throw new hr("Missing required headers");let a=this.verifyTimestamp(s),c=this.sign(o,a,t).split(",")[1],u=i.split(" "),d=new globalThis.TextEncoder;for(let p of u){let[h,f]=p.split(",");if(h==="v1"&&(0,xP.timingSafeEqual)(d.encode(f),d.encode(c)))return JSON.parse(t.toString())}throw new hr("No matching signature found")}sign(t,r,n){if(typeof n!="string")if(n.constructor.name==="Buffer")n=n.toString();else throw new Error("Expected payload to be of type string or Buffer.");let o=new TextEncoder,i=Math.floor(r.getTime()/1e3),s=o.encode(`${t}.${i}.${n}`);return`v1,${jh.encode(kP.hmac(this.key,s))}`}verifyTimestamp(t){let r=Math.floor(Date.now()/1e3),n=parseInt(t,10);if(isNaN(n))throw new hr("Invalid Signature Headers");if(r-n>Fh)throw new hr("Message timestamp too old");if(n>r+Fh)throw new hr("Message timestamp too new");return new Date(n*1e3)}};an.Webhook=$i;$i.prefix="whsec_"});var ug=sn((Vc,cg)=>{"use strict";var{hasOwnProperty:po}=Object.prototype,Vr=Bc();Vr.configure=Bc;Vr.stringify=Vr;Vr.default=Vr;Vc.stringify=Vr;Vc.configure=Bc;cg.exports=Vr;var vA=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function wr(e){return e.length<5e3&&!vA.test(e)?`"${e}"`:JSON.stringify(e)}function jc(e,t){if(e.length>200||t)return e.sort(t);for(let r=1;r<e.length;r++){let n=e[r],o=r;for(;o!==0&&e[o-1]>n;)e[o]=e[o-1],o--;e[o]=n}return e}var xA=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function Fc(e){return xA.call(e)!==void 0&&e.length!==0}function ag(e,t,r){e.length<r&&(r=e.length);let n=t===","?"":" ",o=`"0":${n}${e[0]}`;for(let i=1;i<r;i++)o+=`${t}"${i}":${n}${e[i]}`;return o}function kA(e){if(po.call(e,"circularValue")){let t=e.circularValue;if(typeof t=="string")return`"${t}"`;if(t==null)return t;if(t===Error||t===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function RA(e){let t;if(po.call(e,"deterministic")&&(t=e.deterministic,typeof t!="boolean"&&typeof t!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return t===void 0?!0:t}function CA(e,t){let r;if(po.call(e,t)&&(r=e[t],typeof r!="boolean"))throw new TypeError(`The "${t}" argument must be of type boolean`);return r===void 0?!0:r}function lg(e,t){let r;if(po.call(e,t)){if(r=e[t],typeof r!="number")throw new TypeError(`The "${t}" argument must be of type number`);if(!Number.isInteger(r))throw new TypeError(`The "${t}" argument must be an integer`);if(r<1)throw new RangeError(`The "${t}" argument must be >= 1`)}return r===void 0?1/0:r}function Br(e){return e===1?"1 item":`${e} items`}function EA(e){let t=new Set;for(let r of e)(typeof r=="string"||typeof r=="number")&&t.add(String(r));return t}function PA(e){if(po.call(e,"strict")){let t=e.strict;if(typeof t!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(t)return r=>{let n=`Object can not safely be stringified. Received type ${typeof r}`;throw typeof r!="function"&&(n+=` (${r.toString()})`),new Error(n)}}}function Bc(e){e={...e};let t=PA(e);t&&(e.bigint===void 0&&(e.bigint=!1),"circularValue"in e||(e.circularValue=Error));let r=kA(e),n=CA(e,"bigint"),o=RA(e),i=typeof o=="function"?o:void 0,s=lg(e,"maximumDepth"),a=lg(e,"maximumBreadth");function l(h,f,m,g,w,S){let y=f[h];switch(typeof y=="object"&&y!==null&&typeof y.toJSON=="function"&&(y=y.toJSON(h)),y=g.call(f,h,y),typeof y){case"string":return wr(y);case"object":{if(y===null)return"null";if(m.indexOf(y)!==-1)return r;let v="",C=",",M=S;if(Array.isArray(y)){if(y.length===0)return"[]";if(s<m.length+1)return'"[Array]"';m.push(y),w!==""&&(S+=w,v+=`
3
- ${S}`,C=`,
4
- ${S}`);let te=Math.min(y.length,a),U=0;for(;U<te-1;U++){let At=l(String(U),y,m,g,w,S);v+=At!==void 0?At:"null",v+=C}let Ke=l(String(U),y,m,g,w,S);if(v+=Ke!==void 0?Ke:"null",y.length-1>a){let At=y.length-a-1;v+=`${C}"... ${Br(At)} not stringified"`}return w!==""&&(v+=`
5
- ${M}`),m.pop(),`[${v}]`}let I=Object.keys(y),E=I.length;if(E===0)return"{}";if(s<m.length+1)return'"[Object]"';let x="",B="";w!==""&&(S+=w,C=`,
6
- ${S}`,x=" ");let ee=Math.min(E,a);o&&!Fc(y)&&(I=jc(I,i)),m.push(y);for(let te=0;te<ee;te++){let U=I[te],Ke=l(U,y,m,g,w,S);Ke!==void 0&&(v+=`${B}${wr(U)}:${x}${Ke}`,B=C)}if(E>a){let te=E-a;v+=`${B}"...":${x}"${Br(te)} not stringified"`,B=C}return w!==""&&B.length>1&&(v=`
7
- ${S}${v}
8
- ${M}`),m.pop(),`{${v}}`}case"number":return isFinite(y)?String(y):t?t(y):"null";case"boolean":return y===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(y);default:return t?t(y):void 0}}function c(h,f,m,g,w,S){switch(typeof f=="object"&&f!==null&&typeof f.toJSON=="function"&&(f=f.toJSON(h)),typeof f){case"string":return wr(f);case"object":{if(f===null)return"null";if(m.indexOf(f)!==-1)return r;let y=S,v="",C=",";if(Array.isArray(f)){if(f.length===0)return"[]";if(s<m.length+1)return'"[Array]"';m.push(f),w!==""&&(S+=w,v+=`
9
- ${S}`,C=`,
10
- ${S}`);let E=Math.min(f.length,a),x=0;for(;x<E-1;x++){let ee=c(String(x),f[x],m,g,w,S);v+=ee!==void 0?ee:"null",v+=C}let B=c(String(x),f[x],m,g,w,S);if(v+=B!==void 0?B:"null",f.length-1>a){let ee=f.length-a-1;v+=`${C}"... ${Br(ee)} not stringified"`}return w!==""&&(v+=`
11
- ${y}`),m.pop(),`[${v}]`}m.push(f);let M="";w!==""&&(S+=w,C=`,
12
- ${S}`,M=" ");let I="";for(let E of g){let x=c(E,f[E],m,g,w,S);x!==void 0&&(v+=`${I}${wr(E)}:${M}${x}`,I=C)}return w!==""&&I.length>1&&(v=`
13
- ${S}${v}
14
- ${y}`),m.pop(),`{${v}}`}case"number":return isFinite(f)?String(f):t?t(f):"null";case"boolean":return f===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(f);default:return t?t(f):void 0}}function u(h,f,m,g,w){switch(typeof f){case"string":return wr(f);case"object":{if(f===null)return"null";if(typeof f.toJSON=="function"){if(f=f.toJSON(h),typeof f!="object")return u(h,f,m,g,w);if(f===null)return"null"}if(m.indexOf(f)!==-1)return r;let S=w;if(Array.isArray(f)){if(f.length===0)return"[]";if(s<m.length+1)return'"[Array]"';m.push(f),w+=g;let x=`
15
- ${w}`,B=`,
16
- ${w}`,ee=Math.min(f.length,a),te=0;for(;te<ee-1;te++){let Ke=u(String(te),f[te],m,g,w);x+=Ke!==void 0?Ke:"null",x+=B}let U=u(String(te),f[te],m,g,w);if(x+=U!==void 0?U:"null",f.length-1>a){let Ke=f.length-a-1;x+=`${B}"... ${Br(Ke)} not stringified"`}return x+=`
17
- ${S}`,m.pop(),`[${x}]`}let y=Object.keys(f),v=y.length;if(v===0)return"{}";if(s<m.length+1)return'"[Object]"';w+=g;let C=`,
18
- ${w}`,M="",I="",E=Math.min(v,a);Fc(f)&&(M+=ag(f,C,a),y=y.slice(f.length),E-=f.length,I=C),o&&(y=jc(y,i)),m.push(f);for(let x=0;x<E;x++){let B=y[x],ee=u(B,f[B],m,g,w);ee!==void 0&&(M+=`${I}${wr(B)}: ${ee}`,I=C)}if(v>a){let x=v-a;M+=`${I}"...": "${Br(x)} not stringified"`,I=C}return I!==""&&(M=`
19
- ${w}${M}
20
- ${S}`),m.pop(),`{${M}}`}case"number":return isFinite(f)?String(f):t?t(f):"null";case"boolean":return f===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(f);default:return t?t(f):void 0}}function d(h,f,m){switch(typeof f){case"string":return wr(f);case"object":{if(f===null)return"null";if(typeof f.toJSON=="function"){if(f=f.toJSON(h),typeof f!="object")return d(h,f,m);if(f===null)return"null"}if(m.indexOf(f)!==-1)return r;let g="",w=f.length!==void 0;if(w&&Array.isArray(f)){if(f.length===0)return"[]";if(s<m.length+1)return'"[Array]"';m.push(f);let M=Math.min(f.length,a),I=0;for(;I<M-1;I++){let x=d(String(I),f[I],m);g+=x!==void 0?x:"null",g+=","}let E=d(String(I),f[I],m);if(g+=E!==void 0?E:"null",f.length-1>a){let x=f.length-a-1;g+=`,"... ${Br(x)} not stringified"`}return m.pop(),`[${g}]`}let S=Object.keys(f),y=S.length;if(y===0)return"{}";if(s<m.length+1)return'"[Object]"';let v="",C=Math.min(y,a);w&&Fc(f)&&(g+=ag(f,",",a),S=S.slice(f.length),C-=f.length,v=","),o&&(S=jc(S,i)),m.push(f);for(let M=0;M<C;M++){let I=S[M],E=d(I,f[I],m);E!==void 0&&(g+=`${v}${wr(I)}:${E}`,v=",")}if(y>a){let M=y-a;g+=`${v}"...":"${Br(M)} not stringified"`}return m.pop(),`{${g}}`}case"number":return isFinite(f)?String(f):t?t(f):"null";case"boolean":return f===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(f);default:return t?t(f):void 0}}function p(h,f,m){if(arguments.length>1){let g="";if(typeof m=="number"?g=" ".repeat(Math.min(m,10)):typeof m=="string"&&(g=m.slice(0,10)),f!=null){if(typeof f=="function")return l("",{"":h},[],f,g,"");if(Array.isArray(f))return c("",h,[],EA(f),g,"")}if(g.length!==0)return u("",h,[],g,"")}return d("",h,[])}return p}});var Py=sn((YQ,Tu)=>{"use strict";var bs=process||{},Cy=bs.argv||[],ys=bs.env||{},BM=!(ys.NO_COLOR||Cy.includes("--no-color"))&&(!!ys.FORCE_COLOR||Cy.includes("--color")||bs.platform==="win32"||(bs.stdout||{}).isTTY&&ys.TERM!=="dumb"||!!ys.CI),VM=(e,t,r=e)=>n=>{let o=""+n,i=o.indexOf(t,e.length);return~i?e+UM(o,t,r,i)+t:e+o+t},UM=(e,t,r,n)=>{let o="",i=0;do o+=e.substring(i,n)+r,i=n+t.length,n=e.indexOf(t,i);while(~n);return o+e.substring(i)},Ey=(e=BM)=>{let t=e?VM:()=>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")}};Tu.exports=Ey();Tu.exports.createColors=Ey});import{execFileSync as BE}from"child_process";import VE from"fs";import Oi from"path";function Gl(e){let t=WE(e);return t??Ch(e)}function Ch(e){let t=Oi.dirname(e);return UE(Oi.join(e,".ripplo"))?e:t===e?null:Ch(t)}function UE(e){try{return VE.statSync(e).isDirectory()}catch{return!1}}function WE(e){let t=HE(["rev-parse","--show-toplevel"],e);if(t==null)return null;let r=t.trim();return r.length===0?null:Oi.isAbsolute(r)?r:Oi.resolve(e,r)}function HE(e,t){try{return BE("git",e,{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]})}catch{return null}}import{readdir as GE,rm as qE,stat as KE}from"fs/promises";import Ih from"path";import zE from"pino";var j=zE({level:process.env.LOG_LEVEL??"info",transport:{options:{ignore:"pid,hostname"},target:"pino-pretty"}});var Eh=Ih.join(process.cwd(),".ripplo","debug"),Ph=360*60*1e3;async function Mi({maxRuns:e}){try{let r=(await GE(Eh,{withFileTypes:!0})).filter(c=>c.isDirectory()),n=Date.now(),o=await Promise.all(r.map(async c=>{let u=Ih.join(Eh,c.name),d=await KE(u);return{dirPath:u,mtime:d.mtimeMs}})),i=o.filter(c=>n-c.mtime>Ph),a=o.filter(c=>n-c.mtime<=Ph).toSorted((c,u)=>u.mtime-c.mtime).slice(e),l=[...i,...a];if(l.length===0)return;await Promise.allSettled(l.map(c=>qE(c.dirPath,{force:!0,recursive:!0}))),j.debug("Pruned %d old debug run(s)",l.length)}catch{j.warn("Debug run pruning failed, ignoring")}}import{print as JE}from"graphql";var YE=15e3,XE=3,ZE=300,fr=class extends Error{detail;serverUrl;constructor({detail:t,serverUrl:r}){super(`Failed to connect to Ripplo server at ${r}. Check the server is running and reachable. Details: ${t}`),this.name="GqlConnectionError",this.detail=t,this.serverUrl=r}},Zn=class extends Error{errors;constructor(t){super(t.map(r=>r.message).join(", ")),this.name="GqlRequestError",this.errors=t}};function Qn(e){if(e instanceof Zn)return e.errors[0]?.extensions?.code}async function D(e){let t=JE(e.document),r=JSON.stringify({query:t,variables:e.variables}),n=`${e.config.ripploServerUrl}/graphql`,o=await QE({init:{body:r,headers:{Authorization:`Bearer ${e.config.token}`,"Content-Type":"application/json"},method:"POST"},serverUrl:e.config.ripploServerUrl,url:n}),i=await rP({res:o,url:n});if(!nP(i))throw new Error("Invalid GraphQL response");if(oP(i))throw new Zn(i.errors);if(i.data==null)throw new Error("No data returned from server");return i.data}async function QE({init:e,serverUrl:t,url:r}){let n=1,o=await Ah({init:e,url:r});for(;o.retryable&&n<XE;)await tP(eP(n)),n+=1,o=await Ah({init:e,url:r});if(o.response!=null)return o.response;throw new fr({detail:o.detail,serverUrl:t})}async function Ah({init:e,url:t}){try{let r=await fetch(t,{...e,signal:AbortSignal.timeout(YE)});return{detail:"",response:r,retryable:r.status>=500}}catch(r){return{detail:r instanceof Error?r.message:String(r),response:void 0,retryable:!0}}}function eP(e){return ZE*3**(e-1)*(.5+Math.random())}function tP(e){return new Promise(t=>{setTimeout(t,e)})}async function rP({res:e,url:t}){let r=await e.text();if(r.length===0)throw new Error(`Empty response from Ripplo server at ${t} (status ${String(e.status)}). The server may have restarted or the request was rejected before a body was sent.`);try{return JSON.parse(r)}catch{throw new Error(`Non-JSON response from Ripplo server at ${t} (status ${String(e.status)}): ${r.slice(0,200)}`)}}function nP(e){return typeof e=="object"&&e!=null&&("data"in e||"errors"in e)}function oP(e){return Array.isArray(e.errors)&&e.errors.length>0}import ro from"fs";import Fr from"fs";import iP from"os";import eo from"path";var sP=".local",aP=".ripplo";function ql(e){return eo.join(e,".ripplo",sP)}function Ut(e){let t=ql(e);Fr.existsSync(t)||Fr.mkdirSync(t,{recursive:!0});let r=eo.join(t,".gitignore");return Fr.existsSync(r)||Fr.writeFileSync(r,`*
21
- `),t}function Ot(e,t){return eo.join(ql(e),t)}function Kl(){return eo.join(iP.homedir(),aP)}function to(){let e=Kl();return Fr.existsSync(e)?Fr.chmodSync(e,448):Fr.mkdirSync(e,{mode:448,recursive:!0}),e}function Mt(e){return eo.join(Kl(),e)}function ft(){let e=process.env.RIPPLO_TOKEN;if(e!=null&&e.trim().length>0)return e.trim();let t=Mt("token");if(!ro.existsSync(t))return null;let r=ro.readFileSync(t,"utf8").trim();return r.length===0?null:r}function Jl(e){to(),ro.writeFileSync(Mt("token"),e+`
22
- `,{mode:384})}function Yl(){let e=Mt("token");return ro.existsSync(e)?(ro.unlinkSync(e),!0):!1}import{Agent as lP,RetryAgent as cP,setGlobalDispatcher as uP}from"undici";var dP=1500,pP=4e3,fP=3,hP=50,mP=100,Th=!1;function Xl(){if(Th)return;Th=!0;let e=new lP({connections:mP,keepAliveMaxTimeout:pP,keepAliveTimeout:dP}),t=new cP(e,{errorCodes:["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT","UND_ERR_REQ_CONTENT_LENGTH_MISMATCH","UND_ERR_SOCKET"],maxRetries:fP,methods:["GET","POST","HEAD","OPTIONS","PUT","DELETE"],minTimeout:hP});uP(t)}var Vh=Ti(ec(),1);import Bh from"crypto";function tc({body:e,secret:t}){let r=new Vh.Webhook(t),n=`msg_${Bh.randomUUID()}`,o=new Date,i=r.sign(n,o,e),s=Math.floor(o.getTime()/1e3);return{"webhook-id":n,"webhook-signature":i,"webhook-timestamp":String(s)}}function rc(){return`whsec_${Bh.randomBytes(24).toString("base64")}`}import zh from"fs";import Bi from"path";import{config as IP}from"dotenv";import{z as ji}from"zod";import{err as AP,ok as Gh}from"neverthrow";import _i from"fs";import ic from"path";import{err as nc,ok as Uh}from"neverthrow";import{z as Di}from"zod";var RP=ic.join(".ripplo","project.json"),oc=[".env",".env.local"],CP=Di.object({envFiles:Di.array(Di.string().min(1)).optional(),projectId:Di.string().min(1)});function Wh(e){return ic.join(e,RP)}function sc(e){let t=Wh(e);return _i.existsSync(t)?EP(t).andThen(r=>{let n=CP.safeParse(r);return n.success?Uh({envFiles:n.data.envFiles??oc,projectId:n.data.projectId}):nc({issues:n.error.issues.map(o=>`${o.path.join(".")}: ${o.message}`),kind:"project-file-invalid",path:t})}):nc({kind:"project-file-missing",path:t})}function ac(e){return sc(e).match(t=>t,()=>{})}function EP(e){try{return Uh(JSON.parse(_i.readFileSync(e,"utf8")))}catch(t){return nc({issues:[t instanceof Error?t.message:String(t)],kind:"project-file-invalid",path:e})}}function Hh({cwd:e,envFiles:t,projectId:r}){let n=Wh(e);_i.mkdirSync(ic.dirname(n),{recursive:!0});let o={projectId:r};t!=null&&!PP(t)&&(o.envFiles=[...t]),_i.writeFileSync(n,JSON.stringify(o,null,2)+`
23
- `)}function PP(e){return e.length!==oc.length?!1:e.every((t,r)=>t===oc[r])}function Wt(e){let r=ac(e)?.envFiles??[".env",".env.local"],n=Bi.join(e,".ripplo");r.forEach(o=>{let i=Bi.resolve(n,o);zh.existsSync(i)&&IP({override:!0,path:i,quiet:!0})}),Fi=void 0}var TP=ji.object({RIPPLO_APP_URL:ji.url(),RIPPLO_ENGINE_URL:ji.url(),RIPPLO_WEBHOOK_SECRET:ji.string().min(1)}),Fi;function ln(){return Fi!=null?Gh(Fi):OP().map(e=>(Fi=e,e))}function lc(e){let r=ac(e)?.envFiles??[],n=Bi.join(e,".ripplo");return r.map(o=>Bi.resolve(n,o)).filter(o=>!zh.existsSync(o))}function OP(){let e=TP.safeParse(process.env);if(!e.success)return AP({issues:e.error.issues.map(r=>`${r.path.join(".")}: ${r.message}`),kind:"env-invalid",missingEnvFiles:lc(process.cwd())});let t=e.data;return Gh({appUrl:t.RIPPLO_APP_URL,engineUrl:t.RIPPLO_ENGINE_URL,webhookSecret:t.RIPPLO_WEBHOOK_SECRET})}import pK from"yargs";import{hideBin as fK}from"yargs/helpers";import{readFileSync as MP}from"fs";import{z as qh}from"zod";var LP=qh.object({version:qh.string()});function Kh(){let e=MP(new URL("../package.json",import.meta.url),"utf8");return LP.parse(JSON.parse(e)).version}var Vi=class extends Error{failure;constructor(t){super(t.kind),this.name="CliError",this.failure=t}};import Pc from"fs";import Xi from"path";import{createJiti as nI}from"jiti";import{err as Zi,ok as pm}from"neverthrow";import{z as P}from"zod";var cc=P.enum(["fast","slow","async"]),cn=P.object({ref:P.string().min(1)}),Lt=P.union([P.string(),P.number(),P.boolean()]),uc=P.object({template:P.array(P.union([P.string(),cn])).min(1)}),et=P.union([cn,Lt,uc,P.null()]),Jh=P.object({kind:P.literal("changed")}),dc=P.union([et,Jh]),Ht=P.union([P.string(),cn,uc]),NP=P.object({by:P.literal("role"),name:P.union([Ht,P.undefined()]).optional().transform(e=>e),role:P.string().min(1)}),$P=P.object({by:P.literal("testId"),value:Ht}),DP=P.object({by:P.literal("inside"),scope:P.lazy(()=>Le),target:P.lazy(()=>Le)}),Le=P.discriminatedUnion("by",[NP,$P,DP]),Ui=P.enum(["string","number","boolean"]),pc=P.enum(["strict","eventual"]),_P=P.object({kind:P.literal("string"),maxLength:P.number().int().positive().optional(),minLength:P.number().int().nonnegative().optional(),pattern:P.string().optional()}),jP=P.object({kind:P.literal("number"),max:P.number().int().optional(),min:P.number().int().optional()}),FP=P.object({kind:P.literal("datetime"),maxOffsetDays:P.number().int(),minOffsetDays:P.number().int()}),Yh=P.discriminatedUnion("kind",[_P,jP,FP]),Xh=P.enum(["company.name","date.iso","internet.email","internet.url","person.fullName","lorem.slug","lorem.word"]),fc=P.object({constraints:Yh.optional(),generator:Xh,name:P.string().min(1),type:Ui,values:P.array(Lt).min(1).optional()}),Zh=P.object({consistency:pc.default("strict"),optional:P.boolean(),stable:P.boolean(),type:Ui,valueSpace:P.string().min(1).optional()}),hc=P.enum(["backend","client"]),mc=P.object({description:P.string().optional(),identity:P.array(P.string().min(1)).min(1),identityKind:P.enum(["surrogate","natural"]),name:P.string().min(1),props:P.record(P.string().min(1),Zh),source:hc.default("backend")}),gc=P.object({consistency:pc.default("strict"),default:Lt,description:P.string().optional(),name:P.string().min(1),source:hc.default("backend"),type:Ui,valueSpace:P.string().min(1).optional()}),zt=P.enum(["url","title","viewport"]);import{z as T}from"zod";var BP=T.discriminatedUnion("kind",[T.object({as:T.string().min(1),kind:T.literal("created"),props:T.record(T.string().min(1),et)}),T.object({as:T.string().min(1),kind:T.literal("updated"),props:T.record(T.string().min(1),dc)}),T.object({kind:T.literal("deleted")})]),VP=T.object({kind:T.literal("is"),value:et}),Qh=T.lazy(()=>T.union([et,WP])),UP=T.object({entity:T.string().min(1),where:T.record(T.string().min(1),Qh)}),WP=T.object({field:T.string().min(1),kind:T.literal("within"),selection:UP}),Gt=T.union([cc,T.undefined()]).optional().transform(e=>e),mr=T.lazy(()=>T.discriminatedUnion("kind",[T.object({kind:T.literal("visible"),locator:Le,wait:Gt}),T.object({kind:T.literal("disabled"),locator:Le,wait:Gt}),T.object({kind:T.literal("enabled"),locator:Le,wait:Gt}),T.object({kind:T.literal("focused"),locator:Le,wait:Gt}),T.object({kind:T.literal("value"),locator:Le,value:Ht,wait:Gt}),T.object({kind:T.literal("text"),locator:Le,value:Ht,wait:Gt}),T.object({assertion:VP,kind:T.literal("singleton"),singleton:T.string().min(1),wait:Gt}),T.object({kind:T.literal("browser"),name:zt,value:Ht,wait:Gt}),T.object({assertion:BP,entity:T.string().min(1),key:T.record(T.string().min(1),Qh),kind:T.literal("state"),wait:Gt}),T.object({kind:T.literal("not"),predicate:mr}),T.object({kind:T.literal("and"),predicates:T.array(mr)}),T.object({entity:T.string().min(1),kind:T.literal("count"),value:T.number().int().nonnegative()}),T.object({condition:mr,consequence:mr,kind:T.literal("when"),otherwise:T.union([mr,T.undefined()]).optional().transform(e=>e)})]));import{z as Wi}from"zod";var HP=Wi.object({__codec:Wi.string().min(1),data:Wi.unknown(),version:Wi.number().int().positive()}),Hi=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}},zi=class extends Error{constructor(t){super(`Codec mismatch: expected "${t.expected}", got "${t.got}"`),this.name="CodecMismatchError"}};function yc({name:e,schema:t}){return{currentVersion:1,name:e,decode:r=>zP({name:e,raw:r,schema:t}),encode:r=>({__codec:e,data:r,version:1})}}function qt(e,t){return JSON.stringify(e.encode(t))}function bc(e,t){let r=JSON.parse(t);return e.decode(r)}function zP({name:e,raw:t,schema:r}){let n=HP.parse(t);if(n.__codec!==e)throw new zi({expected:e,got:n.__codec});if(n.version!==1)throw new Hi({codec:e,currentVersion:1,gotVersion:n.version});return r.parse(n.data)}var Gi="__ripplo__",wc="__ripplo_seed__";import{z as A}from"zod";var em=A.discriminatedUnion("kind",[A.object({kind:A.literal("goto"),url:Ht}),A.object({kind:A.literal("fill"),locator:Le,value:et}),A.object({kind:A.literal("clear"),locator:Le}),A.object({kind:A.literal("click"),locator:Le}),A.object({kind:A.literal("dblclick"),locator:Le}),A.object({kind:A.literal("select"),locator:Le,value:et}),A.object({kind:A.literal("check"),locator:Le}),A.object({kind:A.literal("uncheck"),locator:Le}),A.object({kind:A.literal("hover"),locator:Le}),A.object({files:A.array(A.string().min(1)).min(1),kind:A.literal("upload"),locator:Le}),A.object({key:A.string().min(1),kind:A.literal("press"),locator:Le.optional()})]),tm=A.object({action:em,expect:A.array(mr).default([])}),rm=A.object({example:Lt.optional(),valueSpace:A.string().min(1)}),Sc=A.object({as:A.string().min(1),entity:A.string().min(1),set:A.record(A.string().min(1),et)}),nm=A.object({entity:A.string().min(1),where:A.record(A.string().min(1),et)}),qi=A.object({absent:A.array(nm).default([]),exclusive:A.array(A.string().min(1)).default([]),intent:A.string().min(1),maybe:A.array(Sc).default([]),name:A.string().min(1),params:A.record(A.string().min(1),rm),singletons:A.record(A.string().min(1),et).default({}),sourcePath:A.string().min(1).optional(),steps:A.array(tm).default([]),stub:A.boolean().default(!1),world:A.array(Sc).default([])}),om=A.object({sha256:A.string().regex(/^[0-9a-f]{64}$/u),size:A.number().int().nonnegative()}),Ki=A.object({entities:A.array(mc),fixtures:A.record(A.string().min(1),om).default({}),singletons:A.array(gc).default([]),tests:A.array(qi),valueSpaces:A.array(fc)}),bt=yc({name:"ripplo-lockfile",schema:Ki});import{z as gr}from"zod";var im=gr.object({index:gr.number().int().nonnegative(),kind:gr.string(),target:gr.string(),value:gr.string()}),GP=gr.object({steps:gr.array(im),stub:gr.boolean().default(!1)});function oo(e,t){return{index:t,kind:e.action.kind,target:qP(e.action),value:KP(e.action)}}function fe(e){return e.toLowerCase().replaceAll(/[^a-z0-9]/g,"-").split("-").filter(t=>t.length>0).join("-")}function qP(e){return e.kind==="goto"?Ji(e.url):e.kind==="press"&&e.locator==null?"":Yi(e.locator)}function Ji(e){return typeof e=="string"?e:"ref"in e?`{${e.ref}}`:e.template.map(t=>typeof t=="string"?t:`{${t.ref}}`).join("")}function Yi(e){return e.by==="testId"?`testId=${Ji(e.value)}`:e.by==="inside"?`${Yi(e.scope)} \u25B8 ${Yi(e.target)}`:`${e.role} ${e.name==null?"":Ji(e.name)}`.trim()}function KP(e){return e.kind==="fill"||e.kind==="select"?JP(e.value):e.kind==="press"?e.key:""}function JP(e){return e==null?"":typeof e!="object"?String(e):Ji(e)}import{z as Ne}from"zod";var sm=Ne.enum(["Strict","Lax","None"]),am=Ne.object({domain:Ne.string().min(1),expires:Ne.number(),httpOnly:Ne.boolean(),name:Ne.string().min(1),path:Ne.string().min(1),sameSite:sm,secure:Ne.boolean(),value:Ne.string()}),lm=Ne.object({localStorage:Ne.array(Ne.object({name:Ne.string().min(1),value:Ne.string()})),origin:Ne.string().min(1)}),vc=Ne.object({cookies:Ne.array(am),headers:Ne.record(Ne.string().min(1),Ne.string()).optional(),origins:Ne.array(lm)});import{z as X}from"zod";var xc=X.union([Lt,X.null()]),kc=X.record(X.string().min(1),xc),cm=X.object({as:X.string().min(1),entity:X.string().min(1),fields:X.record(X.string().min(1),et)}),YP=X.object({entities:X.array(cm),runId:X.string().min(1),singletons:X.record(X.string().min(1),xc).default({})}),um=X.object({as:X.string().min(1),row:kc,session:vc.optional()}),Rc=X.object({rows:X.array(um)}),XP=X.object({entities:X.array(X.string().min(1)),runId:X.string().min(1),singletons:X.array(X.string().min(1)).default([])}),Cc=X.object({entities:X.record(X.string().min(1),X.array(kc)),singletons:X.record(X.string().min(1),xc).default({})}),ZP=X.object({runId:X.string().min(1)}),Ec=X.object({ok:X.literal(!0)});import QP from"fs";import io from"path";import un from"typescript";function dm(e){let t=io.join(e,"index.ts"),r=rI(e);QP.mkdirSync(io.dirname(r.tsBuildInfoFile??""),{recursive:!0});let n=un.createIncrementalCompilerHost(r),o=un.createIncrementalProgram({host:n,options:r,rootNames:[t]}),i=[...o.getSyntacticDiagnostics(),...o.getSemanticDiagnostics()];o.emit();let s=i.filter(c=>eI(c,e));if(s.length===0)return{diagnostics:[],ok:!0};let a={getCanonicalFileName:c=>c,getCurrentDirectory:()=>io.dirname(e),getNewLine:()=>`
24
- `};return{diagnostics:un.formatDiagnosticsWithColorAndContext(s,a).split(`
25
- `).filter(c=>c.length>0),ok:!1}}function eI(e,t){let r=e.file?.fileName;return r==null?!0:r.startsWith(t)}var tI=io.join(".local","tsbuildinfo");function rI(e){return{allowImportingTsExtensions:!0,allowJs:!1,esModuleInterop:!0,incremental:!0,module:un.ModuleKind.Preserve,moduleResolution:un.ModuleResolutionKind.Bundler,noEmit:!0,resolveJsonModule:!0,skipLibCheck:!0,strict:!1,target:un.ScriptTarget.ES2022,tsBuildInfoFile:io.join(e,tI)}}var tt=".ripplo/ripplo.lock",so;async function fm(e){let{result:t}=await Kt(e);return t}async function Kt(e){let t=iI(Xi.join(e,".ripplo"));if(so!=null&&so.fingerprint===t&&so.result.isOk())return{fingerprint:t,result:so.result};let r=await ve(e);return so={fingerprint:t,result:r},{fingerprint:t,result:r}}async function ve(e){let t=Xi.join(e,".ripplo"),r=Xi.join(t,"index.ts"),n=dm(t);return n.ok?(await sI(r)).andThen(i=>lI({entryPath:r,exported:i})):Zi({diagnostics:n.diagnostics,kind:"typecheck-failed"})}var oI=new Set([".local","debug","node_modules"]);function iI(e){return hm(e).toSorted((t,r)=>t.localeCompare(r)).join("|")}function hm(e){return(Pc.existsSync(e)?Pc.readdirSync(e,{withFileTypes:!0}):[]).flatMap(r=>{if(oI.has(r.name))return[];let n=Xi.join(e,r.name);if(r.isDirectory())return hm(n);let o=Pc.statSync(n);return[`${n}:${String(o.mtimeMs)}:${String(o.size)}`]})}async function sI(e){try{let r=await nI(import.meta.url,{fsCache:!1,moduleCache:!1,sourceMaps:!0}).import(e),n=r!=null&&typeof r=="object"&&"default"in r?Reflect.get(r,"default"):r;return pm(n)}catch(t){return Zi({kind:"load-threw",message:aI(t)})}}function aI(e){return e instanceof Error?e.message:String(e)}function lI({entryPath:e,exported:t}){if(t==null||typeof t!="object"||!("lockfile"in t))return Zi({entryPath:e,kind:"not-ripplo"});let r=Ki.safeParse(Reflect.get(t,"lockfile"));return r.success?pm(r.data):Zi({issues:r.error.issues.map(n=>`${n.path.join(".")}: ${n.message}`),kind:"invalid-lockfile"})}function V(e,t){return t==null?`Load \`/ripplo:${e}\` skill for instructions.`:`Load \`/ripplo:${e}\` skill for instructions on ${t}.`}function mm(e){return e.length===1?V(e[0]):`REQUIRED before proceeding: load ${e.map(r=>`\`/ripplo:${r}\``).join(" AND ")} skills (load every one \u2014 each carries rules the others don't).`}function Pe(e){return[`Compilation failed: ${cI(e)}`,V("create","DSL authoring + lint rules")].join(`
26
- `)}function ym(){return`${tt} is up to date`}function bm(e){return[`${tt} is ${e==="missing"?"missing":"out of date"} \u2014 run \`ripplo compile\` and commit the result`,V("setup")].join(`
27
- `)}function wm(){return`wrote ${tt}`}function cI(e){switch(e.kind){case"typecheck-failed":return["TypeScript errors in .ripplo/:",...gm(e.diagnostics)].join(`
28
- `);case"not-ripplo":return`${e.entryPath} must default-export a Ripplo (createRipplo({ entities, invariants, singletons, tests })). Check that the default export is the value returned by createRipplo, not a function or a re-export.`;case"invalid-lockfile":return["Lockfile failed schema validation (stale or hand-edited .ripplo/ripplo.lock?):",...gm(e.issues),"Regenerate with `npx ripplo compile` \u2014 never hand-edit the lockfile."].join(`
29
- `);case"load-threw":return[`.ripplo/index.ts threw while loading: ${e.message}`,"Usually a bad import or a top-level throw in .ripplo/ \u2014 run `npx ripplo compile` for the stack."].join(`
30
- `)}}function gm(e,t=8){return e.length<=t?e:[...e.slice(0,t),`\u2026 and ${String(e.length-t)} more`]}function Sm(e){return e instanceof Vi?He(e.failure):e instanceof Error?e.message:String(e)}function He(e){switch(e.kind){case"project-file-missing":return[`Missing ${e.path} \u2014 this directory is not a Ripplo project.`,"Run `npx ripplo init` to create it (or cd into the project root).",V("setup")].join(`
31
- `);case"project-file-invalid":return[`${e.path} is invalid:`,...e.issues.map(t=>` ${t}`),"Fix the file by hand or re-run `npx ripplo init`."].join(`
32
- `);case"not-authenticated":return["Not authenticated. Run `ripplo auth login`.","(Claude Code: run it yourself as a background process \u2014 device-code flow, the user only approves in the browser.)"].join(`
33
- `);case"env-invalid":return uI(e);case"playwright-install-failed":return["Playwright browser installation failed (Chromium still missing after install).","Try manually: `npx playwright install chromium` \u2014 look for network/proxy or disk-space errors in its output."].join(`
34
- `);case"gitdir-unrecognized":return`Unrecognized .git file at ${e.marker} \u2014 expected a directory or a "gitdir:" pointer (worktree). Is the repo corrupted?`;case"gitdir-empty":return`Empty gitdir pointer at ${e.marker} \u2014 the worktree's .git file points nowhere. Re-create the worktree.`;case"oauth-device-code-failed":return[`Could not start sign-in (device-code request failed): ${e.description}`,"Is the Ripplo server reachable? Check RIPPLO_SERVER_URL and retry."].join(`
35
- `);case"oauth-authorization-failed":return[`Sign-in failed (${e.code}): ${e.description}`,e.code==="expired_token"?"The approval window expired \u2014 run `ripplo auth login` again.":"Run `ripplo auth login` to retry."].join(`
36
- `);case"compilation-failed":return Pe(e.error)}}function uI(e){let t=e.missingEnvFiles.length===0?[]:["Declared env file(s) not found at this path:",...e.missingEnvFiles.map(r=>` ${r}`),"If you're in a git worktree, the env file may not have been copied from the main checkout \u2014 recreate it (or symlink to a shared file outside the working tree)."];return["Env config invalid:",...e.issues.map(r=>` ${r}`),"Add missing values to the env file(s) declared in .ripplo/project.json.",...t].join(`
37
- `)}import{graphql as EI}from"gql.tada";import{exec as mI}from"child_process";import{createAuthClient as dI}from"better-auth/client";import{deviceAuthorizationClient as pI}from"better-auth/client/plugins";function vm({baseURL:e}){return dI({baseURL:e,fetchOptions:{headers:{"User-Agent":"Ripplo CLI"}},plugins:[pI()]})}import{err as Rm,ok as gI}from"neverthrow";import{z as Ic}from"zod";var fI="https://ripplo.ai";function st(){return Qi().RIPPLO_SERVER_URL}function km(){return Qi().RIPPLO_PROJECT_ID}var hI=Ic.object({RIPPLO_PROJECT_ID:Ic.string().min(1).optional(),RIPPLO_SERVER_URL:Ic.string().min(1).default(fI)}),xm;function Qi(){return xm??=hI.parse(process.env),xm}var yI=5e3,Cm="ripplo-cli";async function Em({onDeviceCode:e,url:t}){let r=t??Qi().RIPPLO_SERVER_URL,n=vm({baseURL:r}),o=await n.device.code({client_id:Cm});if(o.error!=null)return Rm({description:o.error.error_description,kind:"oauth-device-code-failed"});let{device_code:i,user_code:s,verification_uri_complete:a}=o.data;return e({userCode:s,verificationUrl:a}),kI(a),(await bI({authClient:n,deviceCode:i})).map(c=>(Jl(c),c))}async function bI({authClient:e,deviceCode:t}){for(;;){await vI(yI);let r=await e.device.token({client_id:Cm,device_code:t,grant_type:"urn:ietf:params:oauth:grant-type:device_code"});if(r.data?.access_token!=null)return gI(r.data.access_token);if(r.error==null)continue;if(!SI(r.error.error))return Rm({code:r.error.error,description:r.error.error_description,kind:"oauth-authorization-failed"})}}var wI=new Set(["authorization_pending","slow_down"]);function SI(e){return wI.has(e)}function vI(e){return new Promise(t=>{setTimeout(t,e)})}function xI(){return process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open"}function kI(e){let t=xI();mI(`${t} "${e}"`,()=>{})}function yr({serverUrl:e,token:t}){return{appUrl:"",cwd:process.cwd(),engineUrl:"",projectId:"",ripploServerUrl:e,token:t,webhookSecret:""}}import RI from"fs";import CI from"path";function ce(e){return RI.existsSync(CI.join(e,".ripplo"))}var PI=EI(`
2
+ import{A as d,Aa as Ft,B as dt,Ba as Nt,C as R,Ca as Ut,D as pt,Da as Ht,E as ut,Ea as Mt,F as mt,Fa as Wt,G as ft,Ga as qt,H as E,Ha as Bt,I,Ia as Vt,J as gt,K as k,L as de,O as _,Oa as Gt,P as ht,Pa as te,Q as yt,Qa as Jt,R as Z,S as kt,T as wt,U as pe,V as vt,W as bt,Wa as re,X as ue,Xa as zt,Y as C,Ya as Ne,Z as St,_ as Rt,_a as Kt,a as Qe,aa as Ct,ab as Qt,b as D,ba as me,cb as Yt,d as Ye,e as Xe,eb as Xt,f as p,g as ce,ga as xt,gb as Zt,h as Ze,hb as er,i as Oe,ia as Pt,ib as tr,j as O,jb as rr,k as et,ka as Et,kb as nr,l as tt,la as $t,lb as or,m as rt,ma as ee,n as nt,na as w,nb as ir,o as ot,oa as It,p as it,pa as jt,q as W,r as st,ra as At,s as at,sa as Lt,t as q,u as lt,ua as _e,v as N,va as Fe,w as P,wa as Tt,x as L,xa as Dt,y as ct,ya as Ot,z as S,za as _t}from"./chunk-KABDPGL5.js";import Bl from"yargs";import{hideBin as Vl}from"yargs/helpers";import{readFileSync as ho}from"fs";import{z as sr}from"zod";var yo=sr.object({version:sr.string()});function ar(){let e=ho(new URL("../package.json",import.meta.url),"utf8");return yo.parse(JSON.parse(e)).version}import{graphql as Ao}from"gql.tada";import{exec as vo}from"child_process";import{createAuthClient as ko}from"better-auth/client";import{deviceAuthorizationClient as wo}from"better-auth/client/plugins";function lr({baseURL:e}){return ko({baseURL:e,fetchOptions:{headers:{"User-Agent":"Ripplo CLI"}},plugins:[wo()]})}import{err as cr,ok as bo}from"neverthrow";var So=5e3,dr="ripplo-cli";async function pr({onDeviceCode:e,url:t}){let r=t??gt().RIPPLO_SERVER_URL,n=lr({baseURL:r}),o=await n.device.code({client_id:dr});if(o.error!=null)return cr({description:o.error.error_description,kind:"oauth-device-code-failed"});let{device_code:i,user_code:a,verification_uri_complete:s}=o.data;return e({userCode:a,verificationUrl:s}),$o(s),(await Ro({authClient:n,deviceCode:i})).map(c=>(et(c),c))}async function Ro({authClient:e,deviceCode:t}){for(;;){await Po(So);let r=await e.device.token({client_id:dr,device_code:t,grant_type:"urn:ietf:params:oauth:grant-type:device_code"});if(r.data?.access_token!=null)return bo(r.data.access_token);if(r.error==null)continue;if(!xo(r.error.error))return cr({code:r.error.error,description:r.error.error_description,kind:"oauth-authorization-failed"})}}var Co=new Set(["authorization_pending","slow_down"]);function xo(e){return Co.has(e)}function Po(e){return new Promise(t=>{setTimeout(t,e)})}function Eo(){return process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open"}function $o(e){let t=Eo();vo(`${t} "${e}"`,()=>{})}function U({serverUrl:e,token:t}){return{appUrl:"",cwd:process.cwd(),engineUrl:"",projectId:"",ripploServerUrl:e,token:t,webhookSecret:""}}import Io from"fs";import jo from"path";function m(e){return Io.existsSync(jo.join(e,".ripplo"))}var Lo=Ao(`
38
3
  query AuthViewer {
39
4
  currentUser {
40
5
  name
41
6
  email
42
7
  }
43
8
  }
44
- `);async function Pm(){let e=st(),t=ft();if(t!=null&&await II(e,t))return;let n=(await Em({url:e,onDeviceCode:a=>{process.stdout.write(`Opening your browser to finish sign-in.
45
- `),process.stdout.write(`If it didn't open, visit: ${a.verificationUrl}
46
- `),process.stdout.write(`Verification code: ${a.userCode}
9
+ `);async function ur(){let e=I(),t=O();if(t!=null&&await To(e,t))return;let n=(await pr({url:e,onDeviceCode:s=>{process.stdout.write(`Opening your browser to finish sign-in.
10
+ `),process.stdout.write(`If it didn't open, visit: ${s.verificationUrl}
11
+ `),process.stdout.write(`Verification code: ${s.userCode}
47
12
 
48
13
  `),process.stdout.write(`Waiting for you to approve...
49
- `)}})).match(a=>a,a=>{process.stderr.write(`${He(a)}
50
- `),process.exit(1)}),o=await Ac({serverUrl:e,token:n}),i=ce(process.cwd()),s=i?"Welcome back":"Welcome to Ripplo";process.stdout.write(`
51
- `),process.stdout.write(o.kind==="ok"?`${s}, ${AI(o.viewer)}.
52
- `:`${s}.
53
- `),process.stdout.write(`Session saved to ${Mt("token")}.
54
- `),i||(process.stdout.write("\nNext: run `/ripplo:setup` in Claude Code to wire Ripplo into this project,\n"),process.stdout.write("or `npx ripplo init` to set it up by hand.\n"))}async function II(e,t){let r=await Ac({serverUrl:e,token:t});return r.kind==="ok"?(process.stdout.write(`Already signed in as ${r.viewer.email}. Run \`ripplo auth logout\` to switch.
14
+ `)}})).match(s=>s,s=>{process.stderr.write(`${E(s)}
15
+ `),process.exit(1)}),o=await Ue({serverUrl:e,token:n}),i=m(process.cwd()),a=i?"Welcome back":"Welcome to Ripplo";process.stdout.write(`
16
+ `),process.stdout.write(o.kind==="ok"?`${a}, ${Do(o.viewer)}.
17
+ `:`${a}.
18
+ `),process.stdout.write(`Session saved to ${Oe("token")}.
19
+ `),i||(process.stdout.write("\nNext: run `/ripplo:setup` in Claude Code to wire Ripplo into this project,\n"),process.stdout.write("or `npx ripplo init` to set it up by hand.\n"))}async function To(e,t){let r=await Ue({serverUrl:e,token:t});return r.kind==="ok"?(process.stdout.write(`Already signed in as ${r.viewer.email}. Run \`ripplo auth logout\` to switch.
55
20
  `),!0):(r.kind==="unreachable"&&(process.stdout.write(`Could not reach the Ripplo server at ${e} (${r.message}). Your saved session may still be valid \u2014 fix connectivity and retry.
56
21
  `),process.exit(1)),process.stdout.write(`Your saved session expired \u2014 let's sign you back in.
57
22
 
58
- `),!1)}async function Im(){let e=ft();e==null&&(process.stdout.write("Not authenticated. Run `ripplo auth login`.\n"),process.exit(1));let t=st(),r=await Ac({serverUrl:t,token:e});r.kind==="unreachable"&&(process.stdout.write(`Could not reach the Ripplo server at ${t} (${r.message}). The token may still be valid \u2014 check the server / network and retry.
23
+ `),!1)}async function mr(){let e=O();e==null&&(process.stdout.write("Not authenticated. Run `ripplo auth login`.\n"),process.exit(1));let t=I(),r=await Ue({serverUrl:t,token:e});r.kind==="unreachable"&&(process.stdout.write(`Could not reach the Ripplo server at ${t} (${r.message}). The token may still be valid \u2014 check the server / network and retry.
59
24
  `),process.exit(1)),r.kind==="rejected"&&(process.stdout.write("Token rejected by the server. Run `ripplo auth login` to re-authenticate.\n"),process.stdout.write(`(Claude Code: run this yourself as a background process \u2014 device-code flow, the user only approves in the browser.)
60
25
  `),process.exit(1)),process.stdout.write(`Authenticated as ${r.viewer.name} <${r.viewer.email}> (${t})
61
- `)}function Am(){if(!Yl()){process.stdout.write(`No token to remove.
62
- `);return}process.stdout.write(`Removed ${Mt("token")}
63
- `)}async function Ac({serverUrl:e,token:t}){try{let n=(await D({config:yr({serverUrl:e,token:t}),document:PI,variables:void 0})).currentUser;return n==null?{kind:"rejected"}:{kind:"ok",viewer:{email:n.email,name:n.name}}}catch(r){return Qn(r)==="UNAUTHENTICATED"?{kind:"rejected"}:{kind:"unreachable",message:r instanceof Error?r.message:String(r)}}}function AI(e){let t=e.name.trim().split(/\s+/)[0];return t!=null&&t.length>0?t:e.email}import{readFile as TI,writeFile as OI}from"fs/promises";import MI from"path";async function Tm(e){let t=process.cwd(),r=await ve(t);r.isErr()&&(process.stderr.write(`${Pe(r.error)}
64
- `),process.exit(1));let n=qt(bt,r.value),o=MI.join(t,tt);if(e.check){let i=await TI(o,"utf8").catch(()=>null);if(i===n){process.stdout.write(`${ym()}
65
- `);return}process.stderr.write(`${bm(i==null?"missing":"stale")}
66
- `),process.exit(1)}await OI(o,n),process.stdout.write(`${wm()}
67
- `)}import{graphql as Lm}from"gql.tada";function Tc(e){return e==null?"Max local concurrent runs: unknown (not signed in?)":`Max local concurrent runs: ${String(e)} (the daemon applies changes live)`}import{graphql as $I}from"gql.tada";import{err as LI,ok as NI}from"neverthrow";import Om from"fs";import Oc from"path";function Mm(e){let t=Om.realpathSync(e),r=t,n=Oc.dirname(r);for(;n!==r;){if(Om.existsSync(Oc.join(r,".git")))return r;r=n,n=Oc.dirname(r)}return t}function xe(e){return sc(e).andThen(t=>ln().andThen(r=>{let n=ft();return n==null?LI({kind:"not-authenticated"}):NI({appUrl:r.appUrl,cwd:Mm(e),engineUrl:r.engineUrl,projectId:km()??t.projectId,ripploServerUrl:st(),token:n,webhookSecret:r.webhookSecret})}))}var DI=$I(`
26
+ `)}function fr(){if(!tt()){process.stdout.write(`No token to remove.
27
+ `);return}process.stdout.write(`Removed ${Oe("token")}
28
+ `)}async function Ue({serverUrl:e,token:t}){try{let n=(await p({config:U({serverUrl:e,token:t}),document:Lo,variables:void 0})).currentUser;return n==null?{kind:"rejected"}:{kind:"ok",viewer:{email:n.email,name:n.name}}}catch(r){return Xe(r)==="UNAUTHENTICATED"?{kind:"rejected"}:{kind:"unreachable",message:r instanceof Error?r.message:String(r)}}}function Do(e){let t=e.name.trim().split(/\s+/)[0];return t!=null&&t.length>0?t:e.email}import{readFile as Oo,writeFile as _o}from"fs/promises";import Fo from"path";async function gr(e){let t=process.cwd(),r=await S(t);r.isErr()&&(process.stderr.write(`${R(r.error)}
29
+ `),process.exit(1));let n=q(N,r.value),o=Fo.join(t,L);if(e.check){let i=await Oo(o,"utf8").catch(()=>null);if(i===n){process.stdout.write(`${pt()}
30
+ `);return}process.stderr.write(`${ut(i==null?"missing":"stale")}
31
+ `),process.exit(1)}await _o(o,n),process.stdout.write(`${mt()}
32
+ `)}import{graphql as hr}from"gql.tada";function He(e){return e==null?"Max local concurrent runs: unknown (not signed in?)":`Max local concurrent runs: ${String(e)} (the daemon applies changes live)`}import{graphql as No}from"gql.tada";var Uo=No(`
68
33
  query DevSessionCheckPreflight($projectId: String!, $cwd: String!) {
69
34
  project(id: $projectId) {
70
35
  id
@@ -73,26 +38,26 @@ ${S}`),m.pop(),`{${M}}`}case"number":return isFinite(f)?String(f):t?t(f):"null";
73
38
  }
74
39
  }
75
40
  }
76
- `);function wt(){return xe(process.cwd()).match(e=>e,e=>{process.stderr.write(`${He(e)}
77
- `),process.stderr.write(`${V("setup")}
78
- `),process.exit(1)})}async function ao(e){(await D({config:e,document:DI,variables:{cwd:e.cwd,projectId:e.projectId}})).project?.devSession==null&&(process.stderr.write("No active dev session. Start `npx ripplo daemon` as a background process (your app's dev server must also be running), then retry. Or run `/ripplo:start` in Claude Code.\n"),process.stderr.write(`${V("setup")}
79
- `),process.exit(1))}var _I=Lm(`
41
+ `);function j(){return k(process.cwd()).match(e=>e,e=>{process.stderr.write(`${E(e)}
42
+ `),process.stderr.write(`${d("setup")}
43
+ `),process.exit(1)})}async function ne(e){(await p({config:e,document:Uo,variables:{cwd:e.cwd,projectId:e.projectId}})).project?.devSession==null&&(process.stderr.write("No active dev session. Start `npx ripplo daemon` as a background process (your app's dev server must also be running), then retry. Or run `/ripplo:start` in Claude Code.\n"),process.stderr.write(`${d("setup")}
44
+ `),process.exit(1))}var Ho=hr(`
80
45
  mutation CliUpdateMaxLocalConcurrentRuns($value: Int!) {
81
46
  updateMaxLocalConcurrentRuns(value: $value) {
82
47
  id
83
48
  maxLocalConcurrentRuns
84
49
  }
85
50
  }
86
- `),jI=Lm(`
51
+ `),Mo=hr(`
87
52
  query CliMaxLocalConcurrentRuns {
88
53
  currentUser {
89
54
  id
90
55
  maxLocalConcurrentRuns
91
56
  }
92
57
  }
93
- `);async function Nm({value:e}){let t=wt();if(e==null){let n=await D({config:t,document:jI,variables:{}});process.stdout.write(`${Tc(n.currentUser?.maxLocalConcurrentRuns)}
94
- `);return}let r=await D({config:t,document:_I,variables:{value:e}});process.stdout.write(`${Tc(r.updateMaxLocalConcurrentRuns?.maxLocalConcurrentRuns)}
95
- `)}import{graphql as JI}from"gql.tada";import $m from"fs";import{checkSync as FI,lockSync as BI}from"proper-lockfile";var VI="dev.pid",Dm=15e3;function _m(e){return Ot(e,VI)}function dn(e){try{return FI(_m(e),{realpath:!1,stale:Dm})}catch{return!1}}var lo=class extends Error{pid;cwd;constructor({cwd:t,pid:r}){super("dev-lock-held"),this.name="DevLockHeldError",this.pid=r,this.cwd=t}};function jm({cwd:e,onCompromised:t}){Ut(e);let r=_m(e),n=UI({cwd:e,onCompromised:t,path:r});return $m.writeFileSync(r,String(process.pid)),()=>{try{n()}catch{}}}function UI({cwd:e,onCompromised:t,path:r}){try{return BI(r,{realpath:!1,stale:Dm,onCompromised:()=>{t()}})}catch(n){throw WI(n)?new lo({cwd:e,pid:HI(r)}):n}}function WI(e){if(!(e instanceof Error)||!("code"in e))return!1;let{code:t}=e;return t==="ELOCKED"}function HI(e){try{let t=$m.readFileSync(e,"utf8").trim(),r=Number.parseInt(t,10);return Number.isFinite(r)&&r>0?r:null}catch{return null}}import GI from"fs";import Mc from"path";import{execFileSync as zI}from"child_process";function at(e,t){return zI("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}var qI=["MERGE_HEAD","rebase-merge","rebase-apply","CHERRY_PICK_HEAD","REVERT_HEAD"];function es(e){let t=KI(e);return t==null?!1:qI.some(r=>GI.existsSync(Mc.join(t,r)))}function KI(e){try{let t=at(["rev-parse","--git-dir"],e).trim();return t.length===0?null:Mc.isAbsolute(t)?t:Mc.resolve(e,t)}catch{return null}}var YI=JI(`
58
+ `);async function yr({value:e}){let t=j();if(e==null){let n=await p({config:t,document:Mo,variables:{}});process.stdout.write(`${He(n.currentUser?.maxLocalConcurrentRuns)}
59
+ `);return}let r=await p({config:t,document:Ho,variables:{value:e}});process.stdout.write(`${He(r.updateMaxLocalConcurrentRuns?.maxLocalConcurrentRuns)}
60
+ `)}import{graphql as Wo}from"gql.tada";var qo=Wo(`
96
61
  query DevSessionCheckHealth($projectId: String!, $cwd: String!) {
97
62
  project(id: $projectId) {
98
63
  id
@@ -101,145 +66,45 @@ ${S}`),m.pop(),`{${M}}`}case"number":return isFinite(f)?String(f):t?t(f):"null";
101
66
  }
102
67
  }
103
68
  }
104
- `);function Fm(e){switch(e.status){case"active":return e.gitMidOperation?"\u2713 Dev session: ripplo daemon is live (hooks auto-paused \u2014 git is mid-merge/rebase/cherry-pick; resumes when the operation completes or aborts)":"\u2713 Dev session: ripplo daemon is live for this directory";case"starting":return"! Dev session: `ripplo daemon` is running locally but hasn't registered with the server yet. Wait a few seconds and re-run `npx ripplo doctor`. If it persists, check the watch process output for auth/network errors.";case"missing":return"\u2717 Dev session: no active ripplo daemon. Start `npx ripplo daemon` as a background process (separate from your app's dev server). Without it, `ripplo run` will refuse to dispatch and scope/coverage hooks won't arm."}}async function Bm(e){let t=dn(e),r=es(e),n=xe(e).unwrapOr(void 0);return n==null?{gitMidOperation:r,status:t?"starting":"missing",type:"dev-session"}:(await D({config:n,document:YI,variables:{cwd:n.cwd,projectId:n.projectId}}).catch(()=>null))?.project?.devSession!=null?{gitMidOperation:r,status:"active",type:"dev-session"}:{gitMidOperation:r,status:t?"starting":"missing",type:"dev-session"}}function Vm(e){switch(e.type){case"settings":return XI(e);case"env-files":return ZI(e);case"token":return QI(e);case"dev-server":return eA(e);case"dev-session":return Fm(e);case"preconditions":return tA(e);case"webhook-verification":return rA(e);case"preconditions-validation":return nA(e);case"workflows":return oA(e);case"browser":return sA(e);case"engine-endpoint":return e.reachable?`\u2713 Engine endpoint: ${e.url} is reachable`:`\u2717 Engine endpoint: ${e.url} is not reachable`;case"adapter-enabled":return aA(e);case"lockfile":return lA(e);case"pre-commit-hook":return cA(e)}}function XI(e){return e.valid?"\u2713 Settings: Project configured":`\u2717 Settings: Missing fields: ${e.missingFields.join(", ")}`}function ZI(e){return e.missing.length===0?"\u2713 Env files: declared files present":`\u2717 Env files: declared in .ripplo/project.json but missing:
69
+ `);function kr(e){switch(e.status){case"active":return e.gitMidOperation?"\u2713 Dev session: ripplo daemon is live (hooks auto-paused \u2014 git is mid-merge/rebase/cherry-pick; resumes when the operation completes or aborts)":"\u2713 Dev session: ripplo daemon is live for this directory";case"starting":return"! Dev session: `ripplo daemon` is running locally but hasn't registered with the server yet. Wait a few seconds and re-run `npx ripplo doctor`. If it persists, check the watch process output for auth/network errors.";case"missing":return"\u2717 Dev session: no active ripplo daemon. Start `npx ripplo daemon` as a background process (separate from your app's dev server). Without it, `ripplo run` will refuse to dispatch and scope/coverage hooks won't arm."}}async function wr(e){let t=de(e),r=ht(e),n=k(e).unwrapOr(void 0);return n==null?{gitMidOperation:r,status:t?"starting":"missing",type:"dev-session"}:(await p({config:n,document:qo,variables:{cwd:n.cwd,projectId:n.projectId}}).catch(()=>null))?.project?.devSession!=null?{gitMidOperation:r,status:"active",type:"dev-session"}:{gitMidOperation:r,status:t?"starting":"missing",type:"dev-session"}}function vr(e){switch(e.type){case"settings":return Bo(e);case"env-files":return Vo(e);case"token":return Go(e);case"dev-server":return Jo(e);case"dev-session":return kr(e);case"preconditions":return zo(e);case"webhook-verification":return Ko(e);case"preconditions-validation":return Qo(e);case"workflows":return Yo(e);case"browser":return Zo(e);case"engine-endpoint":return e.reachable?`\u2713 Engine endpoint: ${e.url} is reachable`:`\u2717 Engine endpoint: ${e.url} is not reachable`;case"adapter-enabled":return ei(e);case"lockfile":return ti(e);case"pre-commit-hook":return ri(e)}}function Bo(e){return e.valid?"\u2713 Settings: Project configured":`\u2717 Settings: Missing fields: ${e.missingFields.join(", ")}`}function Vo(e){return e.missing.length===0?"\u2713 Env files: declared files present":`\u2717 Env files: declared in .ripplo/project.json but missing:
105
70
  ${e.missing.map(r=>` ${r}`).join(`
106
71
  `)}
107
- If you're in a git worktree, copy the env file from the main checkout (or symlink to a shared file outside the working tree).`}function QI(e){switch(e.status){case"valid":return`\u2713 Auth: Signed in as ${e.email??"unknown"}`;case"missing":return"\u2717 Auth: No token found. Run `ripplo auth login` to authenticate.\n (Claude Code: run this yourself as a background process \u2014 it's a device-code flow, the user only needs to approve in the browser.)";case"invalid":return"\u2717 Auth: Saved token rejected by server. Run `ripplo auth login` to re-authenticate.\n (Claude Code: run this yourself as a background process \u2014 it's a device-code flow, the user only needs to approve in the browser.)";case"unreachable":return`! Auth: Could not reach ${st()} to validate token.`}}function eA(e){return e.reachable?`\u2713 Dev server: ${e.appUrl} is reachable`:`\u2717 Dev server: ${e.appUrl} is not responding. Make sure your dev server is running.`}function tA(e){return e.count===0?"! Entities: None defined":e.configured?e.endpointReachable===void 0?`! Entities: ${String(e.count)} defined (could not verify engine endpoint)`:`\u2713 Entities: ${String(e.count)} defined, engine configured`:`\u2717 Entities: ${String(e.count)} defined but RIPPLO_ENGINE_URL is not set in your env file`}function rA(e){return e.rejectsUnsigned?"\u2713 Webhook verification: Unsigned requests are correctly rejected":"\u2717 Webhook verification: Endpoint accepted an unsigned request \u2014 webhook signature verification may be missing or misconfigured."}function nA(e){if(!e.found)return"\u2717 Model: DSL failed to compile";if(e.valid)return"\u2713 Model: Valid";let t=e.errors.map(r=>` - ${r.path===""?"":r.path+": "}${r.message}`);return`\u2717 Model: ${String(e.errorCount)} validation error${e.errorCount===1?"":"s"}
72
+ If you're in a git worktree, copy the env file from the main checkout (or symlink to a shared file outside the working tree).`}function Go(e){switch(e.status){case"valid":return`\u2713 Auth: Signed in as ${e.email??"unknown"}`;case"missing":return"\u2717 Auth: No token found. Run `ripplo auth login` to authenticate.\n (Claude Code: run this yourself as a background process \u2014 it's a device-code flow, the user only needs to approve in the browser.)";case"invalid":return"\u2717 Auth: Saved token rejected by server. Run `ripplo auth login` to re-authenticate.\n (Claude Code: run this yourself as a background process \u2014 it's a device-code flow, the user only needs to approve in the browser.)";case"unreachable":return`! Auth: Could not reach ${I()} to validate token.`}}function Jo(e){return e.reachable?`\u2713 Dev server: ${e.appUrl} is reachable`:`\u2717 Dev server: ${e.appUrl} is not responding. Make sure your dev server is running.`}function zo(e){return e.count===0?"! Entities: None defined":e.configured?e.endpointReachable===void 0?`! Entities: ${String(e.count)} defined (could not verify engine endpoint)`:`\u2713 Entities: ${String(e.count)} defined, engine configured`:`\u2717 Entities: ${String(e.count)} defined but RIPPLO_ENGINE_URL is not set in your env file`}function Ko(e){return e.rejectsUnsigned?"\u2713 Webhook verification: Unsigned requests are correctly rejected":"\u2717 Webhook verification: Endpoint accepted an unsigned request \u2014 webhook signature verification may be missing or misconfigured."}function Qo(e){if(!e.found)return"\u2717 Model: DSL failed to compile";if(e.valid)return"\u2713 Model: Valid";let t=e.errors.map(r=>` - ${r.path===""?"":r.path+": "}${r.message}`);return`\u2717 Model: ${String(e.errorCount)} validation error${e.errorCount===1?"":"s"}
108
73
  ${t.join(`
109
- `)}`}function oA(e){if(e.total===0)return"! Tests: No tests defined";if(e.invalidNames.length===0)return`\u2713 Tests: ${String(e.total)} valid`;let t=e.invalidWorkflows.map(r=>iA(r));return`\u2717 Tests: ${String(e.invalidNames.length)} invalid
74
+ `)}`}function Yo(e){if(e.total===0)return"! Tests: No tests defined";if(e.invalidNames.length===0)return`\u2713 Tests: ${String(e.total)} valid`;let t=e.invalidWorkflows.map(r=>Xo(r));return`\u2717 Tests: ${String(e.invalidNames.length)} invalid
110
75
  ${t.join(`
111
- `)}`}function iA(e){let t=e.errors.map(r=>" - "+(r.path===""?"":r.path+": ")+r.message);return" "+e.name+`:
76
+ `)}`}function Xo(e){let t=e.errors.map(r=>" - "+(r.path===""?"":r.path+": ")+r.message);return" "+e.name+`:
112
77
  `+t.join(`
113
- `)}function sA(e){return e.installed?"\u2713 Browser: Chromium installed":"\u2717 Browser: Chromium not installed. Run: npx playwright install chromium"}function aA(e){switch(e.status){case"enabled":return`\u2713 Adapter: enabled at ${e.url}`;case"disabled":return"\u2717 Adapter: disabled (handler returned 404). Set ENABLE_RIPPLO_TESTING=true in your app's env (e.g. apps/<app>/.env.local for Next.js) and restart the dev server.";case"bad-secret":return"\u2717 Adapter: webhook signature rejected. RIPPLO_WEBHOOK_SECRET seen by your dev server does not match the one in your env file.";case"unreachable":return`\u2717 Adapter: ${e.url} could not be reached for signed probe.`;case"no-secret":return"\u2717 Adapter: RIPPLO_WEBHOOK_SECRET is not set in your env file (declared in .ripplo/project.json)."}}function lA(e){switch(e.status){case"match":return`\u2713 Lockfile: ${tt} is up to date`;case"missing":return`\u2717 Lockfile: ${tt} is missing \u2014 run \`ripplo compile\` and commit it`;case"stale":return`\u2717 Lockfile: ${tt} is out of date \u2014 run \`ripplo compile\` and commit it`}}function cA(e){return e.installed?"\u2713 Pre-commit hook: .git/hooks/pre-commit runs `ripplo compile --check`":"! Pre-commit hook: .git/hooks/pre-commit does not run `ripplo compile --check` \u2014 see the setup skill for the snippet"}import tl from"fs";import S0 from"path";import{chromium as $V}from"playwright";import uA from"fs";import dA from"path";async function Um(e){let t=dA.join(e,".ripplo","index.ts");if(!uA.existsSync(t))return{appUrl:void 0,engineUrl:void 0,errors:[{message:".ripplo/index.ts not found",path:""}],valid:!1,warnings:[]};let r=await ve(e);return r.isErr()?{appUrl:void 0,engineUrl:void 0,errors:[{message:Pe(r.error),path:".ripplo/"}],valid:!1,warnings:[]}:ln().match(n=>({appUrl:n.appUrl,engineUrl:n.engineUrl,errors:[],valid:!0,warnings:[]}),n=>({appUrl:void 0,engineUrl:void 0,errors:[{message:He(n),path:""}],valid:!1,warnings:[]}))}async function Lc(e){try{await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(5e3)});return}catch{return`appUrl (${e}) is not responding. Make sure your dev server is running on that port.`}}async function Wm({appUrl:e,engineUrl:t}){let r=t.startsWith("http://")||t.startsWith("https://")?t:`${e}${t}`;try{return(await fetch(`${r}/setup`,{body:JSON.stringify({}),headers:{"Content-Type":"application/json"},method:"PUT",signal:AbortSignal.timeout(5e3)})).ok?"Engine endpoint accepted an unsigned request \u2014 webhook signature verification may be missing.":void 0}catch{return}}function Jt(e){let t=new URL(e,"https://ripplo.invalid"),r=[...t.searchParams.entries()].toSorted(([n],[o])=>n.localeCompare(o)).map(([n,o])=>`${n}=${o}`).join("&");return r.length===0?t.pathname:`${t.pathname}?${r}`}function pn(e,t){return e==="url"?Jt(t):t}function Nc(e,t,r){return pn(e,String(t))===pn(e,String(r))}function zm(e,t,r){return e!=="url"?Nc(e,t,r):Hm(String(t))===Hm(String(r))}function Hm(e){return new URL(e,"https://ripplo.invalid").pathname}function $c({actual:e,canon:t,pre:r,predicted:n}){return[...[...new Set([...n.entities.keys(),...e.entities.keys()])].flatMap(s=>pA({actual:e.entities.get(s),canon:t,entity:s,pre:r.entities.get(s),predicted:n.entities.get(s)})),...hA(r.singletons,n.singletons,e.singletons)]}function pA({actual:e,canon:t,entity:r,pre:n,predicted:o}){return[...new Set([...o?.keys()??[],...e?.keys()??[]])].flatMap(s=>fA({actual:e?.get(s),canon:t,entity:r,key:s,predicted:o?.get(s),preHadKey:n?.has(s)??!1,preRow:n?.get(s)}))}function fA({actual:e,canon:t,entity:r,key:n,predicted:o,preHadKey:i,preRow:s}){if(o==null)return[{divergence:{entity:r,key:n,kind:"ghost-write"},pending:i}];if(e==null)return[{divergence:{entity:r,key:n,kind:"absent"},pending:!i}];let a=(c,u,d)=>Km(t(r,c,u),t(r,c,d));return[...new Set([...Object.keys(o),...Object.keys(e)])].filter(c=>!a(c,o[c],e[c])).map(c=>({divergence:{entity:r,field:c,key:n,kind:"field-mismatch",snapshot:o[c],sut:e[c]},pending:s==null?e[c]===void 0:a(c,s[c],e[c])}))}function Km(e,t){return Gm(e)===Gm(t)}function Gm(e){return e==null?"\u2205":JSON.stringify(e)}function hA(e,t,r){return[...new Set([...Object.keys(t),...Object.keys(r)])].flatMap(o=>{let i=t[o],s=r[o];return i===void 0||s===void 0||qm(o,i,s)?[]:[{divergence:{kind:"singleton-mismatch",singleton:o,snapshot:i,sut:s},pending:e[o]!==void 0&&qm(o,e[o],s)}]})}function qm(e,t,r){let n=zt.safeParse(e);return n.success?zm(n.data,t,r):Km(t,r)}function Dc(e){let t=mA(e.entities),r=gA(e.singletons);return n=>yA(n,t,r)}function mA(e){return new Map(e.flatMap(t=>Object.entries(t.props).map(([r,n])=>[Jm(t.name,r),n.consistency])))}function Jm(e,t){return`${e}.${t}`}function gA(e){return new Map(e.map(t=>[t.name,t.consistency]))}function yA(e,t,r){return e.kind==="singleton-mismatch"?bA(e.singleton,r):e.kind==="ghost-write"||e.kind==="absent"?"strict":t.get(Jm(e.entity,e.field))??"strict"}function bA(e,t){return zt.safeParse(e).success?t.get(e)??"eventual":t.get(e)??"strict"}function _c(e){let t=new Set(e.valueSpaces.filter(r=>r.generator==="date.iso").map(r=>r.name));return(r,n,o)=>{if(!t.has(`${r}.${n}`)||typeof o!="string")return o;let i=Date.parse(o);return Number.isNaN(i)?o:new Date(i).toISOString()}}function Xm(e,t,r){return{detail:r.slice(0,500),kind:"engine-http",path:e,status:t}}function ts(e,t){return{code:sg(t),kind:"engine-network",message:uo(t),path:e}}function Zm(e){return{kind:"client-mount-missing",mountKey:e}}function Qm(e,t){return{kind:"engine-decode",message:uo(t),path:e}}function eg(e,t){return{entity:e,field:t,kind:"state-identity"}}function tg(e){return{as:e,kind:"setup-missing-row"}}function co(e){return{kind:"driver-launch",message:uo(e)}}function rg(e,t){return{action:e,kind:"action-failed",message:uo(t)}}function ng(e){return{kind:"check-failed",message:uo(e)}}function og(){return{kind:"aborted"}}var Ym=300;function br(e){switch(e.kind){case"engine-http":return`engine ${e.path} returned ${String(e.status)}: ${wA(e.detail)}${SA(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"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 ig(e){throw new Error(br(e))}function rs(){}function wA(e){let t=e.replaceAll(/\s+/gu," ").trim();return t.length<=Ym?t:`${t.slice(0,Ym)}\u2026 [truncated]`}function SA(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 sg(e){if(!(typeof e!="object"||e==null))return"code"in e&&typeof e.code=="string"?e.code:"cause"in e?sg(e.cause):void 0}function uo(e){return e instanceof Error?e.message:String(e)}var Uc=Ti(ug(),1),eZ=Uc.default.configure,ns=Uc.default;function Q(e){return ns(e)??""}function Yt(e,t){return[...new Map(e.map(r=>[t(r),r])).values()]}function Wc(e){return Yt(e,Q)}function dg(e){return Q(e)}var fo=class extends Error{name="AbortError";constructor(){super("aborted")}};function pg(e){return e instanceof Error&&e.name==="AbortError"}function Sr(e){if(e.aborted)throw new fo}function Hc(e,t){return t.aborted?Promise.reject(new fo):new Promise((r,n)=>{let o=()=>{clearTimeout(i),n(new fo)},i=setTimeout(()=>{t.removeEventListener("abort",o),r()},e);t.addEventListener("abort",o,{once:!0})})}function bg(e){return e.includes("async")?"async":e.includes("slow")?"slow":"fast"}var IA=()=>[];async function Gc({canon:e,classify:t,initialSnapshot:r,lawObligations:n,observe:o,onAssertion:i,onStep:s,steps:a},l){return wg({acc:[],canon:e,classify:t,index:0,lawObligations:n??IA,observe:o,onAssertion:i,onStep:s,signal:l,snapshot:r,steps:a})}async function wg({acc:e,canon:t,classify:r,index:n,lawObligations:o,observe:i,onAssertion:s,onStep:a,signal:l,snapshot:c,steps:u}){Sr(l);let d=u[n];if(d==null)return{finalModel:c,findings:e};let p=Date.now();if(!d.guard(c)){let h={kind:"illegal-transition",step:d.step};return zc(a,{endMs:Date.now(),findings:[h],index:n,startMs:p}),{finalModel:c,findings:[...e,h]}}return d.perform().match(()=>AA({acc:e,canon:t,classify:r,index:n,lawObligations:o,observe:i,onAssertion:s,onStep:a,signal:l,snapshot:c,startMs:p,step:d,steps:u}),h=>{let f=os(h,d);return zc(a,{endMs:Date.now(),findings:[f],index:n,startMs:p}),Promise.resolve({finalModel:c,findings:[...e,f]})})}async function AA({acc:e,canon:t,classify:r,index:n,lawObligations:o,observe:i,onAssertion:s,onStep:a,signal:l,snapshot:c,startMs:u,step:d,steps:p}){let h=d.effect(c),f=await DA({canon:t,classify:r,observe:i,pre:c,predicted:h,signal:l,step:d}),m=[...d.obligations,...o(c,f.snapshot)],g=[...await TA({obligations:m,onAssertion:s,signal:l,step:d}),...f.findings];return zc(a,{endMs:Date.now(),findings:g,index:n,startMs:u}),wg({acc:[...e,...g],canon:t,classify:r,index:n+1,lawObligations:o,observe:i,onAssertion:s,onStep:a,signal:l,snapshot:f.snapshot,steps:p})}async function TA({obligations:e,onAssertion:t,signal:r,step:n}){let o=[...new Map(e.map(s=>[dg(s.source),s])).values()],i=await Promise.all(o.map(async s=>({obligation:s,outcome:await OA(s,r)})));return i.forEach(s=>{MA(t,s.obligation,s.outcome,n)}),i.flatMap(s=>NA(s.obligation,s.outcome,n))}function OA(e,t){if(e.check.kind==="decided"){let r=e.check.passed?"passed":"failed";return Promise.resolve({kind:r})}return _A(e.budget,e.check.run,t)}function MA(e,t,r,n){e?.({outcome:LA(r),source:t.source,step:n.step})}function LA(e){return e.kind==="passed"?"passed":e.kind==="error"?"error":"failed"}function NA(e,t,r){return t.kind==="error"?[os(t.error,r)]:t.kind==="failed"?[{budget:e.budget,kind:"obligation",source:e.source,step:r.step}]:[]}function os(e,t){return{error:e,kind:"driver-error",step:t.step}}function zc(e,t){e?.(t)}var ho={async:12e4,fast:5e3,slow:3e4},Sg={async:{backoffMs:[500,1e3,2e3,5e3],timeoutMs:ho.async},fast:{backoffMs:[100,250,500,1e3],timeoutMs:ho.fast},slow:{backoffMs:[250,500,1e3,2e3],timeoutMs:ho.slow}};function vg(e,t){return e.backoffMs[Math.min(t,e.backoffMs.length-1)]??0}function fg(e){return e().match(t=>({observed:t,ok:!0}),t=>({error:t,ok:!1}))}function $A(e,t,r){return r.reconcile==null?e:r.reconcile(e,t)}function hg({canon:e,pre:t,predicted:r,step:n},o){let i=n.verifyChanges==null?[]:n.verifyChanges(r,o),s=$A(r,o,n),a=i.map(l=>({divergence:l,pending:!0}));return{adopted:s,probed:[...a,...$c({actual:o.snapshot,canon:e,pre:t,predicted:s})]}}function xg(e,t){return{budget:t.settle,divergence:e.divergence,kind:"consistency",pending:e.pending,step:t.step}}function mg(e,t,r){let n=e.probed.filter(o=>!o.pending&&r(o.divergence)==="strict");return n.length>0?{findings:n.map(o=>xg(o,t)),snapshot:e.adopted}:e.probed.length===0?{findings:[],snapshot:e.adopted}:null}function gg(e,t,r){return{findings:[...e.probed.map(n=>xg(n,t)),...r],snapshot:e.adopted}}async function DA({canon:e,classify:t,observe:r,pre:n,predicted:o,signal:i,step:s}){let a=Sg[s.settle],l=Date.now()+a.timeoutMs,c=await fg(r);if(!c.ok)return{findings:[os(c.error,s)],snapshot:o};let u=hg({canon:e,pre:n,predicted:o,step:s},c.observed),d=0;for(;Date.now()<l;){Sr(i);let p=mg(u,s,t);if(p!=null)return p;await Hc(vg(a,d),i),d+=1;let h=await fg(r);if(!h.ok)return gg(u,s,[os(h.error,s)]);u=hg({canon:e,pre:n,predicted:o,step:s},h.observed)}return mg(u,s,t)??gg(u,s,[])}async function _A(e,t,r){let n=Sg[e],o=Date.now()+n.timeoutMs,i=await yg(t),s=0;for(;i.kind==="pending"&&Date.now()<o;)Sr(r),await Hc(vg(n,s),r),s+=1,i=await yg(t);return i.kind==="pending"?{kind:"failed"}:i}function yg(e){return e().match(t=>t?{kind:"passed"}:{kind:"pending"},t=>({error:t,kind:"error"}))}import{z as jA}from"zod";var Kc=jA.string().brand(),ue=Kc.parse("");function Xt(e){return Kc.parse(e)}function Nt(e,t){return Kc.parse(e.length===0?t:`${e}.${t}`)}function ze(e){return cn.safeParse(e).success}function Zt(e){return typeof e=="object"&&e!==null&&"template"in e}function qc(e,t,r){let n=Nt(t,e.ref);if(!r.has(n))throw new Error(`unresolved binding ref "${n}"`);return r.get(n)??null}function is(e,t,r){return FA(e).every(n=>r.has(Nt(t,n)))}function St(e,t,r){return typeof e=="string"?e:ze(e)?String(qc(e,t,r)):e.template.map(n=>typeof n=="string"?n:String(qc(n,t,r))).join("")}function vt(e,t,r){return e===null||typeof e=="number"||typeof e=="boolean"?e:ze(e)?qc(e,t,r):St(e,t,r)}function kg(e,t){return vt(e,ue,t)}function mo(e){return ns(e)}function fn(e,t,r){return Object.fromEntries(Object.entries(e).map(([n,o])=>[n,vt(o,t,r)]))}function FA(e){return e==null||typeof e!="object"?[]:Zt(e)?e.template.flatMap(t=>typeof t=="string"?[]:[t.ref]):[e.ref]}function vr(e){return typeof e=="object"&&e!==null&&"kind"in e}function Ur(e){return Object.fromEntries(Object.entries(e).filter(t=>!vr(t[1])))}function Rg(e,t,r){return t.reduce((n,o)=>BA(n,o,r,e),e)}function Cg(e,t){return Object.keys(t).length===0?e:{...e,singletons:{...e.singletons,...t}}}function BA(e,t,r,n){if(!VA(t,r))return e;if(t.assertion.kind==="created"){let i=fn(t.assertion.props,ue,r);return UA(e,t.entity,mo(i),i)}if(t.assertion.kind==="deleted")return Jc(e,t.entity,GA(t.key,r,n));let o=fn(Ur(t.assertion.props),ue,r);return Jc(e,t.entity,qA(t.key,o,r,n))}function VA(e,t){return("props"in e.assertion?[e.key,Ur(e.assertion.props)]:[e.key]).every(n=>Object.values(n).every(o=>Ig(o)||!ze(o)||t.has(Xt(o.ref))))}function UA(e,t,r,n){let o=new Map([...e.entities.get(t)??[],[r,n]]);return{...e,entities:new Map([...e.entities,[t,o]])}}function Jc(e,t,r){let n=r(e.entities.get(t)??new Map);return{...e,entities:new Map([...e.entities,[t,n]])}}function go(e,t,r,n){let o={env:n,key:r,snapshot:e};return[...(e.entities.get(t)??new Map).values()].filter(i=>as(i,o))}function Eg(e,t,r,n,o){let i={env:n,key:r,snapshot:e};return Jc(e,t,s=>new Map([...s].map(([a,l])=>[a,as(l,i)?o(l):l])))}function as(e,t){return Object.entries(t.key).every(([r,n])=>Pg(e[r],n,t))}function Pg(e,t,r){return Ig(t)?WA(t,r).has(ss(e)):ss(e)===ss(zA(t,r.env))}function Ig(e){return typeof e=="object"&&e!==null&&"kind"in e}function WA(e,t){let r=t.snapshot.entities.get(e.selection.entity);return r==null?new Set:new Set([...r.values()].filter(n=>HA(n,e.selection.where,t)).map(n=>ss(n[e.field])))}function HA(e,t,r){return Object.entries(t).every(([n,o])=>Pg(e[n],o,r))}function ss(e){return e==null?"\u2205":e instanceof Date?e.toISOString():JSON.stringify(e)}function zA(e,t){return vt(e,ue,t)}function GA(e,t,r){let n={env:t,key:e,snapshot:r};return o=>new Map([...o].filter(([,i])=>!as(i,n)))}function qA(e,t,r,n){let o={env:r,key:e,snapshot:n};return i=>new Map([...i].map(([s,a])=>as(a,o)?[s,{...a,...t}]:[s,a]))}function Og(e){let t=e.predicates.filter(i=>$g(i)),r=t.filter(i=>i.assertion.kind==="created"),n=Ng(t);if(r.length===0&&n.length===0&&e.deferred.length===0&&e.adopt.length===0)return;let o=t.filter(i=>i.assertion.kind==="updated");return(i,s)=>{let a=r.reduce((u,d)=>eT(u,s,d,e.env),{env:e.env,snapshot:i}),l=n.reduce((u,d)=>QA(u,s,d,e.env),a.snapshot),c=o.reduce((u,d)=>JA(u,s,d),a.env);return KA(rT(l,e.deferred,c),s,e.adopt)}}function KA(e,t,r){if(r.length===0)return e;let n=r.reduce((o,i)=>{let s=t.snapshot.singletons[i];return s===void 0?o:{...o,[i]:s}},e.singletons);return{...e,singletons:n}}function Mg(e,t,r){return new Map([...e,...Object.entries(r).map(([n,o])=>[Nt(ue,`${t}.${n}`),o])])}function JA(e,t,r){let n=go(t.snapshot,r.entity,r.key,e).at(0);return n==null?e:Mg(e,r.assertion.as,n)}function Lg(e){let t=Ng(e.predicates.filter(r=>$g(r)));if(t.length!==0)return(r,n)=>t.flatMap(o=>YA(o,r,n,e.env))}function Ng(e){return e.filter(t=>t.assertion.kind==="updated"&&Yc(t.assertion.props).length>0)}function Yc(e){return Object.entries(e).filter(([,t])=>vr(t)).map(([t])=>t)}function $g(e){return e.assertion.kind==="created"||e.assertion.kind==="updated"}function YA(e,t,r,n){let o=go(t,e.entity,e.key,n).at(0),i=go(r.snapshot,e.entity,e.key,n).at(0);if(o==null||i==null)return[];let s=mo(XA(e.key,n));return Yc(e.assertion.props).flatMap(a=>Ag(o[a])===Ag(i[a])?[{entity:e.entity,field:a,key:s,kind:"expected-change",value:i[a]}]:[])}function XA(e,t){let r=Object.fromEntries(Object.entries(e).filter(n=>!ZA(n[1])));return fn(r,ue,t)}function ZA(e){return typeof e=="object"&&e!==null&&"kind"in e}function Ag(e){return e==null?"\u2205":JSON.stringify(e)}function QA(e,t,r,n){let o=Yc(r.assertion.props),i=go(t.snapshot,r.entity,r.key,n).at(0);return i==null?e:Eg(e,r.entity,r.key,n,s=>({...s,...Object.fromEntries(o.flatMap(a=>{let l=i[a];return l===void 0?[]:[[a,l]]}))}))}function eT(e,t,r,n){if(r.assertion.kind!=="created")return e;let o=fn(r.assertion.props,ue,n),i=mo(o),s=e.snapshot.entities.get(r.entity);if(s==null||!s.has(i))return e;let a=tT(t.snapshot.entities.get(r.entity),s,o);if(a==null)return e;let[l,c]=a,u=new Map(s);return u.delete(i),u.set(l,c),{env:Mg(e.env,r.assertion.as,c),snapshot:{...e.snapshot,entities:new Map(e.snapshot.entities).set(r.entity,u)}}}function tT(e,t,r){if(e!=null)return[...e].find(([n,o])=>!t.has(n)&&Object.entries(r).every(([i,s])=>Tg(o[i])===Tg(s)))}function Tg(e){return e==null?"\u2205":JSON.stringify(e)}function rT(e,t,r){let n=t.reduce((o,i)=>{let s=nT(i.value,r);return s==null?o:{...o,[i.name]:pn(i.name,s)}},e.singletons);return{...e,singletons:n}}function nT(e,t){try{return St(e,ue,t)}catch{return}}function ls(e,t){if(e.kind==="visible"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused")return{kind:e.kind,locator:yo(e.locator,t)};if(e.kind==="not"){let r=ls(e.predicate,t);return r==null?null:{inner:r,kind:"not"}}return e.kind==="value"||e.kind==="text"?{kind:e.kind,locator:yo(e.locator,t),value:St(e.value,ue,t)}:e.kind!=="browser"?null:{kind:"browser",name:e.name,value:St(e.value,ue,t)}}function bo(e,t){let r=e.expect.filter(l=>l.kind==="state"),n=uT(r),{adopt:o,conditional:i,deferred:s,immediate:a}=sT(e,t,n);return{action:dT(e.action,t),label:e.action.kind,obligations:e.expect.flatMap(l=>fT(l,t)),reconcile:Og({adopt:o,deferred:s,env:t,predicates:r}),verifyChanges:Lg({adopt:o,deferred:s,env:t,predicates:r}),effect:l=>{let c=Rg(l,r,t),u=i.reduce((d,p)=>({...d,...Xc(p,c,t)}),{});return Cg(c,{...a,...u})}}}function yo(e,t){return e.by==="role"?{by:"role",name:e.name==null?void 0:St(e.name,ue,t),role:e.role}:e.by==="inside"?{by:"inside",scope:yo(e.scope,t),target:yo(e.target,t)}:{by:"testId",value:St(e.value,ue,t)}}function Xc(e,t,r){return e==null?{}:e.kind==="when"?Zc(e.condition,t,r)?Xc(e.consequence,t,r):Xc(e.otherwise,t,r):iT(e,r)}function Zc(e,t,r){if(!oT(e))throw new Error(`when() condition cannot be a "${e.kind}" predicate`);switch(e.kind){case"singleton":return t.singletons[e.singleton]===vt(e.assertion.value,ue,r);case"count":return(t.entities.get(e.entity)?.size??0)===e.value;case"not":return!Zc(e.predicate,t,r);case"and":return e.predicates.every(n=>Zc(n,t,r))}}function oT(e){return e.kind==="singleton"||e.kind==="count"||e.kind==="not"||e.kind==="and"}function iT(e,t){if(e.kind!=="browser"&&e.kind!=="singleton")return{};let r=e.kind==="browser"?e.value:e.assertion.value;return is(r,ue,t)?Dg(e,t):{}}function sT(e,t,r){let n=e.action.kind==="goto"&&!e.expect.some(s=>s.kind==="browser"&&s.name==="url"),o=e.action.kind==="goto"&&!n?{url:Jt(St(e.action.url,ue,t))}:{},i=n?["url"]:[];return e.expect.reduce((s,a)=>a.kind==="browser"&&aT(a.value,r)?{...s,deferred:[...s.deferred,{name:a.name,value:a.value}]}:a.kind==="browser"||a.kind==="singleton"?{...s,immediate:{...s.immediate,...Dg(a,t)}}:a.kind==="when"?{...s,conditional:[...s.conditional,a]}:s,{adopt:i,conditional:[],deferred:[],immediate:o})}function aT(e,t){return lT(e).some(r=>t.has(r.split(".")[0]??r))}function lT(e){return typeof e=="string"?[]:ze(e)?[e.ref]:e.template.filter(t=>typeof t!="string").map(t=>t.ref)}function Dg(e,t){if(e.kind==="browser")return{[e.name]:cT(e,t)};if(e.kind==="singleton")return{[e.singleton]:vt(e.assertion.value,ue,t)};throw new Error("when() consequence must be a url (browser) or singleton assertion")}function cT(e,t){return pn(e.name,St(e.value,ue,t))}function uT(e){return new Set(e.flatMap(t=>t.assertion.kind==="created"||t.assertion.kind==="updated"?[t.assertion.as]:[]))}function dT(e,t){return{files:e.kind==="upload"?e.files:void 0,key:e.kind==="press"?e.key:void 0,kind:e.kind,locator:pT(e,t),url:e.kind==="goto"?St(e.url,ue,t):void 0,value:"value"in e?kg(e.value,t):void 0}}function pT(e,t){if(!(!("locator"in e)||e.locator==null))return yo(e.locator,t)}function fT(e,t){if(e.kind==="browser"||e.kind==="singleton")return[];let r=ls(e,t),n="wait"in e?e.wait??"fast":"fast";return r==null?[]:[{budget:n,check:r}]}import{err as hT,ok as mT,okAsync as gT,Result as yT}from"neverthrow";function wo(e,t,r){let n=e.tests.find(a=>a.name===t);if(n==null)throw new Error(`test "${t}" not found in lockfile`);let o=kT(e),i={env:new Map,generate:r.generate,indexed:o,overrides:new Map(Object.entries(r.params??{}).map(([a,l])=>[Xt(a),l]))};RT(n.params,ue,i);let s=n.world.map(a=>CT(a,ue,i));return r.materialize(s).map(a=>bT(AT(a,i.env,o),n,e))}function Wr(e,t){let r=new Map(t.map(n=>[n.name,n]));return n=>gT(ST(n,e,r).rows)}function Qc(e){return t=>{let r=t.map(n=>({as:n.as,entity:n.entity,fields:n.fields}));return e(r).andThen(n=>wT(t,n))}}function _g(e,t){let r=cs(t);return Object.fromEntries(Object.entries(e).filter(([n,o])=>r.includes(n)&&o!=null))}function cs(e){return Object.entries(e.props).filter(([,t])=>t.stable).map(([t])=>t)}function bT(e,t,r){let n=Object.fromEntries(r.singletons.map(l=>[l.name,l.default])),o=Object.fromEntries(Object.entries(t.singletons).map(([l,c])=>[l,vt(c,ue,e.env)])),i={...n,...o},s=new Set(r.singletons.filter(l=>l.source==="client").map(l=>l.name)),a=Object.fromEntries(Object.entries(i).filter(([l])=>s.has(l)));return{...e,clientState:a,snapshot:{...e.snapshot,singletons:i}}}function wT(e,t){let r=new Map(t.map(n=>[n.as,n]));return yT.combine(e.map(n=>{let o=r.get(n.as);return o==null?hT(tg(n.as)):mT({as:n.as,entity:n.entity,row:o.row,session:o.session})}))}function ST(e,t,r){return e.reduce((n,o)=>{let i=vT(o.fields,n.env),s=OT({generate:t,model:o.model,seedPrefix:o.seedPrefix,set:i,valueSpaces:r}),a=Object.entries(s).map(([l,c])=>[`${o.as}.${l}`,c]);return{env:new Map([...n.env,...a]),rows:[...n.rows,{as:o.as,entity:o.entity,row:s,session:void 0}]}},{env:new Map,rows:[]})}function vT(e,t){return Object.fromEntries(Object.entries(e).map(([r,n])=>{if(ze(n))return[r,xT(t,n.ref)];if(Zt(n))throw new Error(`template value not allowed in entity field "${r}"`);return[r,n]}))}function xT(e,t){let r=e.get(t);if(r==null)throw new Error(`setup ref "${t}" was not produced by an earlier entity`);return r}function kT(e){return{models:new Map(e.entities.map(t=>[t.name,t])),valueSpaces:new Map(e.valueSpaces.map(t=>[t.name,t]))}}function RT(e,t,r){Object.entries(e).forEach(([n,o])=>{let i=Nt(t,n),s=r.indexed.valueSpaces.get(o.valueSpace);if(s==null)throw new Error(`unknown valueSpace "${o.valueSpace}" for param "${i}"`);let a=r.overrides.get(i)??o.example??r.generate.value({anchor:void 0,constraints:s.constraints,generator:s.generator,nullable:!1,seed:i,type:s.type,values:s.values,valueSpace:o.valueSpace});r.env.set(i,a)})}function CT(e,t,r){let n=r.indexed.models.get(e.entity);if(n==null)throw new Error(`model "${e.entity}" not found for setup "${e.as}"`);let o=Nt(t,e.as),i=ET(e.set,t,r.env);return{as:o,entity:e.entity,fields:{...IT(n,i,o,r),...i},model:n,seedPrefix:o}}function ET(e,t,r){return Object.fromEntries(Object.entries(e).map(([n,o])=>[n,PT(o,t,r)]))}function PT(e,t,r){if(!ze(e))return e;let n=Nt(t,e.ref);return r.get(n)??{ref:n}}function IT(e,t,r,n){return Object.fromEntries(Object.entries(e.props).filter(([o,i])=>!i.optional&&!e.identity.includes(o)&&!(o in t)).map(([o,i])=>[o,jg({field:o,generate:n.generate,model:e,seedPrefix:r,spec:i,valueSpaces:n.indexed.valueSpaces})]))}function AT(e,t,r){let n=new Map,o=e.flatMap(i=>{let s=r.models.get(i.entity);if(s==null)throw new Error(`model "${i.entity}" not found for setup "${i.as}"`);Object.entries(i.row).forEach(([l,c])=>t.set(Nt(Xt(i.as),l),c));let a=n.get(i.entity)??new Map;return a.set(MT(i.row,s),_g(i.row,s)),n.set(i.entity,a),i.session==null?[]:[i.session]});return{auth:TT(o),env:t,snapshot:{entities:LT(n),singletons:{}}}}function TT(e){if(e.length===0)return;let t=e.flatMap(r=>Object.entries(r.headers??{}));return{cookies:e.flatMap(r=>r.cookies),headers:t.length===0?void 0:Object.fromEntries(t),origins:e.flatMap(r=>r.origins)}}function OT({generate:e,model:t,seedPrefix:r,set:n,valueSpaces:o}){return{...Object.fromEntries(Object.entries(t.props).filter(([s])=>!(s in n)).map(([s,a])=>[s,jg({field:s,generate:e,model:t,seedPrefix:r,spec:a,valueSpaces:o})])),...n}}function jg({field:e,generate:t,model:r,seedPrefix:n,spec:o,valueSpaces:i}){let s=`${r.name}.${e}`;return t.value({anchor:void 0,constraints:i.get(s)?.constraints,generator:i.get(s)?.generator??"lorem.word",nullable:o.optional,seed:Nt(n,e),type:o.type,values:i.get(s)?.values,valueSpace:s})}function MT(e,t){return t.identity.map(r=>String(e[r])).join(":")}function LT(e){return new Map([...e].map(([t,r])=>[t,new Map(r)]))}function $t(e){return`${e.test}#${String(e.index)}`}function ht(e){let t=e.tests.flatMap(r=>us(e,r.name));return Yt(t,r=>`${r.test}:${Q(r.steps)}`)}function us(e,t){let r=zg(e,t),n=Vg(r,e),o=Fg(n,r.singletons),i=rO(r,tO(e));return NT(o,nO(r.steps),n).map(({chunk:a,guard:l},c)=>QT({chunk:a,guard:l,index:c,intent:r.intent,namespace:n.namespace,paramSpaceOf:i,testName:t}))}function Fg(e,t){return{absences:XT(e),entities:ZT(e),exclusives:e.exclusives,optionals:Hg(e.optionals,e),singletons:Object.fromEntries(Object.entries(t).filter(([,r])=>!ze(r)&&!Zt(r)))}}function ds(e,t,r){return Object.values(e).flatMap(n=>ze(n)?tu(n.ref,r):[]).find(n=>n.entity===t)?.aliasPath}function NT(e,t,r){return t.reduce((n,o)=>({guard:$T(n.guard,o,r),guarded:[...n.guarded,{chunk:o,guard:qT(n.guard,o)}]}),{guard:e,guarded:[]}).guarded}function $T(e,t,r){let n=t.flatMap(o=>o.expect.filter(i=>i.kind==="state")).reduce((o,i)=>DT(o,i,r),e);return{...n,singletons:{...n.singletons,...HT(t)}}}function DT(e,t,r){return t.assertion.kind==="deleted"?_T(e,t,r):t.assertion.kind==="created"?BT(e,t.entity,t.assertion.as,t.assertion.props,r):UT(e,t,r)}function _T(e,t,r){let n=ds(t.key,t.entity,r.namespace),o=e.entities.find(a=>a.alias===n),i=So(jT(t.key),t.entity,r),s=o==null?{entity:t.entity,...i}:{entity:o.entity,...FT(o,i)};return{...e,absences:[...e.absences,s],entities:e.entities.filter(a=>a.alias!==n)}}function jT(e){return Object.fromEntries(Object.entries(e).flatMap(t=>{let r=t[1];return Wg(r)?[]:[[t[0],r]]}))}function FT(e,t){return{literals:{...e.literals,...t.literals},relations:[...e.relations.filter(r=>!t.relations.some(n=>n.field===r.field)),...t.relations]}}function BT(e,t,r,n,o){let i=So(n,t,o);return{...e,absences:e.absences.filter(s=>s.entity!==t||!VT(i,s)),entities:[...e.entities,{alias:r,entity:t,...i}]}}function VT(e,t){return Object.entries(t.literals).every(([n,o])=>e.literals[n]===o)&&t.relations.every(n=>e.relations.some(o=>o.field===n.field&&o.targetAlias===n.targetAlias&&o.targetField===n.targetField))}function UT(e,t,r){if(t.assertion.kind!=="updated")return e;let n=ds(t.key,t.entity,r.namespace);if(n==null)return e;let o=So(Ur(t.assertion.props),t.entity,r),i=Object.entries(t.assertion.props).filter(([,a])=>vr(a)).map(([a])=>a),s=a=>a.alias===n?WT(a,o,i):a;return{...e,entities:e.entities.map(a=>s(a)),optionals:e.optionals.map(a=>s(a))}}function WT(e,t,r){let n=Object.entries(e.literals).filter(([o])=>!r.includes(o)&&!(o in t.literals));return{...e,literals:{...Object.fromEntries(n),...t.literals},relations:[...e.relations.filter(o=>!t.relations.some(i=>i.field===o.field)),...t.relations]}}function HT(e){return e.reduce((t,r)=>({...t,...zT(r),...GT(r)}),{})}function zT(e){return e.action.kind==="goto"?{url:e.action.url}:{}}function GT(e){return Object.fromEntries(e.expect.flatMap(t=>t.kind==="browser"?[[t.name,t.value]]:t.kind==="singleton"?[[t.singleton,t.assertion.value]]:[]))}function qT(e,t){return t[0]?.action.kind!=="goto"?e:{...e,singletons:Object.fromEntries(Object.entries(e.singletons).filter(([r])=>r!=="url"))}}function ps(e,t){let r=zg(e,t),n=Vg(r,e);return{guard:Fg(n,r.singletons),namespace:n.namespace,stable:n.stable}}function Bg(e,t){return[...new Set(e)].flatMap(r=>tu(r,t))}function xt(e){return ze(e)?[e.ref]:Zt(e)?e.template.flatMap(t=>ze(t)?[t.ref]:[]):[]}function xr(e){switch(e.kind){case"visible":case"disabled":case"enabled":case"focused":return kr(e.locator);case"value":case"text":return[...kr(e.locator),...xt(e.value)];case"singleton":return xt(e.assertion.value);case"browser":return xt(e.value);case"state":return[...e.assertion.kind==="deleted"?[]:Object.values(Ur(e.assertion.props)).flatMap(t=>xt(t)),...Object.values(e.key).flatMap(t=>Ug(t))];case"not":return xr(e.predicate);case"when":return[...xr(e.condition),...xr(e.consequence),...e.otherwise==null?[]:xr(e.otherwise)];case"and":return e.predicates.flatMap(t=>xr(t));case"count":return[]}}function Vg(e,t){return{absences:e.absent,exclusives:e.exclusive,namespace:new Map([...e.world,...e.maybe].map(r=>[r.as,r.entity])),optionals:e.maybe,setups:e.world,stable:KT(t)}}function KT(e){let t=new Map(e.entities.map(r=>[r.name,r]));return(r,n)=>t.get(r)?.props[n]?.stable===!0}function kr(e){return e.by==="inside"?[...kr(e.scope),...kr(e.target)]:e.by==="role"?e.name==null?[]:xt(e.name):xt(e.value)}function Ug(e){return Wg(e)?Object.values(e.selection.where).flatMap(t=>Ug(t)):xt(e)}function Wg(e){return typeof e=="object"&&e!==null&&"kind"in e}function JT(e){return e.kind==="goto"?xt(e.url):e.kind==="fill"||e.kind==="select"?[...kr(e.locator),...xt(e.value)]:e.kind==="press"?e.locator==null?[]:kr(e.locator):(e.kind==="upload",kr(e.locator))}function YT(e){return[...JT(e.action),...e.expect.flatMap(t=>xr(t))]}function XT(e){return e.absences.map(t=>({entity:t.entity,...So(t.where,t.entity,e)}))}function So(e,t,r){let n=Object.entries(e).filter(([s])=>r.stable(t,s)),o=Object.fromEntries(n.flatMap(([s,a])=>ze(a)||Zt(a)?[]:[[s,a]])),i=n.flatMap(s=>{let a=s[1];if(!ze(a))return[];let l=tu(a.ref,r.namespace).at(0);return l==null?[]:[{entity:l.entity,field:s[0],targetAlias:l.aliasPath,targetField:l.field}]});return{literals:o,relations:i}}function Hg(e,t){return e.map(r=>({alias:r.as,entity:r.entity,...So(r.set,r.entity,t)}))}function ZT(e){return Hg(e.setups,e)}function QT(e){let t=e.chunk.findIndex(s=>s.action.kind!=="goto"),r=t===-1?e.chunk:e.chunk.slice(0,t),n=e.chunk.slice(r.length),o=n.at(-1)??e.chunk.at(-1);if(o==null)throw new Error("empty transition chunk");let i=[...new Set(e.chunk.flatMap(s=>YT(s)))];return{effectStep:o,guard:e.guard,index:e.index,intent:e.intent,namespace:e.namespace,nav:r,paramSpaces:Object.fromEntries(i.filter(s=>e.paramSpaceOf.has(s)).map(s=>[s,e.paramSpaceOf.get(s)])),steps:n,test:e.testName,wait:bg(n.flatMap(s=>eO(s)))}}function eO(e){return e.expect.flatMap(t=>t.kind==="state"&&t.wait!=null?[t.wait]:[])}function tu(e,t){let r=e.lastIndexOf(".");if(r===-1)return[];let n=e.slice(0,r),o=t.get(n);return o==null?[]:[{aliasPath:n,entity:o,field:e.slice(r+1),ref:e}]}function zg(e,t){let r=e.tests.find(n=>n.name===t);if(r==null)throw new Error(`test "${t}" not found in lockfile`);return r}function tO(e){return new Map(e.valueSpaces.map(t=>[t.name,t]))}function rO(e,t){return new Map(Object.entries(e.params).map(([r,n])=>[r,t.get(n.valueSpace)]))}function nO(e){return eu(e,0,[],[])}function eu(e,t,r,n){let o=e[t];if(o==null)return r.length===0?n:[...n,r];let i=[...r,o];return oO(o)?eu(e,t+1,[],[...n,i]):eu(e,t+1,i,n)}function oO(e){return e.expect.some(t=>t.kind==="state")}function Gg(e){return qg(e,new Map)}function iO(e,t){return e.reduce((r,n)=>r??t(n),null)}function qg(e,t){let r=e.variables.find(n=>!t.has(n));return r==null?t:iO(e.domain(r),n=>{let o=new Map([...t,[r,n]]);return e.consistent(o)?qg(e,o):null})}function Dt(e,t){let r=sO(e,t);if(r==null)return null;let n=pO(r);return fO(e.singletons,t,n)?n:null}function sO(e,t){let{absences:r,entities:n,exclusives:o,optionals:i}=e,s=new Map(n.map(c=>[c.alias,c])),a=Gg({variables:n.map(c=>c.alias),consistent:c=>aO(c)&&lO(n,c)&&uO(r,c,t),domain:c=>Yg(s.get(c),t)});if(a==null)return null;let l=Xg(i,a,t);return dO(o,[...n,...i],l,t)?l:null}function aO(e){let t=[...e.values()];return new Set(t).size===t.length}function lO(e,t){return e.every(r=>t.has(r.alias)?r.relations.every(n=>cO(r,n,t)):!0)}function cO(e,t,r){if(!r.has(t.targetAlias))return!0;let n=r.get(t.targetAlias)?.[t.targetField];return n==null?!0:r.get(e.alias)?.[t.field]===n}function uO(e,t,r){return e.every(n=>![...r.entities.get(n.entity)?.values()??[]].some(o=>Kg(o,n,t)))}function Kg(e,t,r){return Jg(e,t)?t.relations.every(n=>{if(!r.has(n.targetAlias))return!1;let o=r.get(n.targetAlias)?.[n.targetField];return o!=null&&e[n.field]===o}):!1}function Jg(e,t){return Object.entries(t.literals).every(([r,n])=>n===null?e[r]==null:e[r]===n)}function Yg(e,t){return e==null?[]:[...t.entities.get(e.entity)?.values()??[]].filter(r=>Jg(r,e))}function Xg(e,t,r){let n=e.reduce((o,i)=>{if(o.has(i.alias))return o;let s=new Set(o.values()),a=Yg(i,r).find(l=>!s.has(l)&&Kg(l,i,o));return a==null?o:new Map([...o,[i.alias,a]])},t);return n.size===t.size?n:Xg(e,n,r)}function dO(e,t,r,n){return e.every(o=>{let i=t.filter(a=>a.entity===o&&r.has(a.alias)).length;return(n.entities.get(o)?.size??0)===i})}function pO(e){return new Map([...e].flatMap(([t,r])=>Object.entries(r).flatMap(n=>{let o=n[1];return typeof o=="string"||typeof o=="number"||typeof o=="boolean"?[[Xt(`${t}.${n[0]}`),o]]:[]})))}function fO(e,t,r){return Object.entries(e).every(([n,o])=>{if(!is(o,ue,r))return!1;let i=vt(o,ue,r),s=t.singletons[n],a=zt.safeParse(n);return a.success?Nc(a.data,i,s):s===i})}function fs(e,t,r){let n=Dt(e.guard,t);return n==null?null:new Map([...n,...Object.entries(r).map(([o,i])=>[Xt(o),i])])}function hs(e,t){let r=bo(e.effectStep,t),n=gO(e,t),o=[...e.nav,...e.steps].map(i=>bo(i,t));return{effect:yO(r.effect,n),steps:o.map(i=>({action:i.action,effect:i.effect,obligations:i.obligations,reconcile:i.reconcile,verifyChanges:i.verifyChanges}))}}function ru(e,t,r){return Dt(e.guard,r)==null?!1:Hr(t(r))!==Hr(r)||bO(e)||hO(e)}function hO(e){return[...e.nav,...e.steps].every(t=>t.expect.every(r=>r.kind!=="state"))}var Zg=new WeakMap;function Hr(e){let t=Zg.get(e);if(t!=null)return t;let r=Q({entities:[...e.entities].map(([n,o])=>[n,[...o]]),singletons:mO(e.singletons)});return Zg.set(e,r),r}function mO(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>t==="url"&&typeof r=="string"?[t,Jt(r)]:[t,r]))}function gO(e,t){let r=e.nav.at(-1);return r==null?void 0:bo(r,t).action.url}function yO(e,t){if(t==null)return e;let r=Jt(t);return n=>{let o=e(n);return{...o,singletons:{...o.singletons,url:r}}}}function bO(e){return e.effectStep.expect.some(t=>t.kind==="state"&&t.assertion.kind==="updated"&&Object.values(t.assertion.props).some(r=>vr(r)))}function vo(e,t,r){let n=fs(e,t.snapshot,r);if(n==null)return null;let o=wO(e,n);return o==null||!ru(e,o.effect,t.snapshot)?null:{next:{snapshot:o.effect(t.snapshot)},resolved:o}}function Qg(e,t,r){let n=fs(e,t.snapshot,r);if(n==null)return"guard-unsatisfied";try{return hs(e,n),"no-effect"}catch{return"unresolvable"}}function wO(e,t){try{return hs(e,t)}catch{return null}}function hn(e,t,r){return e.flatMap((n,o)=>{let i=r(n),s=vo(n,t,i);return s==null?[]:[{firing:s,idx:o,label:$t(n),params:i}]})}var SO={absences:[],entities:[],exclusives:[],optionals:[],singletons:{}};function xo(e){return{...SO,...e}}function nu(e){return vO(e).flatMap(t=>xO(t))}function vO(e){return[...e.reduce((r,n)=>{let o=Q([n.when.singletons,n.consequence]);return new Map([...r,[o,[...r.get(o)??[],n]]])},new Map).values()]}function xO(e){if(e.length<2)return[];let t=e.map(i=>new Set(i.when.entities.map(s=>ey(s)))),[r]=t;if(r==null)return[];let n=[...r].filter(i=>t.every(s=>s.has(i))),o=e.toSorted((i,s)=>i.when.entities.length-s.when.entities.length)[0];return o==null||n.length===o.when.entities.length?[]:kO(o,n,CO(e))}function ey(e){return Q([e.entity,e.literals])}function kO(e,t,r){let n=e.when.entities.filter(s=>t.includes(ey(s))),o=new Set(n.map(s=>s.alias));if(![...e.refs].every(s=>o.has(s)))return[];let i=xo({entities:n.map(s=>RO(s,o)),optionals:e.when.optionals.filter(s=>o.has(s.alias)),singletons:e.when.singletons});return[{consequence:e.consequence,origin:{kind:"generalized",tests:r},refs:e.refs,when:i}]}function RO(e,t){return{...e,relations:e.relations.filter(r=>t.has(r.targetAlias))}}function CO(e){return[...new Set(e.flatMap(t=>t.origin==null?[]:t.origin.kind==="generalized"?t.origin.tests:[t.origin.test]))]}function su(e){return e.flatMap((t,r)=>e.slice(r+1).flatMap(n=>oy(t,n)))}function ny(e,t){return oy(e,t).length>0}function oy(e,t){let r=ty(e.when,t.when);return!r&&!ty(t.when,e.when)||!PO(e.consequence,t.consequence)?[]:[{a:e.consequence,b:t.consequence,when:r?t.when:e.when}]}function ty(e,t){return ou(e.entities,t.entities)&&ou(e.absences,t.absences)&&ou(e.optionals,t.optionals)&&e.exclusives.every(r=>t.exclusives.includes(r))&&EO(e.singletons,t.singletons)}function ou(e,t){let r=new Set(t.map(n=>Q(n)));return e.every(n=>r.has(Q(n)))}function EO(e,t){return Object.entries(e).every(([r,n])=>Q(t[r])===Q(n))}function PO(e,t){return e.kind==="not"?iu(e.predicate,t):t.kind==="not"?iu(e,t.predicate):IO(e,t)||AO(e,t)}function iu(e,t){return e.kind===t.kind&&"locator"in e&&"locator"in t&&iy(e,t)}function iy(e,t){return"locator"in t&&Q(e.locator)===Q(t.locator)}function IO(e,t){let r=new Set([e.kind,t.kind]);return r.has("enabled")&&r.has("disabled")&&"locator"in e&&"locator"in t?iy(e,t):!1}function AO(e,t){let r=ry(e),n=ry(t);return r==null||n==null||e.kind!==t.kind?!1:iu(e,t)&&Q(r)!==Q(n)}function ry(e){return e.kind==="value"||e.kind==="text"?e.value:null}function au(e,t){return e.flatMap(r=>{let n=TO(r),o=new Set(r.guard.absences.map(i=>i.entity));return t.flatMap(i=>OO(r,i,n,o))})}function TO(e){return new Set(e.steps.flatMap(t=>t.expect.flatMap(r=>r.kind==="state"&&r.assertion.kind==="deleted"?[r.entity]:[])))}function OO(e,t,r,n){let{source:o,target:i}=t.reference;return!r.has(i)||r.has(o)||n.has(o)?[]:[{invariant:t,source:o,target:i,transition:$t(e)}]}function cu(e){return Q({consequence:e.consequence,when:e.when})}function uu(e){let t=[...MO(e),...UO(e)],r=nu(t).reduce((n,o)=>[...t,...n].some(s=>ny(o,s))?n:[...n,o],[]);return Yt([...t,...r],cu)}function du(e){return e.kind==="not"?du(e.predicate):e.kind==="visible"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused"||e.kind==="value"||e.kind==="text"}function pu(e,t,r){if(Dt(e.when,t)!=null)return null;let n=Dt(e.when,r);return n==null?null:HO(e,n)}function MO(e){return Yt(e.tests.flatMap(t=>LO(e,t)),cu)}function LO(e,t){let r=ps(e,t.name);return t.steps.reduce((n,o)=>({guard:NO(n.guard,o,r),laws:[...n.laws,...VO(o,n.guard,r.namespace,{kind:"test",test:t.name})]}),{guard:r.guard,laws:[]}).laws}function NO(e,t,r){return t.expect.reduce((n,o)=>o.kind==="state"?$O(n,o,r):n,e)}function $O(e,t,r){if(t.assertion.kind==="created"){let i=DO(t.assertion.as,t.entity,t.assertion.props,r);return{...e,entities:[...e.entities,i]}}let n=ds(t.key,t.entity,r.namespace);if(n==null)return e;if(t.assertion.kind==="deleted")return FO(e,n);let o=Ur(t.assertion.props);return{...e,entities:e.entities.map(i=>i.alias===n?lu(i,o,r):i),optionals:e.optionals.map(i=>i.alias===n?lu(i,o,r):i)}}function DO(e,t,r,n){return lu({alias:e,entity:t,literals:{},relations:[]},r,n)}function lu(e,t,r){return Object.entries(t).reduce((n,[o,i])=>{if(Zt(i)||!r.stable(e.entity,o))return n;if(ze(i)){let s=_O(i.ref,o,r.namespace);return{...n,literals:jO(n.literals,o),relations:s==null?n.relations:[...sy(n.relations,o),s]}}return{...n,literals:{...n.literals,[o]:i},relations:sy(n.relations,o)}},e)}function _O(e,t,r){let n=e.lastIndexOf(".");if(n===-1)return;let o=e.slice(0,n),i=r.get(o);return i==null?void 0:{entity:i,field:t,targetAlias:o,targetField:e.slice(n+1)}}function jO(e,t){return Object.fromEntries(Object.entries(e).filter(([r])=>r!==t))}function sy(e,t){return e.filter(r=>r.field!==t)}function FO(e,t){let r=[...e.entities,...e.optionals].find(o=>o.alias===t),n=BO(e,t);return r==null?n:{...n,absences:[...n.absences,{entity:r.entity,literals:r.literals,relations:r.relations}]}}function BO(e,t){return{...e,entities:e.entities.filter(r=>r.alias!==t),optionals:e.optionals.filter(r=>r.alias!==t)}}function VO(e,t,r,n){if(e.action.kind!=="goto")return[];let o=e.action.url;return e.expect.filter(i=>du(i)).map(i=>ay({consequence:i,guard:t,namespace:r,origin:n,url:o}))}function ay({consequence:e,guard:t,namespace:r,origin:n,url:o}){return{consequence:e,origin:n,refs:new Set(Bg([...xt(o),...xr(e)],r).map(i=>i.aliasPath)),when:{...t,singletons:{...t.singletons,url:o}}}}function UO(e){return Yt(ht(e).flatMap(t=>WO(t)),cu)}function WO(e){let t=e.nav.at(-1),r=e.steps[0]?.action,n=r!=null&&"locator"in r?r.locator:void 0;return t==null||t.action.kind!=="goto"||n==null?[]:[ay({consequence:{kind:"enabled",locator:n,wait:void 0},guard:e.guard,namespace:e.namespace,origin:{intent:e.intent,kind:"trigger",test:e.test},url:t.action.url})]}function HO(e,t){try{let r=ls(e.consequence,t);return r==null?null:{check:r}}catch{return null}}function fu(e){return Wc(e.tests.flatMap(t=>zO(e,t.name)))}function hu(e,t){return Dt(e.when,t)==null?!1:Dt(e.holds,t)==null}function zO(e,t){let r=ps(e,t);return r.guard.entities.flatMap(n=>n.relations.flatMap(o=>GO(e,n,o,r.namespace)?JO(n,o,r.namespace):[]))}function GO(e,t,r,n){let o=n.get(r.targetAlias);return o!=null&&!qO(e,t.entity,r.field)&&KO(e,o,r.targetField)}function qO(e,t,r){return e.entities.find(n=>n.name===t)?.props[r]?.optional===!0}function KO(e,t,r){return e.entities.find(n=>n.name===t)?.identity.includes(r)===!0}function JO(e,t,r){let n=r.get(t.targetAlias);if(n==null)return[];let o=ly(e.alias,e.entity),i=ly(t.targetAlias,n);return[{holds:xo({entities:[{...o,relations:[t]},i]}),reference:{field:t.field,source:e.entity,target:n,targetField:t.targetField},when:xo({entities:[o]})}]}function ly(e,t){return{alias:e,entity:t,literals:{},relations:[]}}function mu(e,t,r){return t.steps.map(n=>({effect:n.effect,obligations:n.obligations.map(o=>({budget:o.budget,check:{kind:"poll",run:()=>r.evaluate(o.check)},source:{check:o.check,kind:"step"}})),reconcile:n.reconcile,settle:e.wait,step:{action:n.action,intent:e.intent,test:e.test},verifyChanges:n.verifyChanges,guard:()=>!0,perform:()=>r.perform(n.action)}))}async function cy(e,t){let{params:r,transition:n}=e.firing,o=vo(n,e.state,r);if(o==null){let s={intent:n.intent,kind:"unfireable",reason:Qg(n,e.state,r),test:n.test};return{label:$t(n),next:e.state,result:{finalModel:e.state.snapshot,findings:[s]}}}let i=await Gc({canon:e.canon,classify:e.classify,initialSnapshot:e.state.snapshot,lawObligations:XO(e.laws,e.invariants,e.driver),observe:e.driver.observe,onAssertion:e.onAssertion,onStep:e.onStep,steps:mu(e.firing.transition,o.resolved,e.driver)},t);return{label:$t(e.firing.transition),next:{snapshot:i.finalModel},result:i}}function YO(e,t){return hu(e,t)?[{budget:"fast",check:{kind:"decided",passed:!1},source:{invariant:e,kind:"invariant"}}]:[]}function XO(e,t,r){return(n,o)=>[...e.flatMap(i=>ZO(i,n,o,r)),...t.flatMap(i=>YO(i,o))]}function ZO(e,t,r,n){let o=pu(e,t,r);return o==null?[]:[{budget:"fast",check:{kind:"poll",run:()=>n.evaluate(o.check)},source:{check:o.check,kind:"law",origin:e.origin}}]}function yu(e,t){return gu({acc:{findings:[],fired:[]},index:0,params:e,signal:t,state:e.initialState,stepBase:0})}async function gu({acc:e,index:t,params:r,signal:n,state:o,stepBase:i}){Sr(n);let s=r.sequence[t];if(s==null)return e;let a=Date.now(),l=[],c=await cy({canon:r.canon,classify:r.classify,driver:r.driver,firing:s,invariants:r.invariants,laws:r.laws,onAssertion:r.onAssertion,state:o,onStep:d=>{l.push(d.index),r.onEvent({endMs:d.endMs,findings:d.findings,index:i+d.index,kind:"step",startMs:d.startMs})}},n);if(c==null)return gu({acc:e,index:t+1,params:r,signal:n,state:o,stepBase:i});r.onEvent({endMs:Date.now(),intent:s.transition.intent,kind:"fired",startMs:a}),c.result.findings.forEach(d=>{r.onEvent({finding:d,kind:"finding"})});let u={findings:[...e.findings,...c.result.findings],fired:[...e.fired,c.label]};return gu({acc:u,index:t+1,params:r,signal:n,state:c.next,stepBase:i+l.length})}var rt={value:e=>QO(e)};function wu(e,t){return{value:r=>e.value({...r,seed:`${t}:${r.seed}`})}}function Su(e,t){return{value:r=>e.value({...r,anchor:t})}}function QO({anchor:e,constraints:t,generator:r,nullable:n,seed:o,type:i,values:s,valueSpace:a}){let l=bu(`${a}:${o}`);return n&&l%4===0?null:s!=null&&s.length>0?s[l%s.length]??s[0]??null:r==="date.iso"?eM({anchor:e,constraints:t,n:l,timeHash:bu(`${a}:${o}#tod`)}):i==="number"?tM(l,t):i==="boolean"?l%2===0:rM(r,l.toString(36))}var ms=864e5;function eM({anchor:e,constraints:t,n:r,timeHash:n}){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 o=Date.parse(e);if(Number.isNaN(o))throw new TypeError(`datetime anchor "${e}" is not a valid ISO timestamp`);let i=t.maxOffsetDays-t.minOffsetDays+1,s=i<=0?t.minOffsetDays:t.minOffsetDays+r%i,a=Math.floor(o/ms)*ms;return new Date(a+s*ms+n%ms).toISOString()}function bu(e,t=0,r=7){return t>=e.length?r>>>0:bu(e,t+1,r*31+(e.codePointAt(t)??0)>>>0)}function tM(e,t){if(t?.kind!=="number"||t.min==null||t.max==null)throw new Error("number value space requires min and max constraints");let r=t.max-t.min+1;return r<=0?t.min:t.min+e%r}function rM(e,t){if(e==="internet.email")return`${t}@test.ripplo.ai`;if(e==="internet.url")return`https://${t}.example.com`;let r=e.split(".").at(-1);if(r==null)throw new Error(`generator "${e}" has no "."-suffix`);return`${r}-${t}`}import{ResultAsync as xu}from"neverthrow";var ko=class extends Error{mountKey;constructor(t){super("client-mount-unmounted"),this.mountKey=t}};function vu(e){return{read:t=>nM(t,e),seedScript:t=>`globalThis[${JSON.stringify(wc)}] = ${JSON.stringify(t)};`}}async function nM(e,t){let r={title:await e.title(),url:Jt(e.url()),viewport:sM(e.viewportSize())};if(t.length===0)return r;let n=await e.evaluate(iM,{mountKey:Gi,names:t,timeoutMs:oM});if(n.kind==="unmounted")throw new ko(Gi);return{...r,...n.values}}var oM=5e3;async function iM(e){let t=Date.now()+e.timeoutMs;for(;Reflect.get(globalThis,e.mountKey)==null&&Date.now()<t;)await new Promise(n=>setTimeout(n,25));let r=Reflect.get(globalThis,e.mountKey);return r==null?{kind:"unmounted"}:{kind:"values",values:Object.fromEntries(e.names.map(n=>[n,r.readSingleton(n)??null]))}}function sM(e){return e==null?"":`${String(e.width)}x${String(e.height)}`}function Ru(e,t,r){return{evaluate:n=>xu.fromPromise(py(aM(e,r,n),`check ${n.kind}`),uy),observe:()=>t.read().andThen(n=>xu.fromPromise(py(fy(e,r,0),"observe"),uy).map(o=>({snapshot:{...n,singletons:{...n.singletons,...o}}}))),perform:n=>xu.fromPromise(my(e,n,0),o=>rg(n.kind,o))}}async function aM(e,t,r){try{return await by(e,t,r)}catch(n){if(hy(n))return!1;throw n}}function uy(e){return e instanceof ko?Zm(e.mountKey):ng(e)}var lM=[100,250,500];async function fy(e,t,r){try{return await t.read(e)}catch(n){let o=lM[r];if(o==null||!hy(n))throw n;return await yy(o),fy(e,t,r+1)}}function hy(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 dy=35e3;function py(e,t){let r,n=new Promise((o,i)=>{r=setTimeout(()=>{i(new Error(`driver op "${t}" exceeded ${String(dy)}ms`))},dy)});return Promise.race([e,n]).finally(()=>{clearTimeout(r)})}var cM=[250,750,2e3];async function my(e,t,r){try{await uM(e,t)}catch(n){let o=cM[r];if(o==null||!fM(n))throw n;await yy(o),await my(e,t,r+1)}}async function uM(e,t){if(t.kind==="goto"){await e.goto(mn(t.url,t,"url"));return}if(t.kind==="press"&&t.locator==null){await e.keyboard.press(mn(t.key,t,"key"));return}await dM(gy(e,t.locator),t)}function mn(e,t,r){if(e==null)throw new Error(`action "${t.kind}" requires ${r}`);return e}function dM(e,t){switch(t.kind){case"goto":throw new Error("goto must not be located");case"fill":return e.fill(String(mn(t.value,t,"value")));case"clear":return e.clear();case"click":return e.click();case"dblclick":return e.dblclick();case"check":return e.check();case"uncheck":return e.uncheck();case"hover":return e.hover();case"select":return e.selectOption(String(mn(t.value,t,"value")));case"upload":return e.setInputFiles(mn(t.files,t,"files"));case"press":return e.press(mn(t.key,t,"key"))}}function gy(e,t){if(t==null)throw new Error("action requires a locator");return ku(e,t)}function ku(e,t){return t.by==="testId"?e.getByTestId(t.value):t.by==="inside"?ku(ku(e,t.scope),t.target):e.locator(pM(t.role,t.name))}function pM(e,t){return t==null?`role=${e}`:`role=${e}[name=${JSON.stringify(t)}i]`}function fM(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 yy(e){return new Promise(t=>{setTimeout(t,e)})}async function by(e,t,r){if(r.kind==="browser")return hM(e,t,r.name,r.value);if(r.kind==="not")return!await by(e,t,r.inner);let n=gy(e,r.locator);return r.kind==="visible"?n.isVisible():r.kind==="disabled"?n.isDisabled():r.kind==="enabled"?n.isEnabled():r.kind==="focused"?n.evaluate(o=>o===o.ownerDocument.activeElement):r.kind==="value"?await n.inputValue()===r.value:(await n.textContent()??"").includes(r.value)}async function hM(e,t,r,n){let i=(await t.read(e))[r];return typeof i=="string"&&i.includes(n)}import{chromium as Sy}from"playwright";async function Cu({baseUrl:e,browser:t,capture:r,clientState:n,engine:o,reader:i,session:s}){let a=await t.newContext({baseURL:e,reducedMotion:"reduce",storageState:s==null?void 0:{cookies:s.cookies,origins:s.origins}});s?.headers!=null&&await a.setExtraHTTPHeaders(s.headers),await a.addInitScript(o.seedScript(n));let l=r==null?mM():await r.hub.attach(a,r.runId),c=await a.newPage();return l.onPage(c),{driver:gM(Ru(c,i,o),l),emitAssertion:l.emitAssertion,close:()=>yM({context:a,handle:l})}}async function Eu(e,t){let r=await Sy.launch({headless:!e});try{return await t(r)}finally{await r.close()}}function mM(){return{emitAction:()=>{},emitAssertion:()=>{},finish:()=>Promise.resolve(),onPage:()=>{}}}function vy({headed:e}){let t;return{acquire:async()=>{let o=t;if(o!=null){let i=await o.catch(()=>{});if(i?.isConnected()===!0)return i;t===o&&(t=void 0)}return t??=Sy.launch({headless:!e}),t},close:async()=>{let o=t;t=void 0,o!=null&&await o.then(i=>i.close()).catch(()=>{})}}}function gM(e,t){return{evaluate:e.evaluate,observe:e.observe,perform:r=>(t.emitAction(r),e.perform(r))}}async function yM({context:e,handle:t}){await wy(t.finish()),await wy(e.close())}var bM=15e3;async function wy(e){let t,r=new Promise(n=>{t=setTimeout(n,bM)});await Promise.race([e.catch(()=>{}),r]).finally(()=>{clearTimeout(t)})}import{err as wM,ok as SM,Result as Pu}from"neverthrow";function Iu(e,t,r){return{read:()=>r.read(e.map(n=>n.name),t).andThen(n=>vM(e,n))}}function vM(e,t){return Pu.combine(e.map(r=>xM(r,t.entities[r.name]??[]).map(n=>[r.name,n]))).map(r=>({entities:new Map(r),singletons:t.singletons}))}function xM(e,t){let r=cs(e);return Pu.combine(t.map(n=>kM(n,e).map(o=>[o,RM(n,r)]))).map(n=>new Map(n))}function kM(e,t){return Pu.combine(t.identity.map(r=>{let n=e[r];return n==null?wM(eg(t.name,r)):SM(String(n))})).map(r=>r.join(":"))}function RM(e,t){let r=t.map(n=>[n,e[n]]).filter(n=>n[1]!=null);return Object.fromEntries(r)}var ky=Ti(ec(),1);import CM from"crypto";import{err as EM,errAsync as xy,ok as PM,ResultAsync as gs}from"neverthrow";var IM=3e4,AM=[250,750,2e3];function Au({baseUrl:e,runId:t,secret:r},n){let o=new ky.Webhook(r),i=(s,a,l)=>TM({baseUrl:e,body:a,path:s,retry:l.retry,schema:l.schema,signal:l.signal,webhook:o});return{query:{read:(s,a)=>i("/state",{entities:s,runId:t,singletons:a},{retry:"transient",schema:Cc,signal:n}).map(l=>({entities:l.entities,singletons:l.singletons}))},setupWorld:s=>i("/setup",{entities:s,runId:t},{retry:"connection",schema:Rc,signal:n}).map(a=>a.rows),teardown:()=>i("/teardown",{runId:t},{retry:"connection",schema:Ec,signal:void 0}).map(()=>{})}}function TM(e){return Ry(e.retry,()=>$M(e),0)}function Ry(e,t,r){return t().orElse(n=>{let o=AM[r];return o==null||!MM(n,e)?xy(n):gs.fromSafePromise(NM(o)).andThen(()=>Ry(e,t,r+1))})}var OM=new Set(["EAI_AGAIN","ECONNREFUSED","ENOTFOUND"]);function MM(e,t){return e.kind==="aborted"?!1:LM(e)?!0:t==="connection"?!1:e.kind==="engine-network"||e.kind==="engine-http"&&e.status>=500}function LM(e){return e.kind==="engine-network"&&e.code!=null&&OM.has(e.code)}function NM(e){return new Promise(t=>{setTimeout(t,e)})}function $M({baseUrl:e,body:t,path:r,schema:n,signal:o,webhook:i}){let s=JSON.stringify(t);return gs.fromPromise(fetch(`${e}${r}`,{body:s,headers:{"Content-Type":"application/json",...DM(i,s)},method:"PUT",signal:_M(o)}),a=>ts(r,a)).andThen(a=>jM(a,r)).andThen(a=>FM(n,a,r)).mapErr(a=>o?.aborted===!0?og():a)}function DM(e,t){let r=`msg_${CM.randomUUID()}`,n=new Date;return{"webhook-id":r,"webhook-signature":e.sign(r,n,t),"webhook-timestamp":String(Math.floor(n.getTime()/1e3))}}function _M(e){let t=AbortSignal.timeout(IM);return e==null?t:AbortSignal.any([e,t])}function jM(e,t){return e.ok?gs.fromPromise(e.json(),r=>ts(t,r)):gs.fromPromise(e.text().catch(()=>""),r=>ts(t,r)).andThen(r=>xy(Xm(t,e.status,r)))}function FM(e,t,r){let n=e.safeParse(t);return n.success?PM(n.data):EM(Qm(r,n.error))}var he=Ti(Py(),1),_={actual:e=>he.default.red(e),bad:e=>he.default.red(he.default.bold(e)),bold:e=>he.default.bold(e),dim:e=>he.default.dim(e),expected:e=>he.default.green(e),good:e=>he.default.green(he.default.bold(e)),heading:e=>he.default.bold(he.default.cyan(e)),path:e=>he.default.cyan(he.default.underline(e)),warn:e=>he.default.yellow(he.default.bold(e))},WM={assertion:he.default.yellow,consistency:he.default.magenta,driver:he.default.red,illegal:he.default.cyan,invariant:he.default.yellow,unfireable:he.default.red};function Ro(e){return`${he.default.red(he.default.bold("\u2717"))} ${WM[e](he.default.bold(e.toUpperCase()))}`}var HM=he.default.red("\u2717"),XQ=he.default.green("\u2713"),Iy=he.default.dim("\u203A"),zM=8;function ne(e,t,r){let n=r==null?"":` ${_.dim(r)}`;return` ${_.dim(e.padStart(zM))} ${t}${n}`}function yn(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${yn(e.scope)} \u25B8 ${yn(e.target)}`:e.name==null?e.role:`${e.role} "${e.name}"`}function Ou(e){return e.url!=null?`${e.kind} ${e.url}`:e.locator!=null?`${e.kind} ${yn(e.locator)}`:e.kind}function ws(e){return e.kind==="not"?`not ${ws(e.inner)}`:e.kind==="browser"?`${e.name}="${e.value}"`:e.kind==="value"||e.kind==="text"?`${e.kind} ${yn(e.locator)}="${e.value}"`:`${e.kind} ${yn(e.locator)}`}function Ss(e){let{field:t,source:r,target:n,targetField:o}=e.reference;return`${r}.${t} \u2192 ${n}.${o}`}function Ty(e){return`${e.intent} \u203A ${Ou(e.action)}`}function Oy(e){return e.kind==="invariant"?`invariant ${Ss(e.invariant)}`:`${e.kind} ${ws(e.check)}`}function gn(e){return e==null?"\u2205":JSON.stringify(e)}function Mu(e){return{label:Oy(e.source),step:Ty(e.step)}}function Co(e){return e.kind==="consistency"?KM(e):e.kind==="obligation"?eL(e.source,e.step,e.budget):e.kind==="illegal-transition"?zr("illegal","guard was false before this step",e.step,[ne("meaning",_.dim("the action fired from a state the model says is unreachable"),void 0)]):e.kind==="unfireable"?zr("unfireable",`could not fire "${e.intent}"`,void 0,[ne("reason",_.actual(qM(e.reason)),void 0),ne("meaning",_.dim("a planned move was skipped \u2014 never silently drop it"),void 0)]):zr("driver","the browser failed to run this step",e.step,[ne("cause",_.actual(br(e.error)),void 0),ne("decide",_.dim("environment/infra failure \u2014 fix the run environment (daemon, dev server, ports); never weaken the model or app for a driver failure"),void 0)])}var GM={"guard-unsatisfied":"the guard isn't satisfied by the live state","no-effect":"the move has no observable effect from this state",unresolvable:"a step references a value the model can't resolve yet (e.g. a not-yet-created id)"};function qM(e){return GM[e]}function Lu({debugDir:e,runId:t}){let r=`${e}/${t}`;return ne("behavior",_.path(`${r}/behavior.jsonl`),void 0)}function Nu(e){if(e.kind==="cascade-gap"){let{gap:n}=e,o=`${n.transition} deletes ${n.target} but leaves ${n.source} dangling`;return`${Ro("invariant")} ${_.bold(o)}
114
- ${ne("breaks",_.dim(Ss(n.invariant)),void 0)}`}if(e.kind==="create-gap"){let{gap:n}=e,o=`${n.transition} creates ${n.entity} without setting required field(s)`;return`${Ro("invariant")} ${_.bold(o)}
115
- ${ne("missing",_.dim(n.missing.join(", ")),void 0)}`}let{conflict:t}=e,r=`view laws contradict: ${t.a.kind} vs ${t.b.kind}`;return`${Ro("invariant")} ${_.bold(r)}
116
- ${ne("when",_.dim(JSON.stringify(t.when.singletons)),void 0)}`}function zr(e,t,r,n){let o=r==null?[]:[` ${r.intent} ${Iy} ${_.dim(Ou(r.action))}`];return[`${Ro(e)} ${_.bold(t)}`,...o,...n].join(`
117
- `)}function KM(e){return e.pending?zr("consistency",XM(e.divergence),e.step,[...Ay(e.divergence),ne("meaning",_.dim(`the write never landed within the ${ZM(e.budget)} settle budget \u2014 the app still showed the pre-step value, not a wrong one`),void 0),ne("fix",_.dim("declare wait: on the expectation (or a slower tier) if this write is legitimately slow"),void 0)]):zr("consistency",QM(e.divergence),e.step,[...Ay(e.divergence),ne("decide",_.dim(YM(e.divergence)),void 0)])}var JM={absent:"app bug if the write was promised; if it only happens from a different starting state, restrict this test's given and cover that state in its own test","expected-change":"app bug if this action should change it; if the change needs other preconditions, split that case into its own test with the right given","field-mismatch":"app bug if the model value is the promised behavior; if the app legitimately owns this value, mark the field stable: false or assert changed() instead","ghost-write":"declare the missing effect on the acting step (Entity.created/updated/deleted), or if this write belongs to a different flow, cover it in that flow's test","singleton-mismatch":"app bug if the model value is the promised behavior; otherwise correct the singleton's expected value at the step that sets it"};function YM(e){return JM[e.kind]}function XM(e){return e.kind==="field-mismatch"?`${e.entity}.${e.field} write never landed`:e.kind==="ghost-write"?`${e.entity} "${e.key}" delete never landed`:e.kind==="absent"?`${e.entity} "${e.key}" create never landed`:e.kind==="expected-change"?`${e.entity}.${e.field} never changed`:`${e.singleton} write never landed`}function Ay(e){if(e.kind==="field-mismatch")return[ne("row",_.dim(`${e.entity} ${e.key}`),void 0),ne("expected",_.expected(gn(e.snapshot)),"model predicted this"),ne("actual",_.actual(gn(e.sut)),"app showed this")];if(e.kind==="singleton-mismatch")return[ne("expected",_.expected(gn(e.snapshot)),"model predicted this"),ne("actual",_.actual(gn(e.sut)),"app showed this")];if(e.kind==="expected-change")return[ne("row",_.dim(`${e.entity} ${e.key}`),void 0),ne("expected",_.expected("a different value"),"changed() asserted a change"),ne("actual",_.actual(gn(e.value)),"app left it unchanged")];let t=e.kind==="ghost-write"?"an app write the model never declared \u2014 unmodeled side effect":"the model expected this row but the app has none";return[ne("meaning",_.dim(t),void 0)]}function ZM(e){return`${String(ho[e]/1e3)}s "${e}"`}function QM(e){return e.kind==="field-mismatch"?`${e.entity}.${e.field} diverged`:e.kind==="ghost-write"?`${e.entity} "${e.key}" written but never modeled`:e.kind==="absent"?`${e.entity} "${e.key}" missing in the app`:e.kind==="expected-change"?`${e.entity}.${e.field} never changed`:`${e.singleton} diverged`}function eL(e,t,r){if(e.kind==="invariant")return zr("invariant",`${Ss(e.invariant)} violated`,t,[ne("meaning",_.dim("a referenced row went missing after this step"),void 0)]);let n=e.kind==="law"?"view law never held":"expectation never held",o=e.kind==="law"&&e.origin!=null?[tL(e.origin)]:[];return zr("assertion",n,t,[ne("check",_.warn(ws(e.check)),void 0),...o,ne("budget",_.dim(`${r} (polled until timeout)`),void 0),ne("decide",_.dim("wrong locator/accessible name, UI regression, or the expectation only holds under a narrower given \u2014 confirm in behavior.jsonl before changing the test"),void 0)])}function tL(e){if(e.kind==="test")return ne("law from",_.dim(`an assertion in test "${e.test}"`),void 0);if(e.kind==="trigger")return ne("law from",_.dim(`the trigger of "${e.intent}" (test "${e.test}")`),void 0);let t=e.tests.map(r=>JSON.stringify(r)).join(", ");return ne("law from",_.dim(`generalized across tests ${t}`),void 0)}import{err as TB,ok as OB,ResultAsync as MB}from"neverthrow";import BS from"path";import rL from"path";import{z as Eo}from"zod";var nL=["unspecified","internal","server","client","producer","consumer"],oL=["unset","ok","error"];function My(e){return nL[e]??"unspecified"}function Ly(e){return oL[e]??"unset"}var see=Eo.looseObject({data:Eo.looseObject({source:Eo.number().optional()}).optional(),timestamp:Eo.number(),type:Eo.number()});function Ny({debugDir:e,runId:t,worker:r}){let n=rL.join(e,t,"behavior.jsonl");return r.open({file:n,runId:t}),{close:o=>r.close({noticeLineIfNoRrweb:o?.noticeIfNoRrweb==null?"":JSON.stringify(iL(o.noticeIfNoRrweb)),runId:t}),emit:o=>{r.line({line:JSON.stringify(o),runId:t,timeNanos:o.timeNanos})},emitRrwebBatch:o=>{r.rrwebBatch({data:o,runId:t})}}}function bn(e){return String(BigInt(Math.round(e))*1000000n)}function iL(e){return{kind:"notice",message:e,source:"capture",timeNanos:"0"}}import{existsSync as sL}from"fs";import{createRequire as aL}from"module";import{fileURLToPath as lL}from"url";import{Worker as cL}from"worker_threads";var uL=aL(import.meta.url);function $y(e){let t=new cL(dL(),{workerData:e});t.unref();let r=new Map,n={next:0};t.on("message",i=>{let s=r.get(i.seq);s!=null&&(r.delete(i.seq),s())});let o=i=>{t.postMessage(i)};return{close:({noticeLineIfNoRrweb:i,runId:s})=>{let a=n.next;return n.next+=1,new Promise(l=>{r.set(a,l),o({noticeLineIfNoRrweb:i,runId:s,seq:a,t:"close"})})},line:({line:i,runId:s,timeNanos:a})=>{o({line:i,runId:s,t:"line",timeNanos:a})},open:({file:i,runId:s})=>{o({file:i,runId:s,t:"open"})},rrwebBatch:({data:i,runId:s})=>{o({data:i,runId:s,t:"rrweb-batch"})},terminate:async()=>{await t.terminate()}}}function dL(){try{return uL.resolve("@ripplo/runtime/capture-worker")}catch{let e=["../../dist/capture-worker.js","./capture-worker.js"].map(r=>lL(new URL(r,import.meta.url))),t=e.find(r=>sL(r));if(t==null)throw new Error(`capture-worker.js not found; looked at: ${e.join(", ")}`);return t}}import{readFile as pL}from"fs/promises";import{createRequire as fL}from"module";import{fileURLToPath as hL}from"url";var mL=fL(import.meta.url);function $u(e,t){try{return mL.resolve(e)}catch{return hL(new URL(`assets/${t}`,import.meta.url))}}var gL=$u("@ripplo/browser-trace/bundle","browser-trace.js");async function _y(e,t){await e.addInitScript(`globalThis.__ripploRunId = ${JSON.stringify(t)};`),await e.addInitScript(await yL())}var Dy;function yL(){return Dy??=pL(gL,{encoding:"utf8"}),Dy}import{createServer as bL}from"http";import{mkdir as wL,rm as SL,writeFile as vL}from"fs/promises";import xL from"path";import{z as oe}from"zod";var kL="otlp-port",Fy=oe.object({key:oe.string(),value:oe.object({boolValue:oe.boolean().optional(),doubleValue:oe.number().optional(),intValue:oe.union([oe.string(),oe.number()]).optional(),stringValue:oe.string().optional()})}),RL=oe.object({attributes:oe.array(Fy).default([]),endTimeUnixNano:oe.string(),kind:oe.number().default(0),name:oe.string(),parentSpanId:oe.string().optional(),spanId:oe.string(),startTimeUnixNano:oe.string(),status:oe.object({code:oe.number(),message:oe.string().optional()}).optional(),traceId:oe.string()}),CL=oe.object({resourceSpans:oe.array(oe.object({resource:oe.object({attributes:oe.array(Fy).default([])}).optional(),scopeSpans:oe.array(oe.object({spans:oe.array(RL).default([])})).default([])})).default([])});async function Po({localDir:e,onRrwebBatch:t,onSpan:r,writePortFile:n}){let{port:o,server:i}=await EL({onRrwebBatch:t,onSpan:r}),s=xL.join(e,kL);return n&&(await wL(e,{recursive:!0}),await vL(s,String(o),{encoding:"utf8"})),{port:o,stop:async()=>{n&&await SL(s,{force:!0}),await OL(i)}}}function EL(e){return new Promise((t,r)=>{let n=bL((o,i)=>{PL(o,i,e)});n.on("error",r),n.listen(0,()=>{let o=n.address();if(o==null||typeof o=="string"){r(new Error("otlp_receiver_no_port"));return}t({port:o.port,server:n})})})}function PL(e,t,r){let n=IL(e.url);if(n!=null){jy(e).then(o=>{r.onRrwebBatch(n,o),vs(t)}).catch(()=>{vs(t)});return}jy(e).then(o=>{AL(CL.parse(JSON.parse(o.toString("utf8"))),r.onSpan),vs(t)}).catch(()=>{vs(t)})}function IL(e){if(e==null||!e.startsWith("/rrweb/"))return;let t=decodeURIComponent(e.slice(7));return t.length===0?void 0:t}function jy(e){return new Promise((t,r)=>{let n=[];e.on("data",o=>{n.push(o)}),e.on("end",()=>{t(Buffer.concat(n))}),e.on("error",r)})}function vs(e){e.writeHead(200,{"content-type":"application/json"}),e.end("{}")}function AL(e,t){e.resourceSpans.flatMap(r=>r.scopeSpans).flatMap(r=>r.spans).forEach(r=>{t({attributes:TL(r.attributes),durationMs:Number((BigInt(r.endTimeUnixNano)-BigInt(r.startTimeUnixNano))/1000000n),kind:"span",name:r.name,parentSpanId:r.parentSpanId,source:"server",spanId:r.spanId,spanKind:My(r.kind),status:{code:Ly(r.status?.code??0),message:r.status?.message},timeNanos:r.startTimeUnixNano,traceId:r.traceId})})}function TL(e){return Object.fromEntries(e.map(({key:t,value:r})=>[t,String(r.stringValue??r.intValue??r.doubleValue??r.boolValue??"")]))}function OL(e){return new Promise((t,r)=>{e.close(n=>{if(n==null){t();return}r(n)}),e.closeAllConnections()})}import{readFile as eD}from"fs/promises";var ML=Object.defineProperty,LL=(e,t,r)=>t in e?ML(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,k=(e,t,r)=>LL(e,typeof t!="symbol"?t+"":t,r),By,NL=Object.defineProperty,$L=(e,t,r)=>t in e?NL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Vy=(e,t,r)=>$L(e,typeof t!="symbol"?t+"":t,r),Be=(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))(Be||{}),Uy={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Wy={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},xs={},DL=()=>!!globalThis.Zone;function Fd(e){if(xs[e])return xs[e];let t=globalThis[e],r=t.prototype,n=e in Uy?Uy[e]:void 0,o=!!(n&&n.every(a=>{var l,c;return!!((c=(l=Object.getOwnPropertyDescriptor(r,a))==null?void 0:l.get)!=null&&c.toString().includes("[native code]"))})),i=e in Wy?Wy[e]:void 0,s=!!(i&&i.every(a=>{var l;return typeof r[a]=="function"&&((l=r[a])==null?void 0:l.toString().includes("[native code]"))}));if(o&&s&&!DL())return xs[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 c=l[e].prototype;return document.body.removeChild(a),c?xs[e]=c:r}catch{return r}}var Du={};function rr(e,t,r){var n;let o=`${e}.${String(r)}`;if(Du[o])return Du[o].call(t);let i=Fd(e),s=(n=Object.getOwnPropertyDescriptor(i,r))==null?void 0:n.get;return s?(Du[o]=s,s.call(t)):t[r]}var _u={};function Bb(e,t,r){let n=`${e}.${String(r)}`;if(_u[n])return _u[n].bind(t);let i=Fd(e)[r];return typeof i!="function"?t[r]:(_u[n]=i,i.bind(t))}function _L(e){return rr("Node",e,"ownerDocument")}function jL(e){return rr("Node",e,"childNodes")}function FL(e){return rr("Node",e,"parentNode")}function BL(e){return rr("Node",e,"parentElement")}function VL(e){return rr("Node",e,"textContent")}function UL(e,t){return Bb("Node",e,"contains")(t)}function WL(e){return Bb("Node",e,"getRootNode")()}function HL(e){return!e||!("host"in e)?null:rr("ShadowRoot",e,"host")}function zL(e){return e.styleSheets}function GL(e){return!e||!("shadowRoot"in e)?null:rr("Element",e,"shadowRoot")}function qL(e,t){return rr("Element",e,"querySelector")(t)}function KL(e,t){return rr("Element",e,"querySelectorAll")(t)}function JL(){return Fd("MutationObserver").constructor}function YL(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],o=r(n);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=o,()=>{e[t]=n}}catch{return()=>{}}}var Je={ownerDocument:_L,childNodes:jL,parentNode:FL,parentElement:BL,textContent:VL,contains:UL,getRootNode:WL,host:HL,styleSheets:zL,shadowRoot:GL,querySelector:qL,querySelectorAll:KL,mutationObserver:JL,patch:YL};function Vb(e){return e.nodeType===e.ELEMENT_NODE}function Lo(e){let t=e&&"host"in e&&"mode"in e&&Je.host(e)||null;return!!(t&&"shadowRoot"in t&&Je.shadowRoot(t)===e)}function No(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function XL(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 ZL(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function Yu(e){try{let t=e.rules||e.cssRules;if(!t)return null;let r=e.href;!r&&e.ownerNode&&(r=e.ownerNode.baseURI);let n=Array.from(t,o=>Ub(o,r)).join("");return XL(n)}catch{return null}}function Ub(e,t){if(e2(e)){let r;try{r=Yu(e.styleSheet)||ZL(e)}catch{r=e.cssText}return e.styleSheet.href?ea(r,e.styleSheet.href):r}else{let r=e.cssText;return t2(e)&&e.selectorText.includes(":")&&(r=QL(r)),t?ea(r,t):r}}function QL(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function e2(e){return"styleSheet"in e}function t2(e){return"selectorText"in e}var Xs=class{constructor(){Vy(this,"idNodeMap",new Map),Vy(this,"nodeMetaMap",new WeakMap)}getId(t){var r;return t?((r=this.getMeta(t))==null?void 0:r.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 r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(n=>this.removeNodeFromMap(n))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){let n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)}replace(t,r){let n=this.getNode(t);if(n){let o=this.nodeMetaMap.get(n);o&&this.nodeMetaMap.set(r,o)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function r2(){return new Xs}function Zs({element:e,maskInputOptions:t,tagName:r,type:n,value:o,maskInputFn:i}){let s=o||"",a=n&&qr(n);return(t[r.toLowerCase()]||a&&t[a])&&(i?s=i(s,e):s="*".repeat(s.length)),s}function qr(e){return e.toLowerCase()}var Hy="__rrweb_original__";function n2(e){let t=e.getContext("2d");if(!t)return!0;let r=50;for(let n=0;n<e.width;n+=r)for(let o=0;o<e.height;o+=r){let i=t.getImageData,s=Hy in i?i[Hy]:i;if(new Uint32Array(s.call(t,n,o,Math.min(r,e.width-n),Math.min(r,e.height-o)).data.buffer).some(l=>l!==0))return!1}return!0}function Qs(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?qr(t):null}function Wb(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}let n=/\.([0-9a-z]+)(?:$)/i,o=r.pathname.match(n);return o?.[1]??null}function o2(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var i2=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,s2=/^(?:[a-z+]+:)?\/\//i,a2=/^www\..*/i,l2=/^(data:)([^,]*),(.*)/i;function ea(e,t){return(e||"").replace(i2,(r,n,o,i,s,a)=>{let l=o||s||a,c=n||i||"";if(!l)return r;if(s2.test(l)||a2.test(l))return`url(${c}${l}${c})`;if(l2.test(l))return`url(${c}${l}${c})`;if(l[0]==="/")return`url(${c}${o2(t)+l}${c})`;let u=t.split("/"),d=l.split("/");u.pop();for(let p of d)p!=="."&&(p===".."?u.pop():u.push(p));return`url(${c}${u.join("/")}${c})`})}function ks(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function c2(e,t,r=!1){let n=Array.from(t.childNodes),o=[],i=0;if(n.length>1&&e&&typeof e=="string"){let s=ks(e,r),a=s.length/e.length;for(let l=1;l<n.length;l++)if(n[l].textContent&&typeof n[l].textContent=="string"){let c=ks(n[l].textContent,r),u=100,d=3;for(;d<c.length&&(c[d].match(/[a-zA-Z0-9]/)||c.indexOf(c.substring(0,d),1)!==-1);d++);for(;d<c.length;d++){let p=c.substring(0,d),h=s.split(p),f=-1;if(h.length===2)f=h[0].length;else if(h.length>2&&h[0]===""&&n[l-1].textContent!=="")f=s.indexOf(p,1);else if(h.length===1){if(p=p.substring(0,p.length-1),h=s.split(p),h.length<=1)return o.push(e),o;d=u+1}else d===c.length-1&&(f=s.indexOf(p));if(h.length>=2&&d>u){let m=n[l-1].textContent;if(m&&typeof m=="string"){let g=ks(m).length;f=s.indexOf(p,g)}f===-1&&(f=h[0].length)}if(f!==-1){let m=Math.floor(f/a);for(;m>0&&m<e.length;){if(i+=1,i>50*n.length)return o.push(e),o;let g=ks(e.substring(0,m),r);if(g.length===f){o.push(e.substring(0,m)),e=e.substring(m),s=s.substring(f);break}else g.length<f?m+=Math.max(1,Math.floor((f-g.length)/a)):m-=Math.max(1,Math.floor((g.length-f)*a))}break}}}}return o.push(e),o}function u2(e,t){return c2(e,t).join("/* rr_split */")}var d2=1,p2=new RegExp("[^a-z0-9-_:]"),Do=-2;function Hb(){return d2++}function f2(e){if(e instanceof HTMLFormElement)return"form";let t=qr(e.tagName);return p2.test(t)?"div":t}var wn,zy,h2=/^[^ \t\n\r\u000c]+/,m2=/^[, \t\n\r\u000c]+/;function g2(e,t){if(t.trim()==="")return t;let r=0;function n(i){let s,a=i.exec(t.substring(r));return a?(s=a[0],r+=s.length,s):""}let o=[];for(;n(m2),!(r>=t.length);){let i=n(h2);if(i.slice(-1)===",")i=xn(e,i.substring(0,i.length-1)),o.push(i);else{let s="";i=xn(e,i);let a=!1;for(;;){let l=t.charAt(r);if(l===""){o.push((i+s).trim());break}else if(a)l===")"&&(a=!1);else if(l===","){r+=1,o.push((i+s).trim());break}else l==="("&&(a=!0);s+=l,r+=1}}}return o.join(", ")}var Gy=new WeakMap;function xn(e,t){return!t||t.trim()===""?t:Bd(e,t)}function y2(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function Bd(e,t){let r=Gy.get(e);if(r||(r=e.createElement("a"),Gy.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function zb(e,t,r,n){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&["table","td","th"].includes(t)?xn(e,n):r==="srcset"?g2(e,n):r==="style"?ea(n,Bd(e)):t==="object"&&r==="data"?xn(e,n):n)}function Gb(e,t,r){return["video","audio"].includes(e)&&t==="autoplay"}function b2(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){let o=e.classList[n];if(t.test(o))return!0}if(r)return e.matches(r)}catch{}return!1}function ta(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?ta(Je.parentNode(e),t,r):!1;for(let n=e.classList.length;n--;){let o=e.classList[n];if(t.test(o))return!0}return r?ta(Je.parentNode(e),t,r):!1}function qb(e,t,r,n){let o;if(Vb(e)){if(o=e,!Je.childNodes(o).length)return!1}else{if(Je.parentElement(e)===null)return!1;o=Je.parentElement(e)}try{if(typeof t=="string"){if(n){if(o.closest(`.${t}`))return!0}else if(o.classList.contains(t))return!0}else if(ta(o,t,n))return!0;if(r){if(n){if(o.closest(r))return!0}else if(o.matches(r))return!0}}catch{}return!1}function w2(e,t,r){let n=e.contentWindow;if(!n)return;let o=!1,i;try{i=n.document.readyState}catch{return}if(i!=="complete"){let a=setTimeout(()=>{o||(t(),o=!0)},r);e.addEventListener("load",()=>{clearTimeout(a),o=!0,t()});return}let s="about:blank";if(n.location.href!==s||e.src===s||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function S2(e,t,r){let n=!1,o;try{o=e.sheet}catch{return}if(o)return;let i=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(i),n=!0,t()})}function v2(e,t){let{doc:r,mirror:n,blockClass:o,blockSelector:i,needsMask:s,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:c,maskInputFn:u,dataURLOptions:d={},inlineImages:p,recordCanvas:h,keepIframeSrcFn:f,newlyAddedElement:m=!1,cssCaptured:g=!1}=t,w=x2(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:Be.Document,childNodes:[],compatMode:e.compatMode}:{type:Be.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Be.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:w};case e.ELEMENT_NODE:return R2(e,{doc:r,blockClass:o,blockSelector:i,inlineStylesheet:a,maskInputOptions:l,maskInputFn:u,dataURLOptions:d,inlineImages:p,recordCanvas:h,keepIframeSrcFn:f,newlyAddedElement:m,rootId:w});case e.TEXT_NODE:return k2(e,{doc:r,needsMask:s,maskTextFn:c,rootId:w,cssCaptured:g});case e.CDATA_SECTION_NODE:return{type:Be.CDATA,textContent:"",rootId:w};case e.COMMENT_NODE:return{type:Be.Comment,textContent:Je.textContent(e)||"",rootId:w};default:return!1}}function x2(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}function k2(e,t){let{needsMask:r,maskTextFn:n,rootId:o,cssCaptured:i}=t,s=Je.parentNode(e),a=s&&s.tagName,l="",c=a==="STYLE"?!0:void 0,u=a==="SCRIPT"?!0:void 0;return u?l="SCRIPT_PLACEHOLDER":i||(l=Je.textContent(e),c&&l&&(l=ea(l,Bd(t.doc)))),!c&&!u&&l&&r&&(l=n?n(l,Je.parentElement(e)):l.replace(/[\S]/g,"*")),{type:Be.Text,textContent:l||"",rootId:o}}function R2(e,t){let{doc:r,blockClass:n,blockSelector:o,inlineStylesheet:i,maskInputOptions:s={},maskInputFn:a,dataURLOptions:l={},inlineImages:c,recordCanvas:u,keepIframeSrcFn:d,newlyAddedElement:p=!1,rootId:h}=t,f=b2(e,n,o),m=f2(e),g={},w=e.attributes.length;for(let y=0;y<w;y++){let v=e.attributes[y];Gb(m,v.name,v.value)||(g[v.name]=zb(r,m,qr(v.name),v.value))}if(m==="link"&&i){let y=Array.from(r.styleSheets).find(C=>C.href===e.href),v=null;y&&(v=Yu(y)),v&&(delete g.rel,delete g.href,g._cssText=v)}if(m==="style"&&e.sheet){let y=Yu(e.sheet);y&&(e.childNodes.length>1&&(y=u2(y,e)),g._cssText=y)}if(["input","textarea","select"].includes(m)){let y=e.value,v=e.checked;g.type!=="radio"&&g.type!=="checkbox"&&g.type!=="submit"&&g.type!=="button"&&y?g.value=Zs({element:e,type:Qs(e),tagName:m,value:y,maskInputOptions:s,maskInputFn:a}):v&&(g.checked=v)}if(m==="option"&&(e.selected&&!s.select?g.selected=!0:delete g.selected),m==="dialog"&&e.open&&(g.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),m==="canvas"&&u){if(e.__context==="2d")n2(e)||(g.rr_dataURL=e.toDataURL(l.type,l.quality));else if(!("__context"in e)){let y=e.toDataURL(l.type,l.quality),v=r.createElement("canvas");v.width=e.width,v.height=e.height;let C=v.toDataURL(l.type,l.quality);y!==C&&(g.rr_dataURL=y)}}if(m==="img"&&c){wn||(wn=r.createElement("canvas"),zy=wn.getContext("2d"));let y=e,v=y.currentSrc||y.getAttribute("src")||"<unknown-src>",C=y.crossOrigin,M=()=>{y.removeEventListener("load",M);try{wn.width=y.naturalWidth,wn.height=y.naturalHeight,zy.drawImage(y,0,0),g.rr_dataURL=wn.toDataURL(l.type,l.quality)}catch(I){if(y.crossOrigin!=="anonymous"){y.crossOrigin="anonymous",y.complete&&y.naturalWidth!==0?M():y.addEventListener("load",M);return}else console.warn(`Cannot inline img src=${v}! Error: ${I}`)}y.crossOrigin==="anonymous"&&(C?g.crossOrigin=C:y.removeAttribute("crossorigin"))};y.complete&&y.naturalWidth!==0?M():y.addEventListener("load",M)}if(["audio","video"].includes(m)){let y=g;y.rr_mediaState=e.paused?"paused":"played",y.rr_mediaCurrentTime=e.currentTime,y.rr_mediaPlaybackRate=e.playbackRate,y.rr_mediaMuted=e.muted,y.rr_mediaLoop=e.loop,y.rr_mediaVolume=e.volume}if(p||(e.scrollLeft&&(g.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(g.rr_scrollTop=e.scrollTop)),f){let{width:y,height:v}=e.getBoundingClientRect();g={class:g.class,rr_width:`${y}px`,rr_height:`${v}px`}}m==="iframe"&&!d(g.src)&&(e.contentDocument||(g.rr_src=g.src),delete g.src);let S;try{customElements.get(m)&&(S=!0)}catch{}return{type:Be.Element,tagName:m,attributes:g,childNodes:[],isSVG:y2(e)||void 0,needBlock:f,rootId:h,isCustom:S}}function me(e){return e==null?"":e.toLowerCase()}function Kb(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 C2(e,t){if(t.comment&&e.type===Be.Comment)return!0;if(e.type===Be.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"&&Wb(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(me(e.attributes.name).match(/^msapplication-tile(image|color)$/)||me(e.attributes.name)==="application-name"||me(e.attributes.rel)==="icon"||me(e.attributes.rel)==="apple-touch-icon"||me(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&me(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(me(e.attributes.property).match(/^(og|twitter|fb):/)||me(e.attributes.name).match(/^(og|twitter):/)||me(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(me(e.attributes.name)==="robots"||me(e.attributes.name)==="googlebot"||me(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(me(e.attributes.name)==="author"||me(e.attributes.name)==="generator"||me(e.attributes.name)==="framework"||me(e.attributes.name)==="publisher"||me(e.attributes.name)==="progid"||me(e.attributes.property).match(/^article:/)||me(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(me(e.attributes.name)==="google-site-verification"||me(e.attributes.name)==="yandex-verification"||me(e.attributes.name)==="csrf-token"||me(e.attributes.name)==="p:domain_verify"||me(e.attributes.name)==="verify-v1"||me(e.attributes.name)==="verification"||me(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function kn(e,t){let{doc:r,mirror:n,blockClass:o,blockSelector:i,maskTextClass:s,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:c=!0,maskInputOptions:u={},maskTextFn:d,maskInputFn:p,slimDOMOptions:h,dataURLOptions:f={},inlineImages:m=!1,recordCanvas:g=!1,onSerialize:w,onIframeLoad:S,iframeLoadTimeout:y=5e3,onStylesheetLoad:v,stylesheetLoadTimeout:C=5e3,keepIframeSrcFn:M=()=>!1,newlyAddedElement:I=!1,cssCaptured:E=!1}=t,{needsMask:x}=t,{preserveWhiteSpace:B=!0}=t;x||(x=qb(e,s,a,x===void 0));let ee=v2(e,{doc:r,mirror:n,blockClass:o,blockSelector:i,needsMask:x,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,dataURLOptions:f,inlineImages:m,recordCanvas:g,keepIframeSrcFn:M,newlyAddedElement:I,cssCaptured:E});if(!ee)return console.warn(e,"not serialized"),null;let te;n.hasNode(e)?te=n.getId(e):C2(ee,h)||!B&&ee.type===Be.Text&&!ee.textContent.replace(/^\s+|\s+$/gm,"").length?te=Do:te=Hb();let U=Object.assign(ee,{id:te});if(n.add(e,U),te===Do)return null;w&&w(e);let Ke=!l;if(U.type===Be.Element){Ke=Ke&&!U.needBlock,delete U.needBlock;let Fe=Je.shadowRoot(e);Fe&&No(Fe)&&(U.isShadowHost=!0)}if((U.type===Be.Document||U.type===Be.Element)&&Ke){h.headWhitespace&&U.type===Be.Element&&U.tagName==="head"&&(B=!1);let Fe={doc:r,mirror:n,blockClass:o,blockSelector:i,needsMask:x,maskTextClass:s,maskTextSelector:a,skipChild:l,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:h,dataURLOptions:f,inlineImages:m,recordCanvas:g,preserveWhiteSpace:B,onSerialize:w,onIframeLoad:S,iframeLoadTimeout:y,onStylesheetLoad:v,stylesheetLoadTimeout:C,keepIframeSrcFn:M,cssCaptured:!1};if(!(U.type===Be.Element&&U.tagName==="textarea"&&U.attributes.value!==void 0)){U.type===Be.Element&&U.attributes._cssText!==void 0&&typeof U.attributes._cssText=="string"&&(Fe.cssCaptured=!0);for(let Dr of Array.from(Je.childNodes(e))){let Tt=kn(Dr,Fe);Tt&&U.childNodes.push(Tt)}}let pt=null;if(Vb(e)&&(pt=Je.shadowRoot(e)))for(let Dr of Array.from(Je.childNodes(pt))){let Tt=kn(Dr,Fe);Tt&&(No(pt)&&(Tt.isShadow=!0),U.childNodes.push(Tt))}}let At=Je.parentNode(e);return At&&Lo(At)&&No(At)&&(U.isShadow=!0),U.type===Be.Element&&U.tagName==="iframe"&&w2(e,()=>{let Fe=e.contentDocument;if(Fe&&S){let pt=kn(Fe,{doc:Fe,mirror:n,blockClass:o,blockSelector:i,needsMask:x,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:h,dataURLOptions:f,inlineImages:m,recordCanvas:g,preserveWhiteSpace:B,onSerialize:w,onIframeLoad:S,iframeLoadTimeout:y,onStylesheetLoad:v,stylesheetLoadTimeout:C,keepIframeSrcFn:M});pt&&S(e,pt)}},y),U.type===Be.Element&&U.tagName==="link"&&typeof U.attributes.rel=="string"&&(U.attributes.rel==="stylesheet"||U.attributes.rel==="preload"&&typeof U.attributes.href=="string"&&Wb(U.attributes.href)==="css")&&S2(e,()=>{if(v){let Fe=kn(e,{doc:r,mirror:n,blockClass:o,blockSelector:i,needsMask:x,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:h,dataURLOptions:f,inlineImages:m,recordCanvas:g,preserveWhiteSpace:B,onSerialize:w,onIframeLoad:S,iframeLoadTimeout:y,onStylesheetLoad:v,stylesheetLoadTimeout:C,keepIframeSrcFn:M});Fe&&v(e,Fe)}},C),U}function E2(e,t){let{mirror:r=new Xs,blockClass:n="rr-block",blockSelector:o=null,maskTextClass:i="rr-mask",maskTextSelector:s=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:c=!1,maskAllInputs:u=!1,maskTextFn:d,maskInputFn:p,slimDOM:h=!1,dataURLOptions:f,preserveWhiteSpace:m,onSerialize:g,onIframeLoad:w,iframeLoadTimeout:S,onStylesheetLoad:y,stylesheetLoadTimeout:v,keepIframeSrcFn:C=()=>!1}=t||{},M=u===!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}:u===!1?{password:!0}:u,I=Kb(h);return kn(e,{doc:e,mirror:r,blockClass:n,blockSelector:o,maskTextClass:i,maskTextSelector:s,skipChild:!1,inlineStylesheet:a,maskInputOptions:M,maskTextFn:d,maskInputFn:p,slimDOMOptions:I,dataURLOptions:f,inlineImages:l,recordCanvas:c,preserveWhiteSpace:m,onSerialize:g,onIframeLoad:w,iframeLoadTimeout:S,onStylesheetLoad:y,stylesheetLoadTimeout:v,keepIframeSrcFn:C,newlyAddedElement:!1})}var P2=/(max|min)-device-(width|height)/,kee=new RegExp(P2.source,"g");function I2(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function A2(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}),r}var Vd={exports:{}},we=String,Jb=function(){return{isColorSupported:!1,reset:we,bold:we,dim:we,italic:we,underline:we,inverse:we,hidden:we,strikethrough:we,black:we,red:we,green:we,yellow:we,blue:we,magenta:we,cyan:we,white:we,gray:we,bgBlack:we,bgRed:we,bgGreen:we,bgYellow:we,bgBlue:we,bgMagenta:we,bgCyan:we,bgWhite:we}};Vd.exports=Jb();Vd.exports.createColors=Jb;var T2=Vd.exports,O2={},M2=Object.freeze(Object.defineProperty({__proto__:null,default:O2},Symbol.toStringTag,{value:"Module"})),Rt=A2(M2),qy=T2,Ky=Rt,Xu=class Yb extends Error{constructor(t,r,n,o,i,s){super(t),this.name="CssSyntaxError",this.reason=t,i&&(this.file=i),o&&(this.source=o),s&&(this.plugin=s),typeof r<"u"&&typeof n<"u"&&(typeof r=="number"?(this.line=r,this.column=n):(this.line=r.line,this.column=r.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,Yb)}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 r=this.source;t==null&&(t=qy.isColorSupported),Ky&&t&&(r=Ky(r));let n=r.split(/\r?\n/),o=Math.max(this.line-3,0),i=Math.min(this.line+2,n.length),s=String(i).length,a,l;if(t){let{bold:c,gray:u,red:d}=qy.createColors(!0);a=p=>c(d(p)),l=p=>u(p)}else a=l=c=>c;return n.slice(o,i).map((c,u)=>{let d=o+1+u,p=" "+(" "+d).slice(-s)+" | ";if(d===this.line){let h=l(p.replace(/\d/g," "))+c.slice(0,this.column-1).replace(/[^\t]/g," ");return a(">")+l(p)+c+`
118
- `+h+a("^")}return" "+l(p)+c}).join(`
119
- `)}toString(){let t=this.showSourceCode();return t&&(t=`
78
+ `)}function Zo(e){return e.installed?"\u2713 Browser: Chromium installed":"\u2717 Browser: Chromium not installed. Run: npx playwright install chromium"}function ei(e){switch(e.status){case"enabled":return`\u2713 Adapter: enabled at ${e.url}`;case"disabled":return"\u2717 Adapter: disabled (handler returned 404). Set ENABLE_RIPPLO_TESTING=true in your app's env (e.g. apps/<app>/.env.local for Next.js) and restart the dev server.";case"bad-secret":return"\u2717 Adapter: webhook signature rejected. RIPPLO_WEBHOOK_SECRET seen by your dev server does not match the one in your env file.";case"unreachable":return`\u2717 Adapter: ${e.url} could not be reached for signed probe.`;case"no-secret":return"\u2717 Adapter: RIPPLO_WEBHOOK_SECRET is not set in your env file (declared in .ripplo/project.json)."}}function ti(e){switch(e.status){case"match":return`\u2713 Lockfile: ${L} is up to date`;case"missing":return`\u2717 Lockfile: ${L} is missing \u2014 run \`ripplo compile\` and commit it`;case"stale":return`\u2717 Lockfile: ${L} is out of date \u2014 run \`ripplo compile\` and commit it`}}function ri(e){return e.installed?"\u2713 Pre-commit hook: .git/hooks/pre-commit runs `ripplo compile --check`":"! Pre-commit hook: .git/hooks/pre-commit does not run `ripplo compile --check` \u2014 see the setup skill for the snippet"}import ge from"fs";import Rr from"path";function H(e){let t=pe(e),r=Ct(e);return[...bt(t,r.invariants).map(n=>({gap:n,kind:"cascade-gap"})),...vt(r.laws).map(n=>({conflict:n,kind:"law-conflict"}))]}function br(e){return`${C.good("OK")} \u2014 no static model violations (${String(e)} tests)`}function M(e){return[`${C.bad("FAIL")} \u2014 ${String(e.length)} static model violation(s):`,...e.map(t=>Rt(t))].join(`
120
79
 
121
- `+t+`
122
- `),this.name+": "+this.message+t}},Ud=Xu;Xu.default=Xu;var Go={};Go.isClean=Symbol("isClean");Go.my=Symbol("my");var Jy={after:`
123
- `,beforeClose:`
124
- `,beforeComment:`
125
- `,beforeDecl:`
126
- `,beforeOpen:" ",beforeRule:`
127
- `,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function L2(e){return e[0].toUpperCase()+e.slice(1)}var Zu=class{constructor(t){this.builder=t}atrule(t,r){let n="@"+t.name,o=t.params?this.rawValue(t,"params"):"";if(typeof t.raws.afterName<"u"?n+=t.raws.afterName:o&&(n+=" "),t.nodes)this.block(t,n+o);else{let i=(t.raws.between||"")+(r?";":"");this.builder(n+o+i,t)}}beforeAfter(t,r){let n;t.type==="decl"?n=this.raw(t,null,"beforeDecl"):t.type==="comment"?n=this.raw(t,null,"beforeComment"):r==="before"?n=this.raw(t,null,"beforeRule"):n=this.raw(t,null,"beforeClose");let o=t.parent,i=0;for(;o&&o.type!=="root";)i+=1,o=o.parent;if(n.includes(`
128
- `)){let s=this.raw(t,null,"indent");if(s.length)for(let a=0;a<i;a++)n+=s}return n}block(t,r){let n=this.raw(t,"between","beforeOpen");this.builder(r+n+"{",t,"start");let o;t.nodes&&t.nodes.length?(this.body(t),o=this.raw(t,"after")):o=this.raw(t,"after","emptyBody"),o&&this.builder(o),this.builder("}",t,"end")}body(t){let r=t.nodes.length-1;for(;r>0&&t.nodes[r].type==="comment";)r-=1;let n=this.raw(t,"semicolon");for(let o=0;o<t.nodes.length;o++){let i=t.nodes[o],s=this.raw(i,"before");s&&this.builder(s),this.stringify(i,r!==o||n)}}comment(t){let r=this.raw(t,"left","commentLeft"),n=this.raw(t,"right","commentRight");this.builder("/*"+r+t.text+n+"*/",t)}decl(t,r){let n=this.raw(t,"between","colon"),o=t.prop+n+this.rawValue(t,"value");t.important&&(o+=t.raws.important||" !important"),r&&(o+=";"),this.builder(o,t)}document(t){this.body(t)}raw(t,r,n){let o;if(n||(n=r),r&&(o=t.raws[r],typeof o<"u"))return o;let i=t.parent;if(n==="before"&&(!i||i.type==="root"&&i.first===t||i&&i.type==="document"))return"";if(!i)return Jy[n];let s=t.root();if(s.rawCache||(s.rawCache={}),typeof s.rawCache[n]<"u")return s.rawCache[n];if(n==="before"||n==="after")return this.beforeAfter(t,n);{let a="raw"+L2(n);this[a]?o=this[a](s,t):s.walk(l=>{if(o=l.raws[r],typeof o<"u")return!1})}return typeof o>"u"&&(o=Jy[n]),s.rawCache[n]=o,o}rawBeforeClose(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length>0&&typeof n.raws.after<"u")return r=n.raws.after,r.includes(`
129
- `)&&(r=r.replace(/[^\n]+$/,"")),!1}),r&&(r=r.replace(/\S/g,"")),r}rawBeforeComment(t,r){let n;return t.walkComments(o=>{if(typeof o.raws.before<"u")return n=o.raws.before,n.includes(`
130
- `)&&(n=n.replace(/[^\n]+$/,"")),!1}),typeof n>"u"?n=this.raw(r,null,"beforeDecl"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeDecl(t,r){let n;return t.walkDecls(o=>{if(typeof o.raws.before<"u")return n=o.raws.before,n.includes(`
131
- `)&&(n=n.replace(/[^\n]+$/,"")),!1}),typeof n>"u"?n=this.raw(r,null,"beforeRule"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeOpen(t){let r;return t.walk(n=>{if(n.type!=="decl"&&(r=n.raws.between,typeof r<"u"))return!1}),r}rawBeforeRule(t){let r;return t.walk(n=>{if(n.nodes&&(n.parent!==t||t.first!==n)&&typeof n.raws.before<"u")return r=n.raws.before,r.includes(`
132
- `)&&(r=r.replace(/[^\n]+$/,"")),!1}),r&&(r=r.replace(/\S/g,"")),r}rawColon(t){let r;return t.walkDecls(n=>{if(typeof n.raws.between<"u")return r=n.raws.between.replace(/[^\s:]/g,""),!1}),r}rawEmptyBody(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length===0&&(r=n.raws.after,typeof r<"u"))return!1}),r}rawIndent(t){if(t.raws.indent)return t.raws.indent;let r;return t.walk(n=>{let o=n.parent;if(o&&o!==t&&o.parent&&o.parent===t&&typeof n.raws.before<"u"){let i=n.raws.before.split(`
133
- `);return r=i[i.length-1],r=r.replace(/\S/g,""),!1}}),r}rawSemicolon(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length&&n.last.type==="decl"&&(r=n.raws.semicolon,typeof r<"u"))return!1}),r}rawValue(t,r){let n=t[r],o=t.raws[r];return o&&o.value===n?o.raw:n}root(t){this.body(t),t.raws.after&&this.builder(t.raws.after)}rule(t){this.block(t,this.rawValue(t,"selector")),t.raws.ownSemicolon&&this.builder(t.raws.ownSemicolon,t,"end")}stringify(t,r){if(!this[t.type])throw new Error("Unknown AST node type "+t.type+". Maybe you need to change PostCSS stringifier.");this[t.type](t,r)}},Xb=Zu;Zu.default=Zu;var N2=Xb;function Qu(e,t){new N2(t).stringify(e)}var ha=Qu;Qu.default=Qu;var{isClean:Rs,my:$2}=Go,D2=Ud,_2=Xb,j2=ha;function ed(e,t){let r=new e.constructor;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n)||n==="proxyCache")continue;let o=e[n],i=typeof o;n==="parent"&&i==="object"?t&&(r[n]=t):n==="source"?r[n]=o:Array.isArray(o)?r[n]=o.map(s=>ed(s,r)):(i==="object"&&o!==null&&(o=ed(o)),r[n]=o)}return r}var td=class{constructor(t={}){this.raws={},this[Rs]=!1,this[$2]=!0;for(let r in t)if(r==="nodes"){this.nodes=[];for(let n of t[r])typeof n.clone=="function"?this.append(n.clone()):this.append(n)}else this[r]=t[r]}addToError(t){if(t.postcssNode=this,t.stack&&this.source&&/\n\s{4}at /.test(t.stack)){let r=this.source;t.stack=t.stack.replace(/\n\s{4}at /,`$&${r.input.from}:${r.start.line}:${r.start.column}$&`)}return t}after(t){return this.parent.insertAfter(this,t),this}assign(t={}){for(let r in t)this[r]=t[r];return this}before(t){return this.parent.insertBefore(this,t),this}cleanRaws(t){delete this.raws.before,delete this.raws.after,t||delete this.raws.between}clone(t={}){let r=ed(this);for(let n in t)r[n]=t[n];return r}cloneAfter(t={}){let r=this.clone(t);return this.parent.insertAfter(this,r),r}cloneBefore(t={}){let r=this.clone(t);return this.parent.insertBefore(this,r),r}error(t,r={}){if(this.source){let{end:n,start:o}=this.rangeBy(r);return this.source.input.error(t,{column:o.column,line:o.line},{column:n.column,line:n.line},r)}return new D2(t)}getProxyProcessor(){return{get(t,r){return r==="proxyOf"?t:r==="root"?()=>t.root().toProxy():t[r]},set(t,r,n){return t[r]===n||(t[r]=n,(r==="prop"||r==="value"||r==="name"||r==="params"||r==="important"||r==="text")&&t.markDirty()),!0}}}markDirty(){if(this[Rs]){this[Rs]=!1;let t=this;for(;t=t.parent;)t[Rs]=!1}}next(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t+1]}positionBy(t,r){let n=this.source.start;if(t.index)n=this.positionInside(t.index,r);else if(t.word){r=this.toString();let o=r.indexOf(t.word);o!==-1&&(n=this.positionInside(o,r))}return n}positionInside(t,r){let n=r||this.toString(),o=this.source.start.column,i=this.source.start.line;for(let s=0;s<t;s++)n[s]===`
134
- `?(o=1,i+=1):o+=1;return{column:o,line:i}}prev(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t-1]}rangeBy(t){let r={column:this.source.start.column,line:this.source.start.line},n=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:r.column+1,line:r.line};if(t.word){let o=this.toString(),i=o.indexOf(t.word);i!==-1&&(r=this.positionInside(i,o),n=this.positionInside(i+t.word.length,o))}else t.start?r={column:t.start.column,line:t.start.line}:t.index&&(r=this.positionInside(t.index)),t.end?n={column:t.end.column,line:t.end.line}:typeof t.endIndex=="number"?n=this.positionInside(t.endIndex):t.index&&(n=this.positionInside(t.index+1));return(n.line<r.line||n.line===r.line&&n.column<=r.column)&&(n={column:r.column+1,line:r.line}),{end:n,start:r}}raw(t,r){return new _2().raw(this,t,r)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...t){if(this.parent){let r=this,n=!1;for(let o of t)o===this?n=!0:n?(this.parent.insertAfter(r,o),r=o):this.parent.insertBefore(r,o);n||this.remove()}return this}root(){let t=this;for(;t.parent&&t.parent.type!=="document";)t=t.parent;return t}toJSON(t,r){let n={},o=r==null;r=r||new Map;let i=0;for(let s in this){if(!Object.prototype.hasOwnProperty.call(this,s)||s==="parent"||s==="proxyCache")continue;let a=this[s];if(Array.isArray(a))n[s]=a.map(l=>typeof l=="object"&&l.toJSON?l.toJSON(null,r):l);else if(typeof a=="object"&&a.toJSON)n[s]=a.toJSON(null,r);else if(s==="source"){let l=r.get(a.input);l==null&&(l=i,r.set(a.input,i),i++),n[s]={end:a.end,inputId:l,start:a.start}}else n[s]=a}return o&&(n.inputs=[...r.keys()].map(s=>s.toJSON())),n}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(t=j2){t.stringify&&(t=t.stringify);let r="";return t(this,n=>{r+=n}),r}warn(t,r,n){let o={node:this};for(let i in n)o[i]=n[i];return t.warn(r,o)}get proxyOf(){return this}},ma=td;td.default=td;var F2=ma,rd=class extends F2{constructor(t){t&&typeof t.value<"u"&&typeof t.value!="string"&&(t={...t,value:String(t.value)}),super(t),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}},ga=rd;rd.default=rd;var B2="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",V2=(e,t=21)=>(r=t)=>{let n="",o=r;for(;o--;)n+=e[Math.random()*e.length|0];return n},U2=(e=21)=>{let t="",r=e;for(;r--;)t+=B2[Math.random()*64|0];return t},W2={nanoid:U2,customAlphabet:V2},{SourceMapConsumer:Yy,SourceMapGenerator:Xy}=Rt,{existsSync:H2,readFileSync:z2}=Rt,{dirname:ju,join:G2}=Rt;function q2(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var nd=class{constructor(t,r){if(r.map===!1)return;this.loadAnnotation(t),this.inline=this.startWith(this.annotation,"data:");let n=r.map?r.map.prev:void 0,o=this.loadMap(r.from,n);!this.mapFile&&r.from&&(this.mapFile=r.from),this.mapFile&&(this.root=ju(this.mapFile)),o&&(this.text=o)}consumer(){return this.consumerCache||(this.consumerCache=new Yy(this.text)),this.consumerCache}decodeInline(t){let r=/^data:application\/json;charset=utf-?8;base64,/,n=/^data:application\/json;base64,/,o=/^data:application\/json;charset=utf-?8,/,i=/^data:application\/json,/;if(o.test(t)||i.test(t))return decodeURIComponent(t.substr(RegExp.lastMatch.length));if(r.test(t)||n.test(t))return q2(t.substr(RegExp.lastMatch.length));let s=t.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+s)}getAnnotationURL(t){return t.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(t){return typeof t!="object"?!1:typeof t.mappings=="string"||typeof t._mappings=="string"||Array.isArray(t.sections)}loadAnnotation(t){let r=t.match(/\/\*\s*# sourceMappingURL=/gm);if(!r)return;let n=t.lastIndexOf(r.pop()),o=t.indexOf("*/",n);n>-1&&o>-1&&(this.annotation=this.getAnnotationURL(t.substring(n,o)))}loadFile(t){if(this.root=ju(t),H2(t))return this.mapFile=t,z2(t,"utf-8").toString().trim()}loadMap(t,r){if(r===!1)return!1;if(r){if(typeof r=="string")return r;if(typeof r=="function"){let n=r(t);if(n){let o=this.loadFile(n);if(!o)throw new Error("Unable to load previous source map: "+n.toString());return o}}else{if(r instanceof Yy)return Xy.fromSourceMap(r).toString();if(r instanceof Xy)return r.toString();if(this.isMap(r))return JSON.stringify(r);throw new Error("Unsupported previous source map format: "+r.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let n=this.annotation;return t&&(n=G2(ju(t),n)),this.loadFile(n)}}}startWith(t,r){return t?t.substr(0,r.length)===r:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}},Zb=nd;nd.default=nd;var{SourceMapConsumer:K2,SourceMapGenerator:J2}=Rt,{fileURLToPath:Zy,pathToFileURL:Cs}=Rt,{isAbsolute:od,resolve:id}=Rt,{nanoid:Y2}=W2,Fu=Rt,Qy=Ud,X2=Zb,Bu=Symbol("fromOffsetCache"),Z2=!!(K2&&J2),eb=!!(id&&od),ra=class{constructor(t,r={}){if(t===null||typeof t>"u"||typeof t=="object"&&!t.toString)throw new Error(`PostCSS received ${t} instead of CSS string`);if(this.css=t.toString(),this.css[0]==="\uFEFF"||this.css[0]==="\uFFFE"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,r.from&&(!eb||/^\w+:\/\//.test(r.from)||od(r.from)?this.file=r.from:this.file=id(r.from)),eb&&Z2){let n=new X2(this.css,r);if(n.text){this.map=n;let o=n.consumer().file;!this.file&&o&&(this.file=this.mapResolve(o))}}this.file||(this.id="<input css "+Y2(6)+">"),this.map&&(this.map.file=this.from)}error(t,r,n,o={}){let i,s,a;if(r&&typeof r=="object"){let c=r,u=n;if(typeof c.offset=="number"){let d=this.fromOffset(c.offset);r=d.line,n=d.col}else r=c.line,n=c.column;if(typeof u.offset=="number"){let d=this.fromOffset(u.offset);s=d.line,a=d.col}else s=u.line,a=u.column}else if(!n){let c=this.fromOffset(r);r=c.line,n=c.col}let l=this.origin(r,n,s,a);return l?i=new Qy(t,l.endLine===void 0?l.line:{column:l.column,line:l.line},l.endLine===void 0?l.column:{column:l.endColumn,line:l.endLine},l.source,l.file,o.plugin):i=new Qy(t,s===void 0?r:{column:n,line:r},s===void 0?n:{column:a,line:s},this.css,this.file,o.plugin),i.input={column:n,endColumn:a,endLine:s,line:r,source:this.css},this.file&&(Cs&&(i.input.url=Cs(this.file).toString()),i.input.file=this.file),i}fromOffset(t){let r,n;if(this[Bu])n=this[Bu];else{let i=this.css.split(`
135
- `);n=new Array(i.length);let s=0;for(let a=0,l=i.length;a<l;a++)n[a]=s,s+=i[a].length+1;this[Bu]=n}r=n[n.length-1];let o=0;if(t>=r)o=n.length-1;else{let i=n.length-2,s;for(;o<i;)if(s=o+(i-o>>1),t<n[s])i=s-1;else if(t>=n[s+1])o=s+1;else{o=s;break}}return{col:t-n[o]+1,line:o+1}}mapResolve(t){return/^\w+:\/\//.test(t)?t:id(this.map.consumer().sourceRoot||this.map.root||".",t)}origin(t,r,n,o){if(!this.map)return!1;let i=this.map.consumer(),s=i.originalPositionFor({column:r,line:t});if(!s.source)return!1;let a;typeof n=="number"&&(a=i.originalPositionFor({column:o,line:n}));let l;od(s.source)?l=Cs(s.source):l=new URL(s.source,this.map.consumer().sourceRoot||Cs(this.map.mapFile));let c={column:s.column,endColumn:a&&a.column,endLine:a&&a.line,line:s.line,url:l.toString()};if(l.protocol==="file:")if(Zy)c.file=Zy(l);else throw new Error("file: protocol is not available in this PostCSS build");let u=i.sourceContentFor(s.source);return u&&(c.source=u),c}toJSON(){let t={};for(let r of["hasBOM","css","file","id"])this[r]!=null&&(t[r]=this[r]);return this.map&&(t.map={...this.map},t.map.consumerCache&&(t.map.consumerCache=void 0)),t}get from(){return this.file||this.id}},ya=ra;ra.default=ra;Fu&&Fu.registerInput&&Fu.registerInput(ra);var{SourceMapConsumer:Qb,SourceMapGenerator:zs}=Rt,{dirname:Gs,relative:ew,resolve:tw,sep:rw}=Rt,{pathToFileURL:tb}=Rt,Q2=ya,eN=!!(Qb&&zs),tN=!!(Gs&&tw&&ew&&rw),rN=class{constructor(t,r,n,o){this.stringify=t,this.mapOpts=n.map||{},this.root=r,this.opts=n,this.css=o,this.originalCSS=o,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let t;this.isInline()?t="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?t=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?t=this.mapOpts.annotation(this.opts.to,this.root):t=this.outputFile()+".map";let r=`
136
- `;this.css.includes(`\r
137
- `)&&(r=`\r
138
- `),this.css+=r+"/*# sourceMappingURL="+t+" */"}applyPrevMaps(){for(let t of this.previous()){let r=this.toUrl(this.path(t.file)),n=t.root||Gs(t.file),o;this.mapOpts.sourcesContent===!1?(o=new Qb(t.text),o.sourcesContent&&(o.sourcesContent=null)):o=t.consumer(),this.map.applySourceMap(o,r,this.toUrl(this.path(n)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let t;for(let r=this.root.nodes.length-1;r>=0;r--)t=this.root.nodes[r],t.type==="comment"&&t.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(r)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),tN&&eN&&this.isMap())return this.generateMap();{let t="";return this.stringify(this.root,r=>{t+=r}),[t]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let t=this.previous()[0].consumer();t.file=this.outputFile(),this.map=zs.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new zs({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new zs({file:this.outputFile(),ignoreInvalidMapping:!0});let t=1,r=1,n="<no source>",o={generated:{column:0,line:0},original:{column:0,line:0},source:""},i,s;this.stringify(this.root,(a,l,c)=>{if(this.css+=a,l&&c!=="end"&&(o.generated.line=t,o.generated.column=r-1,l.source&&l.source.start?(o.source=this.sourcePath(l),o.original.line=l.source.start.line,o.original.column=l.source.start.column-1,this.map.addMapping(o)):(o.source=n,o.original.line=1,o.original.column=0,this.map.addMapping(o))),i=a.match(/\n/g),i?(t+=i.length,s=a.lastIndexOf(`
139
- `),r=a.length-s):r+=a.length,l&&c!=="start"){let u=l.parent||{raws:{}};(!(l.type==="decl"||l.type==="atrule"&&!l.nodes)||l!==u.last||u.raws.semicolon)&&(l.source&&l.source.end?(o.source=this.sourcePath(l),o.original.line=l.source.end.line,o.original.column=l.source.end.column-1,o.generated.line=t,o.generated.column=r-2,this.map.addMapping(o)):(o.source=n,o.original.line=1,o.original.column=0,o.generated.line=t,o.generated.column=r-1,this.map.addMapping(o)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(t=>t.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let t=this.mapOpts.annotation;return typeof t<"u"&&t!==!0?!1:this.previous().length?this.previous().some(r=>r.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(t=>t.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(t){if(this.mapOpts.absolute||t.charCodeAt(0)===60||/^\w+:\/\//.test(t))return t;let r=this.memoizedPaths.get(t);if(r)return r;let n=this.opts.to?Gs(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(n=Gs(tw(n,this.mapOpts.annotation)));let o=ew(n,t);return this.memoizedPaths.set(t,o),o}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(t=>{if(t.source&&t.source.input.map){let r=t.source.input.map;this.previousMaps.includes(r)||this.previousMaps.push(r)}});else{let t=new Q2(this.originalCSS,this.opts);t.map&&this.previousMaps.push(t.map)}return this.previousMaps}setSourcesContent(){let t={};if(this.root)this.root.walk(r=>{if(r.source){let n=r.source.input.from;if(n&&!t[n]){t[n]=!0;let o=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(o,r.source.input.css)}}});else if(this.css){let r=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(r,this.css)}}sourcePath(t){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(t.source.input.from):this.toUrl(this.path(t.source.input.from))}toBase64(t){return Buffer?Buffer.from(t).toString("base64"):window.btoa(unescape(encodeURIComponent(t)))}toFileUrl(t){let r=this.memoizedFileURLs.get(t);if(r)return r;if(tb){let n=tb(t).toString();return this.memoizedFileURLs.set(t,n),n}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(t){let r=this.memoizedURLs.get(t);if(r)return r;rw==="\\"&&(t=t.replace(/\\/g,"/"));let n=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,n),n}},nw=rN,nN=ma,sd=class extends nN{constructor(t){super(t),this.type="comment"}},ba=sd;sd.default=sd;var{isClean:ow,my:iw}=Go,sw=ga,aw=ba,oN=ma,lw,Wd,Hd,cw;function uw(e){return e.map(t=>(t.nodes&&(t.nodes=uw(t.nodes)),delete t.source,t))}function dw(e){if(e[ow]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)dw(t)}var er=class pw extends oN{append(...t){for(let r of t){let n=this.normalize(r,this.last);for(let o of n)this.proxyOf.nodes.push(o)}return this.markDirty(),this}cleanRaws(t){if(super.cleanRaws(t),this.nodes)for(let r of this.nodes)r.cleanRaws(t)}each(t){if(!this.proxyOf.nodes)return;let r=this.getIterator(),n,o;for(;this.indexes[r]<this.proxyOf.nodes.length&&(n=this.indexes[r],o=t(this.proxyOf.nodes[n],n),o!==!1);)this.indexes[r]+=1;return delete this.indexes[r],o}every(t){return this.nodes.every(t)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let t=this.lastEach;return this.indexes[t]=0,t}getProxyProcessor(){return{get(t,r){return r==="proxyOf"?t:t[r]?r==="each"||typeof r=="string"&&r.startsWith("walk")?(...n)=>t[r](...n.map(o=>typeof o=="function"?(i,s)=>o(i.toProxy(),s):o)):r==="every"||r==="some"?n=>t[r]((o,...i)=>n(o.toProxy(),...i)):r==="root"?()=>t.root().toProxy():r==="nodes"?t.nodes.map(n=>n.toProxy()):r==="first"||r==="last"?t[r].toProxy():t[r]:t[r]},set(t,r,n){return t[r]===n||(t[r]=n,(r==="name"||r==="params"||r==="selector")&&t.markDirty()),!0}}}index(t){return typeof t=="number"?t:(t.proxyOf&&(t=t.proxyOf),this.proxyOf.nodes.indexOf(t))}insertAfter(t,r){let n=this.index(t),o=this.normalize(r,this.proxyOf.nodes[n]).reverse();n=this.index(t);for(let s of o)this.proxyOf.nodes.splice(n+1,0,s);let i;for(let s in this.indexes)i=this.indexes[s],n<i&&(this.indexes[s]=i+o.length);return this.markDirty(),this}insertBefore(t,r){let n=this.index(t),o=n===0?"prepend":!1,i=this.normalize(r,this.proxyOf.nodes[n],o).reverse();n=this.index(t);for(let a of i)this.proxyOf.nodes.splice(n,0,a);let s;for(let a in this.indexes)s=this.indexes[a],n<=s&&(this.indexes[a]=s+i.length);return this.markDirty(),this}normalize(t,r){if(typeof t=="string")t=uw(lw(t).nodes);else if(typeof t>"u")t=[];else if(Array.isArray(t)){t=t.slice(0);for(let o of t)o.parent&&o.parent.removeChild(o,"ignore")}else if(t.type==="root"&&this.type!=="document"){t=t.nodes.slice(0);for(let o of t)o.parent&&o.parent.removeChild(o,"ignore")}else if(t.type)t=[t];else if(t.prop){if(typeof t.value>"u")throw new Error("Value field is missed in node creation");typeof t.value!="string"&&(t.value=String(t.value)),t=[new sw(t)]}else if(t.selector)t=[new Wd(t)];else if(t.name)t=[new Hd(t)];else if(t.text)t=[new aw(t)];else throw new Error("Unknown node type in node creation");return t.map(o=>(o[iw]||pw.rebuild(o),o=o.proxyOf,o.parent&&o.parent.removeChild(o),o[ow]&&dw(o),typeof o.raws.before>"u"&&r&&typeof r.raws.before<"u"&&(o.raws.before=r.raws.before.replace(/\S/g,"")),o.parent=this.proxyOf,o))}prepend(...t){t=t.reverse();for(let r of t){let n=this.normalize(r,this.first,"prepend").reverse();for(let o of n)this.proxyOf.nodes.unshift(o);for(let o in this.indexes)this.indexes[o]=this.indexes[o]+n.length}return this.markDirty(),this}push(t){return t.parent=this,this.proxyOf.nodes.push(t),this}removeAll(){for(let t of this.proxyOf.nodes)t.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(t){t=this.index(t),this.proxyOf.nodes[t].parent=void 0,this.proxyOf.nodes.splice(t,1);let r;for(let n in this.indexes)r=this.indexes[n],r>=t&&(this.indexes[n]=r-1);return this.markDirty(),this}replaceValues(t,r,n){return n||(n=r,r={}),this.walkDecls(o=>{r.props&&!r.props.includes(o.prop)||r.fast&&!o.value.includes(r.fast)||(o.value=o.value.replace(t,n))}),this.markDirty(),this}some(t){return this.nodes.some(t)}walk(t){return this.each((r,n)=>{let o;try{o=t(r,n)}catch(i){throw r.addToError(i)}return o!==!1&&r.walk&&(o=r.walk(t)),o})}walkAtRules(t,r){return r?t instanceof RegExp?this.walk((n,o)=>{if(n.type==="atrule"&&t.test(n.name))return r(n,o)}):this.walk((n,o)=>{if(n.type==="atrule"&&n.name===t)return r(n,o)}):(r=t,this.walk((n,o)=>{if(n.type==="atrule")return r(n,o)}))}walkComments(t){return this.walk((r,n)=>{if(r.type==="comment")return t(r,n)})}walkDecls(t,r){return r?t instanceof RegExp?this.walk((n,o)=>{if(n.type==="decl"&&t.test(n.prop))return r(n,o)}):this.walk((n,o)=>{if(n.type==="decl"&&n.prop===t)return r(n,o)}):(r=t,this.walk((n,o)=>{if(n.type==="decl")return r(n,o)}))}walkRules(t,r){return r?t instanceof RegExp?this.walk((n,o)=>{if(n.type==="rule"&&t.test(n.selector))return r(n,o)}):this.walk((n,o)=>{if(n.type==="rule"&&n.selector===t)return r(n,o)}):(r=t,this.walk((n,o)=>{if(n.type==="rule")return r(n,o)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};er.registerParse=e=>{lw=e};er.registerRule=e=>{Wd=e};er.registerAtRule=e=>{Hd=e};er.registerRoot=e=>{cw=e};var Kr=er;er.default=er;er.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,Hd.prototype):e.type==="rule"?Object.setPrototypeOf(e,Wd.prototype):e.type==="decl"?Object.setPrototypeOf(e,sw.prototype):e.type==="comment"?Object.setPrototypeOf(e,aw.prototype):e.type==="root"&&Object.setPrototypeOf(e,cw.prototype),e[iw]=!0,e.nodes&&e.nodes.forEach(t=>{er.rebuild(t)})};var iN=Kr,fw,hw,_o=class extends iN{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new fw(new hw,this,t).stringify()}};_o.registerLazyResult=e=>{fw=e};_o.registerProcessor=e=>{hw=e};var zd=_o;_o.default=_o;var rb={},mw=function(t){rb[t]||(rb[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))},ad=class{constructor(t,r={}){if(this.type="warning",this.text=t,r.node&&r.node.source){let n=r.node.rangeBy(r);this.line=n.start.line,this.column=n.start.column,this.endLine=n.end.line,this.endColumn=n.end.column}for(let n in r)this[n]=r[n]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}},gw=ad;ad.default=ad;var sN=gw,ld=class{constructor(t,r,n){this.processor=t,this.messages=[],this.root=r,this.opts=n,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,r={}){r.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(r.plugin=this.lastPlugin.postcssPlugin);let n=new sN(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(t=>t.type==="warning")}get content(){return this.css}},Gd=ld;ld.default=ld;var Vu=39,nb=34,Es=92,ob=47,Ps=10,Io=32,Is=12,As=9,Ts=13,aN=91,lN=93,cN=40,uN=41,dN=123,pN=125,fN=59,hN=42,mN=58,gN=64,Os=/[\t\n\f\r "#'()/;[\\\]{}]/g,Ms=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,yN=/.[\r\n"'(/\\]/,ib=/[\da-f]/i,bN=function(t,r={}){let n=t.css.valueOf(),o=r.ignoreErrors,i,s,a,l,c,u,d,p,h,f,m=n.length,g=0,w=[],S=[];function y(){return g}function v(E){throw t.error("Unclosed "+E,g)}function C(){return S.length===0&&g>=m}function M(E){if(S.length)return S.pop();if(g>=m)return;let x=E?E.ignoreUnclosed:!1;switch(i=n.charCodeAt(g),i){case Ps:case Io:case As:case Ts:case Is:{s=g;do s+=1,i=n.charCodeAt(s);while(i===Io||i===Ps||i===As||i===Ts||i===Is);f=["space",n.slice(g,s)],g=s-1;break}case aN:case lN:case dN:case pN:case mN:case fN:case uN:{let B=String.fromCharCode(i);f=[B,B,g];break}case cN:{if(p=w.length?w.pop()[1]:"",h=n.charCodeAt(g+1),p==="url"&&h!==Vu&&h!==nb&&h!==Io&&h!==Ps&&h!==As&&h!==Is&&h!==Ts){s=g;do{if(u=!1,s=n.indexOf(")",s+1),s===-1)if(o||x){s=g;break}else v("bracket");for(d=s;n.charCodeAt(d-1)===Es;)d-=1,u=!u}while(u);f=["brackets",n.slice(g,s+1),g,s],g=s}else s=n.indexOf(")",g+1),l=n.slice(g,s+1),s===-1||yN.test(l)?f=["(","(",g]:(f=["brackets",l,g,s],g=s);break}case Vu:case nb:{a=i===Vu?"'":'"',s=g;do{if(u=!1,s=n.indexOf(a,s+1),s===-1)if(o||x){s=g+1;break}else v("string");for(d=s;n.charCodeAt(d-1)===Es;)d-=1,u=!u}while(u);f=["string",n.slice(g,s+1),g,s],g=s;break}case gN:{Os.lastIndex=g+1,Os.test(n),Os.lastIndex===0?s=n.length-1:s=Os.lastIndex-2,f=["at-word",n.slice(g,s+1),g,s],g=s;break}case Es:{for(s=g,c=!0;n.charCodeAt(s+1)===Es;)s+=1,c=!c;if(i=n.charCodeAt(s+1),c&&i!==ob&&i!==Io&&i!==Ps&&i!==As&&i!==Ts&&i!==Is&&(s+=1,ib.test(n.charAt(s)))){for(;ib.test(n.charAt(s+1));)s+=1;n.charCodeAt(s+1)===Io&&(s+=1)}f=["word",n.slice(g,s+1),g,s],g=s;break}default:{i===ob&&n.charCodeAt(g+1)===hN?(s=n.indexOf("*/",g+2)+1,s===0&&(o||x?s=n.length:v("comment")),f=["comment",n.slice(g,s+1),g,s],g=s):(Ms.lastIndex=g+1,Ms.test(n),Ms.lastIndex===0?s=n.length-1:s=Ms.lastIndex-2,f=["word",n.slice(g,s+1),g,s],w.push(f),g=s);break}}return g++,f}function I(E){S.push(E)}return{back:I,endOfFile:C,nextToken:M,position:y}},yw=Kr,na=class extends yw{constructor(t){super(t),this.type="atrule"}append(...t){return this.proxyOf.nodes||(this.nodes=[]),super.append(...t)}prepend(...t){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...t)}},qd=na;na.default=na;yw.registerAtRule(na);var bw=Kr,ww,Sw,Cn=class extends bw{constructor(t){super(t),this.type="root",this.nodes||(this.nodes=[])}normalize(t,r,n){let o=super.normalize(t);if(r){if(n==="prepend")this.nodes.length>1?r.raws.before=this.nodes[1].raws.before:delete r.raws.before;else if(this.first!==r)for(let i of o)i.raws.before=r.raws.before}return o}removeChild(t,r){let n=this.index(t);return!r&&n===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(t)}toResult(t={}){return new ww(new Sw,this,t).stringify()}};Cn.registerLazyResult=e=>{ww=e};Cn.registerProcessor=e=>{Sw=e};var qo=Cn;Cn.default=Cn;bw.registerRoot(Cn);var jo={comma(e){return jo.split(e,[","],!0)},space(e){let t=[" ",`
140
- `," "];return jo.split(e,t)},split(e,t,r){let n=[],o="",i=!1,s=0,a=!1,l="",c=!1;for(let u of e)c?c=!1:u==="\\"?c=!0:a?u===l&&(a=!1):u==='"'||u==="'"?(a=!0,l=u):u==="("?s+=1:u===")"?s>0&&(s-=1):s===0&&t.includes(u)&&(i=!0),i?(o!==""&&n.push(o.trim()),o="",i=!1):o+=u;return(r||o!=="")&&n.push(o.trim()),n}},vw=jo;jo.default=jo;var xw=Kr,wN=vw,oa=class extends xw{constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return wN.comma(this.selector)}set selectors(t){let r=this.selector?this.selector.match(/,\s*/):null,n=r?r[0]:","+this.raw("between","beforeOpen");this.selector=t.join(n)}},Kd=oa;oa.default=oa;xw.registerRule(oa);var SN=ga,vN=bN,xN=ba,kN=qd,RN=qo,sb=Kd,ab={empty:!0,space:!0};function CN(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}var EN=class{constructor(t){this.input=t,this.root=new RN,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:t,start:{column:1,line:1,offset:0}}}atrule(t){let r=new kN;r.name=t[1].slice(1),r.name===""&&this.unnamedAtrule(r,t),this.init(r,t[2]);let n,o,i,s=!1,a=!1,l=[],c=[];for(;!this.tokenizer.endOfFile();){if(t=this.tokenizer.nextToken(),n=t[0],n==="("||n==="["?c.push(n==="("?")":"]"):n==="{"&&c.length>0?c.push("}"):n===c[c.length-1]&&c.pop(),c.length===0)if(n===";"){r.source.end=this.getPosition(t[2]),r.source.end.offset++,this.semicolon=!0;break}else if(n==="{"){a=!0;break}else if(n==="}"){if(l.length>0){for(i=l.length-1,o=l[i];o&&o[0]==="space";)o=l[--i];o&&(r.source.end=this.getPosition(o[3]||o[2]),r.source.end.offset++)}this.end(t);break}else l.push(t);else l.push(t);if(this.tokenizer.endOfFile()){s=!0;break}}r.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(r.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(r,"params",l),s&&(t=l[l.length-1],r.source.end=this.getPosition(t[3]||t[2]),r.source.end.offset++,this.spaces=r.raws.between,r.raws.between="")):(r.raws.afterName="",r.params=""),a&&(r.nodes=[],this.current=r)}checkMissedSemicolon(t){let r=this.colon(t);if(r===!1)return;let n=0,o;for(let i=r-1;i>=0&&(o=t[i],!(o[0]!=="space"&&(n+=1,n===2)));i--);throw this.input.error("Missed semicolon",o[0]==="word"?o[3]+1:o[2])}colon(t){let r=0,n,o,i;for(let[s,a]of t.entries()){if(n=a,o=n[0],o==="("&&(r+=1),o===")"&&(r-=1),r===0&&o===":")if(!i)this.doubleColon(n);else{if(i[0]==="word"&&i[1]==="progid")continue;return s}i=n}return!1}comment(t){let r=new xN;this.init(r,t[2]),r.source.end=this.getPosition(t[3]||t[2]),r.source.end.offset++;let n=t[1].slice(2,-2);if(/^\s*$/.test(n))r.text="",r.raws.left=n,r.raws.right="";else{let o=n.match(/^(\s*)([^]*\S)(\s*)$/);r.text=o[2],r.raws.left=o[1],r.raws.right=o[3]}}createTokenizer(){this.tokenizer=vN(this.input)}decl(t,r){let n=new SN;this.init(n,t[0][2]);let o=t[t.length-1];for(o[0]===";"&&(this.semicolon=!0,t.pop()),n.source.end=this.getPosition(o[3]||o[2]||CN(t)),n.source.end.offset++;t[0][0]!=="word";)t.length===1&&this.unknownWord(t),n.raws.before+=t.shift()[1];for(n.source.start=this.getPosition(t[0][2]),n.prop="";t.length;){let c=t[0][0];if(c===":"||c==="space"||c==="comment")break;n.prop+=t.shift()[1]}n.raws.between="";let i;for(;t.length;)if(i=t.shift(),i[0]===":"){n.raws.between+=i[1];break}else i[0]==="word"&&/\w/.test(i[1])&&this.unknownWord([i]),n.raws.between+=i[1];(n.prop[0]==="_"||n.prop[0]==="*")&&(n.raws.before+=n.prop[0],n.prop=n.prop.slice(1));let s=[],a;for(;t.length&&(a=t[0][0],!(a!=="space"&&a!=="comment"));)s.push(t.shift());this.precheckMissedSemicolon(t);for(let c=t.length-1;c>=0;c--){if(i=t[c],i[1].toLowerCase()==="!important"){n.important=!0;let u=this.stringFrom(t,c);u=this.spacesFromEnd(t)+u,u!==" !important"&&(n.raws.important=u);break}else if(i[1].toLowerCase()==="important"){let u=t.slice(0),d="";for(let p=c;p>0;p--){let h=u[p][0];if(d.trim().indexOf("!")===0&&h!=="space")break;d=u.pop()[1]+d}d.trim().indexOf("!")===0&&(n.important=!0,n.raws.important=d,t=u)}if(i[0]!=="space"&&i[0]!=="comment")break}t.some(c=>c[0]!=="space"&&c[0]!=="comment")&&(n.raws.between+=s.map(c=>c[1]).join(""),s=[]),this.raw(n,"value",s.concat(t),r),n.value.includes(":")&&!r&&this.checkMissedSemicolon(t)}doubleColon(t){throw this.input.error("Double colon",{offset:t[2]},{offset:t[2]+t[1].length})}emptyRule(t){let r=new sb;this.init(r,t[2]),r.selector="",r.raws.between="",this.current=r}end(t){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(t[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(t)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(t){if(this.spaces+=t[1],this.current.nodes){let r=this.current.nodes[this.current.nodes.length-1];r&&r.type==="rule"&&!r.raws.ownSemicolon&&(r.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(t){let r=this.input.fromOffset(t);return{column:r.col,line:r.line,offset:t}}init(t,r){this.current.push(t),t.source={input:this.input,start:this.getPosition(r)},t.raws.before=this.spaces,this.spaces="",t.type!=="comment"&&(this.semicolon=!1)}other(t){let r=!1,n=null,o=!1,i=null,s=[],a=t[1].startsWith("--"),l=[],c=t;for(;c;){if(n=c[0],l.push(c),n==="("||n==="[")i||(i=c),s.push(n==="("?")":"]");else if(a&&o&&n==="{")i||(i=c),s.push("}");else if(s.length===0)if(n===";")if(o){this.decl(l,a);return}else break;else if(n==="{"){this.rule(l);return}else if(n==="}"){this.tokenizer.back(l.pop()),r=!0;break}else n===":"&&(o=!0);else n===s[s.length-1]&&(s.pop(),s.length===0&&(i=null));c=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(r=!0),s.length>0&&this.unclosedBracket(i),r&&o){if(!a)for(;l.length&&(c=l[l.length-1][0],!(c!=="space"&&c!=="comment"));)this.tokenizer.back(l.pop());this.decl(l,a)}else this.unknownWord(l)}parse(){let t;for(;!this.tokenizer.endOfFile();)switch(t=this.tokenizer.nextToken(),t[0]){case"space":this.spaces+=t[1];break;case";":this.freeSemicolon(t);break;case"}":this.end(t);break;case"comment":this.comment(t);break;case"at-word":this.atrule(t);break;case"{":this.emptyRule(t);break;default:this.other(t);break}this.endFile()}precheckMissedSemicolon(){}raw(t,r,n,o){let i,s,a=n.length,l="",c=!0,u,d;for(let p=0;p<a;p+=1)i=n[p],s=i[0],s==="space"&&p===a-1&&!o?c=!1:s==="comment"?(d=n[p-1]?n[p-1][0]:"empty",u=n[p+1]?n[p+1][0]:"empty",!ab[d]&&!ab[u]?l.slice(-1)===","?c=!1:l+=i[1]:c=!1):l+=i[1];if(!c){let p=n.reduce((h,f)=>h+f[1],"");t.raws[r]={raw:p,value:l}}t[r]=l}rule(t){t.pop();let r=new sb;this.init(r,t[0][2]),r.raws.between=this.spacesAndCommentsFromEnd(t),this.raw(r,"selector",t),this.current=r}spacesAndCommentsFromEnd(t){let r,n="";for(;t.length&&(r=t[t.length-1][0],!(r!=="space"&&r!=="comment"));)n=t.pop()[1]+n;return n}spacesAndCommentsFromStart(t){let r,n="";for(;t.length&&(r=t[0][0],!(r!=="space"&&r!=="comment"));)n+=t.shift()[1];return n}spacesFromEnd(t){let r,n="";for(;t.length&&(r=t[t.length-1][0],r==="space");)n=t.pop()[1]+n;return n}stringFrom(t,r){let n="";for(let o=r;o<t.length;o++)n+=t[o][1];return t.splice(r,t.length-r),n}unclosedBlock(){let t=this.current.source.start;throw this.input.error("Unclosed block",t.line,t.column)}unclosedBracket(t){throw this.input.error("Unclosed bracket",{offset:t[2]},{offset:t[2]+1})}unexpectedClose(t){throw this.input.error("Unexpected }",{offset:t[2]},{offset:t[2]+1})}unknownWord(t){throw this.input.error("Unknown word",{offset:t[0][2]},{offset:t[0][2]+t[0][1].length})}unnamedAtrule(t,r){throw this.input.error("At-rule without name",{offset:r[2]},{offset:r[2]+r[1].length})}},PN=EN,IN=Kr,AN=PN,TN=ya;function ia(e,t){let r=new TN(e,t),n=new AN(r);try{n.parse()}catch(o){throw process.env.NODE_ENV!=="production"&&o.name==="CssSyntaxError"&&t&&t.from&&(/\.scss$/i.test(t.from)?o.message+=`
141
- You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser`:/\.sass/i.test(t.from)?o.message+=`
142
- You tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser`:/\.less$/i.test(t.from)&&(o.message+=`
143
- You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),o}return n.root}var Jd=ia;ia.default=ia;IN.registerParse(ia);var{isClean:_t,my:ON}=Go,MN=nw,LN=ha,NN=Kr,$N=zd,DN=mw,lb=Gd,_N=Jd,jN=qo,FN={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},BN={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},VN={Once:!0,postcssPlugin:!0,prepare:!0},En=0;function Ao(e){return typeof e=="object"&&typeof e.then=="function"}function kw(e){let t=!1,r=FN[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,En,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,En,r+"Exit"]:[r,r+"Exit"]}function cb(e){let t;return e.type==="document"?t=["Document",En,"DocumentExit"]:e.type==="root"?t=["Root",En,"RootExit"]:t=kw(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function cd(e){return e[_t]=!1,e.nodes&&e.nodes.forEach(t=>cd(t)),e}var ud={},Pn=class Rw{constructor(t,r,n){this.stringified=!1,this.processed=!1;let o;if(typeof r=="object"&&r!==null&&(r.type==="root"||r.type==="document"))o=cd(r);else if(r instanceof Rw||r instanceof lb)o=cd(r.root),r.map&&(typeof n.map>"u"&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{let i=_N;n.syntax&&(i=n.syntax.parse),n.parser&&(i=n.parser),i.parse&&(i=i.parse);try{o=i(r,n)}catch(s){this.processed=!0,this.error=s}o&&!o[ON]&&NN.rebuild(o)}this.result=new lb(t,o,n),this.helpers={...ud,postcss:ud,result:this.result},this.plugins=this.processor.plugins.map(i=>typeof i=="object"&&i.prepare?{...i,...i.prepare(this.result)}:i)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(t,r){let n=this.result.lastPlugin;try{if(r&&r.addToError(t),this.error=t,t.name==="CssSyntaxError"&&!t.plugin)t.plugin=n.postcssPlugin,t.setMessage();else if(n.postcssVersion&&process.env.NODE_ENV!=="production"){let o=n.postcssPlugin,i=n.postcssVersion,s=this.result.processor.version,a=i.split("."),l=s.split(".");(a[0]!==l[0]||parseInt(a[1])>parseInt(l[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+s+", but "+o+" uses "+i+". Perhaps this is the source of the error below.")}}catch(o){console&&console.error&&console.error(o)}return t}prepareVisitors(){this.listeners={};let t=(r,n,o)=>{this.listeners[n]||(this.listeners[n]=[]),this.listeners[n].push([r,o])};for(let r of this.plugins)if(typeof r=="object")for(let n in r){if(!BN[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${r.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!VN[n])if(typeof r[n]=="object")for(let o in r[n])o==="*"?t(r,n,r[n][o]):t(r,n+"-"+o.toLowerCase(),r[n][o]);else typeof r[n]=="function"&&t(r,n,r[n])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let t=0;t<this.plugins.length;t++){let r=this.plugins[t],n=this.runOnRoot(r);if(Ao(n))try{await n}catch(o){throw this.handleError(o)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[_t];){t[_t]=!0;let r=[cb(t)];for(;r.length>0;){let n=this.visitTick(r);if(Ao(n))try{await n}catch(o){let i=r[r.length-1].node;throw this.handleError(o,i)}}}if(this.listeners.OnceExit)for(let[r,n]of this.listeners.OnceExit){this.result.lastPlugin=r;try{if(t.type==="document"){let o=t.nodes.map(i=>n(i,this.helpers));await Promise.all(o)}else await n(t,this.helpers)}catch(o){throw this.handleError(o)}}}return this.processed=!0,this.stringify()}runOnRoot(t){this.result.lastPlugin=t;try{if(typeof t=="object"&&t.Once){if(this.result.root.type==="document"){let r=this.result.root.nodes.map(n=>t.Once(n,this.helpers));return Ao(r[0])?Promise.all(r):r}return t.Once(this.result.root,this.helpers)}else if(typeof t=="function")return t(this.result.root,this.result)}catch(r){throw this.handleError(r)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let t=this.result.opts,r=LN;t.syntax&&(r=t.syntax.stringify),t.stringifier&&(r=t.stringifier),r.stringify&&(r=r.stringify);let o=new MN(r,this.result.root,this.result.opts).generate();return this.result.css=o[0],this.result.map=o[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let t of this.plugins){let r=this.runOnRoot(t);if(Ao(r))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[_t];)t[_t]=!0,this.walkSync(t);if(this.listeners.OnceExit)if(t.type==="document")for(let r of t.nodes)this.visitSync(this.listeners.OnceExit,r);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(t,r){return process.env.NODE_ENV!=="production"&&("from"in this.opts||DN("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(t,r)}toString(){return this.css}visitSync(t,r){for(let[n,o]of t){this.result.lastPlugin=n;let i;try{i=o(r,this.helpers)}catch(s){throw this.handleError(s,r.proxyOf)}if(r.type!=="root"&&r.type!=="document"&&!r.parent)return!0;if(Ao(i))throw this.getAsyncError()}}visitTick(t){let r=t[t.length-1],{node:n,visitors:o}=r;if(n.type!=="root"&&n.type!=="document"&&!n.parent){t.pop();return}if(o.length>0&&r.visitorIndex<o.length){let[s,a]=o[r.visitorIndex];r.visitorIndex+=1,r.visitorIndex===o.length&&(r.visitors=[],r.visitorIndex=0),this.result.lastPlugin=s;try{return a(n.toProxy(),this.helpers)}catch(l){throw this.handleError(l,n)}}if(r.iterator!==0){let s=r.iterator,a;for(;a=n.nodes[n.indexes[s]];)if(n.indexes[s]+=1,!a[_t]){a[_t]=!0,t.push(cb(a));return}r.iterator=0,delete n.indexes[s]}let i=r.events;for(;r.eventIndex<i.length;){let s=i[r.eventIndex];if(r.eventIndex+=1,s===En){n.nodes&&n.nodes.length&&(n[_t]=!0,r.iterator=n.getIterator());return}else if(this.listeners[s]){r.visitors=this.listeners[s];return}}t.pop()}walkSync(t){t[_t]=!0;let r=kw(t);for(let n of r)if(n===En)t.nodes&&t.each(o=>{o[_t]||this.walkSync(o)});else{let o=this.listeners[n];if(o&&this.visitSync(o,t.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};Pn.registerPostcss=e=>{ud=e};var Cw=Pn;Pn.default=Pn;jN.registerLazyResult(Pn);$N.registerLazyResult(Pn);var UN=nw,WN=ha,HN=mw,zN=Jd,GN=Gd,dd=class{constructor(t,r,n){r=r.toString(),this.stringified=!1,this._processor=t,this._css=r,this._opts=n,this._map=void 0;let o,i=WN;this.result=new GN(this._processor,o,this._opts),this.result.css=r;let s=this;Object.defineProperty(this.result,"root",{get(){return s.root}});let a=new UN(i,o,this._opts,r);if(a.isMap()){let[l,c]=a.generate();l&&(this.result.css=l),c&&(this.result.map=c)}else a.clearAnnotation(),this.result.css=a.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}sync(){if(this.error)throw this.error;return this.result}then(t,r){return process.env.NODE_ENV!=="production"&&("from"in this._opts||HN("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(t,r)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let t,r=zN;try{t=r(this._css,this._opts)}catch(n){this.error=n}if(this.error)throw this.error;return this._root=t,t}get[Symbol.toStringTag](){return"NoWorkResult"}},qN=dd;dd.default=dd;var KN=qN,JN=Cw,YN=zd,XN=qo,Fo=class{constructor(t=[]){this.version="8.4.38",this.plugins=this.normalize(t)}normalize(t){let r=[];for(let n of t)if(n.postcss===!0?n=n():n.postcss&&(n=n.postcss),typeof n=="object"&&Array.isArray(n.plugins))r=r.concat(n.plugins);else if(typeof n=="object"&&n.postcssPlugin)r.push(n);else if(typeof n=="function")r.push(n);else if(typeof n=="object"&&(n.parse||n.stringify)){if(process.env.NODE_ENV!=="production")throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}else throw new Error(n+" is not a PostCSS plugin");return r}process(t,r={}){return!this.plugins.length&&!r.parser&&!r.stringifier&&!r.syntax?new KN(this,t,r):new JN(this,t,r)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}},ZN=Fo;Fo.default=Fo;XN.registerProcessor(Fo);YN.registerProcessor(Fo);var QN=ga,e$=Zb,t$=ba,r$=qd,n$=ya,o$=qo,i$=Kd;function Bo(e,t){if(Array.isArray(e))return e.map(o=>Bo(o));let{inputs:r,...n}=e;if(r){t=[];for(let o of r){let i={...o,__proto__:n$.prototype};i.map&&(i.map={...i.map,__proto__:e$.prototype}),t.push(i)}}if(n.nodes&&(n.nodes=e.nodes.map(o=>Bo(o,t))),n.source){let{inputId:o,...i}=n.source;n.source=i,o!=null&&(n.source.input=t[o])}if(n.type==="root")return new o$(n);if(n.type==="decl")return new QN(n);if(n.type==="rule")return new i$(n);if(n.type==="comment")return new t$(n);if(n.type==="atrule")return new r$(n);throw new Error("Unknown node type: "+e.type)}var s$=Bo;Bo.default=Bo;var a$=Ud,Ew=ga,l$=Cw,c$=Kr,Yd=ZN,u$=ha,d$=s$,Pw=zd,p$=gw,Iw=ba,Aw=qd,f$=Gd,h$=ya,m$=Jd,g$=vw,Tw=Kd,Ow=qo,y$=ma;function ie(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new Yd(e)}ie.plugin=function(t,r){let n=!1;function o(...s){console&&console.warn&&!n&&(n=!0,console.warn(t+`: postcss.plugin was deprecated. Migration guide:
144
- 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:
145
- https://www.w3ctech.com/topic/2226`));let a=r(...s);return a.postcssPlugin=t,a.postcssVersion=new Yd().version,a}let i;return Object.defineProperty(o,"postcss",{get(){return i||(i=o()),i}}),o.process=function(s,a,l){return ie([o(l)]).process(s,a)},o};ie.stringify=u$;ie.parse=m$;ie.fromJSON=d$;ie.list=g$;ie.comment=e=>new Iw(e);ie.atRule=e=>new Aw(e);ie.decl=e=>new Ew(e);ie.rule=e=>new Tw(e);ie.root=e=>new Ow(e);ie.document=e=>new Pw(e);ie.CssSyntaxError=a$;ie.Declaration=Ew;ie.Container=c$;ie.Processor=Yd;ie.Document=Pw;ie.Comment=Iw;ie.Warning=p$;ie.AtRule=Aw;ie.Result=f$;ie.Input=h$;ie.Rule=Tw;ie.Root=Ow;ie.Node=y$;l$.registerPostcss(ie);var b$=ie;ie.default=ie;var ke=I2(b$);ke.stringify;ke.fromJSON;ke.plugin;ke.parse;ke.list;ke.document;ke.comment;ke.atRule;ke.rule;ke.decl;ke.root;ke.CssSyntaxError;ke.Declaration;ke.Container;ke.Processor;ke.Document;ke.Comment;ke.Warning;ke.AtRule;ke.Result;ke.Input;ke.Rule;ke.Root;ke.Node;var w$=Object.defineProperty,S$=(e,t,r)=>t in e?w$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,mt=(e,t,r)=>S$(e,typeof t!="symbol"?t+"":t,r);function v$(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function x$(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}),r}var Xd={exports:{}},Se=String,Mw=function(){return{isColorSupported:!1,reset:Se,bold:Se,dim:Se,italic:Se,underline:Se,inverse:Se,hidden:Se,strikethrough:Se,black:Se,red:Se,green:Se,yellow:Se,blue:Se,magenta:Se,cyan:Se,white:Se,gray:Se,bgBlack:Se,bgRed:Se,bgGreen:Se,bgYellow:Se,bgBlue:Se,bgMagenta:Se,bgCyan:Se,bgWhite:Se}};Xd.exports=Mw();Xd.exports.createColors=Mw;var k$=Xd.exports,R$={},C$=Object.freeze(Object.defineProperty({__proto__:null,default:R$},Symbol.toStringTag,{value:"Module"})),Ct=x$(C$),ub=k$,db=Ct,pd=class Lw extends Error{constructor(t,r,n,o,i,s){super(t),this.name="CssSyntaxError",this.reason=t,i&&(this.file=i),o&&(this.source=o),s&&(this.plugin=s),typeof r<"u"&&typeof n<"u"&&(typeof r=="number"?(this.line=r,this.column=n):(this.line=r.line,this.column=r.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,Lw)}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 r=this.source;t==null&&(t=ub.isColorSupported),db&&t&&(r=db(r));let n=r.split(/\r?\n/),o=Math.max(this.line-3,0),i=Math.min(this.line+2,n.length),s=String(i).length,a,l;if(t){let{bold:c,gray:u,red:d}=ub.createColors(!0);a=p=>c(d(p)),l=p=>u(p)}else a=l=c=>c;return n.slice(o,i).map((c,u)=>{let d=o+1+u,p=" "+(" "+d).slice(-s)+" | ";if(d===this.line){let h=l(p.replace(/\d/g," "))+c.slice(0,this.column-1).replace(/[^\t]/g," ");return a(">")+l(p)+c+`
146
- `+h+a("^")}return" "+l(p)+c}).join(`
147
- `)}toString(){let t=this.showSourceCode();return t&&(t=`
148
-
149
- `+t+`
150
- `),this.name+": "+this.message+t}},Zd=pd;pd.default=pd;var Ko={};Ko.isClean=Symbol("isClean");Ko.my=Symbol("my");var pb={after:`
151
- `,beforeClose:`
152
- `,beforeComment:`
153
- `,beforeDecl:`
154
- `,beforeOpen:" ",beforeRule:`
155
- `,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function E$(e){return e[0].toUpperCase()+e.slice(1)}var fd=class{constructor(t){this.builder=t}atrule(t,r){let n="@"+t.name,o=t.params?this.rawValue(t,"params"):"";if(typeof t.raws.afterName<"u"?n+=t.raws.afterName:o&&(n+=" "),t.nodes)this.block(t,n+o);else{let i=(t.raws.between||"")+(r?";":"");this.builder(n+o+i,t)}}beforeAfter(t,r){let n;t.type==="decl"?n=this.raw(t,null,"beforeDecl"):t.type==="comment"?n=this.raw(t,null,"beforeComment"):r==="before"?n=this.raw(t,null,"beforeRule"):n=this.raw(t,null,"beforeClose");let o=t.parent,i=0;for(;o&&o.type!=="root";)i+=1,o=o.parent;if(n.includes(`
156
- `)){let s=this.raw(t,null,"indent");if(s.length)for(let a=0;a<i;a++)n+=s}return n}block(t,r){let n=this.raw(t,"between","beforeOpen");this.builder(r+n+"{",t,"start");let o;t.nodes&&t.nodes.length?(this.body(t),o=this.raw(t,"after")):o=this.raw(t,"after","emptyBody"),o&&this.builder(o),this.builder("}",t,"end")}body(t){let r=t.nodes.length-1;for(;r>0&&t.nodes[r].type==="comment";)r-=1;let n=this.raw(t,"semicolon");for(let o=0;o<t.nodes.length;o++){let i=t.nodes[o],s=this.raw(i,"before");s&&this.builder(s),this.stringify(i,r!==o||n)}}comment(t){let r=this.raw(t,"left","commentLeft"),n=this.raw(t,"right","commentRight");this.builder("/*"+r+t.text+n+"*/",t)}decl(t,r){let n=this.raw(t,"between","colon"),o=t.prop+n+this.rawValue(t,"value");t.important&&(o+=t.raws.important||" !important"),r&&(o+=";"),this.builder(o,t)}document(t){this.body(t)}raw(t,r,n){let o;if(n||(n=r),r&&(o=t.raws[r],typeof o<"u"))return o;let i=t.parent;if(n==="before"&&(!i||i.type==="root"&&i.first===t||i&&i.type==="document"))return"";if(!i)return pb[n];let s=t.root();if(s.rawCache||(s.rawCache={}),typeof s.rawCache[n]<"u")return s.rawCache[n];if(n==="before"||n==="after")return this.beforeAfter(t,n);{let a="raw"+E$(n);this[a]?o=this[a](s,t):s.walk(l=>{if(o=l.raws[r],typeof o<"u")return!1})}return typeof o>"u"&&(o=pb[n]),s.rawCache[n]=o,o}rawBeforeClose(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length>0&&typeof n.raws.after<"u")return r=n.raws.after,r.includes(`
157
- `)&&(r=r.replace(/[^\n]+$/,"")),!1}),r&&(r=r.replace(/\S/g,"")),r}rawBeforeComment(t,r){let n;return t.walkComments(o=>{if(typeof o.raws.before<"u")return n=o.raws.before,n.includes(`
158
- `)&&(n=n.replace(/[^\n]+$/,"")),!1}),typeof n>"u"?n=this.raw(r,null,"beforeDecl"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeDecl(t,r){let n;return t.walkDecls(o=>{if(typeof o.raws.before<"u")return n=o.raws.before,n.includes(`
159
- `)&&(n=n.replace(/[^\n]+$/,"")),!1}),typeof n>"u"?n=this.raw(r,null,"beforeRule"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeOpen(t){let r;return t.walk(n=>{if(n.type!=="decl"&&(r=n.raws.between,typeof r<"u"))return!1}),r}rawBeforeRule(t){let r;return t.walk(n=>{if(n.nodes&&(n.parent!==t||t.first!==n)&&typeof n.raws.before<"u")return r=n.raws.before,r.includes(`
160
- `)&&(r=r.replace(/[^\n]+$/,"")),!1}),r&&(r=r.replace(/\S/g,"")),r}rawColon(t){let r;return t.walkDecls(n=>{if(typeof n.raws.between<"u")return r=n.raws.between.replace(/[^\s:]/g,""),!1}),r}rawEmptyBody(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length===0&&(r=n.raws.after,typeof r<"u"))return!1}),r}rawIndent(t){if(t.raws.indent)return t.raws.indent;let r;return t.walk(n=>{let o=n.parent;if(o&&o!==t&&o.parent&&o.parent===t&&typeof n.raws.before<"u"){let i=n.raws.before.split(`
161
- `);return r=i[i.length-1],r=r.replace(/\S/g,""),!1}}),r}rawSemicolon(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length&&n.last.type==="decl"&&(r=n.raws.semicolon,typeof r<"u"))return!1}),r}rawValue(t,r){let n=t[r],o=t.raws[r];return o&&o.value===n?o.raw:n}root(t){this.body(t),t.raws.after&&this.builder(t.raws.after)}rule(t){this.block(t,this.rawValue(t,"selector")),t.raws.ownSemicolon&&this.builder(t.raws.ownSemicolon,t,"end")}stringify(t,r){if(!this[t.type])throw new Error("Unknown AST node type "+t.type+". Maybe you need to change PostCSS stringifier.");this[t.type](t,r)}},Nw=fd;fd.default=fd;var P$=Nw;function hd(e,t){new P$(t).stringify(e)}var wa=hd;hd.default=hd;var{isClean:Ls,my:I$}=Ko,A$=Zd,T$=Nw,O$=wa;function md(e,t){let r=new e.constructor;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n)||n==="proxyCache")continue;let o=e[n],i=typeof o;n==="parent"&&i==="object"?t&&(r[n]=t):n==="source"?r[n]=o:Array.isArray(o)?r[n]=o.map(s=>md(s,r)):(i==="object"&&o!==null&&(o=md(o)),r[n]=o)}return r}var gd=class{constructor(t={}){this.raws={},this[Ls]=!1,this[I$]=!0;for(let r in t)if(r==="nodes"){this.nodes=[];for(let n of t[r])typeof n.clone=="function"?this.append(n.clone()):this.append(n)}else this[r]=t[r]}addToError(t){if(t.postcssNode=this,t.stack&&this.source&&/\n\s{4}at /.test(t.stack)){let r=this.source;t.stack=t.stack.replace(/\n\s{4}at /,`$&${r.input.from}:${r.start.line}:${r.start.column}$&`)}return t}after(t){return this.parent.insertAfter(this,t),this}assign(t={}){for(let r in t)this[r]=t[r];return this}before(t){return this.parent.insertBefore(this,t),this}cleanRaws(t){delete this.raws.before,delete this.raws.after,t||delete this.raws.between}clone(t={}){let r=md(this);for(let n in t)r[n]=t[n];return r}cloneAfter(t={}){let r=this.clone(t);return this.parent.insertAfter(this,r),r}cloneBefore(t={}){let r=this.clone(t);return this.parent.insertBefore(this,r),r}error(t,r={}){if(this.source){let{end:n,start:o}=this.rangeBy(r);return this.source.input.error(t,{column:o.column,line:o.line},{column:n.column,line:n.line},r)}return new A$(t)}getProxyProcessor(){return{get(t,r){return r==="proxyOf"?t:r==="root"?()=>t.root().toProxy():t[r]},set(t,r,n){return t[r]===n||(t[r]=n,(r==="prop"||r==="value"||r==="name"||r==="params"||r==="important"||r==="text")&&t.markDirty()),!0}}}markDirty(){if(this[Ls]){this[Ls]=!1;let t=this;for(;t=t.parent;)t[Ls]=!1}}next(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t+1]}positionBy(t,r){let n=this.source.start;if(t.index)n=this.positionInside(t.index,r);else if(t.word){r=this.toString();let o=r.indexOf(t.word);o!==-1&&(n=this.positionInside(o,r))}return n}positionInside(t,r){let n=r||this.toString(),o=this.source.start.column,i=this.source.start.line;for(let s=0;s<t;s++)n[s]===`
162
- `?(o=1,i+=1):o+=1;return{column:o,line:i}}prev(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t-1]}rangeBy(t){let r={column:this.source.start.column,line:this.source.start.line},n=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:r.column+1,line:r.line};if(t.word){let o=this.toString(),i=o.indexOf(t.word);i!==-1&&(r=this.positionInside(i,o),n=this.positionInside(i+t.word.length,o))}else t.start?r={column:t.start.column,line:t.start.line}:t.index&&(r=this.positionInside(t.index)),t.end?n={column:t.end.column,line:t.end.line}:typeof t.endIndex=="number"?n=this.positionInside(t.endIndex):t.index&&(n=this.positionInside(t.index+1));return(n.line<r.line||n.line===r.line&&n.column<=r.column)&&(n={column:r.column+1,line:r.line}),{end:n,start:r}}raw(t,r){return new T$().raw(this,t,r)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...t){if(this.parent){let r=this,n=!1;for(let o of t)o===this?n=!0:n?(this.parent.insertAfter(r,o),r=o):this.parent.insertBefore(r,o);n||this.remove()}return this}root(){let t=this;for(;t.parent&&t.parent.type!=="document";)t=t.parent;return t}toJSON(t,r){let n={},o=r==null;r=r||new Map;let i=0;for(let s in this){if(!Object.prototype.hasOwnProperty.call(this,s)||s==="parent"||s==="proxyCache")continue;let a=this[s];if(Array.isArray(a))n[s]=a.map(l=>typeof l=="object"&&l.toJSON?l.toJSON(null,r):l);else if(typeof a=="object"&&a.toJSON)n[s]=a.toJSON(null,r);else if(s==="source"){let l=r.get(a.input);l==null&&(l=i,r.set(a.input,i),i++),n[s]={end:a.end,inputId:l,start:a.start}}else n[s]=a}return o&&(n.inputs=[...r.keys()].map(s=>s.toJSON())),n}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(t=O$){t.stringify&&(t=t.stringify);let r="";return t(this,n=>{r+=n}),r}warn(t,r,n){let o={node:this};for(let i in n)o[i]=n[i];return t.warn(r,o)}get proxyOf(){return this}},Sa=gd;gd.default=gd;var M$=Sa,yd=class extends M${constructor(t){t&&typeof t.value<"u"&&typeof t.value!="string"&&(t={...t,value:String(t.value)}),super(t),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}},va=yd;yd.default=yd;var L$="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",N$=(e,t=21)=>(r=t)=>{let n="",o=r;for(;o--;)n+=e[Math.random()*e.length|0];return n},$$=(e=21)=>{let t="",r=e;for(;r--;)t+=L$[Math.random()*64|0];return t},D$={nanoid:$$,customAlphabet:N$},{SourceMapConsumer:fb,SourceMapGenerator:hb}=Ct,{existsSync:_$,readFileSync:j$}=Ct,{dirname:Uu,join:F$}=Ct;function B$(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var bd=class{constructor(t,r){if(r.map===!1)return;this.loadAnnotation(t),this.inline=this.startWith(this.annotation,"data:");let n=r.map?r.map.prev:void 0,o=this.loadMap(r.from,n);!this.mapFile&&r.from&&(this.mapFile=r.from),this.mapFile&&(this.root=Uu(this.mapFile)),o&&(this.text=o)}consumer(){return this.consumerCache||(this.consumerCache=new fb(this.text)),this.consumerCache}decodeInline(t){let r=/^data:application\/json;charset=utf-?8;base64,/,n=/^data:application\/json;base64,/,o=/^data:application\/json;charset=utf-?8,/,i=/^data:application\/json,/;if(o.test(t)||i.test(t))return decodeURIComponent(t.substr(RegExp.lastMatch.length));if(r.test(t)||n.test(t))return B$(t.substr(RegExp.lastMatch.length));let s=t.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+s)}getAnnotationURL(t){return t.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(t){return typeof t!="object"?!1:typeof t.mappings=="string"||typeof t._mappings=="string"||Array.isArray(t.sections)}loadAnnotation(t){let r=t.match(/\/\*\s*# sourceMappingURL=/gm);if(!r)return;let n=t.lastIndexOf(r.pop()),o=t.indexOf("*/",n);n>-1&&o>-1&&(this.annotation=this.getAnnotationURL(t.substring(n,o)))}loadFile(t){if(this.root=Uu(t),_$(t))return this.mapFile=t,j$(t,"utf-8").toString().trim()}loadMap(t,r){if(r===!1)return!1;if(r){if(typeof r=="string")return r;if(typeof r=="function"){let n=r(t);if(n){let o=this.loadFile(n);if(!o)throw new Error("Unable to load previous source map: "+n.toString());return o}}else{if(r instanceof fb)return hb.fromSourceMap(r).toString();if(r instanceof hb)return r.toString();if(this.isMap(r))return JSON.stringify(r);throw new Error("Unsupported previous source map format: "+r.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let n=this.annotation;return t&&(n=F$(Uu(t),n)),this.loadFile(n)}}}startWith(t,r){return t?t.substr(0,r.length)===r:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}},$w=bd;bd.default=bd;var{SourceMapConsumer:V$,SourceMapGenerator:U$}=Ct,{fileURLToPath:mb,pathToFileURL:Ns}=Ct,{isAbsolute:wd,resolve:Sd}=Ct,{nanoid:W$}=D$,Wu=Ct,gb=Zd,H$=$w,Hu=Symbol("fromOffsetCache"),z$=!!(V$&&U$),yb=!!(Sd&&wd),sa=class{constructor(t,r={}){if(t===null||typeof t>"u"||typeof t=="object"&&!t.toString)throw new Error(`PostCSS received ${t} instead of CSS string`);if(this.css=t.toString(),this.css[0]==="\uFEFF"||this.css[0]==="\uFFFE"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,r.from&&(!yb||/^\w+:\/\//.test(r.from)||wd(r.from)?this.file=r.from:this.file=Sd(r.from)),yb&&z$){let n=new H$(this.css,r);if(n.text){this.map=n;let o=n.consumer().file;!this.file&&o&&(this.file=this.mapResolve(o))}}this.file||(this.id="<input css "+W$(6)+">"),this.map&&(this.map.file=this.from)}error(t,r,n,o={}){let i,s,a;if(r&&typeof r=="object"){let c=r,u=n;if(typeof c.offset=="number"){let d=this.fromOffset(c.offset);r=d.line,n=d.col}else r=c.line,n=c.column;if(typeof u.offset=="number"){let d=this.fromOffset(u.offset);s=d.line,a=d.col}else s=u.line,a=u.column}else if(!n){let c=this.fromOffset(r);r=c.line,n=c.col}let l=this.origin(r,n,s,a);return l?i=new gb(t,l.endLine===void 0?l.line:{column:l.column,line:l.line},l.endLine===void 0?l.column:{column:l.endColumn,line:l.endLine},l.source,l.file,o.plugin):i=new gb(t,s===void 0?r:{column:n,line:r},s===void 0?n:{column:a,line:s},this.css,this.file,o.plugin),i.input={column:n,endColumn:a,endLine:s,line:r,source:this.css},this.file&&(Ns&&(i.input.url=Ns(this.file).toString()),i.input.file=this.file),i}fromOffset(t){let r,n;if(this[Hu])n=this[Hu];else{let i=this.css.split(`
163
- `);n=new Array(i.length);let s=0;for(let a=0,l=i.length;a<l;a++)n[a]=s,s+=i[a].length+1;this[Hu]=n}r=n[n.length-1];let o=0;if(t>=r)o=n.length-1;else{let i=n.length-2,s;for(;o<i;)if(s=o+(i-o>>1),t<n[s])i=s-1;else if(t>=n[s+1])o=s+1;else{o=s;break}}return{col:t-n[o]+1,line:o+1}}mapResolve(t){return/^\w+:\/\//.test(t)?t:Sd(this.map.consumer().sourceRoot||this.map.root||".",t)}origin(t,r,n,o){if(!this.map)return!1;let i=this.map.consumer(),s=i.originalPositionFor({column:r,line:t});if(!s.source)return!1;let a;typeof n=="number"&&(a=i.originalPositionFor({column:o,line:n}));let l;wd(s.source)?l=Ns(s.source):l=new URL(s.source,this.map.consumer().sourceRoot||Ns(this.map.mapFile));let c={column:s.column,endColumn:a&&a.column,endLine:a&&a.line,line:s.line,url:l.toString()};if(l.protocol==="file:")if(mb)c.file=mb(l);else throw new Error("file: protocol is not available in this PostCSS build");let u=i.sourceContentFor(s.source);return u&&(c.source=u),c}toJSON(){let t={};for(let r of["hasBOM","css","file","id"])this[r]!=null&&(t[r]=this[r]);return this.map&&(t.map={...this.map},t.map.consumerCache&&(t.map.consumerCache=void 0)),t}get from(){return this.file||this.id}},xa=sa;sa.default=sa;Wu&&Wu.registerInput&&Wu.registerInput(sa);var{SourceMapConsumer:Dw,SourceMapGenerator:qs}=Ct,{dirname:Ks,relative:_w,resolve:jw,sep:Fw}=Ct,{pathToFileURL:bb}=Ct,G$=xa,q$=!!(Dw&&qs),K$=!!(Ks&&jw&&_w&&Fw),J$=class{constructor(t,r,n,o){this.stringify=t,this.mapOpts=n.map||{},this.root=r,this.opts=n,this.css=o,this.originalCSS=o,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let t;this.isInline()?t="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?t=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?t=this.mapOpts.annotation(this.opts.to,this.root):t=this.outputFile()+".map";let r=`
164
- `;this.css.includes(`\r
165
- `)&&(r=`\r
166
- `),this.css+=r+"/*# sourceMappingURL="+t+" */"}applyPrevMaps(){for(let t of this.previous()){let r=this.toUrl(this.path(t.file)),n=t.root||Ks(t.file),o;this.mapOpts.sourcesContent===!1?(o=new Dw(t.text),o.sourcesContent&&(o.sourcesContent=null)):o=t.consumer(),this.map.applySourceMap(o,r,this.toUrl(this.path(n)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let t;for(let r=this.root.nodes.length-1;r>=0;r--)t=this.root.nodes[r],t.type==="comment"&&t.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(r)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),K$&&q$&&this.isMap())return this.generateMap();{let t="";return this.stringify(this.root,r=>{t+=r}),[t]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let t=this.previous()[0].consumer();t.file=this.outputFile(),this.map=qs.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new qs({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new qs({file:this.outputFile(),ignoreInvalidMapping:!0});let t=1,r=1,n="<no source>",o={generated:{column:0,line:0},original:{column:0,line:0},source:""},i,s;this.stringify(this.root,(a,l,c)=>{if(this.css+=a,l&&c!=="end"&&(o.generated.line=t,o.generated.column=r-1,l.source&&l.source.start?(o.source=this.sourcePath(l),o.original.line=l.source.start.line,o.original.column=l.source.start.column-1,this.map.addMapping(o)):(o.source=n,o.original.line=1,o.original.column=0,this.map.addMapping(o))),i=a.match(/\n/g),i?(t+=i.length,s=a.lastIndexOf(`
167
- `),r=a.length-s):r+=a.length,l&&c!=="start"){let u=l.parent||{raws:{}};(!(l.type==="decl"||l.type==="atrule"&&!l.nodes)||l!==u.last||u.raws.semicolon)&&(l.source&&l.source.end?(o.source=this.sourcePath(l),o.original.line=l.source.end.line,o.original.column=l.source.end.column-1,o.generated.line=t,o.generated.column=r-2,this.map.addMapping(o)):(o.source=n,o.original.line=1,o.original.column=0,o.generated.line=t,o.generated.column=r-1,this.map.addMapping(o)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(t=>t.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let t=this.mapOpts.annotation;return typeof t<"u"&&t!==!0?!1:this.previous().length?this.previous().some(r=>r.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(t=>t.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(t){if(this.mapOpts.absolute||t.charCodeAt(0)===60||/^\w+:\/\//.test(t))return t;let r=this.memoizedPaths.get(t);if(r)return r;let n=this.opts.to?Ks(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(n=Ks(jw(n,this.mapOpts.annotation)));let o=_w(n,t);return this.memoizedPaths.set(t,o),o}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(t=>{if(t.source&&t.source.input.map){let r=t.source.input.map;this.previousMaps.includes(r)||this.previousMaps.push(r)}});else{let t=new G$(this.originalCSS,this.opts);t.map&&this.previousMaps.push(t.map)}return this.previousMaps}setSourcesContent(){let t={};if(this.root)this.root.walk(r=>{if(r.source){let n=r.source.input.from;if(n&&!t[n]){t[n]=!0;let o=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(o,r.source.input.css)}}});else if(this.css){let r=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(r,this.css)}}sourcePath(t){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(t.source.input.from):this.toUrl(this.path(t.source.input.from))}toBase64(t){return Buffer?Buffer.from(t).toString("base64"):window.btoa(unescape(encodeURIComponent(t)))}toFileUrl(t){let r=this.memoizedFileURLs.get(t);if(r)return r;if(bb){let n=bb(t).toString();return this.memoizedFileURLs.set(t,n),n}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(t){let r=this.memoizedURLs.get(t);if(r)return r;Fw==="\\"&&(t=t.replace(/\\/g,"/"));let n=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,n),n}},Bw=J$,Y$=Sa,vd=class extends Y${constructor(t){super(t),this.type="comment"}},ka=vd;vd.default=vd;var{isClean:Vw,my:Uw}=Ko,Ww=va,Hw=ka,X$=Sa,zw,Qd,ep,Gw;function qw(e){return e.map(t=>(t.nodes&&(t.nodes=qw(t.nodes)),delete t.source,t))}function Kw(e){if(e[Vw]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)Kw(t)}var tr=class Jw extends X${append(...t){for(let r of t){let n=this.normalize(r,this.last);for(let o of n)this.proxyOf.nodes.push(o)}return this.markDirty(),this}cleanRaws(t){if(super.cleanRaws(t),this.nodes)for(let r of this.nodes)r.cleanRaws(t)}each(t){if(!this.proxyOf.nodes)return;let r=this.getIterator(),n,o;for(;this.indexes[r]<this.proxyOf.nodes.length&&(n=this.indexes[r],o=t(this.proxyOf.nodes[n],n),o!==!1);)this.indexes[r]+=1;return delete this.indexes[r],o}every(t){return this.nodes.every(t)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let t=this.lastEach;return this.indexes[t]=0,t}getProxyProcessor(){return{get(t,r){return r==="proxyOf"?t:t[r]?r==="each"||typeof r=="string"&&r.startsWith("walk")?(...n)=>t[r](...n.map(o=>typeof o=="function"?(i,s)=>o(i.toProxy(),s):o)):r==="every"||r==="some"?n=>t[r]((o,...i)=>n(o.toProxy(),...i)):r==="root"?()=>t.root().toProxy():r==="nodes"?t.nodes.map(n=>n.toProxy()):r==="first"||r==="last"?t[r].toProxy():t[r]:t[r]},set(t,r,n){return t[r]===n||(t[r]=n,(r==="name"||r==="params"||r==="selector")&&t.markDirty()),!0}}}index(t){return typeof t=="number"?t:(t.proxyOf&&(t=t.proxyOf),this.proxyOf.nodes.indexOf(t))}insertAfter(t,r){let n=this.index(t),o=this.normalize(r,this.proxyOf.nodes[n]).reverse();n=this.index(t);for(let s of o)this.proxyOf.nodes.splice(n+1,0,s);let i;for(let s in this.indexes)i=this.indexes[s],n<i&&(this.indexes[s]=i+o.length);return this.markDirty(),this}insertBefore(t,r){let n=this.index(t),o=n===0?"prepend":!1,i=this.normalize(r,this.proxyOf.nodes[n],o).reverse();n=this.index(t);for(let a of i)this.proxyOf.nodes.splice(n,0,a);let s;for(let a in this.indexes)s=this.indexes[a],n<=s&&(this.indexes[a]=s+i.length);return this.markDirty(),this}normalize(t,r){if(typeof t=="string")t=qw(zw(t).nodes);else if(typeof t>"u")t=[];else if(Array.isArray(t)){t=t.slice(0);for(let o of t)o.parent&&o.parent.removeChild(o,"ignore")}else if(t.type==="root"&&this.type!=="document"){t=t.nodes.slice(0);for(let o of t)o.parent&&o.parent.removeChild(o,"ignore")}else if(t.type)t=[t];else if(t.prop){if(typeof t.value>"u")throw new Error("Value field is missed in node creation");typeof t.value!="string"&&(t.value=String(t.value)),t=[new Ww(t)]}else if(t.selector)t=[new Qd(t)];else if(t.name)t=[new ep(t)];else if(t.text)t=[new Hw(t)];else throw new Error("Unknown node type in node creation");return t.map(o=>(o[Uw]||Jw.rebuild(o),o=o.proxyOf,o.parent&&o.parent.removeChild(o),o[Vw]&&Kw(o),typeof o.raws.before>"u"&&r&&typeof r.raws.before<"u"&&(o.raws.before=r.raws.before.replace(/\S/g,"")),o.parent=this.proxyOf,o))}prepend(...t){t=t.reverse();for(let r of t){let n=this.normalize(r,this.first,"prepend").reverse();for(let o of n)this.proxyOf.nodes.unshift(o);for(let o in this.indexes)this.indexes[o]=this.indexes[o]+n.length}return this.markDirty(),this}push(t){return t.parent=this,this.proxyOf.nodes.push(t),this}removeAll(){for(let t of this.proxyOf.nodes)t.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(t){t=this.index(t),this.proxyOf.nodes[t].parent=void 0,this.proxyOf.nodes.splice(t,1);let r;for(let n in this.indexes)r=this.indexes[n],r>=t&&(this.indexes[n]=r-1);return this.markDirty(),this}replaceValues(t,r,n){return n||(n=r,r={}),this.walkDecls(o=>{r.props&&!r.props.includes(o.prop)||r.fast&&!o.value.includes(r.fast)||(o.value=o.value.replace(t,n))}),this.markDirty(),this}some(t){return this.nodes.some(t)}walk(t){return this.each((r,n)=>{let o;try{o=t(r,n)}catch(i){throw r.addToError(i)}return o!==!1&&r.walk&&(o=r.walk(t)),o})}walkAtRules(t,r){return r?t instanceof RegExp?this.walk((n,o)=>{if(n.type==="atrule"&&t.test(n.name))return r(n,o)}):this.walk((n,o)=>{if(n.type==="atrule"&&n.name===t)return r(n,o)}):(r=t,this.walk((n,o)=>{if(n.type==="atrule")return r(n,o)}))}walkComments(t){return this.walk((r,n)=>{if(r.type==="comment")return t(r,n)})}walkDecls(t,r){return r?t instanceof RegExp?this.walk((n,o)=>{if(n.type==="decl"&&t.test(n.prop))return r(n,o)}):this.walk((n,o)=>{if(n.type==="decl"&&n.prop===t)return r(n,o)}):(r=t,this.walk((n,o)=>{if(n.type==="decl")return r(n,o)}))}walkRules(t,r){return r?t instanceof RegExp?this.walk((n,o)=>{if(n.type==="rule"&&t.test(n.selector))return r(n,o)}):this.walk((n,o)=>{if(n.type==="rule"&&n.selector===t)return r(n,o)}):(r=t,this.walk((n,o)=>{if(n.type==="rule")return r(n,o)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};tr.registerParse=e=>{zw=e};tr.registerRule=e=>{Qd=e};tr.registerAtRule=e=>{ep=e};tr.registerRoot=e=>{Gw=e};var Jr=tr;tr.default=tr;tr.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,ep.prototype):e.type==="rule"?Object.setPrototypeOf(e,Qd.prototype):e.type==="decl"?Object.setPrototypeOf(e,Ww.prototype):e.type==="comment"?Object.setPrototypeOf(e,Hw.prototype):e.type==="root"&&Object.setPrototypeOf(e,Gw.prototype),e[Uw]=!0,e.nodes&&e.nodes.forEach(t=>{tr.rebuild(t)})};var Z$=Jr,Yw,Xw,Vo=class extends Z${constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new Yw(new Xw,this,t).stringify()}};Vo.registerLazyResult=e=>{Yw=e};Vo.registerProcessor=e=>{Xw=e};var tp=Vo;Vo.default=Vo;var wb={},Zw=function(t){wb[t]||(wb[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))},xd=class{constructor(t,r={}){if(this.type="warning",this.text=t,r.node&&r.node.source){let n=r.node.rangeBy(r);this.line=n.start.line,this.column=n.start.column,this.endLine=n.end.line,this.endColumn=n.end.column}for(let n in r)this[n]=r[n]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}},Qw=xd;xd.default=xd;var Q$=Qw,kd=class{constructor(t,r,n){this.processor=t,this.messages=[],this.root=r,this.opts=n,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,r={}){r.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(r.plugin=this.lastPlugin.postcssPlugin);let n=new Q$(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(t=>t.type==="warning")}get content(){return this.css}},rp=kd;kd.default=kd;var zu=39,Sb=34,$s=92,vb=47,Ds=10,To=32,_s=12,js=9,Fs=13,e6=91,t6=93,r6=40,n6=41,o6=123,i6=125,s6=59,a6=42,l6=58,c6=64,Bs=/[\t\n\f\r "#'()/;[\\\]{}]/g,Vs=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,u6=/.[\r\n"'(/\\]/,xb=/[\da-f]/i,d6=function(t,r={}){let n=t.css.valueOf(),o=r.ignoreErrors,i,s,a,l,c,u,d,p,h,f,m=n.length,g=0,w=[],S=[];function y(){return g}function v(E){throw t.error("Unclosed "+E,g)}function C(){return S.length===0&&g>=m}function M(E){if(S.length)return S.pop();if(g>=m)return;let x=E?E.ignoreUnclosed:!1;switch(i=n.charCodeAt(g),i){case Ds:case To:case js:case Fs:case _s:{s=g;do s+=1,i=n.charCodeAt(s);while(i===To||i===Ds||i===js||i===Fs||i===_s);f=["space",n.slice(g,s)],g=s-1;break}case e6:case t6:case o6:case i6:case l6:case s6:case n6:{let B=String.fromCharCode(i);f=[B,B,g];break}case r6:{if(p=w.length?w.pop()[1]:"",h=n.charCodeAt(g+1),p==="url"&&h!==zu&&h!==Sb&&h!==To&&h!==Ds&&h!==js&&h!==_s&&h!==Fs){s=g;do{if(u=!1,s=n.indexOf(")",s+1),s===-1)if(o||x){s=g;break}else v("bracket");for(d=s;n.charCodeAt(d-1)===$s;)d-=1,u=!u}while(u);f=["brackets",n.slice(g,s+1),g,s],g=s}else s=n.indexOf(")",g+1),l=n.slice(g,s+1),s===-1||u6.test(l)?f=["(","(",g]:(f=["brackets",l,g,s],g=s);break}case zu:case Sb:{a=i===zu?"'":'"',s=g;do{if(u=!1,s=n.indexOf(a,s+1),s===-1)if(o||x){s=g+1;break}else v("string");for(d=s;n.charCodeAt(d-1)===$s;)d-=1,u=!u}while(u);f=["string",n.slice(g,s+1),g,s],g=s;break}case c6:{Bs.lastIndex=g+1,Bs.test(n),Bs.lastIndex===0?s=n.length-1:s=Bs.lastIndex-2,f=["at-word",n.slice(g,s+1),g,s],g=s;break}case $s:{for(s=g,c=!0;n.charCodeAt(s+1)===$s;)s+=1,c=!c;if(i=n.charCodeAt(s+1),c&&i!==vb&&i!==To&&i!==Ds&&i!==js&&i!==Fs&&i!==_s&&(s+=1,xb.test(n.charAt(s)))){for(;xb.test(n.charAt(s+1));)s+=1;n.charCodeAt(s+1)===To&&(s+=1)}f=["word",n.slice(g,s+1),g,s],g=s;break}default:{i===vb&&n.charCodeAt(g+1)===a6?(s=n.indexOf("*/",g+2)+1,s===0&&(o||x?s=n.length:v("comment")),f=["comment",n.slice(g,s+1),g,s],g=s):(Vs.lastIndex=g+1,Vs.test(n),Vs.lastIndex===0?s=n.length-1:s=Vs.lastIndex-2,f=["word",n.slice(g,s+1),g,s],w.push(f),g=s);break}}return g++,f}function I(E){S.push(E)}return{back:I,endOfFile:C,nextToken:M,position:y}},eS=Jr,aa=class extends eS{constructor(t){super(t),this.type="atrule"}append(...t){return this.proxyOf.nodes||(this.nodes=[]),super.append(...t)}prepend(...t){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...t)}},np=aa;aa.default=aa;eS.registerAtRule(aa);var tS=Jr,rS,nS,In=class extends tS{constructor(t){super(t),this.type="root",this.nodes||(this.nodes=[])}normalize(t,r,n){let o=super.normalize(t);if(r){if(n==="prepend")this.nodes.length>1?r.raws.before=this.nodes[1].raws.before:delete r.raws.before;else if(this.first!==r)for(let i of o)i.raws.before=r.raws.before}return o}removeChild(t,r){let n=this.index(t);return!r&&n===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(t)}toResult(t={}){return new rS(new nS,this,t).stringify()}};In.registerLazyResult=e=>{rS=e};In.registerProcessor=e=>{nS=e};var Jo=In;In.default=In;tS.registerRoot(In);var Uo={comma(e){return Uo.split(e,[","],!0)},space(e){let t=[" ",`
168
- `," "];return Uo.split(e,t)},split(e,t,r){let n=[],o="",i=!1,s=0,a=!1,l="",c=!1;for(let u of e)c?c=!1:u==="\\"?c=!0:a?u===l&&(a=!1):u==='"'||u==="'"?(a=!0,l=u):u==="("?s+=1:u===")"?s>0&&(s-=1):s===0&&t.includes(u)&&(i=!0),i?(o!==""&&n.push(o.trim()),o="",i=!1):o+=u;return(r||o!=="")&&n.push(o.trim()),n}},oS=Uo;Uo.default=Uo;var iS=Jr,p6=oS,la=class extends iS{constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return p6.comma(this.selector)}set selectors(t){let r=this.selector?this.selector.match(/,\s*/):null,n=r?r[0]:","+this.raw("between","beforeOpen");this.selector=t.join(n)}},op=la;la.default=la;iS.registerRule(la);var f6=va,h6=d6,m6=ka,g6=np,y6=Jo,kb=op,Rb={empty:!0,space:!0};function b6(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}var w6=class{constructor(t){this.input=t,this.root=new y6,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:t,start:{column:1,line:1,offset:0}}}atrule(t){let r=new g6;r.name=t[1].slice(1),r.name===""&&this.unnamedAtrule(r,t),this.init(r,t[2]);let n,o,i,s=!1,a=!1,l=[],c=[];for(;!this.tokenizer.endOfFile();){if(t=this.tokenizer.nextToken(),n=t[0],n==="("||n==="["?c.push(n==="("?")":"]"):n==="{"&&c.length>0?c.push("}"):n===c[c.length-1]&&c.pop(),c.length===0)if(n===";"){r.source.end=this.getPosition(t[2]),r.source.end.offset++,this.semicolon=!0;break}else if(n==="{"){a=!0;break}else if(n==="}"){if(l.length>0){for(i=l.length-1,o=l[i];o&&o[0]==="space";)o=l[--i];o&&(r.source.end=this.getPosition(o[3]||o[2]),r.source.end.offset++)}this.end(t);break}else l.push(t);else l.push(t);if(this.tokenizer.endOfFile()){s=!0;break}}r.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(r.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(r,"params",l),s&&(t=l[l.length-1],r.source.end=this.getPosition(t[3]||t[2]),r.source.end.offset++,this.spaces=r.raws.between,r.raws.between="")):(r.raws.afterName="",r.params=""),a&&(r.nodes=[],this.current=r)}checkMissedSemicolon(t){let r=this.colon(t);if(r===!1)return;let n=0,o;for(let i=r-1;i>=0&&(o=t[i],!(o[0]!=="space"&&(n+=1,n===2)));i--);throw this.input.error("Missed semicolon",o[0]==="word"?o[3]+1:o[2])}colon(t){let r=0,n,o,i;for(let[s,a]of t.entries()){if(n=a,o=n[0],o==="("&&(r+=1),o===")"&&(r-=1),r===0&&o===":")if(!i)this.doubleColon(n);else{if(i[0]==="word"&&i[1]==="progid")continue;return s}i=n}return!1}comment(t){let r=new m6;this.init(r,t[2]),r.source.end=this.getPosition(t[3]||t[2]),r.source.end.offset++;let n=t[1].slice(2,-2);if(/^\s*$/.test(n))r.text="",r.raws.left=n,r.raws.right="";else{let o=n.match(/^(\s*)([^]*\S)(\s*)$/);r.text=o[2],r.raws.left=o[1],r.raws.right=o[3]}}createTokenizer(){this.tokenizer=h6(this.input)}decl(t,r){let n=new f6;this.init(n,t[0][2]);let o=t[t.length-1];for(o[0]===";"&&(this.semicolon=!0,t.pop()),n.source.end=this.getPosition(o[3]||o[2]||b6(t)),n.source.end.offset++;t[0][0]!=="word";)t.length===1&&this.unknownWord(t),n.raws.before+=t.shift()[1];for(n.source.start=this.getPosition(t[0][2]),n.prop="";t.length;){let c=t[0][0];if(c===":"||c==="space"||c==="comment")break;n.prop+=t.shift()[1]}n.raws.between="";let i;for(;t.length;)if(i=t.shift(),i[0]===":"){n.raws.between+=i[1];break}else i[0]==="word"&&/\w/.test(i[1])&&this.unknownWord([i]),n.raws.between+=i[1];(n.prop[0]==="_"||n.prop[0]==="*")&&(n.raws.before+=n.prop[0],n.prop=n.prop.slice(1));let s=[],a;for(;t.length&&(a=t[0][0],!(a!=="space"&&a!=="comment"));)s.push(t.shift());this.precheckMissedSemicolon(t);for(let c=t.length-1;c>=0;c--){if(i=t[c],i[1].toLowerCase()==="!important"){n.important=!0;let u=this.stringFrom(t,c);u=this.spacesFromEnd(t)+u,u!==" !important"&&(n.raws.important=u);break}else if(i[1].toLowerCase()==="important"){let u=t.slice(0),d="";for(let p=c;p>0;p--){let h=u[p][0];if(d.trim().indexOf("!")===0&&h!=="space")break;d=u.pop()[1]+d}d.trim().indexOf("!")===0&&(n.important=!0,n.raws.important=d,t=u)}if(i[0]!=="space"&&i[0]!=="comment")break}t.some(c=>c[0]!=="space"&&c[0]!=="comment")&&(n.raws.between+=s.map(c=>c[1]).join(""),s=[]),this.raw(n,"value",s.concat(t),r),n.value.includes(":")&&!r&&this.checkMissedSemicolon(t)}doubleColon(t){throw this.input.error("Double colon",{offset:t[2]},{offset:t[2]+t[1].length})}emptyRule(t){let r=new kb;this.init(r,t[2]),r.selector="",r.raws.between="",this.current=r}end(t){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(t[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(t)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(t){if(this.spaces+=t[1],this.current.nodes){let r=this.current.nodes[this.current.nodes.length-1];r&&r.type==="rule"&&!r.raws.ownSemicolon&&(r.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(t){let r=this.input.fromOffset(t);return{column:r.col,line:r.line,offset:t}}init(t,r){this.current.push(t),t.source={input:this.input,start:this.getPosition(r)},t.raws.before=this.spaces,this.spaces="",t.type!=="comment"&&(this.semicolon=!1)}other(t){let r=!1,n=null,o=!1,i=null,s=[],a=t[1].startsWith("--"),l=[],c=t;for(;c;){if(n=c[0],l.push(c),n==="("||n==="[")i||(i=c),s.push(n==="("?")":"]");else if(a&&o&&n==="{")i||(i=c),s.push("}");else if(s.length===0)if(n===";")if(o){this.decl(l,a);return}else break;else if(n==="{"){this.rule(l);return}else if(n==="}"){this.tokenizer.back(l.pop()),r=!0;break}else n===":"&&(o=!0);else n===s[s.length-1]&&(s.pop(),s.length===0&&(i=null));c=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(r=!0),s.length>0&&this.unclosedBracket(i),r&&o){if(!a)for(;l.length&&(c=l[l.length-1][0],!(c!=="space"&&c!=="comment"));)this.tokenizer.back(l.pop());this.decl(l,a)}else this.unknownWord(l)}parse(){let t;for(;!this.tokenizer.endOfFile();)switch(t=this.tokenizer.nextToken(),t[0]){case"space":this.spaces+=t[1];break;case";":this.freeSemicolon(t);break;case"}":this.end(t);break;case"comment":this.comment(t);break;case"at-word":this.atrule(t);break;case"{":this.emptyRule(t);break;default:this.other(t);break}this.endFile()}precheckMissedSemicolon(){}raw(t,r,n,o){let i,s,a=n.length,l="",c=!0,u,d;for(let p=0;p<a;p+=1)i=n[p],s=i[0],s==="space"&&p===a-1&&!o?c=!1:s==="comment"?(d=n[p-1]?n[p-1][0]:"empty",u=n[p+1]?n[p+1][0]:"empty",!Rb[d]&&!Rb[u]?l.slice(-1)===","?c=!1:l+=i[1]:c=!1):l+=i[1];if(!c){let p=n.reduce((h,f)=>h+f[1],"");t.raws[r]={raw:p,value:l}}t[r]=l}rule(t){t.pop();let r=new kb;this.init(r,t[0][2]),r.raws.between=this.spacesAndCommentsFromEnd(t),this.raw(r,"selector",t),this.current=r}spacesAndCommentsFromEnd(t){let r,n="";for(;t.length&&(r=t[t.length-1][0],!(r!=="space"&&r!=="comment"));)n=t.pop()[1]+n;return n}spacesAndCommentsFromStart(t){let r,n="";for(;t.length&&(r=t[0][0],!(r!=="space"&&r!=="comment"));)n+=t.shift()[1];return n}spacesFromEnd(t){let r,n="";for(;t.length&&(r=t[t.length-1][0],r==="space");)n=t.pop()[1]+n;return n}stringFrom(t,r){let n="";for(let o=r;o<t.length;o++)n+=t[o][1];return t.splice(r,t.length-r),n}unclosedBlock(){let t=this.current.source.start;throw this.input.error("Unclosed block",t.line,t.column)}unclosedBracket(t){throw this.input.error("Unclosed bracket",{offset:t[2]},{offset:t[2]+1})}unexpectedClose(t){throw this.input.error("Unexpected }",{offset:t[2]},{offset:t[2]+1})}unknownWord(t){throw this.input.error("Unknown word",{offset:t[0][2]},{offset:t[0][2]+t[0][1].length})}unnamedAtrule(t,r){throw this.input.error("At-rule without name",{offset:r[2]},{offset:r[2]+r[1].length})}},S6=w6,v6=Jr,x6=S6,k6=xa;function ca(e,t){let r=new k6(e,t),n=new x6(r);try{n.parse()}catch(o){throw process.env.NODE_ENV!=="production"&&o.name==="CssSyntaxError"&&t&&t.from&&(/\.scss$/i.test(t.from)?o.message+=`
169
- You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser`:/\.sass/i.test(t.from)?o.message+=`
170
- You tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser`:/\.less$/i.test(t.from)&&(o.message+=`
171
- You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),o}return n.root}var ip=ca;ca.default=ca;v6.registerParse(ca);var{isClean:jt,my:R6}=Ko,C6=Bw,E6=wa,P6=Jr,I6=tp,A6=Zw,Cb=rp,T6=ip,O6=Jo,M6={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},L6={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},N6={Once:!0,postcssPlugin:!0,prepare:!0},An=0;function Oo(e){return typeof e=="object"&&typeof e.then=="function"}function sS(e){let t=!1,r=M6[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,An,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,An,r+"Exit"]:[r,r+"Exit"]}function Eb(e){let t;return e.type==="document"?t=["Document",An,"DocumentExit"]:e.type==="root"?t=["Root",An,"RootExit"]:t=sS(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Rd(e){return e[jt]=!1,e.nodes&&e.nodes.forEach(t=>Rd(t)),e}var Cd={},Tn=class aS{constructor(t,r,n){this.stringified=!1,this.processed=!1;let o;if(typeof r=="object"&&r!==null&&(r.type==="root"||r.type==="document"))o=Rd(r);else if(r instanceof aS||r instanceof Cb)o=Rd(r.root),r.map&&(typeof n.map>"u"&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{let i=T6;n.syntax&&(i=n.syntax.parse),n.parser&&(i=n.parser),i.parse&&(i=i.parse);try{o=i(r,n)}catch(s){this.processed=!0,this.error=s}o&&!o[R6]&&P6.rebuild(o)}this.result=new Cb(t,o,n),this.helpers={...Cd,postcss:Cd,result:this.result},this.plugins=this.processor.plugins.map(i=>typeof i=="object"&&i.prepare?{...i,...i.prepare(this.result)}:i)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(t,r){let n=this.result.lastPlugin;try{if(r&&r.addToError(t),this.error=t,t.name==="CssSyntaxError"&&!t.plugin)t.plugin=n.postcssPlugin,t.setMessage();else if(n.postcssVersion&&process.env.NODE_ENV!=="production"){let o=n.postcssPlugin,i=n.postcssVersion,s=this.result.processor.version,a=i.split("."),l=s.split(".");(a[0]!==l[0]||parseInt(a[1])>parseInt(l[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+s+", but "+o+" uses "+i+". Perhaps this is the source of the error below.")}}catch(o){console&&console.error&&console.error(o)}return t}prepareVisitors(){this.listeners={};let t=(r,n,o)=>{this.listeners[n]||(this.listeners[n]=[]),this.listeners[n].push([r,o])};for(let r of this.plugins)if(typeof r=="object")for(let n in r){if(!L6[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${r.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!N6[n])if(typeof r[n]=="object")for(let o in r[n])o==="*"?t(r,n,r[n][o]):t(r,n+"-"+o.toLowerCase(),r[n][o]);else typeof r[n]=="function"&&t(r,n,r[n])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let t=0;t<this.plugins.length;t++){let r=this.plugins[t],n=this.runOnRoot(r);if(Oo(n))try{await n}catch(o){throw this.handleError(o)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[jt];){t[jt]=!0;let r=[Eb(t)];for(;r.length>0;){let n=this.visitTick(r);if(Oo(n))try{await n}catch(o){let i=r[r.length-1].node;throw this.handleError(o,i)}}}if(this.listeners.OnceExit)for(let[r,n]of this.listeners.OnceExit){this.result.lastPlugin=r;try{if(t.type==="document"){let o=t.nodes.map(i=>n(i,this.helpers));await Promise.all(o)}else await n(t,this.helpers)}catch(o){throw this.handleError(o)}}}return this.processed=!0,this.stringify()}runOnRoot(t){this.result.lastPlugin=t;try{if(typeof t=="object"&&t.Once){if(this.result.root.type==="document"){let r=this.result.root.nodes.map(n=>t.Once(n,this.helpers));return Oo(r[0])?Promise.all(r):r}return t.Once(this.result.root,this.helpers)}else if(typeof t=="function")return t(this.result.root,this.result)}catch(r){throw this.handleError(r)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let t=this.result.opts,r=E6;t.syntax&&(r=t.syntax.stringify),t.stringifier&&(r=t.stringifier),r.stringify&&(r=r.stringify);let o=new C6(r,this.result.root,this.result.opts).generate();return this.result.css=o[0],this.result.map=o[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let t of this.plugins){let r=this.runOnRoot(t);if(Oo(r))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[jt];)t[jt]=!0,this.walkSync(t);if(this.listeners.OnceExit)if(t.type==="document")for(let r of t.nodes)this.visitSync(this.listeners.OnceExit,r);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(t,r){return process.env.NODE_ENV!=="production"&&("from"in this.opts||A6("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(t,r)}toString(){return this.css}visitSync(t,r){for(let[n,o]of t){this.result.lastPlugin=n;let i;try{i=o(r,this.helpers)}catch(s){throw this.handleError(s,r.proxyOf)}if(r.type!=="root"&&r.type!=="document"&&!r.parent)return!0;if(Oo(i))throw this.getAsyncError()}}visitTick(t){let r=t[t.length-1],{node:n,visitors:o}=r;if(n.type!=="root"&&n.type!=="document"&&!n.parent){t.pop();return}if(o.length>0&&r.visitorIndex<o.length){let[s,a]=o[r.visitorIndex];r.visitorIndex+=1,r.visitorIndex===o.length&&(r.visitors=[],r.visitorIndex=0),this.result.lastPlugin=s;try{return a(n.toProxy(),this.helpers)}catch(l){throw this.handleError(l,n)}}if(r.iterator!==0){let s=r.iterator,a;for(;a=n.nodes[n.indexes[s]];)if(n.indexes[s]+=1,!a[jt]){a[jt]=!0,t.push(Eb(a));return}r.iterator=0,delete n.indexes[s]}let i=r.events;for(;r.eventIndex<i.length;){let s=i[r.eventIndex];if(r.eventIndex+=1,s===An){n.nodes&&n.nodes.length&&(n[jt]=!0,r.iterator=n.getIterator());return}else if(this.listeners[s]){r.visitors=this.listeners[s];return}}t.pop()}walkSync(t){t[jt]=!0;let r=sS(t);for(let n of r)if(n===An)t.nodes&&t.each(o=>{o[jt]||this.walkSync(o)});else{let o=this.listeners[n];if(o&&this.visitSync(o,t.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};Tn.registerPostcss=e=>{Cd=e};var lS=Tn;Tn.default=Tn;O6.registerLazyResult(Tn);I6.registerLazyResult(Tn);var $6=Bw,D6=wa,_6=Zw,j6=ip,F6=rp,Ed=class{constructor(t,r,n){r=r.toString(),this.stringified=!1,this._processor=t,this._css=r,this._opts=n,this._map=void 0;let o,i=D6;this.result=new F6(this._processor,o,this._opts),this.result.css=r;let s=this;Object.defineProperty(this.result,"root",{get(){return s.root}});let a=new $6(i,o,this._opts,r);if(a.isMap()){let[l,c]=a.generate();l&&(this.result.css=l),c&&(this.result.map=c)}else a.clearAnnotation(),this.result.css=a.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}sync(){if(this.error)throw this.error;return this.result}then(t,r){return process.env.NODE_ENV!=="production"&&("from"in this._opts||_6("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(t,r)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let t,r=j6;try{t=r(this._css,this._opts)}catch(n){this.error=n}if(this.error)throw this.error;return this._root=t,t}get[Symbol.toStringTag](){return"NoWorkResult"}},B6=Ed;Ed.default=Ed;var V6=B6,U6=lS,W6=tp,H6=Jo,Wo=class{constructor(t=[]){this.version="8.4.38",this.plugins=this.normalize(t)}normalize(t){let r=[];for(let n of t)if(n.postcss===!0?n=n():n.postcss&&(n=n.postcss),typeof n=="object"&&Array.isArray(n.plugins))r=r.concat(n.plugins);else if(typeof n=="object"&&n.postcssPlugin)r.push(n);else if(typeof n=="function")r.push(n);else if(typeof n=="object"&&(n.parse||n.stringify)){if(process.env.NODE_ENV!=="production")throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}else throw new Error(n+" is not a PostCSS plugin");return r}process(t,r={}){return!this.plugins.length&&!r.parser&&!r.stringifier&&!r.syntax?new V6(this,t,r):new U6(this,t,r)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}},z6=Wo;Wo.default=Wo;H6.registerProcessor(Wo);W6.registerProcessor(Wo);var G6=va,q6=$w,K6=ka,J6=np,Y6=xa,X6=Jo,Z6=op;function Ho(e,t){if(Array.isArray(e))return e.map(o=>Ho(o));let{inputs:r,...n}=e;if(r){t=[];for(let o of r){let i={...o,__proto__:Y6.prototype};i.map&&(i.map={...i.map,__proto__:q6.prototype}),t.push(i)}}if(n.nodes&&(n.nodes=e.nodes.map(o=>Ho(o,t))),n.source){let{inputId:o,...i}=n.source;n.source=i,o!=null&&(n.source.input=t[o])}if(n.type==="root")return new X6(n);if(n.type==="decl")return new G6(n);if(n.type==="rule")return new Z6(n);if(n.type==="comment")return new K6(n);if(n.type==="atrule")return new J6(n);throw new Error("Unknown node type: "+e.type)}var Q6=Ho;Ho.default=Ho;var e4=Zd,cS=va,t4=lS,r4=Jr,sp=z6,n4=wa,o4=Q6,uS=tp,i4=Qw,dS=ka,pS=np,s4=rp,a4=xa,l4=ip,c4=oS,fS=op,hS=Jo,u4=Sa;function se(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new sp(e)}se.plugin=function(t,r){let n=!1;function o(...s){console&&console.warn&&!n&&(n=!0,console.warn(t+`: postcss.plugin was deprecated. Migration guide:
172
- 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:
173
- https://www.w3ctech.com/topic/2226`));let a=r(...s);return a.postcssPlugin=t,a.postcssVersion=new sp().version,a}let i;return Object.defineProperty(o,"postcss",{get(){return i||(i=o()),i}}),o.process=function(s,a,l){return se([o(l)]).process(s,a)},o};se.stringify=n4;se.parse=l4;se.fromJSON=o4;se.list=c4;se.comment=e=>new dS(e);se.atRule=e=>new pS(e);se.decl=e=>new cS(e);se.rule=e=>new fS(e);se.root=e=>new hS(e);se.document=e=>new uS(e);se.CssSyntaxError=e4;se.Declaration=cS;se.Container=r4;se.Processor=sp;se.Document=uS;se.Comment=dS;se.Warning=i4;se.AtRule=pS;se.Result=s4;se.Input=a4;se.Rule=fS;se.Root=hS;se.Node=u4;t4.registerPostcss(se);var d4=se;se.default=se;var Re=v$(d4);Re.stringify;Re.fromJSON;Re.plugin;Re.parse;Re.list;Re.document;Re.comment;Re.atRule;Re.rule;Re.decl;Re.root;Re.CssSyntaxError;Re.Declaration;Re.Container;Re.Processor;Re.Document;Re.Comment;Re.Warning;Re.AtRule;Re.Result;Re.Input;Re.Rule;Re.Root;Re.Node;var Pd=class e{constructor(...t){mt(this,"parentElement",null),mt(this,"parentNode",null),mt(this,"ownerDocument"),mt(this,"firstChild",null),mt(this,"lastChild",null),mt(this,"previousSibling",null),mt(this,"nextSibling",null),mt(this,"ELEMENT_NODE",1),mt(this,"TEXT_NODE",3),mt(this,"nodeType"),mt(this,"nodeName"),mt(this,"RRNodeType")}get childNodes(){let t=[],r=this.firstChild;for(;r;)t.push(r),r=r.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,r){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 Pb={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Ib={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Us={},p4=()=>!!globalThis.Zone;function ap(e){if(Us[e])return Us[e];let t=globalThis[e],r=t.prototype,n=e in Pb?Pb[e]:void 0,o=!!(n&&n.every(a=>{var l,c;return!!((c=(l=Object.getOwnPropertyDescriptor(r,a))==null?void 0:l.get)!=null&&c.toString().includes("[native code]"))})),i=e in Ib?Ib[e]:void 0,s=!!(i&&i.every(a=>{var l;return typeof r[a]=="function"&&((l=r[a])==null?void 0:l.toString().includes("[native code]"))}));if(o&&s&&!p4())return Us[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 c=l[e].prototype;return document.body.removeChild(a),c?Us[e]=c:r}catch{return r}}var Gu={};function nr(e,t,r){var n;let o=`${e}.${String(r)}`;if(Gu[o])return Gu[o].call(t);let i=ap(e),s=(n=Object.getOwnPropertyDescriptor(i,r))==null?void 0:n.get;return s?(Gu[o]=s,s.call(t)):t[r]}var qu={};function mS(e,t,r){let n=`${e}.${String(r)}`;if(qu[n])return qu[n].bind(t);let i=ap(e)[r];return typeof i!="function"?t[r]:(qu[n]=i,i.bind(t))}function f4(e){return nr("Node",e,"ownerDocument")}function h4(e){return nr("Node",e,"childNodes")}function m4(e){return nr("Node",e,"parentNode")}function g4(e){return nr("Node",e,"parentElement")}function y4(e){return nr("Node",e,"textContent")}function b4(e,t){return mS("Node",e,"contains")(t)}function w4(e){return mS("Node",e,"getRootNode")()}function S4(e){return!e||!("host"in e)?null:nr("ShadowRoot",e,"host")}function v4(e){return e.styleSheets}function x4(e){return!e||!("shadowRoot"in e)?null:nr("Element",e,"shadowRoot")}function k4(e,t){return nr("Element",e,"querySelector")(t)}function R4(e,t){return nr("Element",e,"querySelectorAll")(t)}function gS(){return ap("MutationObserver").constructor}function Yr(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],o=r(n);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=o,()=>{e[t]=n}}catch{return()=>{}}}var G={ownerDocument:f4,childNodes:h4,parentNode:m4,parentElement:g4,textContent:y4,contains:b4,getRootNode:w4,host:S4,styleSheets:v4,shadowRoot:x4,querySelector:k4,querySelectorAll:R4,mutationObserver:gS,patch:Yr};function Ye(e,t,r=document){let n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var Sn=`Please stop import mirror directly. Instead of that,\r
174
- now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
175
- or you can use record.mirror to access the mirror instance during recording.`,Ab={map:{},getId(){return console.error(Sn),-1},getNode(){return console.error(Sn),null},removeNodeFromMap(){console.error(Sn)},has(){return console.error(Sn),!1},reset(){console.error(Sn)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Ab=new Proxy(Ab,{get(e,t,r){return t==="map"&&console.error(Sn),Reflect.get(e,t,r)}}));function zo(e,t,r={}){let n=null,o=0;return function(...i){let s=Date.now();!o&&r.leading===!1&&(o=s);let a=t-(s-o),l=this;a<=0||a>t?(n&&(clearTimeout(n),n=null),o=s,e.apply(l,i)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{o=r.leading===!1?0:Date.now(),n=null,e.apply(l,i)},a))}}function Ra(e,t,r,n,o=window){let i=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,n?r:{set(s){setTimeout(()=>{r.set.call(this,s)},0),i&&i.set&&i.set.call(this,s)}}),()=>Ra(e,t,i||{},!0)}var ua=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(ua=()=>new Date().getTime());function yS(e){var t,r,n,o;let i=e.document;return{left:i.scrollingElement?i.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:i.documentElement.scrollLeft||i?.body&&((t=G.parentElement(i.body))==null?void 0:t.scrollLeft)||((r=i?.body)==null?void 0:r.scrollLeft)||0,top:i.scrollingElement?i.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:i?.documentElement.scrollTop||i?.body&&((n=G.parentElement(i.body))==null?void 0:n.scrollTop)||((o=i?.body)==null?void 0:o.scrollTop)||0}}function bS(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function wS(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function SS(e){return e?e.nodeType===e.ELEMENT_NODE?e:G.parentElement(e):null}function Xe(e,t,r,n){if(!e)return!1;let o=SS(e);if(!o)return!1;try{if(typeof t=="string"){if(o.classList.contains(t)||n&&o.closest("."+t)!==null)return!0}else if(ta(o,t,n))return!0}catch{}return!!(r&&(o.matches(r)||n&&o.closest(r)!==null))}function C4(e,t){return t.getId(e)!==-1}function Ku(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===Do}function vS(e,t){if(Lo(e))return!1;let r=t.getId(e);if(!t.has(r))return!0;let n=G.parentNode(e);return n&&n.nodeType===e.DOCUMENT_NODE?!1:n?vS(n,t):!0}function Id(e){return!!e.changedTouches}function E4(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 xS(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function kS(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Ad(e){return e?e instanceof Pd&&"shadowRoot"in e?!!e.shadowRoot:!!G.shadowRoot(e):!1}var Td=class{constructor(){k(this,"id",1),k(this,"styleIDMap",new WeakMap),k(this,"idStyleMap",new Map)}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}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 RS(e){var t;let r=null;return"getRootNode"in e&&((t=G.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&G.host(G.getRootNode(e))&&(r=G.host(G.getRootNode(e))),r}function P4(e){let t=e,r;for(;r=RS(t);)t=r;return t}function I4(e){let t=G.ownerDocument(e);if(!t)return!1;let r=P4(e);return G.contains(t,r)}function CS(e){let t=G.ownerDocument(e);return t?G.contains(t,e)||I4(e):!1}var J=(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))(J||{}),q=(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))(q||{}),nt=(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))(nt||{}),Qt=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Qt||{}),On=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(On||{}),vn=(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))(vn||{});var ES=(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))(ES||{});function Tb(e){return"__ln"in e}var Od=class{constructor(){k(this,"length",0),k(this,"head",null),k(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let n=0;n<t;n++)r=r?.next||null;return r}addNode(t){let r={value:t,previous:null,next:null};if(t.__ln=r,t.previousSibling&&Tb(t.previousSibling)){let n=t.previousSibling.__ln.next;r.next=n,r.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=r,n&&(n.previous=r)}else if(t.nextSibling&&Tb(t.nextSibling)&&t.nextSibling.__ln.previous){let n=t.nextSibling.__ln.previous;r.previous=n,r.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=r,n&&(n.next=r)}else this.head&&(this.head.previous=r),r.next=this.head,this.head=r;r.next===null&&(this.tail=r),this.length++}removeNode(t){let r=t.__ln;this.head&&(r.previous?(r.previous.next=r.next,r.next?r.next.previous=r.previous:this.tail=r.previous):(this.head=r.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}},Ob=(e,t)=>`${e}@${t}`,Md=class{constructor(){k(this,"frozen",!1),k(this,"locked",!1),k(this,"texts",[]),k(this,"attributes",[]),k(this,"attributeMap",new WeakMap),k(this,"removes",[]),k(this,"mapRemoves",[]),k(this,"movedMap",{}),k(this,"addedSet",new Set),k(this,"movedSet",new Set),k(this,"droppedSet",new Set),k(this,"removesSubTreeCache",new Set),k(this,"mutationCb"),k(this,"blockClass"),k(this,"blockSelector"),k(this,"maskTextClass"),k(this,"maskTextSelector"),k(this,"inlineStylesheet"),k(this,"maskInputOptions"),k(this,"maskTextFn"),k(this,"maskInputFn"),k(this,"keepIframeSrcFn"),k(this,"recordCanvas"),k(this,"inlineImages"),k(this,"slimDOMOptions"),k(this,"dataURLOptions"),k(this,"doc"),k(this,"mirror"),k(this,"iframeManager"),k(this,"stylesheetManager"),k(this,"shadowDomManager"),k(this,"canvasManager"),k(this,"processedNodeManager"),k(this,"unattachedDoc"),k(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),k(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],r=new Set,n=new Od,o=l=>{let c=l,u=Do;for(;u===Do;)c=c&&c.nextSibling,u=c&&this.mirror.getId(c);return u},i=l=>{let c=G.parentNode(l);if(!c||!CS(l))return;let u=!1;if(l.nodeType===Node.TEXT_NODE){let f=c.tagName;if(f==="TEXTAREA")return;f==="STYLE"&&this.addedSet.has(c)&&(u=!0)}let d=Lo(c)?this.mirror.getId(RS(l)):this.mirror.getId(c),p=o(l);if(d===-1||p===-1)return n.addNode(l);let h=kn(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:f=>{xS(f,this.mirror)&&this.iframeManager.addIframe(f),kS(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),Ad(l)&&this.shadowDomManager.addShadowRoot(G.shadowRoot(l),this.doc)},onIframeLoad:(f,m)=>{this.iframeManager.attachIframe(f,m),this.shadowDomManager.observeAttachShadow(f)},onStylesheetLoad:(f,m)=>{this.stylesheetManager.attachLinkElement(f,m)},cssCaptured:u});h&&(t.push({parentId:d,nextId:p,node:h}),r.add(h.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let l of this.movedSet)Mb(this.removesSubTreeCache,l,this.mirror)&&!this.movedSet.has(G.parentNode(l))||i(l);for(let l of this.addedSet)!Lb(this.droppedSet,l)&&!Mb(this.removesSubTreeCache,l,this.mirror)||Lb(this.movedSet,l)?i(l):this.droppedSet.add(l);let s=null;for(;n.length;){let l=null;if(s){let c=this.mirror.getId(G.parentNode(s.value)),u=o(s.value);c!==-1&&u!==-1&&(l=s)}if(!l){let c=n.tail;for(;c;){let u=c;if(c=c.previous,u){let d=this.mirror.getId(G.parentNode(u.value));if(o(u.value)===-1)continue;if(d!==-1){l=u;break}else{let h=u.value,f=G.parentNode(h);if(f&&f.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let m=G.host(f);if(this.mirror.getId(m)!==-1){l=u;break}}}}}}if(!l){for(;n.head;)n.removeNode(n.head.value);break}s=l.previous,n.removeNode(l.value),i(l.value)}let a={texts:this.texts.map(l=>{let c=l.node,u=G.parentNode(c);return u&&u.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(u),{id:this.mirror.getId(c),value:l.value}}).filter(l=>!r.has(l.id)).filter(l=>this.mirror.has(l.id)),attributes:this.attributes.map(l=>{let{attributes:c}=l;if(typeof c.style=="string"){let u=JSON.stringify(l.styleDiff),d=JSON.stringify(l._unchangedStyles);u.length<c.style.length&&(u+d).split("var(").length===c.style.split("var(").length&&(c.style=l.styleDiff)}return{id:this.mirror.getId(l.node),attributes:c}}).filter(l=>!r.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))}),k(this,"genTextAreaValueMutation",t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r));let n=Array.from(G.childNodes(t),o=>G.textContent(o)||"").join("");r.attributes.value=Zs({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:Qs(t),value:n,maskInputFn:this.maskInputFn})}),k(this,"processMutation",t=>{if(!Ku(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let r=G.textContent(t.target);!Xe(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:qb(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,SS(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{let r=t.target,n=t.attributeName,o=t.target.getAttribute(n);if(n==="value"){let s=Qs(r);o=Zs({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:o,maskInputFn:this.maskInputFn})}if(Xe(t.target,this.blockClass,this.blockSelector,!1)||o===t.oldValue)return;let i=this.attributeMap.get(t.target);if(r.tagName==="IFRAME"&&n==="src"&&!this.keepIframeSrcFn(o))if(!r.contentDocument)n="rr_src";else return;if(i||(i={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(t.target,i)),n==="type"&&r.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!Gb(r.tagName,n))if(i.attributes[n]=zb(this.doc,qr(r.tagName),qr(n),o),n==="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(r.style)){let l=r.style.getPropertyValue(a),c=r.style.getPropertyPriority(a);l!==s.style.getPropertyValue(a)||c!==s.style.getPropertyPriority(a)?c===""?i.styleDiff[a]=l:i.styleDiff[a]=[l,c]:i._unchangedStyles[a]=[l,c]}for(let a of Array.from(s.style))r.style.getPropertyValue(a)===""&&(i.styleDiff[a]=!1)}else n==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?i.attributes.rr_open_mode="modal":i.attributes.rr_open_mode="non-modal");break}case"childList":{if(Xe(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{let n=this.mirror.getId(r),o=Lo(t.target)?this.mirror.getId(G.host(t.target)):this.mirror.getId(t.target);Xe(t.target,this.blockClass,this.blockSelector,!1)||Ku(r,this.mirror,this.slimDOMOptions)||!C4(r,this.mirror)||(this.addedSet.has(r)?(Ld(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||vS(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[Ob(n,o)]?Ld(this.movedSet,r):(this.removes.push({parentId:o,id:n,isShadow:Lo(t.target)&&No(t.target)?!0:void 0}),A4(r,this.removesSubTreeCache))),this.mapRemoves.push(r))});break}}}),k(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(Ku(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[Ob(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);Xe(t,this.blockClass,this.blockSelector,!1)||(G.childNodes(t).forEach(n=>this.genAdds(n)),Ad(t)&&G.childNodes(G.shadowRoot(t)).forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,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(r=>{this[r]=t[r]})}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 Ld(e,t){e.delete(t),G.childNodes(t).forEach(r=>Ld(e,r))}function A4(e,t){let r=[e];for(;r.length;){let n=r.pop();t.has(n)||(t.add(n),G.childNodes(n).forEach(o=>r.push(o)))}}function Mb(e,t,r){return e.size===0?!1:T4(e,t)}function T4(e,t,r){let n=G.parentNode(t);return n?e.has(n):!1}function Lb(e,t){return e.size===0?!1:PS(e,t)}function PS(e,t){let r=G.parentNode(t);return r?e.has(r)?!0:PS(e,r):!1}var $o;function O4(e){$o=e}function M4(){$o=void 0}var Z=e=>$o?(...r)=>{try{return e(...r)}catch(n){if($o&&$o(n)===!0)return;throw n}}:e,Gr=[];function Yo(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 IS(e,t){let r=new Md;Gr.push(r),r.init(e);let n=new(gS())(Z(r.processMutations.bind(r)));return n.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),n}function L4({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===!1)return()=>{};let o=typeof t.mousemove=="number"?t.mousemove:50,i=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,s=[],a,l=zo(Z(d=>{let p=Date.now()-a;e(s.map(h=>(h.timeOffset-=p,h)),d),s=[],a=null}),i),c=Z(zo(Z(d=>{let p=Yo(d),{clientX:h,clientY:f}=Id(d)?d.changedTouches[0]:d;a||(a=ua()),s.push({x:h,y:f,id:n.getId(p),timeOffset:ua()-a}),l(typeof DragEvent<"u"&&d instanceof DragEvent?q.Drag:d instanceof MouseEvent?q.MouseMove:q.TouchMove)}),o,{trailing:!1})),u=[Ye("mousemove",c,r),Ye("touchmove",c,r),Ye("drag",c,r)];return Z(()=>{u.forEach(d=>d())})}function N4({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,sampling:i}){if(i.mouseInteraction===!1)return()=>{};let s=i.mouseInteraction===!0||i.mouseInteraction===void 0?{}:i.mouseInteraction,a=[],l=null,c=u=>d=>{let p=Yo(d);if(Xe(p,n,o,!0))return;let h=null,f=u;if("pointerType"in d){switch(d.pointerType){case"mouse":h=Qt.Mouse;break;case"touch":h=Qt.Touch;break;case"pen":h=Qt.Pen;break}h===Qt.Touch?nt[u]===nt.MouseDown?f="TouchStart":nt[u]===nt.MouseUp&&(f="TouchEnd"):Qt.Pen}else Id(d)&&(h=Qt.Touch);h!==null?(l=h,(f.startsWith("Touch")&&h===Qt.Touch||f.startsWith("Mouse")&&h===Qt.Mouse)&&(h=null)):nt[u]===nt.Click&&(h=l,l=null);let m=Id(d)?d.changedTouches[0]:d;if(!m)return;let g=r.getId(p),{clientX:w,clientY:S}=m;Z(e)({type:nt[f],id:g,x:w,y:S,...h!==null&&{pointerType:h}})};return Object.keys(nt).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&s[u]!==!1).forEach(u=>{let d=qr(u),p=c(u);if(window.PointerEvent)switch(nt[u]){case nt.MouseDown:case nt.MouseUp:d=d.replace("mouse","pointer");break;case nt.TouchStart:case nt.TouchEnd:return}a.push(Ye(d,p,t))}),Z(()=>{a.forEach(u=>u())})}function AS({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,sampling:i}){let s=Z(zo(Z(a=>{let l=Yo(a);if(!l||Xe(l,n,o,!0))return;let c=r.getId(l);if(l===t&&t.defaultView){let u=yS(t.defaultView);e({id:c,x:u.left,y:u.top})}else e({id:c,x:l.scrollLeft,y:l.scrollTop})}),i.scroll||100));return Ye("scroll",s,t)}function $4({viewportResizeCb:e},{win:t}){let r=-1,n=-1,o=Z(zo(Z(()=>{let i=bS(),s=wS();(r!==i||n!==s)&&(e({width:Number(s),height:Number(i)}),r=i,n=s)}),200));return Ye("resize",o,t)}var D4=["INPUT","TEXTAREA","SELECT"],Nb=new WeakMap;function _4({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,ignoreClass:i,ignoreSelector:s,maskInputOptions:a,maskInputFn:l,sampling:c,userTriggeredOnInput:u}){function d(S){let y=Yo(S),v=S.isTrusted,C=y&&y.tagName;if(y&&C==="OPTION"&&(y=G.parentElement(y)),!y||!C||D4.indexOf(C)<0||Xe(y,n,o,!0)||y.classList.contains(i)||s&&y.matches(s))return;let M=y.value,I=!1,E=Qs(y)||"";E==="radio"||E==="checkbox"?I=y.checked:(a[C.toLowerCase()]||a[E])&&(M=Zs({element:y,maskInputOptions:a,tagName:C,type:E,value:M,maskInputFn:l})),p(y,u?{text:M,isChecked:I,userTriggered:v}:{text:M,isChecked:I});let x=y.name;E==="radio"&&x&&I&&t.querySelectorAll(`input[type="radio"][name="${x}"]`).forEach(B=>{if(B!==y){let ee=B.value;p(B,u?{text:ee,isChecked:!I,userTriggered:!1}:{text:ee,isChecked:!I})}})}function p(S,y){let v=Nb.get(S);if(!v||v.text!==y.text||v.isChecked!==y.isChecked){Nb.set(S,y);let C=r.getId(S);Z(e)({...y,id:C})}}let f=(c.input==="last"?["change"]:["input","change"]).map(S=>Ye(S,Z(d),t)),m=t.defaultView;if(!m)return()=>{f.forEach(S=>S())};let g=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),w=[[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 g&&g.set&&f.push(...w.map(S=>Ra(S[0],S[1],{set(){Z(d)({target:this,isTrusted:!1})}},!1,m))),Z(()=>{f.forEach(S=>S())})}function da(e){let t=[];function r(n,o){if(Ws("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||Ws("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||Ws("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||Ws("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let s=Array.from(n.parentRule.cssRules).indexOf(n);o.unshift(s)}else if(n.parentStyleSheet){let s=Array.from(n.parentStyleSheet.cssRules).indexOf(n);o.unshift(s)}return o}return r(e,t)}function Rr(e,t,r){let n,o;return e?(e.ownerNode?n=t.getId(e.ownerNode):o=r.getId(e),{styleId:o,id:n}):{}}function j4({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};let o=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:Z((u,d,p)=>{let[h,f]=p,{id:m,styleId:g}=Rr(d,t,r.styleMirror);return(m&&m!==-1||g&&g!==-1)&&e({id:m,styleId:g,adds:[{rule:h,index:f}]}),u.apply(d,p)})}),n.CSSStyleSheet.prototype.addRule=function(u,d,p=this.cssRules.length){let h=`${u} { ${d} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[h,p])};let i=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(i,{apply:Z((u,d,p)=>{let[h]=p,{id:f,styleId:m}=Rr(d,t,r.styleMirror);return(f&&f!==-1||m&&m!==-1)&&e({id:f,styleId:m,removes:[{index:h}]}),u.apply(d,p)})}),n.CSSStyleSheet.prototype.removeRule=function(u){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[u])};let s;n.CSSStyleSheet.prototype.replace&&(s=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:Z((u,d,p)=>{let[h]=p,{id:f,styleId:m}=Rr(d,t,r.styleMirror);return(f&&f!==-1||m&&m!==-1)&&e({id:f,styleId:m,replace:h}),u.apply(d,p)})}));let a;n.CSSStyleSheet.prototype.replaceSync&&(a=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:Z((u,d,p)=>{let[h]=p,{id:f,styleId:m}=Rr(d,t,r.styleMirror);return(f&&f!==-1||m&&m!==-1)&&e({id:f,styleId:m,replaceSync:h}),u.apply(d,p)})}));let l={};Hs("CSSGroupingRule")?l.CSSGroupingRule=n.CSSGroupingRule:(Hs("CSSMediaRule")&&(l.CSSMediaRule=n.CSSMediaRule),Hs("CSSConditionRule")&&(l.CSSConditionRule=n.CSSConditionRule),Hs("CSSSupportsRule")&&(l.CSSSupportsRule=n.CSSSupportsRule));let c={};return Object.entries(l).forEach(([u,d])=>{c[u]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=new Proxy(c[u].insertRule,{apply:Z((p,h,f)=>{let[m,g]=f,{id:w,styleId:S}=Rr(h.parentStyleSheet,t,r.styleMirror);return(w&&w!==-1||S&&S!==-1)&&e({id:w,styleId:S,adds:[{rule:m,index:[...da(h),g||0]}]}),p.apply(h,f)})}),d.prototype.deleteRule=new Proxy(c[u].deleteRule,{apply:Z((p,h,f)=>{let[m]=f,{id:g,styleId:w}=Rr(h.parentStyleSheet,t,r.styleMirror);return(g&&g!==-1||w&&w!==-1)&&e({id:g,styleId:w,removes:[{index:[...da(h),m]}]}),p.apply(h,f)})})}),Z(()=>{n.CSSStyleSheet.prototype.insertRule=o,n.CSSStyleSheet.prototype.deleteRule=i,s&&(n.CSSStyleSheet.prototype.replace=s),a&&(n.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([u,d])=>{d.prototype.insertRule=c[u].insertRule,d.prototype.deleteRule=c[u].deleteRule})})}function TS({mirror:e,stylesheetManager:t},r){var n,o,i;let s=null;r.nodeName==="#document"?s=e.getId(r):s=e.getId(G.host(r));let a=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(i=(o=r.ownerDocument)==null?void 0:o.defaultView)==null?void 0:i.ShadowRoot,l=a?.prototype?Object.getOwnPropertyDescriptor(a?.prototype,"adoptedStyleSheets"):void 0;return s===null||s===-1||!a||!l?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var c;return(c=l.get)==null?void 0:c.call(this)},set(c){var u;let d=(u=l.set)==null?void 0:u.call(this,c);if(s!==null&&s!==-1)try{t.adoptStyleSheets(c,s)}catch{}return d}}),Z(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))}function F4({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:o}){let i=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(i,{apply:Z((a,l,c)=>{var u;let[d,p,h]=c;if(r.has(d))return i.apply(l,[d,p,h]);let{id:f,styleId:m}=Rr((u=l.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return(f&&f!==-1||m&&m!==-1)&&e({id:f,styleId:m,set:{property:d,value:p,priority:h},index:da(l.parentRule)}),a.apply(l,c)})});let s=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:Z((a,l,c)=>{var u;let[d]=c;if(r.has(d))return s.apply(l,[d]);let{id:p,styleId:h}=Rr((u=l.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return(p&&p!==-1||h&&h!==-1)&&e({id:p,styleId:h,remove:{property:d},index:da(l.parentRule)}),a.apply(l,c)})}),Z(()=>{o.CSSStyleDeclaration.prototype.setProperty=i,o.CSSStyleDeclaration.prototype.removeProperty=s})}function B4({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:o,doc:i}){let s=Z(l=>zo(Z(c=>{let u=Yo(c);if(!u||Xe(u,t,r,!0))return;let{currentTime:d,volume:p,muted:h,playbackRate:f,loop:m}=u;e({type:l,id:n.getId(u),currentTime:d,volume:p,muted:h,playbackRate:f,loop:m})}),o.media||500)),a=[Ye("play",s(vn.Play),i),Ye("pause",s(vn.Pause),i),Ye("seeked",s(vn.Seeked),i),Ye("volumechange",s(vn.VolumeChange),i),Ye("ratechange",s(vn.RateChange),i)];return Z(()=>{a.forEach(l=>l())})}function V4({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return()=>{};let n=[],o=new WeakMap,i=r.FontFace;r.FontFace=function(l,c,u){let d=new i(l,c,u);return o.set(d,{family:l,buffer:typeof c!="string",descriptors:u,fontSource:typeof c=="string"?c:JSON.stringify(Array.from(new Uint8Array(c)))}),d};let s=Yr(t.fonts,"add",function(a){return function(l){return setTimeout(Z(()=>{let c=o.get(l);c&&(e(c),o.delete(l))}),0),a.apply(this,[l])}});return n.push(()=>{r.FontFace=i}),n.push(s),Z(()=>{n.forEach(a=>a())})}function U4(e){let{doc:t,mirror:r,blockClass:n,blockSelector:o,selectionCb:i}=e,s=!0,a=Z(()=>{let l=t.getSelection();if(!l||s&&l?.isCollapsed)return;s=l.isCollapsed||!1;let c=[],u=l.rangeCount||0;for(let d=0;d<u;d++){let p=l.getRangeAt(d),{startContainer:h,startOffset:f,endContainer:m,endOffset:g}=p;Xe(h,n,o,!0)||Xe(m,n,o,!0)||c.push({start:r.getId(h),startOffset:f,end:r.getId(m),endOffset:g})}i({ranges:c})});return a(),Ye("selectionchange",a)}function W4({doc:e,customElementCb:t}){let r=e.defaultView;return!r||!r.customElements?()=>{}:Yr(r.customElements,"define",function(o){return function(i,s,a){try{t({define:{name:i}})}catch{console.warn(`Custom element callback failed for ${i}`)}return o.apply(this,[i,s,a])}})}function H4(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:o,scrollCb:i,viewportResizeCb:s,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:u,canvasMutationCb:d,fontCb:p,selectionCb:h,customElementCb:f}=e;e.mutationCb=(...m)=>{t.mutation&&t.mutation(...m),r(...m)},e.mousemoveCb=(...m)=>{t.mousemove&&t.mousemove(...m),n(...m)},e.mouseInteractionCb=(...m)=>{t.mouseInteraction&&t.mouseInteraction(...m),o(...m)},e.scrollCb=(...m)=>{t.scroll&&t.scroll(...m),i(...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),c(...m)},e.styleDeclarationCb=(...m)=>{t.styleDeclaration&&t.styleDeclaration(...m),u(...m)},e.canvasMutationCb=(...m)=>{t.canvasMutation&&t.canvasMutation(...m),d(...m)},e.fontCb=(...m)=>{t.font&&t.font(...m),p(...m)},e.selectionCb=(...m)=>{t.selection&&t.selection(...m),h(...m)},e.customElementCb=(...m)=>{t.customElement&&t.customElement(...m),f(...m)}}function z4(e,t={}){let r=e.doc.defaultView;if(!r)return()=>{};H4(e,t);let n;e.recordDOM&&(n=IS(e,e.doc));let o=L4(e),i=N4(e),s=AS(e),a=$4(e,{win:r}),l=_4(e),c=B4(e),u=()=>{},d=()=>{},p=()=>{},h=()=>{};e.recordDOM&&(u=j4(e,{win:r}),d=TS(e,e.doc),p=F4(e,{win:r}),e.collectFonts&&(h=V4(e)));let f=U4(e),m=W4(e),g=[];for(let w of e.plugins)g.push(w.observer(w.callback,r,w.options));return Z(()=>{Gr.forEach(w=>w.reset()),n?.disconnect(),o(),i(),s(),a(),l(),c(),u(),d(),p(),h(),f(),m(),g.forEach(w=>w())})}function Ws(e){return typeof window[e]<"u"}function Hs(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var pa=class{constructor(t){k(this,"iframeIdToRemoteIdMap",new WeakMap),k(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,r,n,o){let i=n||this.getIdToRemoteIdMap(t),s=o||this.getRemoteIdToIdMap(t),a=i.get(r);return a||(a=this.generateIdFn(),i.set(r,a),s.set(a,r)),a}getIds(t,r){let n=this.getIdToRemoteIdMap(t),o=this.getRemoteIdToIdMap(t);return r.map(i=>this.getId(t,i,n,o))}getRemoteId(t,r,n){let o=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;let i=o.get(r);return i||-1}getRemoteIds(t,r){let n=this.getRemoteIdToIdMap(t);return r.map(o=>this.getRemoteId(t,o,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}},Nd=class{constructor(t){k(this,"iframes",new WeakMap),k(this,"crossOriginIframeMap",new WeakMap),k(this,"crossOriginIframeMirror",new pa(Hb)),k(this,"crossOriginIframeStyleMirror"),k(this,"crossOriginIframeRootIdMap",new WeakMap),k(this,"mirror"),k(this,"mutationCb"),k(this,"wrappedEmit"),k(this,"loadListener"),k(this,"stylesheetManager"),k(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new pa(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,r){var n,o;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((n=t.contentWindow)==null||n.addEventListener("message",this.handleMessage.bind(this))),(o=this.loadListener)==null||o.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 r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;let o=this.crossOriginIframeMap.get(t.source);if(!o)return;let i=this.transformCrossOriginEvent(o,r.data.event);i&&this.wrappedEmit(i,r.data.isCheckout)}transformCrossOriginEvent(t,r){var n;switch(r.type){case J.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);let o=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,o),this.patchRootIdOnNode(r.data.node,o),{timestamp:r.timestamp,type:J.IncrementalSnapshot,data:{source:q.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case J.Meta:case J.Load:case J.DomContentLoaded:return!1;case J.Plugin:return r;case J.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case J.IncrementalSnapshot:switch(r.data.source){case q.Mutation:return r.data.adds.forEach(o=>{this.replaceIds(o,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(o.node,t);let i=this.crossOriginIframeRootIdMap.get(t);i&&this.patchRootIdOnNode(o.node,i)}),r.data.removes.forEach(o=>{this.replaceIds(o,t,["parentId","id"])}),r.data.attributes.forEach(o=>{this.replaceIds(o,t,["id"])}),r.data.texts.forEach(o=>{this.replaceIds(o,t,["id"])}),r;case q.Drag:case q.TouchMove:case q.MouseMove:return r.data.positions.forEach(o=>{this.replaceIds(o,t,["id"])}),r;case q.ViewportResize:return!1;case q.MediaInteraction:case q.MouseInteraction:case q.Scroll:case q.CanvasMutation:case q.Input:return this.replaceIds(r.data,t,["id"]),r;case q.StyleSheetRule:case q.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case q.Font:return r;case q.Selection:return r.data.ranges.forEach(o=>{this.replaceIds(o,t,["start","end"])}),r;case q.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)==null||n.forEach(o=>{this.replaceStyleIds(o,t,["styleId"])}),r}}return!1}replace(t,r,n,o){for(let i of o)!Array.isArray(r[i])&&typeof r[i]!="number"||(Array.isArray(r[i])?r[i]=t.getIds(n,r[i]):r[i]=t.getId(n,r[i]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}patchRootIdOnNode(t,r){t.type!==ES.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}},$d=class{constructor(t){k(this,"shadowDoms",new WeakSet),k(this,"mutationCb"),k(this,"scrollCb"),k(this,"bypassOptions"),k(this,"mirror"),k(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,r){if(!No(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);let n=IS({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(AS({...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(G.host(t))),this.restoreHandlers.push(TS({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,r){let n=this;this.restoreHandlers.push(Yr(t.prototype,"attachShadow",function(o){return function(i){let s=o.call(this,i),a=G.shadowRoot(this);return a&&CS(this)&&n.addShadowRoot(a,r),s}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},Rn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",G4=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(Mo=0;Mo<Rn.length;Mo++)G4[Rn.charCodeAt(Mo)]=Mo;var Mo,q4=function(e){var t=new Uint8Array(e),r,n=t.length,o="";for(r=0;r<n;r+=3)o+=Rn[t[r]>>2],o+=Rn[(t[r]&3)<<4|t[r+1]>>4],o+=Rn[(t[r+1]&15)<<2|t[r+2]>>6],o+=Rn[t[r+2]&63];return n%3===2?o=o.substring(0,o.length-1)+"=":n%3===1&&(o=o.substring(0,o.length-2)+"=="),o};var $b=new Map;function K4(e,t){let r=$b.get(e);return r||(r=new Map,$b.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}var OS=(e,t,r)=>{if(!e||!(LS(e,t)||typeof e=="object"))return;let n=e.constructor.name,o=K4(r,n),i=o.indexOf(e);return i===-1&&(i=o.length,o.push(e)),i};function Js(e,t,r){if(e instanceof Array)return e.map(n=>Js(n,t,r));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 n=e.constructor.name,o=q4(e);return{rr_type:n,base64:o}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Js(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:o}=e;return{rr_type:n,src:o}}else if(e instanceof HTMLCanvasElement){let n="HTMLImageElement",o=e.toDataURL();return{rr_type:n,src:o}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[Js(e.data,t,r),e.width,e.height]};if(LS(e,t)||typeof e=="object"){let n=e.constructor.name,o=OS(e,t,r);return{rr_type:n,index:o}}}}return e}var MS=(e,t,r)=>e.map(n=>Js(n,t,r)),LS=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(o=>typeof t[o]=="function").find(o=>e instanceof t[o]);function J4(e,t,r,n){let o=[],i=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let s of i)try{if(typeof t.CanvasRenderingContext2D.prototype[s]!="function")continue;let a=Yr(t.CanvasRenderingContext2D.prototype,s,function(l){return function(...c){return Xe(this.canvas,r,n,!0)||setTimeout(()=>{let u=MS(c,t,this);e(this.canvas,{type:On["2D"],property:s,args:u})},0),l.apply(this,c)}});o.push(a)}catch{let a=Ra(t.CanvasRenderingContext2D.prototype,s,{set(l){e(this.canvas,{type:On["2D"],property:s,args:[l],setter:!0})}});o.push(a)}return()=>{o.forEach(s=>s())}}function Y4(e){return e==="experimental-webgl"?"webgl":e}function Db(e,t,r,n){let o=[];try{let i=Yr(e.HTMLCanvasElement.prototype,"getContext",function(s){return function(a,...l){if(!Xe(this,t,r,!0)){let c=Y4(a);if("__context"in this||(this.__context=c),n&&["webgl","webgl2"].includes(c))if(l[0]&&typeof l[0]=="object"){let u=l[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else l.splice(0,1,{preserveDrawingBuffer:!0})}return s.apply(this,[a,...l])}});o.push(i)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach(i=>i())}}function _b(e,t,r,n,o,i){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 c=Yr(e,l,function(u){return function(...d){let p=u.apply(this,d);if(OS(p,i,this),"tagName"in this.canvas&&!Xe(this.canvas,n,o,!0)){let h=MS(d,i,this),f={type:t,property:l,args:h};r(this.canvas,f)}return p}});s.push(c)}catch{let c=Ra(e,l,{set(u){r(this.canvas,{type:t,property:l,args:[u],setter:!0})}});s.push(c)}return s}function X4(e,t,r,n){let o=[];return o.push(..._b(t.WebGLRenderingContext.prototype,On.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext<"u"&&o.push(..._b(t.WebGL2RenderingContext.prototype,On.WebGL2,e,r,n,t)),()=>{o.forEach(i=>i())}}var NS="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",Z4=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),jb=typeof window<"u"&&window.Blob&&new Blob([Z4(NS)],{type:"text/javascript;charset=utf-8"});function Q4(e){let t;try{if(t=jb&&(window.URL||window.webkitURL).createObjectURL(jb),!t)throw"";let r=new Worker(t,{name:e?.name});return r.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),r}catch{return new Worker("data:text/javascript;base64,"+NS,{name:e?.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var Dd=class{constructor(t){k(this,"pendingCanvasMutations",new Map),k(this,"rafStamps",{latestId:0,invokeId:null}),k(this,"mirror"),k(this,"mutationCb"),k(this,"resetObservers"),k(this,"frozen",!1),k(this,"locked",!1),k(this,"processMutation",(l,c)=>{(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(c)});let{sampling:r="all",win:n,blockClass:o,blockSelector:i,recordCanvas:s,dataURLOptions:a}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,s&&r==="all"&&this.initCanvasMutationObserver(n,o,i),s&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,o,i,{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,r,n,o,i){let s=Db(r,n,o,!0),a=new Map,l=new Q4;l.onmessage=f=>{let{id:m}=f.data;if(a.set(m,!1),!("base64"in f.data))return;let{base64:g,type:w,width:S,height:y}=f.data;this.mutationCb({id:m,type:On["2D"],commands:[{property:"clearRect",args:[0,0,S,y]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:g}],type:w}]},0,0]}]})};let c=1e3/t,u=0,d,p=()=>{let f=[];return r.document.querySelectorAll("canvas").forEach(m=>{Xe(m,n,o,!0)||f.push(m)}),f},h=f=>{if(u&&f-u<c){d=requestAnimationFrame(h);return}u=f,p().forEach(async m=>{var g;let w=this.mirror.getId(m);if(a.get(w)||m.width===0||m.height===0)return;if(a.set(w,!0),["webgl","webgl2"].includes(m.__context)){let y=m.getContext(m.__context);((g=y?.getContextAttributes())==null?void 0:g.preserveDrawingBuffer)===!1&&y.clear(y.COLOR_BUFFER_BIT)}let S=await createImageBitmap(m);l.postMessage({id:w,bitmap:S,width:m.width,height:m.height,dataURLOptions:i.dataURLOptions},[S])}),d=requestAnimationFrame(h)};d=requestAnimationFrame(h),this.resetObservers=()=>{s(),cancelAnimationFrame(d)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let o=Db(t,r,n,!1),i=J4(this.processMutation.bind(this),t,r,n),s=X4(this.processMutation.bind(this),t,r,n);this.resetObservers=()=>{o(),i(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;let o=n.map(s=>{let{type:a,...l}=s;return l}),{type:i}=n[0];this.mutationCb({id:r,type:i,commands:o}),this.pendingCanvasMutations.delete(t)}},_d=class{constructor(t){k(this,"trackedLinkElements",new WeakSet),k(this,"mutationCb"),k(this,"adoptedStyleSheetCb"),k(this,"styleMirror",new Td),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;let n={id:r,styleIds:[]},o=[];for(let i of t){let s;this.styleMirror.has(i)?s=this.styleMirror.getId(i):(s=this.styleMirror.add(i),o.push({styleId:s,rules:Array.from(i.rules||CSSRule,(a,l)=>({rule:Ub(a,i.href),index:l}))})),n.styleIds.push(s)}o.length>0&&(n.styles=o),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},jd=class{constructor(){k(this,"nodeMap",new WeakMap),k(this,"active",!1)}inOtherBuffer(t,r){let n=this.nodeMap.get(t);return n&&Array.from(n).some(o=>o!==r)}add(t,r){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}destroy(){}},Te,Ys,Ju,fa=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((By=e.contentWindow)==null?void 0:By.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var kt=r2();function Xr(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:o="rr-block",blockSelector:i=null,ignoreClass:s="rr-ignore",ignoreSelector:a=null,maskTextClass:l="rr-mask",maskTextSelector:c=null,inlineStylesheet:u=!0,maskAllInputs:d,maskInputOptions:p,slimDOMOptions:h,maskInputFn:f,maskTextFn:m,hooks:g,packFn:w,sampling:S={},dataURLOptions:y={},mousemoveWait:v,recordDOM:C=!0,recordCanvas:M=!1,recordCrossOriginIframes:I=!1,recordAfter:E=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:x=!1,collectFonts:B=!1,inlineImages:ee=!1,plugins:te,keepIframeSrcFn:U=()=>!1,ignoreCSSAttributes:Ke=new Set([]),errorHandler:At}=e;O4(At);let Fe=I?window.parent===window:!0,pt=!1;if(!Fe)try{window.parent.document&&(pt=!1)}catch{pt=!0}if(Fe&&!t)throw new Error("emit function is required");if(!Fe&&!pt)return()=>{};v!==void 0&&S.mousemove===void 0&&(S.mousemove=v),kt.reset();let Dr=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}:p!==void 0?p:{password:!0},Tt=Kb(h);E4();let Sh,Wl=0,vh=re=>{for(let yt of te||[])yt.eventProcessor&&(re=yt.eventProcessor(re));return w&&!pt&&(re=w(re)),re};Te=(re,yt)=>{var Ie;let Ae=re;if(Ae.timestamp=ua(),(Ie=Gr[0])!=null&&Ie.isFrozen()&&Ae.type!==J.FullSnapshot&&!(Ae.type===J.IncrementalSnapshot&&Ae.data.source===q.Mutation)&&Gr.forEach(ot=>ot.unfreeze()),Fe)t?.(vh(Ae),yt);else if(pt){let ot={type:"rrweb",event:vh(Ae),origin:window.location.origin,isCheckout:yt};window.parent.postMessage(ot,"*")}if(Ae.type===J.FullSnapshot)Sh=Ae,Wl=0;else if(Ae.type===J.IncrementalSnapshot){if(Ae.data.source===q.Mutation&&Ae.data.isAttachIframe)return;Wl++;let ot=n&&Wl>=n,le=r&&Ae.timestamp-Sh.timestamp>r;(ot||le)&&Ys(!0)}};let Ii=re=>{Te({type:J.IncrementalSnapshot,data:{source:q.Mutation,...re}})},xh=re=>Te({type:J.IncrementalSnapshot,data:{source:q.Scroll,...re}}),kh=re=>Te({type:J.IncrementalSnapshot,data:{source:q.CanvasMutation,...re}}),LE=re=>Te({type:J.IncrementalSnapshot,data:{source:q.AdoptedStyleSheet,...re}}),_r=new _d({mutationCb:Ii,adoptedStyleSheetCb:LE}),jr=new Nd({mirror:kt,mutationCb:Ii,stylesheetManager:_r,recordCrossOriginIframes:I,wrappedEmit:Te});for(let re of te||[])re.getMirror&&re.getMirror({nodeMirror:kt,crossOriginIframeMirror:jr.crossOriginIframeMirror,crossOriginIframeStyleMirror:jr.crossOriginIframeStyleMirror});let Hl=new jd;Ju=new Dd({recordCanvas:M,mutationCb:kh,win:window,blockClass:o,blockSelector:i,mirror:kt,sampling:S.canvas,dataURLOptions:y});let Ai=new $d({mutationCb:Ii,scrollCb:xh,bypassOptions:{blockClass:o,blockSelector:i,maskTextClass:l,maskTextSelector:c,inlineStylesheet:u,maskInputOptions:Dr,dataURLOptions:y,maskTextFn:m,maskInputFn:f,recordCanvas:M,inlineImages:ee,sampling:S,slimDOMOptions:Tt,iframeManager:jr,stylesheetManager:_r,canvasManager:Ju,keepIframeSrcFn:U,processedNodeManager:Hl},mirror:kt});Ys=(re=!1)=>{if(!C)return;Te({type:J.Meta,data:{href:window.location.href,width:wS(),height:bS()}},re),_r.reset(),Ai.init(),Gr.forEach(Ie=>Ie.lock());let yt=E2(document,{mirror:kt,blockClass:o,blockSelector:i,maskTextClass:l,maskTextSelector:c,inlineStylesheet:u,maskAllInputs:Dr,maskTextFn:m,maskInputFn:f,slimDOM:Tt,dataURLOptions:y,recordCanvas:M,inlineImages:ee,onSerialize:Ie=>{xS(Ie,kt)&&jr.addIframe(Ie),kS(Ie,kt)&&_r.trackLinkElement(Ie),Ad(Ie)&&Ai.addShadowRoot(G.shadowRoot(Ie),document)},onIframeLoad:(Ie,Ae)=>{jr.attachIframe(Ie,Ae),Ai.observeAttachShadow(Ie)},onStylesheetLoad:(Ie,Ae)=>{_r.attachLinkElement(Ie,Ae)},keepIframeSrcFn:U});if(!yt)return console.warn("Failed to snapshot the document");Te({type:J.FullSnapshot,data:{node:yt,initialOffset:yS(window)}},re),Gr.forEach(Ie=>Ie.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&_r.adoptStyleSheets(document.adoptedStyleSheets,kt.getId(document))};try{let re=[],yt=Ae=>{var ot;return Z(z4)({mutationCb:Ii,mousemoveCb:(le,zl)=>Te({type:J.IncrementalSnapshot,data:{source:zl,positions:le}}),mouseInteractionCb:le=>Te({type:J.IncrementalSnapshot,data:{source:q.MouseInteraction,...le}}),scrollCb:xh,viewportResizeCb:le=>Te({type:J.IncrementalSnapshot,data:{source:q.ViewportResize,...le}}),inputCb:le=>Te({type:J.IncrementalSnapshot,data:{source:q.Input,...le}}),mediaInteractionCb:le=>Te({type:J.IncrementalSnapshot,data:{source:q.MediaInteraction,...le}}),styleSheetRuleCb:le=>Te({type:J.IncrementalSnapshot,data:{source:q.StyleSheetRule,...le}}),styleDeclarationCb:le=>Te({type:J.IncrementalSnapshot,data:{source:q.StyleDeclaration,...le}}),canvasMutationCb:kh,fontCb:le=>Te({type:J.IncrementalSnapshot,data:{source:q.Font,...le}}),selectionCb:le=>{Te({type:J.IncrementalSnapshot,data:{source:q.Selection,...le}})},customElementCb:le=>{Te({type:J.IncrementalSnapshot,data:{source:q.CustomElement,...le}})},blockClass:o,ignoreClass:s,ignoreSelector:a,maskTextClass:l,maskTextSelector:c,maskInputOptions:Dr,inlineStylesheet:u,sampling:S,recordDOM:C,recordCanvas:M,inlineImages:ee,userTriggeredOnInput:x,collectFonts:B,doc:Ae,maskInputFn:f,maskTextFn:m,keepIframeSrcFn:U,blockSelector:i,slimDOMOptions:Tt,dataURLOptions:y,mirror:kt,iframeManager:jr,stylesheetManager:_r,shadowDomManager:Ai,processedNodeManager:Hl,canvasManager:Ju,ignoreCSSAttributes:Ke,plugins:((ot=te?.filter(le=>le.observer))==null?void 0:ot.map(le=>({observer:le.observer,options:le.options,callback:zl=>Te({type:J.Plugin,data:{plugin:le.name,payload:zl}})})))||[]},g)};jr.addLoadListener(Ae=>{try{re.push(yt(Ae.contentDocument))}catch(ot){console.warn(ot)}});let Ie=()=>{Ys(),re.push(yt(document)),fa=!0};return["interactive","complete"].includes(document.readyState)?Ie():(re.push(Ye("DOMContentLoaded",()=>{Te({type:J.DomContentLoaded,data:{}}),E==="DOMContentLoaded"&&Ie()})),re.push(Ye("load",()=>{Te({type:J.Load,data:{}}),E==="load"&&Ie()},window))),()=>{re.forEach(Ae=>{try{Ae()}catch(ot){String(ot).toLowerCase().includes("cross-origin")||console.warn(ot)}}),Hl.destroy(),fa=!1,M4()}}catch(re){console.warn(re)}}Xr.addCustomEvent=(e,t)=>{if(!fa)throw new Error("please add custom event after start recording");Te({type:J.Custom,data:{tag:e,payload:t}})};Xr.freezePage=()=>{Gr.forEach(e=>e.freeze())};Xr.takeFullSnapshot=e=>{if(!fa)throw new Error("please take full snapshot after start recording");Ys(e)};Xr.mirror=kt;var Fb;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(Fb||(Fb={}));var rte=5*1e3;var{addCustomEvent:nte}=Xr,{freezePage:ote}=Xr,{takeFullSnapshot:ite}=Xr;var _S="__ripploEmitRrwebEvent";function jS(){return{eventTypes:$S(J),incrementalSources:$S(q)}}function $S(e){return Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="number").map(([t,r])=>[r,t]))}var tD=$u("@ripplo/rrweb-bundle/bundle","rrweb.js"),DS;function FS(){return DS??=eD(tD,{encoding:"utf8"}),DS}async function cp({debugDir:e,writeOtlpPortFile:t}){let r=new Map,n=$y(jS()),o=await Po({localDir:BS.join(BS.dirname(e),".local"),writePortFile:t,onRrwebBatch:(a,l)=>{r.get(a)?.emitRrwebBatch(l)},onSpan:a=>{let l=a.attributes["ripplo.run"];l!=null&&r.get(l)?.emit(a)}}),i=await FS();return{attach:async(a,l)=>{let c=Ny({debugDir:e,runId:l,worker:n});r.set(l,c),await _y(a,l),await a.addInitScript(`globalThis.__ripploCapturePort = ${String(o.port)};`),await nD(a,c);let u=[];return{emitAction:d=>{sD(c,d)},emitAssertion:d=>{aD(c,d)},finish:()=>oD(c,{pages:u,registry:r,runId:l}),onPage:d=>{u.push(d),iD(c,i,d)}}},close:async()=>{await o.stop(),await n.terminate()},injectSpan:(a,l)=>{r.get(a)?.emit(l)}}}async function rD(e){await Promise.all(e.map(t=>t.evaluate("globalThis.__ripploFlushRrweb ? globalThis.__ripploFlushRrweb() : undefined").catch(()=>{})))}async function nD(e,t){await e.exposeBinding(_S,(r,n)=>{let o=typeof n=="string"?n:JSON.stringify(n);t.emitRrwebBatch(Buffer.from(o,"utf8"))})}async function oD(e,t){await rD(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 iD(e,t,r){r.on("load",()=>{r.addScriptTag({content:t}).catch(()=>{})}),r.on("response",n=>{dD(e,n)}),r.on("console",n=>{e.emit({kind:"console",level:n.type(),source:"browser",text:n.text(),timeNanos:bn(Date.now())})}),r.on("pageerror",n=>{e.emit({kind:"error",message:n.message,source:"browser",stack:n.stack,timeNanos:bn(Date.now())})})}function sD(e,t){e.emit({action:t.kind,kind:"action",source:"test",target:lD(t),timeNanos:bn(Date.now()),value:cD(t)})}function aD(e,t){let r=Mu(t);e.emit({kind:"assertion",label:r.label,outcome:t.outcome,source:"test",step:r.step,timeNanos:bn(Date.now())})}function lD(e){if(e.url!=null)return e.url;if(e.locator!=null)return lp(e.locator)}function lp(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${lp(e.scope)} \u25B8 ${lp(e.target)}`:`${e.role} ${e.name??""}`.trim()}function cD(e){return e.value!=null?typeof e.value=="object"?JSON.stringify(e.value):String(e.value):e.key}var uD=/^http:\/\/127\.0\.0\.1:\d+\/rrweb\//;function dD(e,t){let r=t.request(),n=r.resourceType();if(n!=="fetch"&&n!=="xhr"||uD.test(r.url()))return;let o=r.headers().traceparent?.split("-");e.emit({kind:"network",method:r.method(),resourceType:n,source:"browser",spanId:o?.[2],status:t.status(),timeNanos:bn(Date.now()),traceId:o?.[1],url:t.url()})}import{err as r0,ok as Bf,ResultAsync as SB}from"neverthrow";function Xo(e){return{invariants:fu(e),laws:uu(e)}}var VS=Object.defineProperty,US=(e,t)=>{let r={};for(var n in e)VS(r,n,{get:e[n],enumerable:!0});return t||VS(r,Symbol.toStringTag,{value:"Module"}),r};var pD=class WS{constructor(t){this.seed=t}clone(){return new WS(this.seed)}next(){let t=up(this.seed),r=dp(t),n=up(t),o=dp(n);return this.seed=up(n),dp(this.seed)+(o+(r<<15)<<15)|0}jump(){this.seed=Math.imul(this.seed,1994129409)+916127744&4294967295}getState(){return[this.seed]}};function up(e){return Math.imul(e,214013)+2531011&4294967295}function dp(e){return(e&-2147483649)>>16}function HS(e){return new pD(e)}var fD="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",hD=class GS{constructor(t,r){this.states=t,this.index=r}clone(){return new GS(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=Ca(this.states,this.index),t}getState(){return[this.index,...this.states]}jump(){let t=this.states.slice(),r=this.index;this.index=Ca(this.states,this.index);for(let n=19932;n>0;--n)fD.charCodeAt(n/6|0)-48&1<<n%6&&zS(this.states,this.index,t,r),this.index=Ca(this.states,this.index);zS(this.states,this.index,t,r)}};function zS(e,t,r,n){let o=0;if(n>=t){for(;o<624-n;o++)e[o+t]^=r[o+n];for(;o<624-t;o++)e[o+t]^=r[o+n-624];for(;o<624;o++)e[o+t-624]^=r[o+n-624]}else{for(;o<624-t;o++)e[o+t]^=r[o+n];for(;o<624-n;o++)e[o+t-624]^=r[o+n];for(;o<624;o++)e[o+t-624]^=r[o+n-624]}}function Ca(e,t){if(t<227){let r=e[t]&2147483648|e[t+1]&2147483647;return e[t]=e[t+397]^r>>>1^-(r&1)&2567483615,t+1}else if(t<623){let r=e[t]&2147483648|e[t+1]&2147483647;return e[t]=e[t+397-624]^r>>>1^-(r&1)&2567483615,t+1}else{let r=e[t]&2147483648|e[0]&2147483647;return e[t]=e[396]^r>>>1^-(r&1)&2567483615,0}}function mD(e){for(let t=0;t!==624;++t)Ca(e,t)}function qS(e){let t=[e|0];for(let r=1;r!==624;++r){let n=t[r-1]^t[r-1]>>>30;t.push(Math.imul(1812433253,n)+r|0)}return mD(t),new hD(t,0)}var gD=class KS{constructor(t,r,n,o){this.s01=t,this.s00=r,this.s11=n,this.s10=o}clone(){return new KS(this.s01,this.s00,this.s11,this.s10)}next(){let t=this.s00^this.s00<<23,r=this.s01^(this.s01<<23|this.s00>>>9),n=t^this.s10^(t>>>18|r<<14)^(this.s10>>>5|this.s11<<27),o=r^this.s11^r>>>18^this.s11>>>5,i=this.s00+this.s10|0;return this.s01=this.s11,this.s00=this.s10,this.s11=o,this.s10=n,i}jump(){let t=0,r=0,n=0,o=0,i=[1667051007,2321340297,1548169110,304075285];for(let s=0;s!==4;++s)for(let a=1;a;a<<=1)i[s]&a&&(t^=this.s01,r^=this.s00,n^=this.s11,o^=this.s10),this.next();this.s01=t,this.s00=r,this.s11=n,this.s10=o}getState(){return[this.s01,this.s00,this.s11,this.s10]}};function pp(e){return new gD(-1,~e,e|0,0)}var yD=class JS{constructor(t,r,n,o){this.s01=t,this.s00=r,this.s11=n,this.s10=o}clone(){return new JS(this.s01,this.s00,this.s11,this.s10)}next(){let t=this.s00+this.s10|0,r=this.s10^this.s00,n=this.s11^this.s01,o=this.s00,i=this.s01;return this.s00=o<<24^i>>>8^r^r<<16,this.s01=i<<24^o>>>8^n^(n<<16|r>>>16),this.s10=n<<5^r>>>27,this.s11=r<<5^n>>>27,t}jump(){let t=0,r=0,n=0,o=0,i=[3639956645,3750757012,1261568508,386426335];for(let s=0;s!==4;++s)for(let a=1;a;a<<=1)i[s]&a&&(t^=this.s01,r^=this.s00,n^=this.s11,o^=this.s10),this.next();this.s01=t,this.s00=r,this.s11=n,this.s10=o}getState(){return[this.s01,this.s00,this.s11,this.s10]}};function YS(e){return new yD(-1,~e,e|0,0)}function XS(e,t){for(let r=0;r!==t;++r)e.next()}var ZS=BigInt,bD=4294967296n;function ev(e,t,r){let n=r-t+1n,o=bD,i=1;for(;o<n;)o<<=32n,++i;let s=QS(i,e);if(s<n)return s+t;if(s+n<o)return s%n+t;let a=o-o%n;for(;s>=a;)s=QS(i,e);return s%n+t}function QS(e,t){let r=ZS(t.next()+2147483648);for(let n=1;n<e;++n){let o=t.next();r=(r<<32n)+ZS(o+2147483648)}return r}function Zo(e,t){let r=t>2?~~(4294967296/t)*t:4294967296,n=e.next()+2147483648;for(;n>=r;)n=e.next()+2147483648;return n%t}function fp(e,t){if(t<0){let r=-t;e.sign=-1,e.data[0]=~~(r/4294967296),e.data[1]=r>>>0}else e.sign=1,e.data[0]=~~(t/4294967296),e.data[1]=t>>>0;return e}function wD(e,t,r){let n=t.data[1],o=t.data[0],i=t.sign,s=r.data[1],a=r.data[0],l=r.sign;if(e.sign=1,i===1&&l===-1){let m=n+s,g=o+a+(m>4294967295?1:0);return e.data[0]=g>>>0,e.data[1]=m>>>0,e}let c=n,u=o,d=s,p=a;i===-1&&(c=s,u=a,d=n,p=o);let h=0,f=c-d;return f<0&&(h=1,f=f>>>0),e.data[0]=u-p-h,e.data[1]=f,e}function SD(e,t,r){let n=r[0]+1;for(t[0]=Zo(e,n),t[1]=Zo(e,4294967296);t[0]>=r[0]&&(t[0]!==r[0]||t[1]>=r[1]);)t[0]=Zo(e,n),t[1]=Zo(e,4294967296);return t}var vD=Number.MAX_SAFE_INTEGER,xD={sign:1,data:[0,0]},kD={sign:1,data:[0,0]},tv={sign:1,data:[0,0]},hp=[0,0];function RD(e,t,r,n){let o=n<=vD?fp(tv,n):wD(tv,fp(xD,r),fp(kD,t));return o.data[1]===4294967295?(o.data[0]+=1,o.data[1]=0):o.data[1]+=1,SD(e,hp,o.data),hp[0]*4294967296+hp[1]+t}function Ea(e,t,r){let n=r-t;return n<=4294967295?Zo(e,n+1)+t:RD(e,t,r,n)}var rv=Symbol.for("fast-check/PreconditionFailure"),Or=class extends Error{constructor(e=!1){super(),this.interruptExecution=e,this.footprint=rv}static isFailure(e){return e!=null&&e.footprint===rv}};function CD(e){if(!e)throw new Or}var ED=class{[Symbol.iterator](){return this}next(e){return{value:e,done:!0}}},PD=new ED;function ID(){return PD}function*AD(e,t){for(let r of e)yield t(r)}function*TD(e,t){for(let r of e)yield*t(r)}function*OD(e,t){for(let r of e)t(r)&&(yield r)}function*MD(e,t){for(let r=0;r<t;++r){let n=e.next();if(n.done)break;yield n.value}}function*LD(e,t){let r=e.next();for(;!r.done&&t(r.value);)yield r.value,r=e.next()}function*ND(e,t){for(let r=e.next();!r.done;r=e.next())yield r.value;for(let r of t)for(let n=r.next();!n.done;n=r.next())yield n.value}var $D=Symbol.iterator,H=class or{static nil(){return new or(ID())}static of(...t){return new or(t[$D]())}constructor(t){this.g=t}next(){return this.g.next()}[Symbol.iterator](){return this.g}map(t){return new or(AD(this.g,t))}flatMap(t){return new or(TD(this.g,t))}dropWhile(t){let r=!1;function*n(o){(r||!t(o))&&(r=!0,yield o)}return this.flatMap(n)}drop(t){if(t<=0)return this;let r=0;function n(){return r++<t}return this.dropWhile(n)}takeWhile(t){return new or(LD(this.g,t))}take(t){return new or(MD(this.g,t))}filter(t){return new or(OD(this.g,t))}every(t){for(let r of this.g)if(!t(r))return!1;return!0}has(t){for(let r of this.g)if(t(r))return[!0,r];return[!1,null]}join(...t){return new or(ND(this.g,t))}getNthOrLast(t){let r=t,n=null;for(let o of this.g){if(r--===0)return o;n=o}return n}};function Ar(e){return new H(e)}var Ue=Symbol.for("fast-check/cloneMethod");function Qr(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&Ue in e&&typeof e[Ue]=="function"}function Dn(e){return Qr(e)?e[Ue]():e}var DD=Object.defineProperty,$=class{constructor(e,t,r){this.value_=e,this.context=t,this.hasToBeCloned=r!==void 0||Qr(e),this.readOnce=!1,this.value=e,this.hasToBeCloned&&DD(this,"value",{get:r!==void 0?r:this.getValue,enumerable:!1,configurable:!1})}getValue(){return this.hasToBeCloned?this.readOnce?this.value_[Ue]():(this.readOnce=!0,this.value_):this.value_}},ye=class{filter(e){return new FD(this,e)}map(e,t){return new jD(this,e,t)}chain(e){return new _D(this,e)}},_D=class extends ye{constructor(e,t){super(),this.arb=e,this.chainer=t}generate(e,t){let r=e.clone(),n=this.arb.generate(e,t);return this.valueChainer(n,e,r,t)}canShrinkWithoutContext(e){return!1}shrink(e,t){return this.isSafeContext(t)?(t.stoppedForOriginal?H.nil():this.arb.shrink(t.originalValue,t.originalContext).map(r=>this.valueChainer(r,t.clonedMrng.clone(),t.clonedMrng,t.originalBias))).join(t.chainedArbitrary.shrink(e,t.chainedContext).map(r=>{let n={...t,chainedContext:r.context,stoppedForOriginal:!0};return new $(r.value_,n)})):H.nil()}valueChainer(e,t,r,n){let o=this.chainer(e.value_),i=o.generate(t,n),s={originalBias:n,originalValue:e.value_,originalContext:e.context,stoppedForOriginal:!1,chainedArbitrary:o,chainedContext:i.context,clonedMrng:r};return new $(i.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}},jD=class extends ye{constructor(e,t,r){super(),this.arb=e,this.mapper=t,this.unmapper=r,this.bindValueMapper=n=>this.valueMapper(n)}generate(e,t){let r=this.arb.generate(e,t);return this.valueMapper(r)}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 r=this.unmapper(e);return this.arb.shrink(r,void 0).map(this.bindValueMapper)}return H.nil()}mapperWithCloneIfNeeded(e){let t=e.value,r=this.mapper(t);return e.hasToBeCloned&&(typeof r=="object"&&r!==null||typeof r=="function")&&Object.isExtensible(r)&&!Qr(r)&&Object.defineProperty(r,Ue,{get:()=>()=>this.mapperWithCloneIfNeeded(e)[0]}),[r,t]}valueMapper(e){let[t,r]=this.mapperWithCloneIfNeeded(e);return new $(t,{originalValue:r,originalContext:e.context})}isSafeContext(e){return e!=null&&typeof e=="object"&&"originalValue"in e&&"originalContext"in e}},FD=class extends ye{constructor(e,t){super(),this.arb=e,this.refinement=t,this.bindRefinementOnValue=r=>this.refinementOnValue(r)}generate(e,t){for(;;){let r=this.arb.generate(e,t);if(this.refinementOnValue(r))return r}}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 rk(e){return typeof e=="object"&&e!==null&&"generate"in e&&"shrink"in e&&"canShrinkWithoutContext"in e}function nk(e){if(!rk(e))throw new Error("Unexpected value received: not an instance of Arbitrary")}var ok=Function.prototype.apply,mp=Symbol("apply");function BD(e){try{return e.apply}catch{return}}function VD(e,t,r){let n=e;n[mp]=ok;let o=n[mp](t,r);return delete n[mp],o}function Y(e,t,r){return BD(e)===ok?e.apply(t,r):VD(e,t,r)}var ik=Array,O=BigInt,UD=BigInt64Array,WD=BigUint64Array,sk=Boolean,Va=Date,L=Error,ak=Float32Array,lk=Float64Array,HD=Int8Array,zD=Int16Array,GD=Int32Array,sr=Number,Ze=String,_n=Set,qD=Uint8Array,KD=Uint8ClampedArray,JD=Uint16Array,YD=Uint32Array,XD=encodeURIComponent,ar=Map,Na=Symbol,nv=Array.prototype.forEach,ov=Array.prototype.indexOf,iv=Array.prototype.join,sv=Array.prototype.map,av=Array.prototype.flat,lv=Array.prototype.filter,cv=Array.prototype.push,uv=Array.prototype.pop,dv=Array.prototype.splice,pv=Array.prototype.slice,fv=Array.prototype.sort,hv=Array.prototype.every;function ZD(e){try{return e.forEach}catch{return}}function QD(e){try{return e.indexOf}catch{return}}function e3(e){try{return e.join}catch{return}}function t3(e){try{return e.map}catch{return}}function r3(e){try{return e.flat}catch{return}}function n3(e){try{return e.filter}catch{return}}function o3(e){try{return e.push}catch{return}}function i3(e){try{return e.pop}catch{return}}function s3(e){try{return e.splice}catch{return}}function a3(e){try{return e.slice}catch{return}}function l3(e){try{return e.sort}catch{return}}function c3(e){try{return e.every}catch{return}}function ck(e,t){return ZD(e)===nv?e.forEach(t):Y(nv,e,[t])}function ir(e,...t){return QD(e)===ov?e.indexOf(...t):Y(ov,e,t)}function ge(e,...t){return e3(e)===iv?e.join(...t):Y(iv,e,t)}function K(e,t){return t3(e)===sv?e.map(t):Y(sv,e,[t])}function u3(e,t){return r3(e)===av?([].flat(),e.flat(t)):Y(av,e,[t])}function d3(e,t){return n3(e)===lv?e.filter(t):Y(lv,e,[t])}function N(e,...t){return o3(e)===cv?e.push(...t):Y(cv,e,t)}function uk(e){return i3(e)===uv?e.pop():Y(uv,e,[])}function dk(e,...t){return s3(e)===dv?e.splice(...t):Y(dv,e,t)}function Ge(e,...t){return a3(e)===pv?e.slice(...t):Y(pv,e,t)}function pk(e,...t){return l3(e)===fv?e.sort(...t):Y(fv,e,t)}function fk(e,...t){return c3(e)===hv?e.every(...t):Y(hv,e,t)}var mv=Date.prototype.getTime,gv=Date.prototype.toISOString;function p3(e){try{return e.getTime}catch{return}}function f3(e){try{return e.toISOString}catch{return}}function Ua(e){return p3(e)===mv?e.getTime():Y(mv,e,[])}function h3(e){return f3(e)===gv?e.toISOString():Y(gv,e,[])}var yv=Set.prototype.add,bv=Set.prototype.has;function m3(e){try{return e.add}catch{return}}function g3(e){try{return e.has}catch{return}}function ni(e,t){return m3(e)===yv?e.add(t):Y(yv,e,[t])}function Wa(e,t){return g3(e)===bv?e.has(t):Y(bv,e,[t])}var wv=WeakMap.prototype.set,Sv=WeakMap.prototype.get;function y3(e){try{return e.set}catch{return}}function b3(e){try{return e.get}catch{return}}function w3(e,t,r){return y3(e)===wv?e.set(t,r):Y(wv,e,[t,r])}function S3(e,t){return b3(e)===Sv?e.get(t):Y(Sv,e,[t])}var vv=Map.prototype.set,xv=Map.prototype.get,kv=Map.prototype.has;function v3(e){try{return e.set}catch{return}}function x3(e){try{return e.get}catch{return}}function k3(e){try{return e.has}catch{return}}function Et(e,t,r){return v3(e)===vv?e.set(t,r):Y(vv,e,[t,r])}function ut(e,t){return x3(e)===xv?e.get(t):Y(xv,e,[t])}function R3(e,t){return k3(e)===kv?e.has(t):Y(kv,e,[t])}var Rv=String.prototype.split,Cv=String.prototype.startsWith,Ev=String.prototype.endsWith,Pv=String.prototype.substring,Iv=String.prototype.toLowerCase,Av=String.prototype.toUpperCase,Tv=String.prototype.padStart,Ov=String.prototype.charCodeAt,Mv=String.prototype.normalize,Lv=String.prototype.replace;function C3(e){try{return e.split}catch{return}}function E3(e){try{return e.startsWith}catch{return}}function P3(e){try{return e.endsWith}catch{return}}function I3(e){try{return e.substring}catch{return}}function A3(e){try{return e.toLowerCase}catch{return}}function T3(e){try{return e.toUpperCase}catch{return}}function O3(e){try{return e.padStart}catch{return}}function M3(e){try{return e.charCodeAt}catch{return}}function L3(e){try{return e.normalize}catch{return}}function N3(e){try{return e.replace}catch{return}}function Qe(e,...t){return C3(e)===Rv?e.split(...t):Y(Rv,e,t)}function $3(e,...t){return E3(e)===Cv?e.startsWith(...t):Y(Cv,e,t)}function D3(e,...t){return P3(e)===Ev?e.endsWith(...t):Y(Ev,e,t)}function Ce(e,...t){return I3(e)===Pv?e.substring(...t):Y(Pv,e,t)}function Bp(e){return A3(e)===Iv?e.toLowerCase():Y(Iv,e,[])}function ff(e){return T3(e)===Av?e.toUpperCase():Y(Av,e,[])}function _3(e,...t){return O3(e)===Tv?e.padStart(...t):Y(Tv,e,t)}function jn(e,t){return M3(e)===Ov?e.charCodeAt(t):Y(Ov,e,[t])}function j3(e,t){return L3(e)===Mv?e.normalize(t):Y(Mv,e,[t])}function F3(e,t,r){return N3(e)===Lv?e.replace(t,r):Y(Lv,e,[t,r])}var Nv=Number.prototype.toString;function B3(e){try{return e.toString}catch{return}}function oi(e,...t){return B3(e)===Nv?e.toString(...t):Y(Nv,e,t)}var V3=Object.prototype.hasOwnProperty,U3=Object.prototype.toString;function hk(e,t){return Y(V3,e,[t])}function Vp(e){return Y(U3,e,[])}var W3=Error.prototype.toString;function H3(e){return Y(W3,e,[])}var z3=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 Ir(e){return new z3(e)}var mk=Array.isArray,G3=Object.defineProperty;function gk(e,t){return G3(e,Ue,{value:()=>{let r=[];for(let n=0;n!==t.length;++n)N(r,t[n].value);return gk(r,t),r}})}function yk(e){let t=!1,r=[],n=[];for(let o=0;o!==e.length;++o){let i=e[o];t=t||i.hasToBeCloned,N(r,i.value),N(n,i.context)}return t&&gk(r,e),new $(r,n)}function bk(e,t,r){let n=[],o=mk(r)?r:[];for(let i=0;i!==e.length;++i)N(n,Ir(()=>e[i].shrink(t[i],o[i]).map(s=>{let a=K(t,(l,c)=>new $(Dn(l),o[c]));return[...Ge(a,0,i),s,...Ge(a,i+1)]}).map(yk)));return H.nil().join(...n)}var q3=class extends ye{constructor(e){super(),this.arbs=e;for(let t=0;t!==e.length;++t){let r=e[t];if(r==null||r.generate===null||r.generate===void 0)throw new Error(`Invalid parameter encountered at index ${t}: expecting an Arbitrary`)}}generate(e,t){let r=[];for(let n=0;n!==this.arbs.length;++n)N(r,this.arbs[n].generate(e,t));return yk(r)}canShrinkWithoutContext(e){if(!mk(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 bk(this.arbs,e,t)}};function z(...e){return new q3(e)}var K3=Math.log;function wk(e){return 2+~~(K3(e+1)*.4342944819032518)}var hf={};function J3(e){hf=e}function Pt(){return hf}function Y3(){hf={}}var ii=Symbol("UndefinedContextPlaceholder");function Fn(e){return e.context!==void 0?e:e.hasToBeCloned?new $(e.value_,ii,()=>e.value):new $(e.value_,ii)}var $v=()=>{},X3=class{constructor(e,t){this.arb=e,this.predicate=t;let{asyncBeforeEach:r,asyncAfterEach:n,beforeEach:o,afterEach:i}=Pt()||{};if(r!==void 0&&o!==void 0)throw L(`Global "asyncBeforeEach" and "beforeEach" parameters can't be set at the same time when running async properties`);if(n!==void 0&&i!==void 0)throw L(`Global "asyncAfterEach" and "afterEach" parameters can't be set at the same time when running async properties`);this.beforeEachHook=r||o||$v,this.afterEachHook=n||i||$v}isAsync(){return!0}generate(e,t){return Fn(this.arb.generate(e,t!==void 0?wk(t):void 0))}shrink(e){if(e.context===void 0&&!this.arb.canShrinkWithoutContext(e.value_))return H.nil();let t=e.context!==ii?e.context:void 0;return this.arb.shrink(e.value_,t).map(Fn)}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 L("Property failed by returning false")}}catch(t){return Or.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}},Sk=class extends ye{constructor(e){super(),this.arb=e}generate(e,t){return Fn(this.arb.generate(e,t))}canShrinkWithoutContext(e){return!0}shrink(e,t){if(t===void 0&&!this.arb.canShrinkWithoutContext(e))return H.nil();let r=t!==ii?t:void 0;return this.arb.shrink(e,r).map(Fn)}};function Z3(...e){if(e.length<2)throw new Error("asyncProperty expects at least two parameters");let t=Ge(e,0,e.length-1),r=e[e.length-1];return ck(t,nk),new X3(z(...K(t,n=>new Sk(n))),n=>r(...n))}var Dv=()=>{},vk=class{constructor(e,t){this.arb=e,this.predicate=t;let{beforeEach:r=Dv,afterEach:n=Dv,asyncBeforeEach:o,asyncAfterEach:i}=Pt()||{};if(o!==void 0)throw L(`"asyncBeforeEach" can't be set when running synchronous properties`);if(i!==void 0)throw L(`"asyncAfterEach" can't be set when running synchronous properties`);this.beforeEachHook=r,this.afterEachHook=n}isAsync(){return!1}generate(e,t){return Fn(this.arb.generate(e,t!==void 0?wk(t):void 0))}shrink(e){if(e.context===void 0&&!this.arb.canShrinkWithoutContext(e.value_))return H.nil();let t=e.context!==ii?e.context:void 0;return this.arb.shrink(e.value_,t).map(Fn)}runBeforeEach(){this.beforeEachHook()}runAfterEach(){this.afterEachHook()}run(e){try{let t=this.predicate(e);return t===void 0||t===!0?null:{error:new L("Property failed by returning false")}}catch(t){return Or.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 Q3(...e){if(e.length<2)throw new Error("property expects at least two parameters");let t=Ge(e,0,e.length-1),r=e[e.length-1];return ck(t,nk),new vk(z(...K(t,n=>new Sk(n))),n=>r(...n))}var e_=(function(e){return e[e.None=0]="None",e[e.Verbose=1]="Verbose",e[e.VeryVerbose=2]="VeryVerbose",e})({});function Up(e){return"unsafeNext"in e?e.unsafeJump===void 0?{clone:()=>Up(e),next:()=>e.unsafeNext(),getState:()=>e.getState()}:{clone:()=>Up(e),next:()=>e.unsafeNext(),jump:()=>e.unsafeJump(),getState:()=>e.getState()}:e}function xk(e){return"jump"in e&&typeof e.jump=="function"?e:{clone:()=>xk(e),next:()=>e.next(),jump:()=>XS(e,42),getState:()=>e.getState()}}function qa(e){return xk(Up(e))}var t_=Date.now,r_=Math.min,n_=Math.random,o_=class{constructor(e){let t=e||{};this.seed=i_(t),this.randomType=s_(t),this.numRuns=a_(t),this.verbose=l_(t),this.maxSkipsPerRun=t.maxSkipsPerRun!==void 0?t.maxSkipsPerRun:100,this.timeout=yp(t.timeout),this.skipAllAfterTimeLimit=yp(t.skipAllAfterTimeLimit),this.interruptAfterTimeLimit=yp(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:r=>{console.log(r)},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 gp(e){return t=>qa(e(t))}function i_(e){if(e.seed===void 0)return t_()^n_()*4294967296;let t=e.seed|0;return e.seed===t?t:t^(e.seed-t)*4294967296}function s_(e){if(e.randomType===void 0)return pp;if(typeof e.randomType=="string")switch(e.randomType){case"mersenne":return gp(qS);case"congruential":case"congruential32":return gp(HS);case"xorshift128plus":return pp;case"xoroshiro128plus":return YS;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===qa(t)?e.randomType:gp(e.randomType)}function a_(e){return e.numRuns!==void 0?e.numRuns:e.num_runs!==void 0?e.num_runs:100}function l_(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 yp(e){if(e!==void 0)return r_(e,2147483647)}function mf(e){return new o_(e)}function c_(e,t,r){let n=null;return{clear:()=>r(n),promise:new Promise(o=>{n=t(()=>{o(new Or(!0))},e)})}}var _v=class{constructor(e,t,r,n,o,i){this.property=e,this.getTime=t,this.interruptExecution=n,this.setTimeoutSafe=o,this.clearTimeoutSafe=i,this.skipAfterTime=this.getTime()+r}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 r=new Or(this.interruptExecution);return this.isAsync()?Promise.resolve(r):r}if(this.interruptExecution&&this.isAsync()){let r=c_(t,this.setTimeoutSafe,this.clearTimeoutSafe),n=Promise.race([this.property.run(e),r.promise]);return n.then(r.clear,r.clear),n}return this.property.run(e)}runBeforeEach(){return this.property.runBeforeEach()}runAfterEach(){return this.property.runAfterEach()}},u_=(e,t,r)=>{let n=null;return{clear:()=>r(n),promise:new Promise(o=>{n=t(()=>{o({error:new L(`Property timeout: exceeded limit of ${e} milliseconds`)})},e)})}},d_=class{constructor(e,t,r,n){this.property=e,this.timeMs=t,this.setTimeoutSafe=r,this.clearTimeoutSafe=n}isAsync(){return!0}generate(e,t){return this.property.generate(e,t)}shrink(e){return this.property.shrink(e)}async run(e){let t=u_(this.timeMs,this.setTimeoutSafe,this.clearTimeoutSafe),r=Promise.race([this.property.run(e),t.promise]);return r.then(t.clear,t.clear),r}runBeforeEach(){return Promise.resolve(this.property.runBeforeEach())}runAfterEach(){return Promise.resolve(this.property.runAfterEach())}},kk=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()}},jv=Array.from,Fv=typeof Buffer<"u"?Buffer.isBuffer:void 0,Mn=JSON.stringify,Bv=Number.isNaN,p_=Object.keys,f_=Object.getOwnPropertySymbols,h_=Object.getOwnPropertyDescriptor,Vv=Object.getPrototypeOf,Uv=Number.NEGATIVE_INFINITY,m_=Number.POSITIVE_INFINITY,It=Symbol.for("fast-check/toStringMethod");function gf(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&It in e&&typeof e[It]=="function"}var lr=Symbol.for("fast-check/asyncToStringMethod");function yf(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&lr in e&&typeof e[lr]=="function"}var g_=/^Symbol\((.*)\)$/;function y_(e){if(e.description!==void 0)return e.description;let t=g_.exec(Ze(e));return t&&t[1].length?t[1]:null}function Wv(e){switch(e){case 0:return 1/e===Uv?"-0":"0";case Uv:return"Number.NEGATIVE_INFINITY";case m_:return"Number.POSITIVE_INFINITY";default:return e===e?Ze(e):"Number.NaN"}}function b_(e){let t=-1;for(let r in e){let n=Number(r);if(n!==t+1)return!0;t=n}return t+1!==e.length}function ct(e,t,r){let n=[...t,e];if(typeof e=="object"&&ir(t,e)!==-1)return"[cyclic]";if(yf(e)){let o=r(e);if(o.state==="fulfilled")return o.value}if(gf(e))try{return e[It]()}catch{}switch(Vp(e)){case"[object Array]":{let o=e;if(o.length>=50&&b_(o)){let s=[];for(let a in o)Bv(Number(a))||N(s,`${a}:${ct(o[a],n,r)}`);return s.length!==0?`Object.assign(Array(${o.length}),{${ge(s,",")}})`:`Array(${o.length})`}let i=ge(K(o,s=>ct(s,n,r)),",");return o.length===0||o.length-1 in o?`[${i}]`:`[${i},]`}case"[object BigInt]":return`${e}n`;case"[object Boolean]":{let o=e==!0?"true":"false";return typeof e=="boolean"?o:`new Boolean(${o})`}case"[object Date]":{let o=e;return Bv(Ua(o))?"new Date(NaN)":`new Date(${Mn(h3(o))})`}case"[object Map]":return`new Map(${ct(Array.from(e),n,r)})`;case"[object Null]":return"null";case"[object Number]":return typeof e=="number"?Wv(e):`new Number(${Wv(Number(e))})`;case"[object Object]":{try{let i=e.toString;if(typeof i=="function"&&i!==Object.prototype.toString)return e.toString()}catch{return"[object Object]"}let o=i=>`${i==="__proto__"?'["__proto__"]':typeof i=="symbol"?`[${ct(i,n,r)}]`:Mn(i)}:${ct(e[i],n,r)}`;return"{"+ge([...Vv(e)===null?["__proto__:null"]:[],...K(p_(e),o),...K(d3(f_(e),i=>{let s=h_(e,i);return s&&s.enumerable}),o)],",")+"}"}case"[object Set]":return`new Set(${ct(Array.from(e),n,r)})`;case"[object String]":return typeof e=="string"?Mn(e):`new String(${Mn(e)})`;case"[object Symbol]":{let o=e;if(Na.keyFor(o)!==void 0)return`Symbol.for(${Mn(Na.keyFor(o))})`;let i=y_(o);return i===null?"Symbol()":o===(i.startsWith("Symbol.")&&Na[i.substring(7)])?i:`Symbol(${Mn(i)})`}case"[object Promise]":{let o=r(e);switch(o.state){case"fulfilled":return`Promise.resolve(${ct(o.value,n,r)})`;case"rejected":return`Promise.reject(${ct(o.value,n,r)})`;case"pending":return"new Promise(() => {/*pending*/})";default:return"new Promise(() => {/*unknown*/})"}}case"[object Error]":if(e instanceof Error)return`new Error(${ct(e.message,n,r)})`;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 Fv=="function"&&Fv(e))return`Buffer.from(${e.buffer.detached?"/*detached ArrayBuffer*/":ct(jv(e.values()),n,r)})`;let o=Vv(e),i=o&&o.constructor&&o.constructor.name;if(typeof i=="string"){let s=e;return s.buffer.detached?`${i}.from(/*detached ArrayBuffer*/)`:`${i}.from(${ct(jv(s.values()),n,r)})`}break}}try{return e.toString()}catch{return Vp(e)}}function Me(e){return ct(e,[],()=>({state:"unknown",value:void 0}))}function Rk(e){let t=Na(),r=[],n=new ar;function o(){let l=null,c=()=>{l!==null&&clearTimeout(l)};return{delay:new Promise(u=>{l=setTimeout(()=>{l=null,u(t)},0)}),cancel:c}}let i={state:"unknown",value:void 0},s=function(c){let u=c;if(n.has(u))return n.get(u);let d=o(),p=lr in c?Promise.resolve().then(()=>c[lr]()):c;return p.catch(()=>{}),r.push(Promise.race([p,d.delay]).then(h=>{h===t?n.set(u,{state:"pending",value:void 0}):n.set(u,{state:"fulfilled",value:h}),d.cancel()},h=>{n.set(u,{state:"rejected",value:h}),d.cancel()})),n.set(u,i),i};function a(){let l=ct(e,[],s);return r.length===0?l:Promise.all(r.splice(0)).then(a)}return a()}async function bf(e){return Promise.resolve(Rk(e))}function Hv(e){return e===null?new Or:e}function w_(...e){return e[1]?e[0].then(Hv):Hv(e[0])}function S_(e,t){return w_(e,t)}var zv=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=Me(e);if(this.coveredCases.has(t)){let n=this.coveredCases.get(t);return this.skipRuns?S_(n,this.property.isAsync()):n}let r=this.property.run(e);return this.coveredCases.set(t,r),r}runBeforeEach(){return this.property.runBeforeEach()}runAfterEach(){return this.property.runAfterEach()}},Gv=Date.now,bp=setTimeout,wp=clearTimeout;function v_(e,t){let r=e;return e.isAsync()&&t.timeout!==void 0&&(r=new d_(r,t.timeout,bp,wp)),t.unbiased&&(r=new kk(r)),t.skipAllAfterTimeLimit!==void 0&&(r=new _v(r,Gv,t.skipAllAfterTimeLimit,!1,bp,wp)),t.interruptAfterTimeLimit!==void 0&&(r=new _v(r,Gv,t.interruptAfterTimeLimit,!0,bp,wp)),t.skipEqualValues&&(r=new zv(r,!0)),t.ignoreEqualValues&&(r=new zv(r,!1)),r}var x_=(function(e){return e[e.Success=0]="Success",e[e.Skipped=-1]="Skipped",e[e.Failure=1]="Failure",e})({}),k_=class Ck{constructor(t,r){this.verbosity=t,this.interruptedAsFailure=r,this.rootExecutionTrees=[],this.currentLevelExecutionTrees=this.rootExecutionTrees,this.failure=null,this.numSkips=0,this.numSuccesses=0,this.interrupted=!1}appendExecutionTree(t,r){let n={status:t,value:r,children:[]};return this.currentLevelExecutionTrees.push(n),n}fail(t,r,n){if(this.verbosity>=1){let o=this.appendExecutionTree(1,t);this.currentLevelExecutionTrees=o.children}this.pathToFailure===void 0?this.pathToFailure=`${r}`:this.pathToFailure+=`:${r}`,this.value=t,this.failure=n}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?+Qe(this.pathToFailure,":")[0]:-1}numShrinks(){return this.pathToFailure!==void 0?Qe(this.pathToFailure,":").length-1:0}extractFailures(){if(this.isSuccess())return[];let t=[],r=this.rootExecutionTrees;for(;r.length>0&&r[r.length-1].status===1;){let n=r[r.length-1];t.push(n.value),r=n.children}return t}static mergePaths(t,r){if(t.length===0)return r;let n=t.split(":"),o=r.split(":"),i=+n[n.length-1]+ +o[0];return[...n.slice(0,n.length-1),`${i}`,...o.slice(1)].join(":")}toRunDetails(t,r,n,o){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:Ck.mergePaths(r,this.pathToFailure),errorInstance:this.failure.error,failures:this.extractFailures(),executionSummary:this.rootExecutionTrees,verbose:this.verbosity,runConfiguration:o.toParameters()};let i=this.interruptedAsFailure||this.numSuccesses===0;return{failed:this.numSkips>n||this.interrupted&&i,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:o.toParameters()}}},Ek=class{constructor(e,t,r,n){this.sourceValues=e,this.shrink=t,this.runExecution=new k_(r,n),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"&&!Or.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_)}},R_=class{constructor(e,t,r){this.initialValues=e,this.maxInitialIterations=t,this.remainingSkips=r}[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}},C_=-2147483648,E_=2147483647,P_=Math.pow(2,27),I_=Math.pow(2,-53),wf=class Pk{constructor(t){this.internalRng=qa(t.clone())}clone(){return new Pk(this.internalRng)}next(t){return Ea(this.internalRng,0,(1<<t)-1)}nextBoolean(){return Ea(this.internalRng,0,1)===1}nextInt(t,r){return Ea(this.internalRng,t===void 0?C_:t,r===void 0?E_:r)}nextBigInt(t,r){return ev(this.internalRng,t,r)}nextDouble(){let t=this.next(26),r=this.next(27);return(t*P_+r)*I_}getState(){if("getState"in this.internalRng&&typeof this.internalRng.getState=="function")return this.internalRng.getState()}};function A_(e,t,r){return t.jump(),e.generate(new wf(t),r)}function*Ik(e,t,r,n){for(let o=0;o!==n.length;++o)yield new $(n[o],void 0);for(let o=0,i=r(t);;++o)yield A_(e,i,o)}function T_(e,t,r){return()=>e.generate(new wf(t),r)}function*Ak(e,t,r,n){yield*K(n,s=>()=>new $(s,void 0));let o=0,i=qa(r(t));for(;;)i.jump(),yield T_(e,i,o++)}function qv(e){return e()}function Tk(e,t,r){let n=t,o=e.split(":").map(s=>+s);if(o.length===0)return n.map(qv);if(!o.every(s=>!Number.isNaN(s)))throw new Error(`Unable to replay, got invalid path=${e}`);let i=n.drop(o[0]).map(qv);for(let s of o.slice(1)){let a=i.getNthOrLast(0);if(a===null)throw new Error(`Unable to replay, got wrong path=${e}`);i=r(a).drop(s)}return i}var O_=Object.assign;function M_(e){return e.length===1?`Hint: ${e[0]}`:e.map((t,r)=>`Hint (${r+1}): ${t}`).join(`
176
- `)}function L_(e,t){return`Encountered failures were:
177
- - ${e.map(t).join(`
178
- - `)}`}function Sf(e,t){let r=[],n=[];for(let o=e.length-1;o>=0;--o)n.push({depth:1,tree:e[o]});for(;n.length!==0;){let o=n.pop(),i=o.tree,s=o.depth,a=i.status===0?"\x1B[32m\u221A\x1B[0m":i.status===1?"\x1B[31m\xD7\x1B[0m":"\x1B[33m!\x1B[0m",l=s!==0?". ".repeat(s-1):"";r.push(`${l}${a} ${t(i.value)}`);for(let c=i.children.length-1;c>=0;--c)n.push({depth:s+1,tree:i.children[c]})}return`Execution summary:
179
- ${r.join(`
180
- `)}`}function N_(e,t){let r=`Failed to run property, too many pre-condition failures encountered
181
- { seed: ${e.seed} }
182
-
183
- Ran ${e.numRuns} time(s)
184
- Skipped ${e.numSkips} time(s)`,n=null,o=["Try to reduce the number of rejected values by combining map, chain and built-in arbitraries","Increase failure tolerance by setting maxSkipsPerRun to an higher value"];return e.verbose>=2?n=Sf(e.executionSummary,t):N(o,"Enable verbose mode at level VeryVerbose in order to check all generated values and their associated status"),{message:r,details:n,hints:o}}function $_(e){if(e instanceof L&&e.stack!==void 0)return e.stack;try{return Ze(e)}catch{}if(e instanceof L)try{return H3(e)}catch{}if(e!==null&&typeof e=="object")try{return Vp(e)}catch{}return"Failed to serialize errorInstance"}function D_(e,t){let r=e.runConfiguration.includeErrorInReport?`
185
- Got ${F3($_(e.errorInstance),/^Error: /,"error: ")}`:"",n=`Property failed after ${e.numRuns} tests
186
- { seed: ${e.seed}, path: "${e.counterexamplePath}", endOnFailure: true }
187
- Counterexample: ${t(e.counterexample)}
188
- Shrunk ${e.numShrinks} time(s)${r}`,o=null,i=[];return e.verbose>=2?o=Sf(e.executionSummary,t):e.verbose===1?o=L_(e.failures,t):N(i,"Enable verbose mode in order to have the list of all failing values encountered during the run"),{message:n,details:o,hints:i}}function __(e,t){let r=`Property interrupted after ${e.numRuns} tests
189
- { seed: ${e.seed} }`,n=null,o=[];return e.verbose>=2?n=Sf(e.executionSummary,t):N(o,"Enable verbose mode at level VeryVerbose in order to check all generated values and their associated status"),{message:r,details:n,hints:o}}function Wp(e,t){if(!e.failed)return;let{message:r,details:n,hints:o}=e.counterexamplePath===null?e.interrupted?__(e,t):N_(e,t):D_(e,t),i=r;return n!==null&&(i+=`
190
-
191
- ${n}`),o.length>0&&(i+=`
192
-
193
- ${M_(o)}`),i}function Ok(e){return Wp(e,Me)}async function Mk(e){let t=[];function r(s){let a=Rk(s);return typeof a=="string"?a:(t.push(Promise.all([s,a])),"\u2026")}let n=Wp(e,r);if(t.length===0)return n;let o=new ar(await Promise.all(t));function i(s){let a=ut(o,s);return a!==void 0?a:Me(s)}return Wp(e,i)}function Lk(e,t){if(t.runConfiguration.includeErrorInReport)throw new L(e);let r=new L(e,{cause:t.errorInstance});return"cause"in r||O_(r,{cause:t.errorInstance}),r}function j_(e){if(e.failed)throw Lk(Ok(e),e)}async function F_(e){if(e.failed)throw Lk(await Mk(e),e)}function B_(e){return e.runConfiguration.asyncReporter?e.runConfiguration.asyncReporter(e):e.runConfiguration.reporter?e.runConfiguration.reporter(e):j_(e)}async function V_(e){return e.runConfiguration.asyncReporter?e.runConfiguration.asyncReporter(e):e.runConfiguration.reporter?e.runConfiguration.reporter(e):F_(e)}function U_(e,t,r,n,o){let i=new Ek(r,t,n,o);for(let s of i){e.runBeforeEach();let a=e.run(s);e.runAfterEach(),i.handleResult(a)}return i.runExecution}async function W_(e,t,r,n,o){let i=new Ek(r,t,n,o);for(let s of i){await e.runBeforeEach();let a=await e.run(s);await e.runAfterEach(),i.handleResult(a)}return i.runExecution}function Nk(e,t){if(e==null||e.generate===null||e.generate===void 0)throw new Error("Invalid property encountered, please use a valid property");if(e.run===null||e.run===void 0)throw new Error("Invalid property encountered, please use a valid property not an arbitrary");let r=mf({...Pt(),...t});if(r.reporter!==void 0&&r.asyncReporter!==void 0)throw new Error("Invalid parameters encountered, reporter and asyncReporter cannot be specified together");if(r.asyncReporter!==void 0&&!e.isAsync())throw new Error("Invalid parameters encountered, only asyncProperty can be used when asyncReporter specified");let n=v_(e,r),o=r.path.length===0||r.path.indexOf(":")===-1?r.numRuns:-1,i=r.numRuns*r.maxSkipsPerRun,s=(...c)=>n.shrink(...c),a=new R_(r.path.length===0?Ik(n,r.seed,r.randomType,r.examples):Tk(r.path,Ar(Ak(n,r.seed,r.randomType,r.examples)),s),o,i),l=r.endOnFailure?H.nil:s;return n.isAsync()?W_(n,l,a,r.verbose,r.markInterruptAsFailure).then(c=>c.toRunDetails(r.seed,r.path,i,r)):U_(n,l,a,r.verbose,r.markInterruptAsFailure).toRunDetails(r.seed,r.path,i,r)}function H_(e,t){let r=Nk(e,t);if(e.isAsync())return r.then(V_);B_(r)}function z_(e,t){let r=Object.prototype.hasOwnProperty.call(e,"isAsync")?e:new vk(e,()=>!0);return t.unbiased===!0?new kk(r):r}function $k(e,t){let r=mf(typeof t=="number"?{...Pt(),numRuns:t}:{...Pt(),...t}),n=z_(e,r),o=n.shrink.bind(n);return(r.path.length===0?Ar(Ik(n,r.seed,r.randomType,r.examples)):Tk(r.path,Ar(Ak(n,r.seed,r.randomType,r.examples)),o)).take(r.numRuns).map(i=>i.value_)}function G_(e,t){return[...$k(e,t)]}function q_(e){return(Math.round(e*100)/100).toFixed(2)}function K_(e,t,r){let n=mf(typeof r=="number"?{...Pt(),numRuns:r}:{...Pt(),...r}),o={};for(let l of $k(e,r)){let c=t(l),u=Array.isArray(c)?c:[c];for(let d of u)o[d]=(o[d]||0)+1}let i=Object.entries(o).sort((l,c)=>c[1]-l[1]).map(l=>[l[0],`${q_(l[1]*100/n.numRuns)}%`]),s=i.map(l=>l[0].length).reduce((l,c)=>Math.max(l,c),0),a=i.map(l=>l[1].length).reduce((l,c)=>Math.max(l,c),0);for(let l of i)n.logger(`${l[0].padEnd(s,".")}..${l[1].padStart(a,".")}`)}var J_=Object.assign;function Hp(e,t,r,n){let o=r(),i=e.clone(),s={mrng:e.clone(),biasFactor:t,history:[]},a=c=>{let u=o[s.history.length];if(u!==void 0&&u.arb===c){let p=u.value;return N(s.history,{arb:c,value:p,context:u.context,mrng:u.mrng}),i=u.mrng.clone(),p}let d=c.generate(i,t);return N(s.history,{arb:c,value:d.value_,context:d.context,mrng:i.clone()}),d.value},l=(c,...u)=>a(n(c,u));return new $(J_(l,{values(){return K(s.history,c=>c.value)},[Ue](){return Hp(e,t,r,n).value},[It](){return Me(K(s.history,c=>c.value))}}),s)}var Sp=Array.isArray,Kv=Object.keys,Y_=Object.is;function X_(e){let t=new ar;return function(n,o){let i=ut(t,n);if(i===void 0){let l=n(...o);return Et(t,n,[{args:o,value:l}]),l}let s=i;for(let l of s)if(e(o,l.args))return l.value;let a=n(...o);return N(s,{args:o,value:a}),a}}function Dk(e,t){if(e!==null&&typeof e=="object"&&t!==null&&typeof t=="object"){if(Sp(e)){if(!Sp(t)||e.length!==t.length)return!1}else if(Sp(t))return!1;if(Kv(e).length!==Kv(t).length)return!1;for(let r in e)if(!(r in t)||!Dk(e[r],t[r]))return!1;return!0}else return Y_(e,t)}var Z_=class extends ye{constructor(...e){super(...e),this.arbitraryCache=X_(Dk)}generate(e,t){return Hp(e,t,()=>[],this.arbitraryCache)}canShrinkWithoutContext(e){return!1}shrink(e,t){if(t===void 0)return H.nil();let r=t,n=r.mrng,o=r.biasFactor,i=r.history;return bk(i.map(s=>s.arb),i.map(s=>s.value),i.map(s=>s.context)).map(s=>{function a(){let l=s.value,c=s.context;return K(i,(u,d)=>({arb:u.arb,value:l[d],context:c[d],mrng:u.mrng}))}return Hp(n,o,a,this.arbitraryCache)})}};function Q_(){return new Z_}var ej=Math.floor,Jv=Math.log;function tj(e){return ej(Jv(e)/Jv(2))}function rj(e){return e===O(0)?O(0):O(Ze(e).length)}function _k(e,t,r){if(e===t)return[{min:e,max:t}];if(e<0&&t>0){let s=r(-e),a=r(t);return[{min:-s,max:a},{min:t-a,max:t},{min:e,max:e+s}]}let n=r(t-e),o={min:e,max:e+n},i={min:t-n,max:t};return e<0?[i,o]:[o,i]}var nj=Math.ceil,oj=Math.floor;function Yv(e){return oj(e/2)}function Xv(e){return nj(e/2)}function Zv(e,t,r){let n=e-t;function*o(){let s=r?void 0:t,a=r?n:Yv(n);for(let l=a;l>0;l=Yv(l)){let c=l===n?t:e-l;yield new $(c,s),s=c}}function*i(){let s=r?void 0:t,a=r?n:Xv(n);for(let l=a;l<0;l=Xv(l)){let c=l===n?t:e-l;yield new $(c,s),s=c}}return n>0?Ar(o()):Ar(i())}var Qv=Math.sign,ij=Number.isInteger,sj=Object.is,Bn=class jk extends ye{constructor(t,r){super(),this.min=t,this.max=r}generate(t,r){let n=this.computeGenerateRange(t,r);return new $(t.nextInt(n.min,n.max),void 0)}canShrinkWithoutContext(t){return typeof t=="number"&&ij(t)&&!sj(t,-0)&&this.min<=t&&t<=this.max}shrink(t,r){return jk.isValidContext(t,r)?this.isLastChanceTry(t,r)?H.of(new $(r,void 0)):Zv(t,r,!1):Zv(t,this.defaultTarget(),!0)}defaultTarget(){return this.min<=0&&this.max>=0?0:this.min<0?this.max:this.min}computeGenerateRange(t,r){if(r===void 0||t.nextInt(1,r)!==1)return{min:this.min,max:this.max};let n=_k(this.min,this.max,tj);if(n.length===1)return n[0];let o=t.nextInt(-2*(n.length-1),n.length-2);return o<0?n[0]:n[o+1]}isLastChanceTry(t,r){return t>0?t===r+1&&t>this.min:t<0?t===r-1&&t<this.max:!1}static isValidContext(t,r){if(r===void 0)return!1;if(typeof r!="number")throw new Error("Invalid context type passed to IntegerArbitrary (#1)");if(r!==0&&Qv(t)!==Qv(r))throw new Error("Invalid context value passed to IntegerArbitrary (#2)");return!0}},ex=Number.isInteger;function aj(e){return{min:e.min!==void 0?e.min:-2147483648,max:e.max!==void 0?e.max:2147483647}}function ae(e={}){let t=aj(e);if(t.min>t.max)throw new Error("fc.integer maximum value should be equal or greater than the minimum one");if(!ex(t.min))throw new Error("fc.integer minimum value should be an integer");if(!ex(t.max))throw new Error("fc.integer maximum value should be an integer");return new Bn(t.min,t.max)}var tx=new Map;function vf(e){if(e===void 0)return{depth:0};if(typeof e!="string")return e;let t=ut(tx,e);if(t!==void 0)return t;let r={depth:0};return Et(tx,e,r),r}function xf(){return{depth:0}}var lj=class{constructor(e,t,r){this.arb=e,this.mrng=t,this.biasFactor=r}attemptExact(){}next(){return this.arb.generate(this.mrng,this.biasFactor)}},cj=Math.min,uj=Math.max,dj=class{constructor(e,t,r,n){this.arb=e,this.mrng=t,this.slices=r,this.biasFactor=n,this.activeSliceIndex=0,this.nextIndexInSlice=0,this.lastIndexInSlice=-1}attemptExact(e){if(e!==0&&this.mrng.nextInt(1,this.biasFactor)===1){let t=[];for(let r=0;r!==this.slices.length;++r)this.slices[r].length===e&&N(t,r);if(t.length===0)return;this.activeSliceIndex=t[this.mrng.nextInt(0,t.length-1)],this.nextIndexInSlice=0,this.lastIndexInSlice=e-1}}next(){if(this.nextIndexInSlice<=this.lastIndexInSlice)return new $(this.slices[this.activeSliceIndex][this.nextIndexInSlice++],void 0);if(this.mrng.nextInt(1,this.biasFactor)!==1)return this.arb.generate(this.mrng,this.biasFactor);this.activeSliceIndex=this.mrng.nextInt(0,this.slices.length-1);let e=this.slices[this.activeSliceIndex];if(this.mrng.nextInt(1,this.biasFactor)!==1)return this.nextIndexInSlice=1,this.lastIndexInSlice=e.length-1,new $(e[0],void 0);let t=this.mrng.nextInt(0,e.length-1),r=this.mrng.nextInt(0,e.length-1);return this.nextIndexInSlice=cj(t,r),this.lastIndexInSlice=uj(t,r),new $(e[this.nextIndexInSlice++],void 0)}};function rx(e,t,r,n){return n===void 0||r.length===0||t.nextInt(1,n)!==1?new lj(e,t,n):new dj(e,t,r,n)}var pj=Math.floor,nx=Math.log,ox=Math.max,fj=Array.isArray;function vp(e,t){return e===t?e:e+pj(nx(t-e)/nx(2))}var Fk=class Bk extends ye{constructor(t,r,n,o,i,s,a){super(),this.arb=t,this.minLength=r,this.maxGeneratedLength=n,this.maxLength=o,this.setBuilder=s,this.customSlices=a,this.lengthArb=ae({min:r,max:n}),this.depthContext=vf(i)}preFilter(t){if(this.setBuilder===void 0)return t;let r=this.setBuilder();for(let n=0;n!==t.length;++n)r.tryAdd(t[n]);return r.getData()}static makeItCloneable(t,r){return t[Ue]=()=>{let n=[];for(let o=0;o!==r.length;++o)N(n,r[o].value);return this.makeItCloneable(n,r),n},t}generateNItemsNoDuplicates(t,r,n,o){let i=0,s=t(),a=rx(this.arb,n,this.customSlices,o);for(;s.size()<r&&i<this.maxGeneratedLength;){let l=a.next();s.tryAdd(l)?i=0:i+=1}return s.getData()}safeGenerateNItemsNoDuplicates(t,r,n,o){let i=ox(0,r-vp(this.minLength,this.maxGeneratedLength));this.depthContext.depth+=i;try{return this.generateNItemsNoDuplicates(t,r,n,o)}finally{this.depthContext.depth-=i}}generateNItems(t,r,n){let o=[],i=rx(this.arb,r,this.customSlices,n);i.attemptExact(t);for(let s=0;s!==t;++s)N(o,i.next());return o}safeGenerateNItems(t,r,n){let o=ox(0,t-vp(this.minLength,this.maxGeneratedLength));this.depthContext.depth+=o;try{return this.generateNItems(t,r,n)}finally{this.depthContext.depth-=o}}wrapper(t,r,n,o){let i=r?this.preFilter(t):t,s=!1,a=[],l=[];for(let c=0;c!==i.length;++c){let u=i[c];s=s||u.hasToBeCloned,N(a,u.value),N(l,u.context)}return s&&Bk.makeItCloneable(a,i),new $(a,{shrunkOnce:r,lengthContext:t.length===i.length&&n!==void 0?n:void 0,itemsContexts:l,startIndex:o})}generate(t,r){let n=this.applyBias(t,r),o=n.size,i=this.setBuilder!==void 0?this.safeGenerateNItemsNoDuplicates(this.setBuilder,o,t,n.biasFactorItems):this.safeGenerateNItems(o,t,n.biasFactorItems);return this.wrapper(i,!1,void 0,0)}applyBias(t,r){if(r===void 0)return{size:this.lengthArb.generate(t,void 0).value};if(this.minLength===this.maxGeneratedLength)return{size:this.lengthArb.generate(t,void 0).value,biasFactorItems:r};if(t.nextInt(1,r)!==1)return{size:this.lengthArb.generate(t,void 0).value};if(t.nextInt(1,r)!==1||this.minLength===this.maxGeneratedLength)return{size:this.lengthArb.generate(t,void 0).value,biasFactorItems:r};let n=vp(this.minLength,this.maxGeneratedLength);return{size:ae({min:this.minLength,max:n}).generate(t,void 0).value,biasFactorItems:r}}canShrinkWithoutContext(t){if(!fj(t)||this.minLength>t.length||t.length>this.maxLength)return!1;for(let r=0;r!==t.length;++r)if(!(r in t)||!this.arb.canShrinkWithoutContext(t[r]))return!1;return this.preFilter(K(t,r=>new $(r,void 0))).length===t.length}shrinkItemByItem(t,r,n){let o=[];for(let i=r.startIndex;i<n;++i)N(o,Ir(()=>this.arb.shrink(t[i],r.itemsContexts[i]).map(s=>{let a=K(Ge(t,0,i),(c,u)=>new $(Dn(c),r.itemsContexts[u])),l=K(Ge(t,i+1),(c,u)=>new $(Dn(c),r.itemsContexts[u+i+1]));return[[...a,s,...l],void 0,i]})));return H.nil().join(...o)}shrinkImpl(t,r){if(t.length===0)return H.nil();let n=r!==void 0?r:{shrunkOnce:!1,lengthContext:void 0,itemsContexts:[],startIndex:0};return this.lengthArb.shrink(t.length,n.lengthContext).drop(n.shrunkOnce&&n.lengthContext===void 0&&t.length>this.minLength+1?1:0).map(o=>{let i=t.length-o.value;return[K(Ge(t,i),(s,a)=>new $(Dn(s),n.itemsContexts[a+i])),o.context,0]}).join(Ir(()=>t.length>this.minLength?this.shrinkItemByItem(t,n,1):this.shrinkItemByItem(t,n,t.length))).join(t.length>this.minLength?Ir(()=>{let o={shrunkOnce:!1,lengthContext:void 0,itemsContexts:Ge(n.itemsContexts,1),startIndex:0};return this.shrinkImpl(Ge(t,1),o).filter(i=>this.minLength<=i[0].length+1).map(i=>[[new $(Dn(t[0]),n.itemsContexts[0]),...i[0]],void 0,0])}):H.nil())}shrink(t,r){return this.shrinkImpl(t,r).map(n=>this.wrapper(n[0],!0,n[1],n[2]))}},hj=Math.floor,mj=Math.min,en=2147483647,Ln=["xsmall","small","medium","large","xlarge"],gj=["-4","-3","-2","-1","=","+1","+2","+3","+4"],kf="small";function yj(e,t){switch(t){case"xsmall":return hj(1.1*e)+1;case"small":return 2*e+10;case"medium":return 11*e+100;case"large":return 101*e+1e3;case"xlarge":return 1001*e+1e4;default:throw new Error(`Unable to compute lengths based on received size: ${t}`)}}function li(e,t){let r=ir(gj,e);if(r===-1)return e;let n=ir(Ln,t);if(n===-1)throw new Error(`Unable to offset size based on the unknown defaulted one: ${t}`);let o=n+r-4;return o<0?Ln[0]:o>=Ln.length?Ln[Ln.length-1]:Ln[o]}function si(e,t,r,n){let{baseSize:o=kf,defaultSizeToMaxWhenMaxSpecified:i}=Pt()||{},s=e!==void 0?e:n&&i?"max":o;return s==="max"?r:mj(yj(t,li(s,o)),r)}function bj(e,t){if(typeof e=="number")return 1/e;let{baseSize:r=kf,defaultSizeToMaxWhenMaxSpecified:n}=Pt()||{},o=e!==void 0?e:t&&n?"max":r;if(o==="max")return 0;switch(li(o,r)){case"xsmall":return 1;case"small":return .5;case"medium":return .25;case"large":return .125;case"xlarge":return .0625}}function Rf(e){let{baseSize:t=kf}=Pt()||{};return e===void 0?t:li(e,t)}function de(e,t={}){let r=t.size,n=t.minLength||0,o=t.maxLength,i=t.depthIdentifier,s=o!==void 0?o:en;return new Fk(e,n,si(r,n,s,o!==void 0),s,i,void 0,t.experimentalCustomSlices||[])}function Pa(e){return e/O(2)}function ix(e,t,r){let n=e-t;function*o(){let s=r?void 0:t,a=r?n:Pa(n);for(let l=a;l>0;l=Pa(l)){let c=e-l;yield new $(c,s),s=c}}function*i(){let s=r?void 0:t,a=r?n:Pa(n);for(let l=a;l<0;l=Pa(l)){let c=e-l;yield new $(c,s),s=c}}return n>0?Ar(o()):Ar(i())}var wj=class Vk extends ye{constructor(t,r){super(),this.min=t,this.max=r}generate(t,r){let n=this.computeGenerateRange(t,r);return new $(t.nextBigInt(n.min,n.max),void 0)}computeGenerateRange(t,r){if(r===void 0||t.nextInt(1,r)!==1)return{min:this.min,max:this.max};let n=_k(this.min,this.max,rj);if(n.length===1)return n[0];let o=t.nextInt(-2*(n.length-1),n.length-2);return o<0?n[0]:n[o+1]}canShrinkWithoutContext(t){return typeof t=="bigint"&&this.min<=t&&t<=this.max}shrink(t,r){return Vk.isValidContext(t,r)?this.isLastChanceTry(t,r)?H.of(new $(r,void 0)):ix(t,r,!1):ix(t,this.defaultTarget(),!0)}defaultTarget(){return this.min<=0&&this.max>=0?O(0):this.min<0?this.max:this.min}isLastChanceTry(t,r){return t>0?t===r+O(1)&&t>this.min:t<0?t===r-O(1)&&t<this.max:!1}static isValidContext(t,r){if(r===void 0)return!1;if(typeof r!="bigint")throw new Error("Invalid context type passed to BigIntArbitrary (#1)");let n=t>0&&r<0||t<0&&r>0;if(r!==O(0)&&n)throw new Error("Invalid context value passed to BigIntArbitrary (#2)");return!0}};function Sj(e){let r=O(-1)<<O(255),n=(O(1)<<O(255))-O(1),o=e.min,i=e.max;return{min:o!==void 0?o:r-(i!==void 0&&i<O(0)?i*i:O(0)),max:i!==void 0?i:n+(o!==void 0&&o>O(0)?o*o:O(0))}}function vj(e){return e[0]===void 0?{}:e[1]===void 0?e[0]:{min:e[0],max:e[1]}}function Tr(...e){let t=Sj(vj(e));if(t.min>t.max)throw new Error("fc.bigInt expects max to be greater than or equal to min");return new wj(t.min,t.max)}var xj=Object.getPrototypeOf,Qo=class extends ye{constructor(e){super(),this.arb=e}generate(e,t){return this.arb.generate(e,void 0)}canShrinkWithoutContext(e){return this.arb.canShrinkWithoutContext(e)}shrink(e,t){return this.arb.shrink(e,t)}};function Ha(e){return xj(e)===Qo.prototype&&e.generate===Qo.prototype.generate&&e.canShrinkWithoutContext===Qo.prototype.canShrinkWithoutContext&&e.shrink===Qo.prototype.shrink?e:new Qo(e)}function kj(e){return e===1}function Rj(e){if(typeof e!="boolean")throw new Error("Unsupported input type");return e===!0?1:0}function ci(){return Ha(ae({min:0,max:1}).map(kj,Rj))}var ri=Object.is,Cj=class{constructor(e){this.values=e,this.fastValues=new _n(this.values);let t=!1,r=!1;if(Wa(this.fastValues,0))for(let n=0;n!==this.values.length;++n){let o=this.values[n];t=t||ri(o,-0),r=r||ri(o,0)}this.hasMinusZero=t,this.hasPlusZero=r}has(e){return e===0?ri(e,0)?this.hasPlusZero:this.hasMinusZero:Wa(this.fastValues,e)}},Uk=class extends ye{constructor(e){super(),this.values=e}generate(e,t){let r=this.values.length===1?0:e.nextInt(0,this.values.length-1),n=this.values[r];return Qr(n)?new $(n,r,()=>n[Ue]()):new $(n,r)}canShrinkWithoutContext(e){return this.values.length===1?ri(this.values[0],e):(this.fastValues===void 0&&(this.fastValues=new Cj(this.values)),this.fastValues.has(e))}shrink(e,t){return t===0||ri(e,this.values[0])?H.nil():H.of(new $(this.values[0],0))}};function Bt(...e){if(e.length===0)throw new Error("fc.constantFrom expects at least one parameter");return new Uk(e)}function Ej(e){return!e||!e.withBigInt?Bt(!1,null,void 0,0,"",NaN):Bt(!1,null,void 0,0,"",NaN,O(0))}function Oe(e){return new Uk([e])}var Pj=class Wk{constructor(){this.receivedLogs=[]}log(t){this.receivedLogs.push(t)}size(){return this.receivedLogs.length}toString(){return JSON.stringify({logs:this.receivedLogs})}[Ue](){return new Wk}};function Ij(){return Oe(new Pj)}var Aj=NaN,Tj=Number.isNaN;function Hk(e){return new Va(e)}function zk(e){if(!(e instanceof Va)||e.constructor!==Va)throw new L("Not a valid value for date unmapper");return Ua(e)}function Oj(e){return t=>t===e?new Va(Aj):Hk(t)}function Mj(e){return t=>{let r=zk(t);return Tj(r)?e:r}}var sx=Number.isNaN;function Gk(e={}){let t=e.min!==void 0?Ua(e.min):-864e13,r=e.max!==void 0?Ua(e.max):864e13,n=e.noInvalidDate;if(sx(t))throw new Error("fc.date min must be valid instance of Date");if(sx(r))throw new Error("fc.date max must be valid instance of Date");if(t>r)throw new Error("fc.date max must be greater or equal to min");if(n)return ae({min:t,max:r}).map(Hk,zk);let o=r+1;return ae({min:t,max:r+1}).map(Oj(o),Mj(o))}var Lj=class extends ye{constructor(e,t){super(),this.startArb=e,this.chainer=t}generate(e,t){let r=[],n=e.clone(),o=this.startArb.generate(e,t);for(r.push({arbitrary:this.startArb,value:o.value_,context:o.context,clonedMrng:n});;){let s=this.chainer(o.value_);if(s===void 0)break;let a=e.clone();o=s.generate(e,t),r.push({arbitrary:s,value:o.value_,context:o.context,clonedMrng:a})}let i={biasFactor:t,entries:r,currentShrinkLevel:0};return new $(o.value_,i)}canShrinkWithoutContext(e){return!1}shrink(e,t){return this.isSafeContext(t)?new H(this.shrinkIterator(t)):H.nil()}*shrinkIterator(e){let{entries:t,currentShrinkLevel:r,biasFactor:n}=e;for(let o=r;o<t.length;++o){let i=t[o],s=i.arbitrary.shrink(i.value,i.context);for(let a of s){let l=t.slice(0,o);l.push({arbitrary:i.arbitrary,value:a.value_,context:a.context,clonedMrng:i.clonedMrng});let c=a,u=i.clonedMrng.clone();for(;;){let h=this.chainer(c.value_);if(h===void 0)break;let f=u.clone(),m=h.generate(u,n);l.push({arbitrary:h,value:m.value_,context:m.context,clonedMrng:f}),c=m}let d=l[l.length-1],p={biasFactor:n,entries:l,currentShrinkLevel:o};yield new $(d.value,p)}}}isSafeContext(e){return e!=null&&typeof e=="object"&&"biasFactor"in e&&"entries"in e&&"currentShrinkLevel"in e}};function Nj(e,t){return new Lj(e,t)}var $j=Symbol.iterator,Dj=Array.isArray,_j=Object.is,jj=class qk extends ye{constructor(t,r){super(),this.arb=t,this.numValues=r}generate(t,r){let n=[];if(this.numValues<=0)return this.wrapper(n);for(let o=0;o!==this.numValues-1;++o)N(n,this.arb.generate(t.clone(),r));return N(n,this.arb.generate(t,r)),this.wrapper(n)}canShrinkWithoutContext(t){if(!Dj(t)||t.length!==this.numValues)return!1;if(t.length===0)return!0;for(let r=1;r<t.length;++r)if(!_j(t[0],t[r]))return!1;return this.arb.canShrinkWithoutContext(t[0])}shrink(t,r){return t.length===0?H.nil():new H(this.shrinkImpl(t,r!==void 0?r:[])).map(n=>this.wrapper(n))}*shrinkImpl(t,r){let n=K(t,(i,s)=>this.arb.shrink(i,r[s])[$j]()),o=K(n,i=>i.next());for(;!o[0].done;)yield K(o,i=>i.value),o=K(n,i=>i.next())}static makeItCloneable(t,r){return t[Ue]=()=>{let n=[];for(let o=0;o!==r.length;++o)N(n,r[o].value);return this.makeItCloneable(n,r),n},t}wrapper(t){let r=!1,n=[],o=[];for(let i=0;i!==t.length;++i){let s=t[i];r=r||s.hasToBeCloned,N(n,s.value),N(o,s.context)}return r&&qk.makeItCloneable(n,t),new $(n,o)}};function Fj(e,t){return new jj(e,t)}var ax=class{constructor(e){this.isEqual=e,this.data=[]}tryAdd(e){for(let t=0;t!==this.data.length;++t)if(this.isEqual(this.data[t],e))return!1;return N(this.data,e),!0}size(){return this.data.length}getData(){return this.data}},Bj=Number.isNaN,Vj=class{constructor(e){this.selector=e,this.selectedItemsExceptNaN=new _n,this.data=[]}tryAdd(e){let t=this.selector(e);if(Bj(t))return N(this.data,e),!0;let r=this.selectedItemsExceptNaN.size;return ni(this.selectedItemsExceptNaN,t),r!==this.selectedItemsExceptNaN.size?(N(this.data,e),!0):!1}size(){return this.data.length}getData(){return this.data}},Uj=Object.is,Wj=class{constructor(e){this.selector=e,this.selectedItemsExceptMinusZero=new _n,this.data=[],this.hasMinusZero=!1}tryAdd(e){let t=this.selector(e);if(Uj(t,-0))return this.hasMinusZero?!1:(N(this.data,e),this.hasMinusZero=!0,!0);let r=this.selectedItemsExceptMinusZero.size;return ni(this.selectedItemsExceptMinusZero,t),r!==this.selectedItemsExceptMinusZero.size?(N(this.data,e),!0):!1}size(){return this.data.length}getData(){return this.data}},Hj=class{constructor(e){this.selector=e,this.selectedItems=new _n,this.data=[]}tryAdd(e){let t=this.selector(e),r=this.selectedItems.size;return ni(this.selectedItems,t),r!==this.selectedItems.size?(N(this.data,e),!0):!1}size(){return this.data.length}getData(){return this.data}};function zj(e){if(typeof e.comparator=="function"){if(e.selector===void 0){let a=e.comparator,l=(c,u)=>a(c.value_,u.value_);return()=>new ax(l)}let n=e.comparator,o=e.selector,i=a=>o(a.value_),s=(a,l)=>n(i(a),i(l));return()=>new ax(s)}let t=e.selector||(n=>n),r=n=>t(n.value_);switch(e.comparator){case"IsStrictlyEqual":return()=>new Vj(r);case"SameValueZero":return()=>new Hj(r);case"SameValue":case void 0:return()=>new Wj(r)}}function tn(e,t={}){let r=t.minLength!==void 0?t.minLength:0,n=t.maxLength!==void 0?t.maxLength:en,o=si(t.size,r,n,t.maxLength!==void 0),i=t.depthIdentifier,s=new Fk(e,r,o,n,i,zj(t),[]);return r===0?s:s.filter(a=>a.length>=r)}var Gj=Object.create,qj=Object.defineProperty,Kj=Object.getOwnPropertyDescriptor,lx=Object.getPrototypeOf,Jj=Object.prototype,Yj=Reflect.ownKeys;function Xj(e){let t=e[1]?Gj(null):{};for(let r of e[0])qj(t,r[0],{enumerable:!0,configurable:!0,writable:!0,value:r[1]});return t}function Zj(e){return e!==void 0&&!!e.configurable&&!!e.enumerable&&!!e.writable&&e.get===void 0&&e.set===void 0}function Qj(e){if(typeof e!="object"||e===null)throw new L("Incompatible instance received: should be a non-null object");let t=lx(e)===null,r=lx(e)===Jj;if(!t&&!r)throw new L("Incompatible instance received: should be of exact type Object");let n=K(Yj(e),o=>[o,Kj(e,o)]);if(!fk(n,([,o])=>Zj(o)))throw new L("Incompatible instance received: should contain only c/e/w properties without get/set");return[K(n,([o,i])=>[o,i.value]),t]}function eF(e){return e[0]}function Cf(e,t,r={}){let n=!!r.noNullPrototype;return z(tn(z(e,t),{minLength:r.minKeys,maxLength:r.maxKeys,size:r.size,selector:eF,depthIdentifier:r.depthIdentifier}),n?Oe(!1):ci()).map(Xj,Qj)}var tF=Number.POSITIVE_INFINITY,rF=Number.MAX_SAFE_INTEGER,nF=Number.isInteger,oF=Math.floor,iF=Math.pow,sF=Math.min,zp=class Kk extends ye{static from(t,r,n){if(t.length===0)throw new Error(`${n} expects at least one weighted arbitrary`);let o=0;for(let i=0;i!==t.length;++i){if(t[i].arbitrary===void 0)throw new Error(`${n} expects arbitraries to be specified`);let s=t[i].weight;if(o+=s,!nF(s))throw new Error(`${n} expects weights to be integer values`);if(s<0)throw new Error(`${n} expects weights to be superior or equal to 0`)}if(o<=0)throw new Error(`${n} expects the sum of weights to be strictly superior to 0`);return new Kk(t,{depthBias:bj(r.depthSize,r.maxDepth!==void 0),maxDepth:r.maxDepth!==void 0?r.maxDepth:tF,withCrossShrink:!!r.withCrossShrink},vf(r.depthIdentifier))}constructor(t,r,n){super(),this.warbs=t,this.constraints=r,this.context=n;let o=0;this.cumulatedWeights=[];for(let i=0;i!==t.length;++i)o+=t[i].weight,N(this.cumulatedWeights,o);this.totalWeight=o}generate(t,r){if(this.mustGenerateFirst())return this.safeGenerateForIndex(t,0,r);let n=t.nextInt(this.computeNegDepthBenefit(),this.totalWeight-1);for(let o=0;o!==this.cumulatedWeights.length;++o)if(n<this.cumulatedWeights[o])return this.safeGenerateForIndex(t,o,r);throw new Error("Unable to generate from fc.frequency")}canShrinkWithoutContext(t){return this.canShrinkWithoutContextIndex(t)!==-1}shrink(t,r){if(r!==void 0){let o=r,i=o.selectedIndex,s=o.originalBias,a=this.warbs[i].arbitrary.shrink(t,o.originalContext).map(l=>this.mapIntoValue(i,l,null,s));if(o.clonedMrngForFallbackFirst!==null){o.cachedGeneratedForFirst===void 0&&(o.cachedGeneratedForFirst=this.safeGenerateForIndex(o.clonedMrngForFallbackFirst,0,s));let l=o.cachedGeneratedForFirst;return H.of(l).join(a)}return a}let n=this.canShrinkWithoutContextIndex(t);return n===-1?H.nil():this.defaultShrinkForFirst(n).join(this.warbs[n].arbitrary.shrink(t,void 0).map(o=>this.mapIntoValue(n,o,null,void 0)))}defaultShrinkForFirst(t){++this.context.depth;try{if(!this.mustFallbackToFirstInShrink(t)||this.warbs[0].fallbackValue===void 0)return H.nil()}finally{--this.context.depth}let r=new $(this.warbs[0].fallbackValue.default,void 0);return H.of(this.mapIntoValue(0,r,null,void 0))}canShrinkWithoutContextIndex(t){if(this.mustGenerateFirst())return this.warbs[0].arbitrary.canShrinkWithoutContext(t)?0:-1;try{++this.context.depth;for(let r=0;r!==this.warbs.length;++r){let n=this.warbs[r];if(n.weight!==0&&n.arbitrary.canShrinkWithoutContext(t))return r}return-1}finally{--this.context.depth}}mapIntoValue(t,r,n,o){let i={selectedIndex:t,originalBias:o,originalContext:r.context,clonedMrngForFallbackFirst:n};return new $(r.value,i)}safeGenerateForIndex(t,r,n){++this.context.depth;try{let o=this.warbs[r].arbitrary.generate(t,n),i=this.mustFallbackToFirstInShrink(r)?t.clone():null;return this.mapIntoValue(r,o,i,n)}finally{--this.context.depth}}mustGenerateFirst(){return this.constraints.maxDepth<=this.context.depth}mustFallbackToFirstInShrink(t){return t!==0&&this.constraints.withCrossShrink&&this.warbs[0].weight!==0}computeNegDepthBenefit(){let t=this.constraints.depthBias;if(t<=0||this.warbs[0].weight===0)return 0;let r=oF(iF(1+t,this.context.depth))-1;return-sF(this.totalWeight*r,rF)||0}};function aF(e){return e!=null&&typeof e=="object"&&!("generate"in e)&&!("arbitrary"in e)&&!("weight"in e)}function cx(e){return rk(e)?{arbitrary:e,weight:1}:e}function Ve(...e){let t=e[0];if(aF(t)){let n=K(Ge(e,1),cx);return zp.from(n,t,"fc.oneof")}let r=K(e,cx);return zp.from(r,{},"fc.oneof")}var lF=Number.isInteger;function Pr(e){let t=typeof e=="number"?e:e&&e.max!==void 0?e.max:2147483647;if(t<0)throw new Error("fc.nat value should be greater than or equal to 0");if(!lF(t))throw new Error("fc.nat maximum value should be an integer");return new Bn(0,t)}var cF=Object.is;function uF(e){let t=0,r=[];for(let n of e){let o=t;t=o+n.num;let i=t-1;r.push({from:o,to:i,entry:n})}return r}function dF(e,t){let r=0,n=e.length;for(;n-r>1;){let o=~~((r+n)/2);t<e[o].from?n=o:r=o}return e[r]}function pF(e){let t=uF(e);return function(n){let o=dF(t,n);return o.entry.build(n-o.from)}}function fF(e){let t={mapping:new ar,negativeZeroIndex:void 0},r=0;for(let n=0;n!==e.length;++n){let o=e[n];for(let i=0;i!==o.num;++i){let s=o.build(i);s===0&&1/s===sr.NEGATIVE_INFINITY?t.negativeZeroIndex=r:Et(t.mapping,s,r),++r}}return t}function hF(e){let t=null;return function(n){t===null&&(t=fF(e));let o=cF(n,-0)?t.negativeZeroIndex:ut(t.mapping,n);if(o===void 0)throw new L("Unknown value encountered cannot be built using this mapToConstant");return o}}function mF(e){if(e.length===0)throw new L("fc.mapToConstant expects at least one option");let t=0;for(let r=0;r!==e.length;++r){if(e[r].num<0)throw new L("fc.mapToConstant expects all options to have a number of entries greater or equal to zero");t+=e[r].num}if(t===0)throw new L("fc.mapToConstant expects at least one choice among options");return t}function Vn(...e){return Pr({max:mF(e)-1}).map(pF(e),hF(e))}function Jk(e,t,r,n){if(t.length===0)return r>0?void 0:[];if(n<=0)return;let o=[{endIndexChunks:0,nextStartIndex:1,chunks:[]}];for(;o.length>0;){let i=uk(o);for(let s=i.nextStartIndex;s<=t.length;++s){let a=Ce(t,i.endIndexChunks,s);if(e.canShrinkWithoutContext(a)){let l=[...i.chunks,a];if(s===t.length){if(l.length<r)break;return l}N(o,{endIndexChunks:i.endIndexChunks,nextStartIndex:s+1,chunks:i.chunks}),l.length<n&&N(o,{endIndexChunks:s,nextStartIndex:s+1,chunks:l});break}}}}function gF(e){return ge(e,"")}function Yk(e){return e.minLength!==void 0?e.minLength:0}function Xk(e){return e.maxLength!==void 0?e.maxLength:en}function yF(e,t){return Yk(t)<=e.length&&e.length<=Xk(t)}function bF(e,t){return function(n){if(typeof n!="string")throw new L("Unsupported value");let o=Jk(e,n,Yk(t),Xk(t));if(o===void 0)throw new L("Unable to unmap received string");return o}}var Zk=["__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__","__proto__","constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf","apply","arguments","bind","call","caller","length","name","prototype","key","ref"];function wF(e,t,r){let n;try{n=r(e)}catch{return}for(let o of n)if(!t.canShrinkWithoutContext(o))return;return n}function SF(e,t){let r=[];for(let n of Zk){let o=wF(n,e,t);o!==void 0&&N(r,o)}return r}var ux=new WeakMap;function vF(e){let t=[];for(let r of Zk){let n=Jk(e,r,0,en);n!==void 0&&N(t,n)}return t}function xF(e,t){let r=S3(ux,e);r===void 0&&(r=vF(e),w3(ux,e,r));let n=[];for(let o of r)yF(o,t)&&N(n,o);return n}var kF=[[0,127]],RF=[[0,55295],[57344,1114111]],CF=[[32,126],[160,172],[174,767],[880,887],[890,895],[900,906],[908],[910,929],[931,1154],[1162,1327],[1329,1366],[1369,1418],[1421,1423],[1470],[1472],[1475],[1478],[1488,1514],[1519,1524],[1542,1551],[1563],[1565,1610],[1632,1647],[1649,1749],[1758],[1765,1766],[1769],[1774,1805],[1808],[1810,1839],[1869,1957],[1969],[1984,2026],[2036,2042],[2046,2069],[2074],[2084],[2088],[2096,2110],[2112,2136],[2142],[2144,2154],[2160,2190],[2208,2249],[2308,2361],[2365],[2384],[2392,2401],[2404,2432],[2437,2444],[2447,2448],[2451,2472],[2474,2480],[2482],[2486,2489],[2493],[2510],[2524,2525],[2527,2529],[2534,2557],[2565,2570],[2575,2576],[2579,2600],[2602,2608],[2610,2611],[2613,2614],[2616,2617],[2649,2652],[2654],[2662,2671],[2674,2676],[2678],[2693,2701],[2703,2705],[2707,2728],[2730,2736],[2738,2739],[2741,2745],[2749],[2768],[2784,2785],[2790,2801],[2809],[2821,2828],[2831,2832],[2835,2856],[2858,2864],[2866,2867],[2869,2873],[2877],[2908,2909],[2911,2913],[2918,2935],[2947],[2949,2954],[2958,2960],[2962,2965],[2969,2970],[2972],[2974,2975],[2979,2980],[2984,2986],[2990,3001],[3024],[3046,3066],[3077,3084],[3086,3088],[3090,3112],[3114,3129],[3133],[3160,3162],[3165],[3168,3169],[3174,3183],[3191,3200],[3204,3212],[3214,3216],[3218,3240],[3242,3251],[3253,3257],[3261],[3293,3294],[3296,3297],[3302,3311],[3313,3314],[3332,3340],[3342,3344],[3346,3386],[3389],[3407],[3412,3414],[3416,3425],[3430,3455],[3461,3478],[3482,3505],[3507,3515],[3517],[3520,3526],[3558,3567],[3572],[3585,3632],[3634],[3647,3654],[3663,3675],[3713,3714],[3716],[3718,3722],[3724,3747],[3749],[3751,3760],[3762],[3773],[3776,3780],[3782],[3792,3801],[3804,3807],[3840,3863],[3866,3892],[3894],[3896],[3898,3901],[3904,3911],[3913,3948],[3973],[3976,3980],[4030,4037],[4039,4044],[4046,4058],[4096,4138],[4159,4181],[4186,4189],[4193],[4197,4198],[4206,4208],[4213,4225],[4238],[4240,4249],[4254,4293],[4295],[4301],[4304,4351],[4608,4680],[4682,4685],[4688,4694],[4696],[4698,4701],[4704,4744],[4746,4749],[4752,4784],[4786,4789],[4792,4798],[4800],[4802,4805],[4808,4822],[4824,4880],[4882,4885],[4888,4954],[4960,4988],[4992,5017],[5024,5109],[5112,5117],[5120,5788],[5792,5880],[5888,5905],[5919,5937],[5941,5942],[5952,5969],[5984,5996],[5998,6e3],[6016,6067],[6100,6108],[6112,6121],[6128,6137],[6144,6154],[6160,6169],[6176,6264],[6272,6276],[6279,6312],[6314],[6320,6389],[6400,6430],[6464],[6468,6509],[6512,6516],[6528,6571],[6576,6601],[6608,6618],[6622,6678],[6686,6740],[6784,6793],[6800,6809],[6816,6829],[6917,6963],[6981,6988],[6992,7018],[7028,7038],[7043,7072],[7086,7141],[7164,7203],[7227,7241],[7245,7304],[7312,7354],[7357,7367],[7379],[7401,7404],[7406,7411],[7413,7414],[7418],[7424,7615],[7680,7957],[7960,7965],[7968,8005],[8008,8013],[8016,8023],[8025],[8027],[8029],[8031,8061],[8064,8116],[8118,8132],[8134,8147],[8150,8155],[8157,8175],[8178,8180],[8182,8190],[8192,8202],[8208,8233],[8239,8287],[8304,8305],[8308,8334],[8336,8348],[8352,8384],[8448,8587],[8592,9254],[9280,9290],[9312,11123],[11126,11157],[11159,11502],[11506,11507],[11513,11557],[11559],[11565],[11568,11623],[11631,11632],[11648,11670],[11680,11686],[11688,11694],[11696,11702],[11704,11710],[11712,11718],[11720,11726],[11728,11734],[11736,11742],[11776,11869],[11904,11929],[11931,12019],[12032,12245],[12272,12329],[12336,12351],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12771],[12783,12830],[12832,13312],[19903,19968],[40959,42124],[42128,42182],[42192,42539],[42560,42606],[42611],[42622,42653],[42656,42735],[42738,42743],[42752,42954],[42960,42961],[42963],[42965,42969],[42994,43009],[43011,43013],[43015,43018],[43020,43042],[43048,43051],[43056,43065],[43072,43127],[43138,43187],[43214,43225],[43250,43262],[43264,43301],[43310,43334],[43359],[43396,43442],[43457,43469],[43471,43481],[43486,43492],[43494,43518],[43520,43560],[43584,43586],[43588,43595],[43600,43609],[43612,43642],[43646,43695],[43697],[43701,43702],[43705,43709],[43712],[43714],[43739,43754],[43760,43764],[43777,43782],[43785,43790],[43793,43798],[43808,43814],[43816,43822],[43824,43883],[43888,44002],[44011],[44016,44025],[44032],[55203],[63744,64109],[64112,64217],[64256,64262],[64275,64279],[64285],[64287,64310],[64312,64316],[64318],[64320,64321],[64323,64324],[64326,64450],[64467,64911],[64914,64967],[64975],[65008,65023],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65136,65140],[65142,65276],[65281,65437],[65440,65470],[65474,65479],[65482,65487],[65490,65495],[65498,65500],[65504,65510],[65512,65518],[65532,65533],[65536,65547],[65549,65574],[65576,65594],[65596,65597],[65599,65613],[65616,65629],[65664,65786],[65792,65794],[65799,65843],[65847,65934],[65936,65948],[65952],[66e3,66044],[66176,66204],[66208,66256],[66273,66299],[66304,66339],[66349,66378],[66384,66421],[66432,66461],[66463,66499],[66504,66517],[66560,66717],[66720,66729],[66736,66771],[66776,66811],[66816,66855],[66864,66915],[66927,66938],[66940,66954],[66956,66962],[66964,66965],[66967,66977],[66979,66993],[66995,67001],[67003,67004],[67072,67382],[67392,67413],[67424,67431],[67456,67461],[67463,67504],[67506,67514],[67584,67589],[67592],[67594,67637],[67639,67640],[67644],[67647,67669],[67671,67742],[67751,67759],[67808,67826],[67828,67829],[67835,67867],[67871,67897],[67903],[67968,68023],[68028,68047],[68050,68096],[68112,68115],[68117,68119],[68121,68149],[68160,68168],[68176,68184],[68192,68255],[68288,68324],[68331,68342],[68352,68405],[68409,68437],[68440,68466],[68472,68497],[68505,68508],[68521,68527],[68608,68680],[68736,68786],[68800,68850],[68858,68899],[68912,68921],[69216,69246],[69248,69289],[69293],[69296,69297],[69376,69415],[69424,69445],[69457,69465],[69488,69505],[69510,69513],[69552,69579],[69600,69622],[69635,69687],[69703,69709],[69714,69743],[69745,69746],[69749],[69763,69807],[69819,69820],[69822,69825],[69840,69864],[69872,69881],[69891,69926],[69942,69956],[69959],[69968,70002],[70004,70006],[70019,70066],[70081],[70084,70088],[70093],[70096,70111],[70113,70132],[70144,70161],[70163,70187],[70200,70205],[70207,70208],[70272,70278],[70280],[70282,70285],[70287,70301],[70303,70313],[70320,70366],[70384,70393],[70405,70412],[70415,70416],[70419,70440],[70442,70448],[70450,70451],[70453,70457],[70461],[70480],[70493,70497],[70656,70708],[70727,70747],[70749],[70751,70753],[70784,70831],[70852,70855],[70864,70873],[71040,71086],[71105,71131],[71168,71215],[71233,71236],[71248,71257],[71264,71276],[71296,71338],[71352,71353],[71360,71369],[71424,71450],[71472,71494],[71680,71723],[71739],[71840,71922],[71935,71942],[71945],[71948,71955],[71957,71958],[71960,71983],[72004,72006],[72016,72025],[72096,72103],[72106,72144],[72161,72163],[72192],[72203,72242],[72255,72262],[72272],[72284,72323],[72346,72354],[72368,72440],[72448,72457],[72704,72712],[72714,72750],[72768,72773],[72784,72812],[72816,72847],[72960,72966],[72968,72969],[72971,73008],[73040,73049],[73056,73061],[73063,73064],[73066,73097],[73112],[73120,73129],[73440,73458],[73463,73464],[73476,73488],[73490,73523],[73539,73561],[73648],[73664,73713],[73727,74649],[74752,74862],[74864,74868],[74880,75075],[77712,77810],[77824,78895],[78913,78918],[82944,83526],[92160,92728],[92736,92766],[92768,92777],[92782,92862],[92864,92873],[92880,92909],[92917],[92928,92975],[92983,92997],[93008,93017],[93019,93025],[93027,93047],[93053,93071],[93760,93850],[93952,94026],[94032],[94099,94111],[94176,94179],[94208],[100343],[100352,101589],[101632],[101640],[110576,110579],[110581,110587],[110589,110590],[110592,110882],[110898],[110928,110930],[110933],[110948,110951],[110960,111355],[113664,113770],[113776,113788],[113792,113800],[113808,113817],[113820],[113823],[118608,118723],[118784,119029],[119040,119078],[119081,119140],[119146,119148],[119171,119172],[119180,119209],[119214,119274],[119296,119361],[119365],[119488,119507],[119520,119539],[119552,119638],[119648,119672],[119808,119892],[119894,119964],[119966,119967],[119970],[119973,119974],[119977,119980],[119982,119993],[119995],[119997,120003],[120005,120069],[120071,120074],[120077,120084],[120086,120092],[120094,120121],[120123,120126],[120128,120132],[120134],[120138,120144],[120146,120485],[120488,120779],[120782,121343],[121399,121402],[121453,121460],[121462,121475],[121477,121483],[122624,122654],[122661,122666],[122928,122989],[123136,123180],[123191,123197],[123200,123209],[123214,123215],[123536,123565],[123584,123627],[123632,123641],[123647],[124112,124139],[124144,124153],[124896,124902],[124904,124907],[124909,124910],[124912,124926],[124928,125124],[125127,125135],[125184,125251],[125259],[125264,125273],[125278,125279],[126065,126132],[126209,126269],[126464,126467],[126469,126495],[126497,126498],[126500],[126503],[126505,126514],[126516,126519],[126521],[126523],[126530],[126535],[126537],[126539],[126541,126543],[126545,126546],[126548],[126551],[126553],[126555],[126557],[126559],[126561,126562],[126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[126704,126705],[126976,127019],[127024,127123],[127136,127150],[127153,127167],[127169,127183],[127185,127221],[127232,127405],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127994],[128e3,128727],[128732,128748],[128752,128764],[128768,128886],[128891,128985],[128992,129003],[129008],[129024,129035],[129040,129095],[129104,129113],[129120,129159],[129168,129197],[129200,129201],[129280,129619],[129632,129645],[129648,129660],[129664,129672],[129680,129725],[129727,129733],[129742,129755],[129760,129768],[129776,129784],[129792,129938],[129940,129994],[130032,130041],[131072],[173791],[173824],[177977],[177984],[178205],[178208],[183969],[183984],[191456],[191472],[192093],[194560,195101],[196608],[201546],[201552],[205743]],EF=[[192,197],[199,207],[209,214],[217,221],[224,229],[231,239],[241,246],[249,253],[255,271],[274,293],[296,304],[308,311],[313,318],[323,328],[332,337],[340,357],[360,382],[416,417],[431,432],[461,476],[478,483],[486,496],[500,501],[504,539],[542,543],[550,563],[901,902],[904,906],[908],[910,912],[938,944],[970,974],[979,980],[1024,1025],[1027],[1031],[1036,1038],[1049],[1081],[1104,1105],[1107],[1111],[1116,1118],[1142,1143],[1217,1218],[1232,1235],[1238,1239],[1242,1247],[1250,1255],[1258,1269],[1272,1273],[1570,1574],[1728],[1730],[1747],[2345],[2353],[2356],[2392,2399],[2524,2525],[2527],[2611],[2614],[2649,2651],[2654],[2908,2909],[2964],[3907],[3917],[3922],[3927],[3932],[3945],[4134],[6918],[6920],[6922],[6924],[6926],[6930],[7680,7833],[7835],[7840,7929],[7936,7957],[7960,7965],[7968,8005],[8008,8013],[8016,8023],[8025],[8027],[8029],[8031,8048],[8050],[8052],[8054],[8056],[8058],[8060],[8064,8116],[8118,8122],[8124],[8129,8132],[8134,8136],[8138],[8140,8146],[8150,8154],[8157,8162],[8164,8170],[8172,8173],[8178,8180],[8182,8184],[8186],[8188],[8602,8603],[8622],[8653,8655],[8708],[8713],[8716],[8740],[8742],[8769],[8772],[8775],[8777],[8800],[8802],[8813,8817],[8820,8821],[8824,8825],[8832,8833],[8836,8837],[8840,8841],[8876,8879],[8928,8931],[8938,8941],[10972],[12364],[12366],[12368],[12370],[12372],[12374],[12376],[12378],[12380],[12382],[12384],[12386],[12389],[12391],[12393],[12400,12401],[12403,12404],[12406,12407],[12409,12410],[12412,12413],[12436],[12446],[12460],[12462],[12464],[12466],[12468],[12470],[12472],[12474],[12476],[12478],[12480],[12482],[12485],[12487],[12489],[12496,12497],[12499,12500],[12502,12503],[12505,12506],[12508,12509],[12532],[12535,12538],[12542],[44032],[55203],[64285],[64287],[64298,64310],[64312,64316],[64318],[64320,64321],[64323,64324],[64326,64334],[69786],[69788],[69803],[119134,119140],[119227,119232]],dx=String.fromCodePoint,PF=Math.min,IF=Math.max;function Gp(e){if(e.length===1){let r=dx(e[0]);return{num:1,build:()=>r}}let t=e[0];return{num:e[1]-e[0]+1,build:r=>dx(t+r)}}function px(e,t){let r=[],n=0,o=0;for(;n<e.length&&o<t.length;){let i=e[n],s=i[0],a=i.length===1?i[0]:i[1],l=t[o],c=l[0],u=l.length===1?l[0]:l[1];if(a<c)n+=1;else if(u<s)o+=1;else{let d=IF(s,c),p=PF(a,u);if(r.length>=1){let h=r[r.length-1];(h.length===1?h[0]:h[1])+1===d&&(d=h[0],uk(r))}N(r,d===p?[d]:[d,p]),a<=p&&(n+=1),u<=p&&(o+=1)}}return r}var fx=Object.create(null);function AF(e){switch(e){case"full":return RF;case"ascii":return kF}}function TF(e,t){let r=`${e}:${t}`,n=fx[r];if(n!==void 0)return n;let o=AF(t),i=e==="binary"?o:px(o,CF),s=[];for(let l of i)N(s,Gp(l));if(e==="grapheme"){let l=px(o,EF);for(let c of l){let u=Gp(c);N(s,{num:u.num,build:d=>j3(u.build(d),"NFD")})}}let a=Vn(...s);return fx[r]=a,a}function ei(e,t){return TF(e,t)}function OF(e){if(typeof e.unit=="object")return e.unit;switch(e.unit){case"grapheme":return ei("grapheme","full");case"grapheme-composite":return ei("composite","full");case"grapheme-ascii":case void 0:return ei("grapheme","ascii");case"binary":return ei("binary","full");case"binary-ascii":return ei("binary","ascii")}}function De(e={}){let t=OF(e),r=bF(t,e),n=xF(t,e);return de(t,{...e,experimentalCustomSlices:n}).map(gF,r)}var Qk=Map,Ef=String.fromCharCode,Pf={num:26,build:e=>Ef(e+97)},MF={num:26,build:e=>Ef(e+65)},e1={num:10,build:e=>Ef(e+48)};function LF(e){let t=XD(e);return e!==t?t:`%${oi(jn(e,0),16)}`}function NF(e){if(typeof e!="string")throw new Error("Unsupported");return decodeURIComponent(e)}var $F=()=>De({unit:"binary",minLength:1,maxLength:1}).map(LF,NF),xp;function DF(){return xp===void 0&&(xp=Vn(Pf)),xp}var Ia;function qp(e){Ia===void 0&&(Ia=new Qk);let t=ut(Ia,e);return t===void 0&&(t=Vn(Pf,e1,{num:e.length,build:r=>e[r]}),Et(Ia,e,t)),t}function _F(e){return Vn(Pf,MF,e1,{num:e.length,build:t=>e[t]})}var Aa;function If(e){Aa===void 0&&(Aa=new Qk);let t=ut(Aa,e);return t===void 0&&(t=Ve({weight:10,arbitrary:_F(e)},{weight:1,arbitrary:$F()}),Et(Aa,e,t)),t}function cr(e,t={}){let r=t.freq===void 0?6:t.freq,n=hk(t,"nil")?t.nil:null,o=[{arbitrary:Oe(n),weight:1,fallbackValue:{default:n}},{arbitrary:e,weight:r-1}],i={withCrossShrink:!0,depthSize:t.depthSize,maxDepth:t.maxDepth,depthIdentifier:t.depthIdentifier};return zp.from(o,i,"fc.option")}function jF(e){return e.length>63?!1:e.length<4||e[0]!=="x"||e[1]!=="n"||e[2]!=="-"||e[3]!=="-"}var t1=Symbol("adapted-value");function FF(e,t){let r=t(e.value_);return r.adapted?new $(r.value,t1):e}var BF=class extends ye{constructor(e,t){super(),this.sourceArb=e,this.adapter=t,this.adaptValue=r=>FF(r,t)}generate(e,t){let r=this.sourceArb.generate(e,t);return this.adaptValue(r)}canShrinkWithoutContext(e){return this.sourceArb.canShrinkWithoutContext(e)&&!this.adapter(e).adapted}shrink(e,t){return t===t1?this.sourceArb.canShrinkWithoutContext(e)?this.sourceArb.shrink(e,void 0).map(this.adaptValue):H.nil():this.sourceArb.shrink(e,t).map(this.adaptValue)}};function r1(e,t){return new BF(e,t)}function VF([e,t]){return t===null?e:`${e}${t[0]}${t[1]}`}function UF(e){if(typeof e!="string"||e.length===0)throw new Error("Unsupported");return e.length===1?[e[0],null]:[e[0],[Ce(e,1,e.length-1),e[e.length-1]]]}function WF(e){let t=qp("");return z(t,cr(z(De({unit:qp("-"),size:e,maxLength:61}),t))).map(VF,UF).filter(jF)}function HF(e){return`${ge(e[0],".")}.${e[1]}`}function zF(e){if(typeof e!="string")throw new Error("Unsupported type");let t=e.lastIndexOf(".");return[Qe(Ce(e,0,t),"."),Ce(e,t+1)]}function GF(e){let[t,r]=e,n=r.length;for(let o=0;o!==t.length;++o)if(n+=1+t[o].length,n>255)return{adapted:!0,value:[Ge(t,0,o),r]};return{adapted:!1,value:e}}function Af(e={}){let t=Rf(e.size),r=li("-1",t),n=De({unit:DF(),minLength:2,maxLength:63,size:r});return r1(z(de(WF(t),{size:r,minLength:1,maxLength:127}),n),GF).map(HF,zF)}function qF(e){let t=e[0].length;for(let r=1;r!==e.length;++r)if(t+=1+e[r].length,t>64)return{adapted:!0,value:Ge(e,0,r)};return{adapted:!1,value:e}}function KF(e){return ge(e,".")}function JF(e){if(typeof e!="string")throw new Error("Unsupported");return Qe(e,".")}function YF(e){return`${e[0]}@${e[1]}`}function XF(e){if(typeof e!="string")throw new Error("Unsupported");return Qe(e,"@",2)}function ZF(e={}){return z(r1(de(De({unit:qp("!#$%&'*+-/=?^_`{|}~"),minLength:1,maxLength:64,size:e.size}),{minLength:1,maxLength:32,size:e.size}),qF).map(KF,JF),Af({size:e.size})).map(YF,XF)}var QF=sr.NEGATIVE_INFINITY,Kp=sr.POSITIVE_INFINITY,n1=sr.EPSILON,Tf=O(2146435072)*O(4294967296),e8=-Tf-O(1),hx=4503599627370496,t8=O(0xfffffffffffff),mx=O("9007199254740992"),Jp=new Float64Array(1),gx=new Uint32Array(Jp.buffer,Jp.byteOffset);function r8(e){return Jp[0]=e,[gx[1],gx[0]]}function n8(e){let{0:t,1:r}=r8(e),n=t>>>31,o=t>>>20&2047,i=(t&1048575)*4294967296+r,s=o===0?-1022:o-1023,a=o===0?0:1;return a+=i*n1,a*=n===0?1:-1,{exponent:s,significand:a}}function yx(e,t){return e===-1022?O(t*hx):O((t-1)*hx)+(O(e+1023)<<O(52))}function Of(e){if(e===Kp)return Tf;if(e===QF)return e8;let t=n8(e),r=t.exponent,n=t.significand;return e>0||e===0&&1/e===Kp?yx(r,n):-yx(r,-n)-O(1)}function Yp(e){if(e<0)return-Yp(-e-O(1));if(e===Tf)return Kp;if(e<mx)return sr(e)*2**-1074;let t=e-mx,r=-1021+sr(t>>O(52));return(1+sr(t&t8)*n1)*2**r}var bx=Number.isInteger,wx=Object.is,kp=Number.NEGATIVE_INFINITY,Rp=Number.POSITIVE_INFINITY;function o1(e,t,r,n){let{noDefaultInfinity:o=!1,minExcluded:i=!1,maxExcluded:s=!1,min:a=o?-t:kp,max:l=o?t:Rp}=e,c=i?a<-r?-n:Math.max(a,-r):a===kp?Math.max(a,-n):Math.max(a,-r),u=s?l>r?n:Math.min(l,r):l===Rp?Math.min(l,n):Math.min(l,r);return{noDefaultInfinity:!1,minExcluded:i||(a!==kp||i)&&bx(c),maxExcluded:s||(l!==Rp||s)&&bx(u),min:wx(c,-0)?0:c,max:wx(u,0)?-0:u,noNaN:e.noNaN||!1}}var i1=Number.NEGATIVE_INFINITY,s1=Number.POSITIVE_INFINITY,o8=Number.MAX_VALUE,i8=45035996273704955e-1,Xp=4503599627370496;function s8(e){return o1(e,o8,i8,Xp)}function a8(e){return e===4503599627370496?s1:e===-4503599627370496?i1:e}function l8(e){if(typeof e!="number")throw new Error("Unsupported type");return e===s1?Xp:e===i1?-Xp:e}var c8=Number.isInteger,a1=Number.isNaN,u8=Number.NEGATIVE_INFINITY,d8=Number.POSITIVE_INFINITY,Sx=Number.MAX_VALUE,p8=NaN;function vx(e,t){if(a1(e))throw new Error("fc.double constraints."+t+" must be a 64-bit float");return Of(e)}function f8(e){if(typeof e!="number")throw new Error("Unsupported type");return Of(e)}function h8(e){return!c8(e)}function xx(e){let{noDefaultInfinity:t=!1,noNaN:r=!1,minExcluded:n=!1,maxExcluded:o=!1,min:i=t?-Sx:u8,max:s=t?Sx:d8}=e,a=vx(i,"min"),l=n?a+O(1):a,c=vx(s,"max"),u=o?c-O(1):c;if(u<l)throw new Error("fc.double constraints.min must be smaller or equal to constraints.max");if(r)return Tr({min:l,max:u}).map(Yp,f8);let d=u>O(0),p=d?l:l-O(1),h=d?u+O(1):u;return Tr({min:p,max:h}).map(f=>u<f||f<l?p8:Yp(f),f=>{if(typeof f!="number")throw new Error("Unsupported type");return a1(f)?u!==h?h:p:Of(f)})}function Ka(e={}){return e.noInteger?xx(s8(e)).map(a8,l8).filter(h8):xx(e)}var m8=Number.NEGATIVE_INFINITY,Zp=Number.POSITIVE_INFINITY,g8=Math.imul,Qp=2**127*(1+(2**23-1)/2**23),l1=2139095040,y8=-2139095041,ef=new Float32Array(1),b8=new Uint32Array(ef.buffer,ef.byteOffset);function w8(e){return ef[0]=e,b8[0]}function S8(e){let t=w8(e),r=t>>>31,n=t>>>23&255,o=t&8388607,i=n===0?-126:n-127,s=n===0?0:1;return s+=o/2**23,s*=r===0?1:-1,{exponent:i,significand:s}}function kx(e,t){return e===-126?t*8388608:g8(e+127,8388608)+(t-1)*8388608}function Mf(e){if(e===Zp)return l1;if(e===m8)return y8;let t=S8(e),r=t.exponent,n=t.significand;return e>0||e===0&&1/e===Zp?kx(r,n):-kx(r,-n)-1}function tf(e){if(e<0)return-tf(-e-1);if(e===l1)return Zp;if(e<16777216)return e*2**-149;let t=e-16777216,r=-125+(t>>23);return(1+(t&8388607)/8388608)*2**r}var c1=Number.NEGATIVE_INFINITY,u1=Number.POSITIVE_INFINITY,v8=Qp,x8=83886075e-1,rf=8388608;function k8(e){return o1(e,v8,x8,rf)}function R8(e){return e===8388608?u1:e===-8388608?c1:e}function C8(e){if(typeof e!="number")throw new Error("Unsupported type");return e===u1?rf:e===c1?-rf:e}var E8=Number.isInteger,d1=Number.isNaN,P8=Math.fround,I8=Number.NEGATIVE_INFINITY,A8=Number.POSITIVE_INFINITY,T8=NaN;function Rx(e,t){let r="fc.float constraints."+t+" must be a 32-bit float - you can convert any double to a 32-bit float by using `Math.fround(myDouble)`";if(d1(e)||P8(e)!==e)throw new Error(r);return Mf(e)}function O8(e){if(typeof e!="number")throw new Error("Unsupported type");return Mf(e)}function M8(e){return!E8(e)}function Cx(e){let{noDefaultInfinity:t=!1,noNaN:r=!1,minExcluded:n=!1,maxExcluded:o=!1,min:i=t?-Qp:I8,max:s=t?Qp:A8}=e,a=Rx(i,"min"),l=n?a+1:a,c=Rx(s,"max"),u=o?c-1:c;if(l>u)throw new Error("fc.float constraints.min must be smaller or equal to constraints.max");if(r)return ae({min:l,max:u}).map(tf,O8);let d=u>0?l:l-1,p=u>0?u+1:u;return ae({min:d,max:p}).map(h=>h>u||h<l?T8:tf(h),h=>{if(typeof h!="number")throw new Error("Unsupported type");return d1(h)?u!==p?p:d:Mf(h)})}function p1(e={}){return e.noInteger?Cx(k8(e)).map(R8,C8).filter(M8):Cx(e)}function L8(e){return e.replace(/([$`\\])/g,"\\$1").replace(/\r/g,"\\r")}function f1(e){return e.replace(/\*\//g,"*\\/")}var lt=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];function za(e){let t=4294967295;for(let r=0;r<e.length;++r){let n=jn(e,r);if(n<128)t=lt[t&255^n]^t>>8;else if(n<2048)t=lt[t&255^(192|n>>6&31)]^t>>8,t=lt[t&255^(128|n&63)]^t>>8;else if(n>=55296&&n<57344){let o=jn(e,++r);if(n>=56320||o<56320||o>57343||Number.isNaN(o))r-=1,t=lt[t&255^239]^t>>8,t=lt[t&255^191]^t>>8,t=lt[t&255^189]^t>>8;else{let i=(n&1023)+64,s=o&1023;t=lt[t&255^(240|i>>8&7)]^t>>8,t=lt[t&255^(128|i>>2&63)]^t>>8,t=lt[t&255^(128|s>>6&15|(i&3)<<4)]^t>>8,t=lt[t&255^(128|s&63)]^t>>8}}else t=lt[t&255^(224|n>>12&15)]^t>>8,t=lt[t&255^(128|n>>6&63)]^t>>8,t=lt[t&255^(128|n&63)]^t>>8}return(t|0)+2147483648}var N8=Object.getPrototypeOf,ti=class extends ye{constructor(e){super(),this.arb=e}generate(e,t){return this.arb.generate(e,t)}canShrinkWithoutContext(e){return this.arb.canShrinkWithoutContext(e)}shrink(e,t){return H.nil()}};function Ga(e){return N8(e)===ti.prototype&&e.generate===ti.prototype.generate&&e.canShrinkWithoutContext===ti.prototype.canShrinkWithoutContext&&e.shrink===ti.prototype.shrink?e:new ti(e)}var $8=Object.assign,D8=Object.keys;function h1(e){return z(Ga(ae()),Ga(ae({min:1,max:4294967295}))).map(([t,r])=>{let n=()=>{let o={};return $8((s,a)=>{let l=Me(s),c=Me(a),u=e(za(`${t}${l}`)%r,za(`${t}${c}`)%r);return o[`[${l},${c}]`]=u,u},{toString:()=>{let s=D8(o).sort().map(a=>`${a} => ${Me(o[a])}`).map(a=>`/* ${f1(a)} */`);return`function(a, b) {
194
- // With hash and stringify coming from fast-check${s.length!==0?`
195
- ${ge(s,`
196
- `)}`:""}
197
- const cmp = ${e};
198
- const hA = hash('${t}' + stringify(a)) % ${r};
199
- const hB = hash('${t}' + stringify(b)) % ${r};
200
- return cmp(hA, hB);
201
- }`},[Ue]:n})};return n()})}var _8=Object.assign;function j8(){return h1(_8((e,t)=>e<t,{toString(){return"(hA, hB) => hA < hB"}}))}var F8=Object.assign;function B8(){return h1(F8((e,t)=>e-t,{toString(){return"(hA, hB) => hA - hB"}}))}var V8=Object.defineProperties,U8=Object.keys;function W8(e){return z(de(e,{minLength:1}),Ga(ae())).map(([t,r])=>{let n=()=>{let o={},i=(...a)=>{let l=Me(a),c=t[za(`${r}${l}`)%t.length];return o[l]=c,Qr(c)?c[Ue]():c};function s(a){let l=K(K(pk(U8(o)),c=>`${c} => ${Me(o[c])}`),c=>`/* ${f1(c)} */`);return`function(...args) {
202
- // With hash and stringify coming from fast-check${l.length!==0?`
203
- ${l.join(`
204
- `)}`:""}
205
- const outs = ${a};
206
- return outs[hash('${r}' + stringify(args)) % outs.length];
207
- }`}return V8(i,{toString:{value:()=>s(Me(t))},[It]:{value:()=>s(Me(t))},[lr]:{value:async()=>s(await bf(t))},[Ue]:{value:n,configurable:!0}})};return n()})}var H8=Number.MIN_SAFE_INTEGER,z8=Number.MAX_SAFE_INTEGER;function m1(){return new Bn(H8,z8)}var G8=Number.MAX_SAFE_INTEGER;function q8(){return new Bn(0,G8)}var K8=Number.parseInt;function J8(e){let[t,r]=e;switch(t){case"oct":return`0${oi(r,8)}`;case"hex":return`0x${oi(r,16)}`;default:return`${r}`}}function $a(e,t){let r=K8(e,t);if(oi(r,t)!==e)throw new Error("Invalid value");return r}function Y8(e){if(typeof e!="string")throw new Error("Invalid type");return e.length>=2&&e[0]==="0"?e[1]==="x"?["hex",$a(Ce(e,2),16)]:["oct",$a(Ce(e,1),8)]:["dec",$a(e,10)]}function X8(e){return ge(e,".")}function Z8(e){if(typeof e!="string")throw new Error("Invalid type");return K(Qe(e,"."),t=>$a(t,10))}function Lf(){return z(Pr(255),Pr(255),Pr(255),Pr(255)).map(X8,Z8)}function Ft(e){return z(Bt("dec","oct","hex"),Pr(e)).map(J8,Y8)}function Cp(e){return ge(e,".")}function Ep(e){if(typeof e!="string")throw new Error("Invalid type");return Qe(e,".")}function g1(){return Ve(z(Ft(255),Ft(255),Ft(255),Ft(255)).map(Cp,Ep),z(Ft(255),Ft(255),Ft(65535)).map(Cp,Ep),z(Ft(255),Ft(16777215)).map(Cp,Ep),Ft(4294967295))}function Nf(e){return e.length===0?[]:Qe(e,":")}function $f(e){let t=Qe(e,":");return t.length>=2&&t[t.length-1].length<=4?[Ge(t,0,t.length-2),`${t[t.length-2]}:${t[t.length-1]}`]:[Ge(t,0,t.length-1),t[t.length-1]]}function Q8(e){return`${ge(e[0],":")}:${e[1]}`}function e7(e){if(typeof e!="string")throw new Error("Invalid type");return $f(e)}function t7(e){return`::${ge(e[0],":")}:${e[1]}`}function r7(e){if(typeof e!="string")throw new Error("Invalid type");if(!$3(e,"::"))throw new Error("Invalid value");return $f(Ce(e,2))}function Da(e){return`${ge(e[0],":")}::${ge(e[1],":")}:${e[2]}`}function _a(e){if(typeof e!="string")throw new Error("Invalid type");let[t,r]=Qe(e,"::",2),[n,o]=$f(r);return[Nf(t),n,o]}function n7(e){return Da([e[0],[e[1]],e[2]])}function o7(e){let t=_a(e);return[t[0],ge(t[1],":"),t[2]]}function Ex(e){return`${ge(e[0],":")}::${e[1]}`}function Px(e){if(typeof e!="string")throw new Error("Invalid type");let[t,r]=Qe(e,"::",2);return[Nf(t),r]}function i7(e){return`${ge(e[0],":")}::`}function s7(e){if(typeof e!="string")throw new Error("Invalid type");if(!D3(e,"::"))throw new Error("Invalid value");return[Nf(Ce(e,0,e.length-2))]}function a7([e,t]){return`${e}:${t}`}function l7(e){if(typeof e!="string")throw new L("Invalid type");if(!e.includes(":"))throw new L("Invalid value");return e.split(":",2)}var c7="0123456789abcdef",Pp;function u7(){return Pp===void 0&&(Pp=ae({min:0,max:15}).map(e=>c7[e],e=>{if(typeof e!="string")throw new L("Not a string");if(e.length!==1)throw new L("Invalid length");let t=jn(e,0);if(t<=57)return t-48;if(t<97)throw new L("Invalid character");return t-87})),Pp}function y1(){let e=De({unit:u7(),minLength:1,maxLength:4,size:"max"}),t=Ve(z(e,e).map(a7,l7),Lf());return Ve(z(de(e,{minLength:6,maxLength:6,size:"max"}),t).map(Q8,e7),z(de(e,{minLength:5,maxLength:5,size:"max"}),t).map(t7,r7),z(de(e,{minLength:0,maxLength:1,size:"max"}),de(e,{minLength:4,maxLength:4,size:"max"}),t).map(Da,_a),z(de(e,{minLength:0,maxLength:2,size:"max"}),de(e,{minLength:3,maxLength:3,size:"max"}),t).map(Da,_a),z(de(e,{minLength:0,maxLength:3,size:"max"}),de(e,{minLength:2,maxLength:2,size:"max"}),t).map(Da,_a),z(de(e,{minLength:0,maxLength:4,size:"max"}),e,t).map(n7,o7),z(de(e,{minLength:0,maxLength:5,size:"max"}),t).map(Ex,Px),z(de(e,{minLength:0,maxLength:6,size:"max"}),e).map(Ex,Px),z(de(e,{minLength:0,maxLength:7,size:"max"})).map(i7,s7))}var d7=class extends ye{constructor(e){super(),this.name=e,this.underlying=null}generate(e,t){if(this.underlying===null)throw new Error(`Lazy arbitrary ${JSON.stringify(this.name)} not correctly initialized`);return this.underlying.generate(e,t)}canShrinkWithoutContext(e){if(this.underlying===null)throw new Error(`Lazy arbitrary ${JSON.stringify(this.name)} not correctly initialized`);return this.underlying.canShrinkWithoutContext(e)}shrink(e,t){if(this.underlying===null)throw new Error(`Lazy arbitrary ${JSON.stringify(this.name)} not correctly initialized`);return this.underlying.shrink(e,t)}},p7=Object.getOwnPropertyNames;function f7(){let e=new ar;return r=>{let n=ut(e,r);return n!==void 0||(n=new d7(String(r)),Et(e,r,n)),n}}function b1(e){let t=f7(),r=e(t),n=p7(r);for(let o of n){let i=t(o);i.underlying=r[o]}return r}function h7(e,t){for(let r of e){let n=t[r]||{};if(n.maxLength===void 0||n.maxLength>0)return!0}return!1}function m7(e,t){if(e.length===0)return Oe([]);if(!h7(e,t))throw new L("Contraints on pool must accept at least one entity, maxLength cannot sum to 0");return z(...e.map(r=>de(Oe(r),t[r]))).map(r=>u3(r)).filter(r=>r.length>0)}var Ix=Object.assign,ja=Object.create,w1=Object.defineProperty,Ax=Object.getPrototypeOf,g7=Object.prototype;function y7(e){return w1(ja(null),It,{configurable:!1,enumerable:!1,writable:!1,value:()=>e})}function Tx(e,t){return y7(`<${Ze(e)}#${t}>`)}function b7(e,t){let r=ja(g7);for(let n in e){let o=e[n],i=[];for(let s of o){let a=Ix(ja(Ax(s)),s);i.push(a)}r[n]=i}for(let n in t){let o=t[n];for(let i=0;i!==o.length;++i){let s=o[i],a=r[n][i];for(let l in s){let c=s[l];a[l]=c.index===void 0?void 0:typeof c.index=="number"?r[c.type][c.index]:K(c.index,u=>r[c.type][u])}w1(a,It,{configurable:!1,enumerable:!1,writable:!1,value:()=>{let l=e[n][i],c=Ix(ja(Ax(l)),l);for(let u in s){let d=s[u];c[u]=d.index===void 0?void 0:typeof d.index=="number"?Tx(d.type,d.index):K(d.index,p=>Tx(d.type,p))}return Me(c)}})}}return r}function w7(e){let t=0,r=new ar;for(let o in e){let i=e[o];for(let s in i){let a=i[s];if(a.arity!=="inverse")continue;let l=ut(r,a.type);if(l===void 0&&(l=new ar,Et(r,a.type,l)),R3(l,a.forwardRelationship))throw new L(`Cannot declare multiple inverse relationships for the same forward relationship ${Ze(a.forwardRelationship)} on type ${Ze(a.type)}`);Et(l,a.forwardRelationship,{type:o,property:s}),t+=1}}let n=new ar;if(t===0)return n;for(let o in e){let i=e[o],s=ut(r,o);if(s!==void 0)for(let a in i){let l=i[a];if(l.arity==="inverse")continue;let c=ut(s,a);if(c!==void 0){if(c.type!==l.type)throw new L(`Inverse relationship ${Ze(c.property)} on type ${Ze(c.type)} references forward relationship ${Ze(a)} but types do not match`);Et(n,l,c)}}}if(n.size!==t)throw new L("Some inverse relationships could not be matched with their corresponding forward relationships");return n}var Ox=Object.create;function S7(e,t,r){switch(e){case"exclusive":return Oe(r);case"successor":return Ha(ae({min:t!==void 0?t+1:0,max:r}));case"any":return Ha(ae({min:0,max:r}))}}function v7(e,t,r,n,o,i,s){let a=S7(t,r,n);switch(e){case"0-1":return cr(a,{nil:void 0,depthIdentifier:o}).generate(i,s).value;case"1":return a.generate(i,s).value;case"many":{let l=0,c=cr(tn(a,{depthIdentifier:o,selector:d=>d===n?d+ ++l:d,minLength:1}),{nil:[],depthIdentifier:o}).generate(i,s).value,u=0;return K(c,d=>d===n?d+u++:d)}}}var x7=class extends ye{constructor(e,t){super(),this.relations=e,this.defaultEntities=t;let r=new _n,n=new _n;for(let o in e){let i=e[o];for(let s in i){let a=i[s];if(a.arity!=="inverse"){if(a.strategy==="exclusive"){if(Wa(r,a.type))throw new L(`Cannot mix exclusive with other strategies for type ${Ze(a.type)}`);ni(n,a.type)}else{if(Wa(n,a.type))throw new L(`Cannot mix exclusive with other strategies for type ${Ze(a.type)}`);ni(r,a.type)}if(a.strategy==="successor"&&a.type!==o)throw new L("Cannot mix types for the strategy successor");if(a.strategy==="successor"&&a.arity==="1")throw new L("Cannot use an arity of 1 for the strategy successor")}}}this.inversedRelations=w7(e)}createEmptyLinksInstanceFor(e){let t=Ox(null),r=this.relations[e];for(let n in r){let o=r[n];o.arity==="inverse"&&(t[n]={type:o.type,index:[]})}return t}generate(e,t){let r=Ox(null);for(let i in this.relations)r[i]=[];let n=[];for(let i of this.defaultEntities)N(n,{type:i,indexInType:r[i].length,depth:0}),N(r[i],this.createEmptyLinksInstanceFor(i));let o=-1;for(;++o<n.length;){let i=n[o],s=this.relations[i.type],a=r[i.type][i.indexInType],l=xf();l.depth=i.depth;for(let c in s){let u=s[c];if(u.arity==="inverse")continue;let d=u.type,p=r[d],h=p.length,f=v7(u.arity,u.strategy||"any",d===i.type?i.indexInType:void 0,p.length,l,e,t);a[c]={type:d,index:f};let m=f===void 0?[]:typeof f=="number"?[f]:f;for(let g of m){g>=h&&(N(n,{type:d,indexInType:g,depth:i.depth+1}),N(p,this.createEmptyLinksInstanceFor(d)));let w=ut(this.inversedRelations,u);if(w!==void 0){let S=p[g][w.property].index;N(S,i.indexInType)}}}}return n.length=0,new $(r,void 0)}canShrinkWithoutContext(e){return!1}shrink(e,t){return H.nil()}};function k7(e,t){return new x7(e,t)}var R7=Object.keys,C7=Object.getOwnPropertySymbols,E7=Object.getOwnPropertyDescriptor;function P7(e){let t=R7(e),r=C7(e);for(let n=0;n!==r.length;++n){let o=r[n],i=E7(e,o);i&&i.enumerable&&t.push(o)}return t}var I7=Object.create,A7=Object.defineProperty,T7=Object.getOwnPropertyDescriptor,O7=Object.getOwnPropertyNames,M7=Object.getOwnPropertySymbols;function L7(e,t){return function(n){let o=n[1]?I7(null):{};for(let i=0;i!==e.length;++i){let s=n[0][i];s!==t&&A7(o,e[i],{value:s,configurable:!0,enumerable:!0,writable:!0})}return o}}function N7(e,t){return function(n){if(typeof n!="object"||n===null)throw new Error("Incompatible instance received: should be a non-null object");let o=Object.getPrototypeOf(n)===null,i="constructor"in n&&n.constructor===Object;if(!o&&!i)throw new Error("Incompatible instance received: should be of exact type Object");let s=0,a=[];for(let u=0;u!==e.length;++u){let d=T7(n,e[u]);if(d!==void 0){if(!d.configurable||!d.enumerable||!d.writable)throw new Error("Incompatible instance received: should contain only c/e/w properties");if(d.get!==void 0||d.set!==void 0)throw new Error("Incompatible instance received: should contain only no get/set properties");++s,N(a,d.value)}else N(a,t)}let l=O7(n).length,c=M7(n).length;if(s!==l+c)throw new Error("Incompatible instance received: should not contain extra properties");return[a,o]}}var Ip=Symbol("no-key");function Ap(e,t,r){let n=P7(e),o=[];for(let i=0;i!==n.length;++i){let s=n[i],a=e[s];t===void 0||ir(t,s)!==-1?N(o,a):N(o,cr(a,{nil:Ip}))}return z(z(...o),r?Oe(!1):ci()).map(L7(n,Ip),N7(n,Ip))}function nf(e,t){let r=t!==void 0&&!!t.noNullPrototype;if(t===void 0||!("requiredKeys"in t&&t.requiredKeys!==void 0))return Ap(e,void 0,r);let n=("requiredKeys"in t?t.requiredKeys:void 0)||[];for(let o=0;o!==n.length;++o){let i=Object.getOwnPropertyDescriptor(e,n[o]);if(i===void 0)throw new Error("requiredKeys cannot reference keys that have not been defined in recordModel");if(!i.enumerable)throw new Error("requiredKeys cannot reference keys that are not enumerable in recordModel")}return Ap(e,n,r)}var $7=Object.create;function D7(e,t,r,n){let o=$7(null);for(let i in e){let s=e[i],a=nf(s,n),l=t(i),c=r(i),u={minLength:l,maxLength:l};o[i]=c!==void 0?tn(a,{...u,selector:c}):de(a,u)}return nf(o)}var Mx=Object.create,_7=Object.keys;function j7(e,t,r={}){let n=_7(e),o=r.initialPoolConstraints||Mx(null),i=r.unicityConstraints||Mx(null),s={noNullPrototype:r.noNullPrototype};return m7(n,o).chain(a=>k7(t,a).chain(l=>D7(e,c=>l[c].length,c=>i[c],s).map(c=>b7(c,l))))}function F7(e){return ge(K(e,t=>t[t.length-1]===","?Ce(t,0,t.length-1):t)," ")}function B7(e){return function(r){if(typeof r!="string")throw new Error("Unsupported type");let n=[];for(let o of Qe(r," "))if(e.canShrinkWithoutContext(o))N(n,o);else if(e.canShrinkWithoutContext(o+","))N(n,o+",");else throw new Error("Unsupported word");return n}}function V7(e){let t=ge(e," ");return t[t.length-1]===","&&(t=Ce(t,0,t.length-1)),ff(t[0])+Ce(t,1)+"."}function U7(e){return function(r){if(typeof r!="string")throw new Error("Unsupported type");if(r.length<2||r[r.length-1]!=="."||r[r.length-2]===","||ff(Bp(r[0]))!==r[0])throw new Error("Unsupported value");let n=Bp(r[0])+Ce(r,1,r.length-1),o=[],i=Qe(n," ");for(let s=0;s!==i.length;++s){let a=i[s];if(e.canShrinkWithoutContext(a))N(o,a);else if(s===i.length-1&&e.canShrinkWithoutContext(a+","))N(o,a+",");else throw new Error("Unsupported word")}return o}}function W7(e){return ge(e," ")}function H7(e){if(typeof e!="string")throw new Error("Unsupported type");let t=Qe(e,". ");for(let r=0;r<t.length-1;++r)t[r]+=".";return t}var b=(e,t)=>({arbitrary:Oe(e),weight:t});function z7(){return Ve(b("non",6),b("adipiscing",5),b("ligula",5),b("enim",5),b("pellentesque",5),b("in",5),b("augue",5),b("et",5),b("nulla",5),b("lorem",4),b("sit",4),b("sed",4),b("diam",4),b("fermentum",4),b("ut",4),b("eu",4),b("aliquam",4),b("mauris",4),b("vitae",4),b("felis",4),b("ipsum",3),b("dolor",3),b("amet,",3),b("elit",3),b("euismod",3),b("mi",3),b("orci",3),b("erat",3),b("praesent",3),b("egestas",3),b("leo",3),b("vel",3),b("sapien",3),b("integer",3),b("curabitur",3),b("convallis",3),b("purus",3),b("risus",2),b("suspendisse",2),b("lectus",2),b("nec,",2),b("ultricies",2),b("sed,",2),b("cras",2),b("elementum",2),b("ultrices",2),b("maecenas",2),b("massa,",2),b("varius",2),b("a,",2),b("semper",2),b("proin",2),b("nec",2),b("nisl",2),b("amet",2),b("duis",2),b("congue",2),b("libero",2),b("vestibulum",2),b("pede",2),b("blandit",2),b("sodales",2),b("ante",2),b("nibh",2),b("ac",2),b("aenean",2),b("massa",2),b("suscipit",2),b("sollicitudin",2),b("fusce",2),b("tempus",2),b("aliquam,",2),b("nunc",2),b("ullamcorper",2),b("rhoncus",2),b("metus",2),b("faucibus,",2),b("justo",2),b("magna",2),b("at",2),b("tincidunt",2),b("consectetur",1),b("tortor,",1),b("dignissim",1),b("congue,",1),b("non,",1),b("porttitor,",1),b("nonummy",1),b("molestie,",1),b("est",1),b("eleifend",1),b("mi,",1),b("arcu",1),b("scelerisque",1),b("vitae,",1),b("consequat",1),b("in,",1),b("pretium",1),b("volutpat",1),b("pharetra",1),b("tempor",1),b("bibendum",1),b("odio",1),b("dui",1),b("primis",1),b("faucibus",1),b("luctus",1),b("posuere",1),b("cubilia",1),b("curae,",1),b("hendrerit",1),b("velit",1),b("mauris,",1),b("gravida",1),b("ornare",1),b("ut,",1),b("pulvinar",1),b("varius,",1),b("turpis",1),b("nibh,",1),b("eros",1),b("id",1),b("aliquet",1),b("quis",1),b("lobortis",1),b("consectetuer",1),b("morbi",1),b("vehicula",1),b("tortor",1),b("tellus,",1),b("id,",1),b("eu,",1),b("quam",1),b("feugiat,",1),b("posuere,",1),b("iaculis",1),b("lectus,",1),b("tristique",1),b("mollis,",1),b("nisl,",1),b("vulputate",1),b("sem",1),b("vivamus",1),b("placerat",1),b("imperdiet",1),b("cursus",1),b("rutrum",1),b("iaculis,",1),b("augue,",1),b("lacus",1))}function G7(e={}){let{maxCount:t,mode:r="words",size:n}=e;if(t!==void 0&&t<1)throw new Error("lorem has to produce at least one word/sentence");let o=z7();return r==="sentences"?de(de(o,{minLength:1,size:"small"}).map(V7,U7(o)),{minLength:1,maxLength:t,size:n}).map(W7,H7):de(o,{minLength:1,maxLength:t,size:n}).map(F7,B7(o))}function q7(e){return new Map(e)}function K7(e){if(typeof e!="object"||e===null)throw new Error("Incompatible instance received: should be a non-null object");if(!("constructor"in e)||e.constructor!==Map)throw new Error("Incompatible instance received: should be of exact type Map");return Array.from(e)}function J7(e){return e[0]}function of(e,t,r={}){return tn(z(e,t),{minLength:r.minKeys,maxLength:r.maxKeys,size:r.size,selector:J7,depthIdentifier:r.depthIdentifier,comparator:"SameValueZero"}).map(q7,K7)}var Ta=10;function Y7(e){let t={};return(r=>{let n=r!==void 0?r:Ta;if(!hk(t,n)){let o=Ta;Ta=n-1,t[n]=e(n),Ta=o}return t[n]})}function X7(e){let t=0;for(;e>O(0);)e&O(1)&&++t,e>>=O(1);return t}function Z7(e,t){let r=(O(1)<<O(t))-O(1),n=e&r,o=X7(e-n),i=n;for(let s=O(1);s<=r&&o!==0;s<<=O(1))i&s||(i|=s,--o);return i}function Oa(e,t){let r=[];for(let n=e.length-1;n!==-1;--n)t(e[n])!==e[n]&&N(r,n);return r}function Q7(e,t,r){let n=O(0);for(let o=0,i=O(1);o!==r.length;++o,i<<=O(1))e[r[o]]!==t[r[o]]&&(n|=i);return n}function Tp(e,t,r,n){for(let o=0,i=O(1);o!==r.length;++o,i<<=O(1))t&i&&(e[r[o]]=n(e[r[o]]))}var e9=class extends ye{constructor(e,t,r){super(),this.stringArb=e,this.toggleCase=t,this.untoggleAll=r}buildContextFor(e,t){return{rawString:e.value,rawStringContext:e.context,flags:t.value,flagsContext:t.context}}generate(e,t){let r=this.stringArb.generate(e,t),n=[...r.value],o=Oa(n,this.toggleCase),i=Tr(O(0),(O(1)<<O(o.length))-O(1)).generate(e,void 0);return Tp(n,i.value,o,this.toggleCase),new $(ge(n,""),this.buildContextFor(r,i))}canShrinkWithoutContext(e){return typeof e!="string"?!1:this.untoggleAll!==void 0?this.stringArb.canShrinkWithoutContext(this.untoggleAll(e)):this.stringArb.canShrinkWithoutContext(e)}shrink(e,t){let r;if(t!==void 0)r=t;else if(this.untoggleAll!==void 0){let i=this.untoggleAll(e),s=[...e],a=[...i];r={rawString:i,rawStringContext:void 0,flags:Q7(a,s,Oa(a,this.toggleCase)),flagsContext:void 0}}else r={rawString:e,rawStringContext:void 0,flags:O(0),flagsContext:void 0};let n=r.rawString,o=r.flags;return this.stringArb.shrink(n,r.rawStringContext).map(i=>{let s=[...i.value],a=Oa(s,this.toggleCase),l=Z7(o,a.length);return Tp(s,l,a,this.toggleCase),new $(ge(s,""),this.buildContextFor(i,new $(l,void 0)))}).join(Ir(()=>{let i=[...n],s=Oa(i,this.toggleCase);return Tr(O(0),(O(1)<<O(s.length))-O(1)).shrink(o,r.flagsContext).map(a=>{let l=Ge(i);return Tp(l,a.value,s,this.toggleCase),new $(ge(l,""),this.buildContextFor(new $(n,r.rawStringContext),a))})}))}};function t9(e){let t=ff(e);return t!==e?t:Bp(e)}function r9(e,t){return new e9(e,t&&t.toggleCase||t9,t&&t.untoggleAll)}function n9(e){return ak.from(e)}function o9(e){if(!(e instanceof ak))throw new Error("Unexpected type");return[...e]}function S1(e={}){return de(p1(e),e).map(n9,o9)}function i9(e){return lk.from(e)}function s9(e){if(!(e instanceof lk))throw new Error("Unexpected type");return[...e]}function v1(e={}){return de(Ka(e),e).map(i9,s9)}function ur(e,t,r,n,o){let i=n.name,{min:s=t,max:a=r,...l}=e;if(s>a)throw new Error(`Invalid range passed to ${i}: min must be lower than or equal to max`);if(s<t)throw new Error(`Invalid min value passed to ${i}: min must be greater than or equal to ${t}`);if(a>r)throw new Error(`Invalid max value passed to ${i}: max must be lower than or equal to ${r}`);return de(o({min:s,max:a}),l).map(c=>n.from(c),c=>{if(!(c instanceof n))throw new Error("Invalid type");return[...c]})}function x1(e={}){return ur(e,-32768,32767,zD,ae)}function k1(e={}){return ur(e,-2147483648,2147483647,GD,ae)}function R1(e={}){return ur(e,-128,127,HD,ae)}function C1(e={}){return ur(e,0,65535,JD,ae)}function E1(e={}){return ur(e,0,4294967295,YD,ae)}function P1(e={}){return ur(e,0,255,qD,ae)}function I1(e={}){return ur(e,0,255,KD,ae)}function a9(e){return e!==void 0}function Lx(e){return e.hasToBeCloned?new $(e.value_,{generatorContext:e.context},()=>e.value):new $(e.value_,{generatorContext:e.context})}function Nx(e){return e.hasToBeCloned?new $(e.value_,{shrinkerContext:e.context},()=>e.value):new $(e.value_,{shrinkerContext:e.context})}var l9=class extends ye{constructor(e,t){super(),this.generatorArbitrary=e,this.shrinkerArbitrary=t}generate(e,t){return Lx(this.generatorArbitrary.generate(e,t))}canShrinkWithoutContext(e){return this.shrinkerArbitrary.canShrinkWithoutContext(e)}shrink(e,t){return a9(t)?"generatorContext"in t?this.generatorArbitrary.shrink(e,t.generatorContext).map(Lx):this.shrinkerArbitrary.shrink(e,t.shrinkerContext).map(Nx):this.shrinkerArbitrary.shrink(e,void 0).map(Nx)}};function sf(e,t,r){let n=ae({min:e,max:t});return t===r?n:new l9(n,ae({min:e,max:r}))}var c9=Math.min,af=Math.max,$x=ik.isArray,u9=Object.entries;function d9(e){let t=-1;for(let r=0;r!==e.length;++r)t=af(t,e[r][0]);return t}function p9(e,t){let r=ik(e);for(let n=0;n!==t.length;++n){let o=t[n];o[0]<e&&(r[o[0]]=o[1])}return r}function A1(e,t={}){let{size:r,minNumElements:n=0,maxLength:o=en,maxNumElements:i=o,noTrailingHole:s,depthIdentifier:a}=t,l=si(r,si(r,n,i,t.maxNumElements!==void 0),o,t.maxLength!==void 0);if(n>o)throw new Error("The minimal number of non-hole elements cannot be higher than the maximal length of the array");if(n>i)throw new Error("The minimal number of non-hole elements cannot be higher than the maximal number of non-holes");let c=c9(i,o),u=t.maxNumElements!==void 0||r!==void 0?r:"=",d=tn(z(sf(0,af(l-1,0),af(o-1,0)),e),{size:u,minLength:n,maxLength:c,selector:p=>p[0],depthIdentifier:a}).map(p=>p9(d9(p)+1,p),p=>{if(!$x(p))throw new Error("Not supported entry type");if(s&&p.length!==0&&!(p.length-1 in p))throw new Error("No trailing hole");return K(u9(p),h=>[Number(h[0]),h[1]])});return s||o===n?d:z(d,sf(n,l,o)).map(p=>{let h=p[0],f=p[1];if(h.length>=f)return h;let m=Ge(h);return m.length=f,m},p=>{if(!$x(p))throw new Error("Not supported entry type");return[p,p.length]})}function f9(e){return new Set(e)}function h9(e){if(typeof e!="object"||e===null)throw new Error("Incompatible instance received: should be a non-null object");if(!("constructor"in e)||e.constructor!==Set)throw new Error("Incompatible instance received: should be of exact type Set");return Array.from(e)}function T1(e,t={}){return tn(e,{minLength:t.minLength,maxLength:t.maxLength,size:t.size,depthIdentifier:t.depthIdentifier,comparator:"SameValueZero"}).map(f9,h9)}function m9(e,t,r,n,o,i){return Cf(e,t,{maxKeys:r,noNullPrototype:!i,size:n,depthIdentifier:o})}function g9(e){return Ve(R1(e),P1(e),I1(e),x1(e),C1(e),k1(e),E1(e),S1(e),v1(e))}function O1(e){let t=e.values,r=e.depthSize,n=xf(),o=e.maxDepth,i=e.maxKeys,s=e.size,a=Ve(...t,...e.withBigInt?[Tr()]:[],...e.withDate?[Gk()]:[]);return b1(l=>({anything:Ve({maxDepth:o,depthSize:r,depthIdentifier:n},a,l("array"),l("object"),...e.withMap?[l("map")]:[],...e.withSet?[l("set")]:[],...e.withObjectString?[l("anything").map(c=>Me(c))]:[],...e.withTypedArray?[g9({maxLength:i,size:s})]:[],...e.withSparseArray?[A1(l("anything"),{maxNumElements:i,size:s,depthIdentifier:n})]:[]),keys:e.withObjectString?Ve({arbitrary:e.key,weight:10},{arbitrary:l("anything").map(c=>Me(c)),weight:1}):e.key,array:de(l("anything"),{maxLength:i,size:s,depthIdentifier:n}),set:T1(l("anything"),{maxLength:i,size:s,depthIdentifier:n}),map:Ve(of(l("keys"),l("anything"),{maxKeys:i,size:s,depthIdentifier:n}),of(l("anything"),l("anything"),{maxKeys:i,size:s,depthIdentifier:n})),object:m9(l("keys"),l("anything"),i,s,n,e.withNullPrototype)})).anything}function y9(e){switch(typeof e){case"boolean":return new sk(e);case"number":return new sr(e);case"string":return new Ze(e);default:return e}}function b9(e){return typeof e!="object"||e===null||!("constructor"in e)?e:e.constructor===sk||e.constructor===sr||e.constructor===Ze?e.valueOf():e}function w9(e){return e.map(y9,b9)}function S9(e,t){return[ci(),m1(),Ka(),t(e),Ve(t(e),Oe(null),Oe(void 0))]}function v9(e){return e.map(t=>w9(t))}function x9(e,t){return t?v9(e).concat(e):e}function M1(e={}){let t={size:e.size,unit:"stringUnit"in e?e.stringUnit:e.withUnicodeString?"binary":void 0};return{key:e.key!==void 0?e.key:De(t),values:x9(e.values!==void 0?e.values:S9(t,De),e.withBoxedValues===!0),depthSize:e.depthSize,maxDepth:e.maxDepth,maxKeys:e.maxKeys,size:e.size,withSet:e.withSet===!0,withMap:e.withMap===!0,withObjectString:e.withObjectString===!0,withNullPrototype:e.withNullPrototype===!0,withBigInt:e.withBigInt===!0,withDate:e.withDate===!0,withTypedArray:e.withTypedArray===!0,withSparseArray:e.withSparseArray===!0}}function k9(e){return Cf(e.key,O1(e),{maxKeys:e.maxKeys,noNullPrototype:!e.withNullPrototype,size:e.size})}function R9(e){return k9(M1(e))}function C9(e,t){let{depthSize:r,maxDepth:n}=t;return{key:e,values:[ci(),Ka({noDefaultInfinity:!0,noNaN:!0}),e,Oe(null)],depthSize:r,maxDepth:n}}function L1(e){return O1(M1(e))}function N1(e={}){let t=e.noUnicodeString===void 0||e.noUnicodeString===!0;return L1(C9("stringUnit"in e?De({unit:e.stringUnit}):t?De():De({unit:"binary"}),e))}var E9=JSON.stringify,P9=JSON.parse;function I9(e){if(typeof e!="string")throw new L("Cannot unmap the passed value");return P9(e)}function A9(e={}){return N1(e).map(E9,I9)}var T9=Object.defineProperties;function Op(e,t){return`Stream(${t!==void 0?`${ge(t,",")}\u2026`:`${e} emitted`})`}var O9=class extends ye{constructor(e,t){super(),this.arb=e,this.history=t}generate(e,t){let r=t!==void 0&&e.nextInt(1,t)===1?t:void 0,n=()=>{let o=this.history?[]:null,i=0,s=function*(a,l){for(;;){let c=a.generate(l,r).value;i++,o!==null&&N(o,c),yield c}};return T9(new H(s(this.arb,e.clone())),{toString:{value:()=>Op(i,o!==null?o.map(Me):void 0)},[It]:{value:()=>Op(i,o!==null?o.map(Me):void 0)},[lr]:{value:async()=>Op(i,o!==null?await Promise.all(o.map(bf)):void 0)},[Ue]:{value:n,enumerable:!0}})};return new $(n(),void 0)}canShrinkWithoutContext(e){return!1}shrink(e,t){return H.nil()}};function M9(e,t){return new O9(e,t!==void 0&&typeof t=="object"&&"noHistory"in t?!t.noHistory:!0)}function L9(e){return ge(e,"")}function Dx(e){if(typeof e!="string")throw new Error("Cannot unmap the passed value");return[...e]}function N9(e){switch(e.length%4){case 0:return e;case 3:return`${e}=`;case 2:return`${e}==`;default:return Ce(e,1)}}function $9(e){if(typeof e!="string"||e.length%4!==0)throw new Error("Invalid string received");let t=e.indexOf("=");if(t===-1)return e;if(e.length-t>2)throw new Error("Cannot unmap the passed value");return Ce(e,0,t)}var Mp=String.fromCharCode;function D9(e){return e<26?Mp(e+65):e<52?Mp(e+97-26):e<62?Mp(e+48-52):e===62?"+":"/"}function _9(e){if(typeof e!="string"||e.length!==1)throw new L("Invalid entry");let t=jn(e,0);return t>=65&&t<=90?t-65:t>=97&&t<=122?t-97+26:t>=48&&t<=57?t-48+52:t===43?62:t===47?63:-1}function j9(){return ae({min:0,max:63}).map(D9,_9)}function F9(e={}){let{minLength:t=0,maxLength:r=en,size:n}=e,o=t+3-(t+3)%4,i=r-r%4,s=e.maxLength===void 0&&n===void 0?"=":n;if(o>i)throw new L("Minimal length should be inferior or equal to maximal length");if(o%4!==0)throw new L("Minimal length of base64 strings must be a multiple of 4");if(i%4!==0)throw new L("Maximal length of base64 strings must be a multiple of 4");let a=j9();return de(a,{minLength:o,maxLength:i,size:s,experimentalCustomSlices:SF(a,Dx)}).map(L9,Dx).map(N9,$9)}var _x=Object.is;function B9(e,t){let r=new ar,n=0;for(let o of e)_x(o,-0)?++n:Et(r,o,(ut(r,o)||0)+1);for(let o=0;o!==t.length;++o){if(!(o in t))return!1;let i=t[o];if(_x(i,-0)){if(n===0)return!1;--n}else{let s=ut(r,i)||0;if(s===0)return!1;Et(r,i,s-1)}}return!0}var V9=Math.floor,jx=Math.log,U9=Array.isArray,$1=class extends ye{constructor(e,t,r,n){if(super(),this.originalArray=e,this.isOrdered=t,this.minLength=r,this.maxLength=n,r<0||r>e.length)throw new Error("fc.*{s|S}ubarrayOf expects the minimal length to be between 0 and the size of the original array");if(n<0||n>e.length)throw new Error("fc.*{s|S}ubarrayOf expects the maximal length to be between 0 and the size of the original array");if(r>n)throw new Error("fc.*{s|S}ubarrayOf expects the minimal length to be inferior or equal to the maximal length");this.lengthArb=new Bn(r,n),this.biasedLengthArb=r!==n?new Bn(r,r+V9(jx(n-r)/jx(2))):this.lengthArb}generate(e,t){let r=(t!==void 0&&e.nextInt(1,t)===1?this.biasedLengthArb:this.lengthArb).generate(e,void 0),n=r.value,o=K(this.originalArray,(s,a)=>a),i=[];for(let s=0;s!==n;++s){let a=e.nextInt(0,o.length-1);N(i,o[a]),dk(o,a,1)}return this.isOrdered&&pk(i,(s,a)=>s-a),new $(K(i,s=>this.originalArray[s]),r.context)}canShrinkWithoutContext(e){return!U9(e)||!this.lengthArb.canShrinkWithoutContext(e.length)?!1:B9(this.originalArray,e)}shrink(e,t){return e.length===0?H.nil():this.lengthArb.shrink(e.length,t).map(r=>new $(Ge(e,e.length-r.value),r.context)).join(e.length>this.minLength?Ir(()=>this.shrink(Ge(e,1),void 0).filter(r=>this.minLength<=r.value.length+1).map(r=>new $([e[0],...r.value],void 0))):H.nil())}};function W9(e,t={}){let{minLength:r=0,maxLength:n=e.length}=t;return new $1(e,!0,r,n)}function H9(e,t={}){let{minLength:r=0,maxLength:n=e.length}=t;return new $1(e,!1,r,n)}var z9={10:"A",11:"B",12:"C",13:"D",14:"E",15:"F",16:"G",17:"H",18:"J",19:"K",20:"M",21:"N",22:"P",23:"Q",24:"R",25:"S",26:"T",27:"V",28:"W",29:"X",30:"Y",31:"Z"},G9={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,G:16,H:17,J:18,K:19,M:20,N:21,P:22,Q:23,R:24,S:25,T:26,V:27,W:28,X:29,Y:30,Z:31};function q9(e){return e<10?Ze(e):z9[e]}function Fx(e,t){let r="";for(;e.length+r.length<t;)r+="0";return r+e}function Bx(e){let t="";for(let r=e;r!==0;){let n=r>>5;t=q9(r-(n<<5))+t,r=n}return t}function K9(e,t){let r=~~(e/1073741824),n=e&1073741823;return Fx(Bx(r),t-6)+Fx(Bx(n),6)}function D1(e){return function(r){return K9(r,e)}}function Lp(e){if(typeof e!="string")throw new L("Unsupported type");let t=0,r=1;for(let n=e.length-1;n>=0;--n){let o=G9[e[n]];if(o===void 0)throw new L("Unsupported type");t+=o*r,r*=32}return t}var J9=D1(10),Vx=D1(8);function Y9(e){return J9(e[0])+Vx(e[1])+Vx(e[2])}function X9(e){if(typeof e!="string"||e.length!==26)throw new Error("Unsupported type");return[Lp(e.slice(0,10)),Lp(e.slice(10,18)),Lp(e.slice(18))]}function Z9(){return z(ae({min:0,max:0xffffffffffff}),ae({min:0,max:0xffffffffff}),ae({min:0,max:0xffffffffff})).map(Y9,X9)}function _1(e){return _3(oi(e,16),8,"0")}function Q9(e){if(typeof e!="string")throw new Error("Unsupported type");if(e.length!==8)throw new Error("Unsupported value: invalid length");let t=parseInt(e,16);if(e!==_1(t))throw new Error("Unsupported value: invalid content");return t}function Np(e,t){return ae({min:e,max:t}).map(_1,Q9)}function e5(e){return`${e[0]}-${Ce(e[1],4)}-${Ce(e[1],0,4)}-${Ce(e[2],0,4)}-${Ce(e[2],4)}${e[3]}`}var t5=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/;function r5(e){if(typeof e!="string")throw new Error("Unsupported type");let t=t5.exec(e);if(t===null)throw new Error("Unsupported type");return[t[1],t[3]+t[2],t[4]+Ce(t[5],0,4),Ce(t[5],4)]}var Ux="0123456789abcdef";function n5(e){let t={},r={};for(let i=0;i!==e.length;++i){let s=Ux[i],a=Ux[e[i]];t[s]=a,r[a]=s}function n(i){return t[i[0]]+Ce(i,1)}function o(i){if(typeof i!="string")throw new L("Cannot produce non-string values");let s=r[i[0]];if(s===void 0)throw new L("Cannot produce strings not starting by the version in hexa code");return s+Ce(i,1)}return{versionsApplierMapper:n,versionsApplierUnmapper:o}}function o5(e){let t={};for(let r of e){if(t[r])throw new L(`Version ${r} has been requested at least twice for uuid`);if(t[r]=!0,r<1||r>15)throw new L(`Version must be a value in [1-15] for uuid, but received ${r}`);if(~~r!==r)throw new L(`Version must be an integer value for uuid, but received ${r}`)}if(e.length===0)throw new L("Must provide at least one version for uuid")}function i5(e={}){let t=Np(0,4294967295),r=e.version!==void 0?typeof e.version=="number"?[e.version]:e.version:[1,2,3,4,5,6,7,8];o5(r);let{versionsApplierMapper:n,versionsApplierUnmapper:o}=n5(r);return z(t,Np(0,268435456*r.length-1).map(n,o),Np(2147483648,3221225471),t).map(e5,r5)}function s5(e){return De({unit:If("-._~!$&'()*+,;=:"),size:e})}function a5([e,t,r]){return(e===null?"":`${e}@`)+t+(r===null?"":`:${r}`)}function l5(e){if(typeof e!="string")throw new Error("Unsupported");let t=e.indexOf("@"),r=t!==-1?e.substring(0,t):null,n=/:(\d+)$/.exec(e),o=n!==null?Number(n[1]):null;return[r,n!==null?e.substring(t+1,e.length-n[1].length-1):e.substring(t+1),o]}function c5(e){return`[${e}]`}function u5(e){if(typeof e!="string"||e[0]!=="["||e[e.length-1]!=="]")throw new Error("Unsupported");return e.substring(1,e.length-1)}function j1(e){let t=e||{},r=t.size,n=[Af({size:r}),...t.withIPv4===!0?[Lf()]:[],...t.withIPv6===!0?[y1().map(c5,u5)]:[],...t.withIPv4Extended===!0?[g1()]:[]];return z(t.withUserInfo===!0?cr(s5(r)):Oe(null),Ve(...n),t.withPort===!0?cr(Pr(65535)):Oe(null)).map(a5,l5)}function F1(e){return De({unit:If("-._~!$&'()*+,;=:@/?"),size:e})}function B1(e={}){return F1(e.size)}function V1(e={}){return De({unit:If("-._~!$&'()*+,;=:@"),size:e.size})}function d5(e){return ge(K(e,t=>`/${t}`),"")}function p5(e){if(typeof e!="string")throw new Error("Incompatible value received: type");if(e.length!==0&&e[0]!=="/")throw new Error("Incompatible value received: start");return dk(Qe(e,"/"),1)}function f5(e){switch(e){case"xsmall":return["xsmall","xsmall"];case"small":return["small","xsmall"];case"medium":return["small","small"];case"large":return["medium","small"];case"xlarge":return["medium","medium"]}}function $p(e,t){return de(V1({size:e}),{size:t}).map(d5,p5)}function h5(e){let[t,r]=f5(e);return t===r?$p(t,r):Ve($p(t,r),$p(r,t))}function U1(e){return h5(Rf((e||{}).size))}function W1(e={}){return F1(e.size)}function m5(e){let[t,r,n]=e;return`${t}://${r}${n}${e[3]===null?"":`?${e[3]}`}${e[4]===null?"":`#${e[4]}`}`}var g5=/^([[A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)([^?#]*)(\?[A-Za-z0-9\-._~!$&'()*+,;=:@/?%]*)?(#[A-Za-z0-9\-._~!$&'()*+,;=:@/?%]*)?$/;function y5(e){if(typeof e!="string")throw new Error("Incompatible value received: type");let t=g5.exec(e);if(t===null)throw new Error("Incompatible value received");let r=t[1],n=t[2],o=t[3],i=t[4],s=t[5];return[r,n,o,i!==void 0?i.substring(1):null,s!==void 0?s.substring(1):null]}function b5(e){let t=e||{},r=Rf(t.size),n=t.authoritySettings!==void 0&&t.authoritySettings.size!==void 0?li(t.authoritySettings.size,r):r,o={...t.authoritySettings,size:n};return z(Bt(...t.validSchemes||["http","https"]),j1(o),U1({size:r}),t.withQueryParameters===!0?cr(W1({size:r})):Oe(null),t.withFragments===!0?cr(B1({size:r})):Oe(null)).map(m5,y5)}var w5=class H1{constructor(t,r){this.commands=t,this.metadataForReplay=r,this[Ue]=function(){return new H1(this.commands.map(n=>n.clone()),this.metadataForReplay)}}[Symbol.iterator](){return this.commands[Symbol.iterator]()}toString(){let t=this.commands.filter(n=>n.hasRan).map(n=>n.toString()).join(","),r=this.metadataForReplay();return r.length!==0?`${t} /*${r}*/`:t}},S5=class lf{constructor(t){if(this.cmd=t,this.hasRan=!1,gf(t)){let r=t[It];this[It]=function(){return r.call(t)}}if(yf(t)){let r=t[lr];this[lr]=function(){return r.call(t)}}}check(t){return this.cmd.check(t)}run(t,r){return this.hasRan=!0,this.cmd.run(t,r)}clone(){return Qr(this.cmd)?new lf(this.cmd[Ue]()):new lf(this.cmd)}toString(){return this.cmd.toString()}},Wx=class{static parse(e){let[t,r]=e.split(":"),n=this.parseCounts(t),o=this.parseChanges(r);return this.parseOccurences(n,o)}static stringify(e){let t=this.countOccurences(e);return`${this.stringifyCounts(t)}:${this.stringifyChanges(t)}`}static intToB64(e){return e<26?String.fromCharCode(e+65):e<52?String.fromCharCode(e+97-26):e<62?String.fromCharCode(e+48-52):String.fromCharCode(e===62?43:47)}static b64ToInt(e){return e>="a"?e.charCodeAt(0)-97+26:e>="A"?e.charCodeAt(0)-65:e>="0"?e.charCodeAt(0)-48+52:e==="+"?62:63}static countOccurences(e){return e.reduce((t,r)=>(t.length===0||t[t.length-1].count===64||t[t.length-1].value!==r?t.push({value:r,count:1}):t[t.length-1].count+=1,t),[])}static parseOccurences(e,t){let r=[];for(let n=0;n!==e.length;++n){let o=e[n],i=t[n];for(let s=0;s!==o;++s)r.push(i)}return r}static stringifyChanges(e){let t="";for(let r=0;r<e.length;r+=6){let n=e.slice(r,r+6).reduceRight((o,i)=>(o<<1)+(i.value?1:0),0);t+=this.intToB64(n)}return t}static parseChanges(e){let t=e.split("").map(n=>this.b64ToInt(n)),r=[];for(let n=0;n!==t.length;++n){let o=t[n];for(let i=0;i!==6;++i,o>>=1)r.push(o%2===1)}return r}static stringifyCounts(e){return e.map(({count:t})=>this.intToB64(t-1)).join("")}static parseCounts(e){return e.split("").map(t=>this.b64ToInt(t)+1)}},v5=class extends ye{constructor(e,t,r,n,o){super(),this.sourceReplayPath=n,this.disableReplayLog=o,this.oneCommandArb=Ve(...e).map(i=>new S5(i)),this.lengthArb=sf(0,t,r),this.replayPath=[],this.replayPathPosition=0}metadataForReplay(){return this.disableReplayLog?"":`replayPath=${JSON.stringify(Wx.stringify(this.replayPath))}`}buildValueFor(e,t){let r=e.map(o=>o.value_),n={shrunkOnce:t,items:e};return new $(new w5(r,()=>this.metadataForReplay()),n)}generate(e){let t=this.lengthArb.generate(e,void 0).value,r=Array(t);for(let n=0;n!==t;++n)r[n]=this.oneCommandArb.generate(e,void 0);return this.replayPathPosition=0,this.buildValueFor(r,!1)}canShrinkWithoutContext(e){return!1}filterOnExecution(e){let t=[];for(let r of e)r.value_.hasRan?(this.replayPath.push(!0),t.push(r)):this.replayPath.push(!1);return t}filterOnReplay(e){return e.filter((t,r)=>{let n=this.replayPath[this.replayPathPosition+r];if(n===void 0)throw new Error("Too short replayPath");if(!n&&t.value_.hasRan)throw new Error("Mismatch between replayPath and real execution");return n})}filterForShrinkImpl(e){this.replayPathPosition===0&&(this.replayPath=this.sourceReplayPath!==null?Wx.parse(this.sourceReplayPath):[]);let t=this.replayPathPosition<this.replayPath.length?this.filterOnReplay(e):this.filterOnExecution(e);return this.replayPathPosition+=e.length,t}shrink(e,t){if(t===void 0)return H.nil();let r=t,n=r.shrunkOnce,o=r.items,i=this.filterForShrinkImpl(o);if(i.length===0)return H.nil();let s=n?H.nil():new H([[]][Symbol.iterator]()),a=[];for(let l=0;l!==i.length;++l)a.push(Ir(()=>{let c=i.slice(0,l);return this.lengthArb.shrink(i.length-1-l,void 0).map(u=>c.concat(i.slice(i.length-(u.value+1))))}));for(let l=0;l!==i.length;++l)a.push(Ir(()=>this.oneCommandArb.shrink(i[l].value_,i[l].context).map(c=>i.slice(0,l).concat([c],i.slice(l+1)))));return s.join(...a).map(l=>this.buildValueFor(l.map(c=>new $(c.value_.clone(),c.context)),!0))}};function x5(e,t={}){let{size:r,maxCommands:n=en,disableReplayLog:o=!1,replayPath:i=null}=t;return new v5(e,si(r,0,n,t.maxCommands!==void 0),n,i,o)}var k5=class{constructor(e,t){this.s=e,this.cmd=t}async check(e){let t=null,r=!1;if((await this.s.scheduleSequence([{label:`check@${this.cmd.toString()}`,builder:async()=>{try{r=await Promise.resolve(this.cmd.check(e))}catch(n){throw t=n,n}}}]).task).faulty)throw t;return r}async run(e,t){let r=null;if((await this.s.scheduleSequence([{label:`run@${this.cmd.toString()}`,builder:async()=>{try{await this.cmd.run(e,t)}catch(n){throw r=n,n}}}]).task).faulty)throw r}},R5=function*(e,t){for(let r of t)yield new k5(e,r)},z1=(e,t,r,n,o)=>e.then(i=>{let{model:s,real:a}=i,l=r;for(let c of t)l=o(l,()=>n(c,s,a));return l}),C5=(e,t)=>z1({then:i=>{i(e())}},t,void 0,(i,s,a)=>{i.check(s)&&i.run(s,a)},(i,s)=>s()),E5=e=>typeof e.then=="function",G1=async(e,t,r=Promise.resolve())=>await z1({then:s=>{let a=e();return E5(a)?a.then(s):s(a)}},t,r,async(s,a,l)=>{await s.check(a)&&await s.run(a,l)},(s,a)=>s.then(a));function P5(e,t){C5(e,t)}async function I5(e,t){await G1(e,t)}async function A5(e,t,r){let n=G1(t,R5(e,r),e.schedule(Promise.resolve(),"startModel"));await e.waitFor(n),await e.waitAll()}var Ma=e=>e(),q1=class cf{constructor(t,r){this.act=t,this.taskSelector=r,this.lastTaskId=0,this.sourceTaskSelector=r.clone(),this.scheduledTasks=[],this.triggeredTasks=[],this.scheduledWatchers=[],this[Ue]=function(){return new cf(this.act,this.sourceTaskSelector)}}static buildLog(t){return`[task\${${t.taskId}}] ${t.label.length!==0?`${t.schedulingType}::${t.label}`:t.schedulingType} ${t.status}${t.outputValue!==void 0?` with value ${L8(t.outputValue)}`:""}`}log(t,r,n,o,i,s){this.triggeredTasks.push({status:i,schedulingType:t,taskId:r,label:n,metadata:o,outputValue:s!==void 0?Me(s):void 0})}scheduleInternal(t,r,n,o,i,s){let a=++this.lastTaskId,l,c=new Promise((u,d)=>{l=()=>{let p=Promise.resolve(s!==void 0?n.then(()=>s()):n);return p.then(h=>{this.log(t,a,r,o,"resolved",h),u(h)},h=>{this.log(t,a,r,o,"rejected",h),d(h)}),p}});return this.scheduledTasks.push({original:n,trigger:l,schedulingType:t,taskId:a,label:r,metadata:o,customAct:i}),this.scheduledWatchers.length!==0&&this.scheduledWatchers[0](),c}schedule(t,r,n,o){return this.scheduleInternal("promise",r||"",t,n,o||Ma)}scheduleFunction(t,r){return(...n)=>this.scheduleInternal("function",`${t.name}(${n.map(Me).join(",")})`,t(...n),void 0,r||Ma)}scheduleSequence(t,r){let n={done:!1,faulty:!1},o={then:u=>u()},i=()=>{},s=new Promise(u=>{i=()=>u({done:n.done,faulty:n.faulty})}),a=()=>{n.faulty=!0,i()},l=()=>{n.done=!0,i()},c=(u,d)=>{if(u>=t.length){d.then(l,a);return}d.then(()=>{let p=t[u],[h,f,m]=typeof p=="function"?[p,p.name,void 0]:[p.builder,p.label,p.metadata],g=this.scheduleInternal("sequence",f,o,m,r||Ma,()=>h());c(u+1,g)},a)};return c(0,o),Object.assign(n,{task:s})}count(){return this.scheduledTasks.length}internalWaitOne(){if(this.scheduledTasks.length===0)throw new Error("No task scheduled");let t=this.taskSelector.nextTaskIndex(this.scheduledTasks),[r]=this.scheduledTasks.splice(t,1);return r.customAct(()=>r.trigger().catch(n=>{}))}waitOne(t){let r=t||Ma;return this.act(()=>r(()=>this.internalWaitOne()))}async waitAll(t){for(;this.scheduledTasks.length>0;)await this.waitOne(t)}async internalWaitFor(t,r){let n=!1,o=r.customAct,i=r.onWaitStart,s=r.onWaitIdle,a=r.launchAwaiterOnInit,l,c,u=0,d=null,p=null,h=async()=>{for(u=50,u=50;!n&&u>0;--u)await Promise.resolve();if(!n&&this.scheduledTasks.length>0)return i!==void 0&&i(),p=this.waitOne(o),p.then(()=>(p=null,h()),w=>{throw p=null,n=!0,c(w),w});!n&&s!==void 0&&s(),d=null},f=()=>{if(d!==null){u=51;return}d=h().catch(()=>{})},m=()=>{let w=this.scheduledWatchers.indexOf(f);w!==-1&&this.scheduledWatchers.splice(w,1),w===0&&this.scheduledWatchers.length!==0&&this.scheduledWatchers[0]()},g=new Promise((w,S)=>{l=y=>{m(),w(y)},c=y=>{m(),S(y)}});return t.then(w=>{n=!0,p===null?l(w):p.then(()=>l(w),S=>c(S))},w=>{n=!0,p===null?c(w):p.then(()=>c(w),()=>c(w))}),(this.scheduledTasks.length>0||a)&&this.scheduledWatchers.length===0&&f(),this.scheduledWatchers.push(f),g}waitNext(t,r){let n,o=t,i=o<=0?Promise.resolve():new Promise(s=>{n=()=>{--o<=0&&s()}});return this.internalWaitFor(i,{customAct:r,onWaitStart:n,onWaitIdle:void 0,launchAwaiterOnInit:!1})}waitIdle(t){let r,n=new Promise(o=>r=o);return this.internalWaitFor(n,{customAct:t,onWaitStart:void 0,onWaitIdle:r,launchAwaiterOnInit:!0})}waitFor(t,r){return this.internalWaitFor(t,{customAct:r,onWaitStart:void 0,onWaitIdle:void 0,launchAwaiterOnInit:!1})}report(){return[...this.triggeredTasks,...this.scheduledTasks.map(t=>({status:"pending",schedulingType:t.schedulingType,taskId:t.taskId,label:t.label,metadata:t.metadata}))]}toString(){return"schedulerFor()`\n"+this.report().map(cf.buildLog).map(t=>`-> ${t}`).join(`
208
- `)+"`"}};function K1(e){let t=0;return{clone:()=>K1(e),nextTaskIndex:r=>{if(e.length<=t)throw new Error("Invalid schedulerFor defined: too many tasks have been scheduled");let n=r.findIndex(o=>o.taskId===e[t]);if(n===-1)throw new Error("Invalid schedulerFor defined: unable to find next task");return++t,n}}}function Hx(e,t){return new q1(e,K1(t))}function J1(e){let t=e.clone();return{clone:()=>J1(t),nextTaskIndex:r=>e.nextInt(0,r.length-1)}}var T5=class extends ye{constructor(e){super(),this.act=e}generate(e,t){return new $(new q1(this.act,J1(e.clone())),void 0)}canShrinkWithoutContext(e){return!1}shrink(e,t){return H.nil()}};function O5(e){let{act:t=r=>r()}=e||{};return new T5(t)}function M5(e,t){let{act:r=n=>n()}=Array.isArray(e)?t||{}:e||{};return Array.isArray(e)?Hx(r,e):function(n,...o){return Hx(r,o)}}function L5(e={}){return ur(e,O("-9223372036854775808"),O("9223372036854775807"),UD,Tr)}function N5(e={}){return ur(e,O(0),O("18446744073709551615"),WD,Tr)}function $5(e,t){return t}var Dp=Math.floor,D5=Math.min;function gt(e,t){switch(e.type){case"Char":return{astNode:e,minLength:1};case"Repetition":switch(e.quantifier.kind){case"*":{let r=gt(e.expression,t);return{astNode:{type:"Repetition",quantifier:{...e.quantifier,kind:"Range",from:0,to:t},expression:r.astNode},minLength:0}}case"+":{let r=gt(e.expression,t),n=r.minLength>1?r.minLength:1;return{astNode:{type:"Repetition",quantifier:{...e.quantifier,kind:"Range",from:1,to:Dp(t/n)},expression:r.astNode},minLength:r.minLength}}case"?":{let r=gt(e.expression,t);return t<r.minLength?{astNode:{type:"Repetition",quantifier:{...e.quantifier,kind:"Range",from:0,to:0},expression:r.astNode},minLength:0}:{astNode:{...e,expression:r.astNode},minLength:0}}case"Range":{let r=e.quantifier.from>1?Dp(t/e.quantifier.from):t,n=gt(e.expression,r),o=n.minLength>1?n.minLength:1;return e.quantifier.to===void 0||e.quantifier.to*o>t?{astNode:{type:"Repetition",quantifier:{...e.quantifier,kind:"Range",to:Dp(t/o)},expression:n.astNode},minLength:e.quantifier.from*n.minLength}:{astNode:{...e,expression:n.astNode},minLength:e.quantifier.from*n.minLength}}default:return $5(e.quantifier,{astNode:e,minLength:0})}case"Quantifier":return{astNode:e,minLength:0};case"Alternative":{let r=0,n=[];for(let i=0;i!==e.expressions.length;++i){let s=t-r,a=gt(e.expressions[i],s);r+=a.minLength,N(n,{value:a,allowance:s})}let o=[];for(let i=0;i!==n.length;++i){let s=n[i].value,a=n[i].allowance,l=t-r+s.minLength;N(o,(l!==a?gt(s.astNode,l):s).astNode)}return{astNode:{...e,expressions:o},minLength:r}}case"CharacterClass":return{astNode:e,minLength:1};case"ClassRange":return{astNode:e,minLength:1};case"Group":{let r=gt(e.expression,t);return{astNode:{...e,expression:r.astNode},minLength:r.minLength}}case"Disjunction":{if(e.left===null){if(e.right===null)return{astNode:e,minLength:0};let o=gt(e.right,t),i=o.minLength>t?null:o.astNode;return{astNode:{...e,left:null,right:i},minLength:0}}if(e.right===null){let o=gt(e.left,t),i=o.minLength>t?null:o.astNode;return{astNode:{...e,left:i,right:null},minLength:0}}let r=gt(e.left,t),n=gt(e.right,t);return r.minLength>t?n:n.minLength>t?r:{astNode:{...e,left:r.astNode,right:n.astNode},minLength:D5(r.minLength,n.minLength)}}case"Assertion":return{astNode:e,minLength:0};case"Backreference":return{astNode:e,minLength:0};case"UnicodeProperty":return{astNode:e,minLength:1}}}function _5(e,t){return gt(e,t).astNode}function j5(e){return new Error(`Unsupported AST node! Received: ${Me(e)}`)}function Fa(e,t,r){if(!t&&!r)return e;let n={hasStart:!1,hasEnd:!1},o=Y1(e,t,r,n),i=t&&!n.hasStart,s=r&&!n.hasEnd;if(!i&&!s)return o;let a=[];return i&&(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(o),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 Y1(e,t,r,n){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 n.hasStart=!0,n.hasEnd=!0,{...e,expressions:e.expressions.map((o,i)=>Fa(o,t&&i===0,r&&i===e.expressions.length-1))};case"CharacterClass":return e;case"ClassRange":return e;case"Group":return{...e,expression:Y1(e.expression,t,r,n)};case"Disjunction":return n.hasStart=!0,n.hasEnd=!0,{...e,left:e.left!==null?Fa(e.left,t,r):null,right:e.right!==null?Fa(e.right,t,r):null};case"Assertion":if(e.kind==="^"||e.kind==="Lookahead")return n.hasStart=!0,e;if(e.kind==="$"||e.kind==="Lookbehind")return n.hasEnd=!0,e;throw new Error(`Assertions of kind ${e.kind} not implemented yet!`);case"Backreference":return e;case"UnicodeProperty":return e;default:throw j5(e)}}function F5(e){return Fa(e,!0,!0)}function zx(e,t){return e[t]>="\uD800"&&e[t]<="\uDBFF"&&e[t+1]>="\uDC00"&&e[t+1]<="\uDFFF"?2:1}function $e(e){return e>="0"&&e<="9"||e>="a"&&e<="f"||e>="A"&&e<="F"}function uf(e){return e>="0"&&e<="9"}function X1(e,t){for(let r=t;r!==e.length;++r){let n=e[r];if(n==="\\")r+=1;else if(n==="]")return r}throw new Error("Missing closing ']'")}function B5(e,t){let r=0;for(let n=t;n!==e.length;++n){let o=e[n];if(o==="\\")n+=1;else if(o===")"){if(r===0)return n;r-=1}else o==="["?n=X1(e,n):o==="("&&(r+=1)}throw new Error("Missing closing ')'")}function V5(e,t){let r=!1;for(let n=t;n!==e.length;++n){let o=e[n];if(!uf(o)){if(t===n)return-1;if(o===","){if(r)return-1;r=!0}else return o==="}"?n:-1}}return-1}function U5(e,t,r,n){switch(e[t]){case"[":return n===1?t+1:X1(e,t+1)+1;case"{":{if(n===1)return t+1;let o=V5(e,t+1);return o===-1?t+1:o+1}case"(":return n===1?t+1:B5(e,t+1)+1;case"]":case"}":case")":return t+1;case"\\":{let o=e[t+1];switch(o){case"x":if($e(e[t+2])&&$e(e[t+3]))return t+4;throw new Error(`Unexpected token '${e.substring(t,t+4)}' found`);case"u":if(e[t+2]==="{"){if(!r)return t+2;if(e[t+4]==="}"){if($e(e[t+3]))return t+5;throw new Error(`Unexpected token '${e.substring(t,t+5)}' found`)}if(e[t+5]==="}"){if($e(e[t+3])&&$e(e[t+4]))return t+6;throw new Error(`Unexpected token '${e.substring(t,t+6)}' found`)}if(e[t+6]==="}"){if($e(e[t+3])&&$e(e[t+4])&&$e(e[t+5]))return t+7;throw new Error(`Unexpected token '${e.substring(t,t+7)}' found`)}if(e[t+7]==="}"){if($e(e[t+3])&&$e(e[t+4])&&$e(e[t+5])&&$e(e[t+6]))return t+8;throw new Error(`Unexpected token '${e.substring(t,t+8)}' found`)}if(e[t+8]==="}"&&$e(e[t+3])&&$e(e[t+4])&&$e(e[t+5])&&$e(e[t+6])&&$e(e[t+7]))return t+9;throw new Error(`Unexpected token '${e.substring(t,t+9)}' found`)}if($e(e[t+2])&&$e(e[t+3])&&$e(e[t+4])&&$e(e[t+5]))return t+6;throw new Error(`Unexpected token '${e.substring(t,t+6)}' found`);case"p":case"P":{if(!r)return t+2;let i=t+2;for(;i<e.length&&e[i]!=="}";i+=e[i]==="\\"?2:1);if(e[i]!=="}")throw new Error("Invalid \\P definition");return i+1}case"k":{let i=t+2;for(;i<e.length&&e[i]!==">";++i);if(e[i]!==">"){if(!r)return t+2;throw new Error("Invalid \\k definition")}return i+1}default:if(uf(o)){let i=r?e.length:Math.min(t+4,e.length),s=t+2;for(;s<i&&uf(e[s]);++s);return s}return t+(r?zx(e,t+1):1)+1}}default:return t+(r?zx(e,t):1)}}function La(e,t,r,n){let o=U5(e,t,r,n);return e.substring(t,o)}var Gx={gc:"General_Category",sc:"Script",scx:"Script_Extensions"},Ja={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"},ai=_f(Ja),Df={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"},df=_f(Df),Z1={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"},qx=_f(Z1);function _f(e){let t={};for(let r of Object.keys(e)){let n=e[r];if(Array.isArray(n))for(let o=0;o!==n.length;++o)t[n[o]]=r;else t[n]=r}return t}function W5(e){return e in Df||e in df}function H5(e){return e in Ja||e in ai}function Kx(e){if(e in Gx)return Gx[e];if(e in ai)return ai[e];if(e in Ja||e==="General_Category"||e==="Script"||e==="Script_Extensions")return e;throw new Error(`Unknown Unicode property name: ${e}`)}function Jx(e){if(e in df)return df[e];if(e in qx)return qx[e];if(e in ai)return ai[e];if(e in Df||e in Z1||e in Ja)return e;throw new Error(`Unknown Unicode property value: ${e}`)}function z5(e,t){let r=e.indexOf("=");if(r!==-1){let n=e.substring(0,r),o=e.substring(r+1);return{type:"UnicodeProperty",name:n,value:o,negative:t,shorthand:!1,binary:!1,canonicalName:Kx(n),canonicalValue:Jx(o)}}if(W5(e))return{type:"UnicodeProperty",name:"General_Category",value:e,negative:t,shorthand:!0,binary:!1,canonicalName:"General_Category",canonicalValue:Jx(e)};if(H5(e)){let n=Kx(e);return{type:"UnicodeProperty",name:e,value:e,negative:t,shorthand:!1,binary:!0,canonicalName:n,canonicalValue:n}}throw new Error(`Invalid Unicode property: ${e}`)}var _p=String.fromCodePoint;function jp(e){let t=e.pop();if(t===void 0)throw new Error("Unable to extract token preceeding the currently parsed one");return t}function Q1(e){return e>="0"&&e<="9"}function Ba(e,t){return{type:"Char",kind:"simple",symbol:e,value:e,codePoint:e.codePointAt(0)||-1,escaped:t}}function Nn(e,t){return{type:"Char",kind:"meta",symbol:t,value:e,codePoint:t.codePointAt(0)||-1}}function Cr(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 Fp(e){if(e[0]==="\\"){let t=e[1];switch(t){case"x":{let r=e.substring(2),n=Number.parseInt(r,16);return{type:"Char",kind:"hex",symbol:_p(n),value:e,codePoint:n}}case"u":{if(e==="\\u")return Ba("u",!0);let r=e[2]==="{"?e.substring(3,e.length-1):e.substring(2),n=Number.parseInt(r,16);return{type:"Char",kind:"unicode",symbol:_p(n),value:e,codePoint:n}}case"0":return Nn(e,"\0");case"n":return Nn(e,`
209
- `);case"f":return Nn(e,"\f");case"r":return Nn(e,"\r");case"t":return Nn(e," ");case"v":return Nn(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(Q1(t)){let r=e.substring(1),n=Number(r);return{type:"Char",kind:"decimal",symbol:_p(n),value:e,codePoint:n}}if(e.length>2&&(t==="p"||t==="P")){let r=t==="P";return z5(e.substring(3,e.length-1),r)}return Ba(e.substring(1),!0)}}return Ba(e)}function $n(e,t,r,n){let o=null;for(let i=0,s=La(t,i,r,0);i!==t.length;i+=s.length,s=La(t,i,r,0)){let a=s[0];switch(a){case"|":o===null&&(o=[]),o.push(Cr(e.splice(0),!0)||null);break;case".":e.push({type:"Char",kind:"meta",symbol:s,value:s,codePoint:NaN});break;case"*":case"+":{let l=jp(e);e.push({type:"Repetition",expression:l,quantifier:{type:"Quantifier",kind:a,greedy:!0}});break}case"?":{let l=jp(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(Ba(s));break}let l=jp(e),c=s.substring(1,s.length-1).split(","),u=Number(c[0]),d=c.length===1?u:c[1].length!==0?Number(c[1]):void 0;e.push({type:"Repetition",expression:l,quantifier:{type:"Quantifier",kind:"Range",greedy:!0,from:u,to:d}});break}case"[":{let l=s.substring(1,s.length-1),c=[],u,d=!1;for(let p=0,h=La(l,p,r,1);p!==l.length;p+=h.length,h=La(l,p,r,1)){if(p===0&&h==="^"){u=!0;continue}let f=Fp(h);if(h==="-")c.push(f),d=!0;else{let m=c.length>=2?c[c.length-2]:void 0;d&&m!==void 0&&m.type==="Char"&&f.type==="Char"?(c.pop(),c.pop(),c.push({type:"ClassRange",from:m,to:f})):c.push(f),d=!1}}e.push({type:"CharacterClass",expressions:c,negative:u});break}case"(":{let l=s.substring(1,s.length-1),c=[];if(l[0]==="?")if(l[1]===":")$n(c,l.substring(2),r,n),e.push({type:"Group",capturing:!1,expression:Cr(c)});else if(l[1]==="="||l[1]==="!")$n(c,l.substring(2),r,n),e.push({type:"Assertion",kind:"Lookahead",negative:l[1]==="!"?!0:void 0,assertion:Cr(c)});else if(l[1]==="<"&&(l[2]==="="||l[2]==="!"))$n(c,l.substring(3),r,n),e.push({type:"Assertion",kind:"Lookbehind",negative:l[2]==="!"?!0:void 0,assertion:Cr(c)});else{let u=l.split(">");if(u.length<2||u[0][1]!=="<")throw new Error(`Unsupported regex content found at ${JSON.stringify(s)}`);let d=++n.lastIndex,p=u[0].substring(2);n.named.set(p,d),$n(c,u.slice(1).join(">"),r,n),e.push({type:"Group",capturing:!0,nameRaw:p,name:p,number:d,expression:Cr(c)})}else{let u=++n.lastIndex;$n(c,l,r,n),e.push({type:"Group",capturing:!0,number:u,expression:Cr(c)})}break}default:if(s==="^")e.push({type:"Assertion",kind:s});else if(s==="$")e.push({type:"Assertion",kind:s});else if(s[0]==="\\"&&Q1(s[1])){let l=Number(s.substring(1));r||l<=n.lastIndex?e.push({type:"Backreference",kind:"number",number:l,reference:l}):e.push(Fp(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:n.named.get(l)||0,referenceRaw:l,reference:l})}else e.push(Fp(s));break}}if(o!==null){o.push(Cr(e.splice(0),!0)||null);let i={type:"Disjunction",left:o[0],right:o[1]};for(let s=2;s<o.length;++s)i={type:"Disjunction",left:i,right:o[s]};e.push(i)}}function G5(e){let t=ir([...e.flags],"u")!==-1,r=e.source,n=[];return $n(n,r,t,{lastIndex:0,named:new Map}),Cr(n)}var q5=String.fromCodePoint;function K5(e){return e.binary||e.shorthand?e.canonicalValue:`${e.canonicalName}=${e.canonicalValue}`}function Yx(e,t,r,n){let o=-1;for(let i=t;i<=r;++i)if(e.test(q5(i)))o===-1&&(o=i);else if(o!==-1){let s=i-1;n.push(o===s?[s]:[o,s]),o=-1}o!==-1&&n.push(o===r?[r]:[o,r])}function J5(e,t){let r=new RegExp(`^\\${t?"P":"p"}{${e}}$`,"u"),n=[];return Yx(r,0,55295,n),Yx(r,57344,1114111,n),n}var Xx=new Map;function Y5(e,t){let r=`${t?"P":"p"}:${e}`,n=Xx.get(r);if(n!==void 0)return n;let o=J5(e,t);return Xx.set(r,o),o}function X5(e){return Vn(...K(Y5(K5(e),e.negative),t=>Gp(t)))}var Z5=String.fromCodePoint,Zx=[..."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"],Qx=[..."0123456789"],ek=[...` \r
210
- \v\f`],pf=[...`\r
211
- `],e0=[...""],Q5=[...pf,...e0],Zr=()=>De({unit:"grapheme-ascii",minLength:1,maxLength:1});function tk(e){return new L(`Unsupported AST node! Received: ${Me(e)}`)}function Er(e,t,r){switch(e.type){case"Char":if(e.kind==="meta")switch(e.value){case"\\w":return Bt(...Zx);case"\\W":return Zr().filter(n=>ir(Zx,n)===-1);case"\\d":return Bt(...Qx);case"\\D":return Zr().filter(n=>ir(Qx,n)===-1);case"\\s":return Bt(...ek);case"\\S":return Zr().filter(n=>ir(ek,n)===-1);case"\\b":case"\\B":throw new L(`Meta character ${e.value} not implemented yet!`);case".":{let n=r.dotAll?e0:Q5;return Zr().filter(o=>ir(n,o)===-1)}}if(e.symbol===void 0)throw new L(`Unexpected undefined symbol received for non-meta Char! Received: ${Me(e)}`);return Oe(e.symbol);case"Repetition":{let n=Er(e.expression,t,r);switch(e.quantifier.kind){case"*":return De({...t,unit:n});case"+":return De({...t,minLength:1,unit:n});case"?":return De({...t,minLength:0,maxLength:1,unit:n});case"Range":return De({...t,minLength:e.quantifier.from,maxLength:e.quantifier.to,unit:n});default:throw tk(e.quantifier)}}case"Quantifier":throw new L("Wrongly defined AST tree, Quantifier nodes not supposed to be scanned!");case"Alternative":return z(...K(e.expressions,n=>Er(n,t,r))).map(n=>ge(n,""));case"CharacterClass":if(e.negative){let n=K(e.expressions,o=>Er(o,t,r));return Zr().filter(o=>fk(n,i=>!i.canShrinkWithoutContext(o)))}return Ve(...K(e.expressions,n=>Er(n,t,r)));case"ClassRange":{let n=e.from.codePoint,o=e.to.codePoint;return ae({min:n,max:o}).map(i=>Z5(i),i=>{if(typeof i!="string")throw new L("Invalid type");if([...i].length!==1)throw new L("Invalid length");return jn(i,0)})}case"Group":return Er(e.expression,t,r);case"Disjunction":return Ve(e.left!==null?Er(e.left,t,r):Oe(""),e.right!==null?Er(e.right,t,r):Oe(""));case"Assertion":if(e.kind==="^"||e.kind==="$")return r.multiline?e.kind==="^"?Ve(Oe(""),z(De({unit:Zr()}),Bt(...pf)).map(n=>`${n[0]}${n[1]}`,n=>{if(typeof n!="string"||n.length===0)throw new L("Invalid type");return[Ce(n,0,n.length-1),n[n.length-1]]})):Ve(Oe(""),z(Bt(...pf),De({unit:Zr()})).map(n=>`${n[0]}${n[1]}`,n=>{if(typeof n!="string"||n.length===0)throw new L("Invalid type");return[n[0],Ce(n,1)]})):Oe("");throw new L(`Assertions of kind ${e.kind} not implemented yet!`);case"Backreference":throw new L("Backreference nodes not implemented yet!");case"UnicodeProperty":return X5(e);default:throw tk(e)}}function eB(e,t={}){for(let a of e.flags)if(a!=="d"&&a!=="g"&&a!=="m"&&a!=="s"&&a!=="u")throw new L(`Unable to use "stringMatching" against a regex using the flag ${a}`);let r=t.maxLength,n={size:t.size,maxLength:r},o={multiline:e.multiline,dotAll:e.dotAll},i=F5(G5(e));r!==void 0&&(i=_5(i,r));let s=Er(i,n,o);return r!==void 0?s.filter(a=>[...a].length<=r):s}function tB(e){let t=[];for(let r=0;r!==e.length;++r)t.push(e[r].next());return t}function rB(e,t){for(let r=0;r!==e.length;++r)t[r]=e[r].next()}function nB(e){for(let t=0;t!==e.length;++t)if(e[t].done)return!0;return!1}function*oB(...e){let t=tB(e);for(;!nB(t);)yield t.map(r=>r.value),rB(e,t)}function*iB(e){let t=e;for(;;)yield t,++t}var sB=class extends ye{constructor(e,t){super(),this.arb=e,this.maxShrinks=t}generate(e,t){let r=this.arb.generate(e,t);return this.valueMapper(r,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,r){let n=this.maxShrinks-r;return n<=0?H.nil():new H(oB(this.arb.shrink(e,t),iB(r+1))).take(n).map(o=>this.valueMapper(o[0],o[1]))}valueMapper(e,t){let r={originalContext:e.context,length:t};return new $(e.value,r)}isSafeContext(e){return e!=null&&typeof e=="object"&&"originalContext"in e&&"length"in e}};function aB(e,t){return new sB(e,t)}var lB=US({Arbitrary:()=>ye,ExecutionStatus:()=>x_,PreconditionFailure:()=>Or,Random:()=>wf,Stream:()=>H,Value:()=>$,VerbosityLevel:()=>e_,__commitHash:()=>dB,__type:()=>cB,__version:()=>uB,anything:()=>L1,array:()=>de,assert:()=>H_,asyncDefaultReportMessage:()=>Mk,asyncModelRun:()=>I5,asyncProperty:()=>Z3,asyncStringify:()=>bf,asyncToStringMethod:()=>lr,base64String:()=>F9,bigInt:()=>Tr,bigInt64Array:()=>L5,bigUint64Array:()=>N5,boolean:()=>ci,chainUntil:()=>Nj,check:()=>Nk,clone:()=>Fj,cloneIfNeeded:()=>Dn,cloneMethod:()=>Ue,commands:()=>x5,compareBooleanFunc:()=>j8,compareFunc:()=>B8,configureGlobal:()=>J3,constant:()=>Oe,constantFrom:()=>Bt,context:()=>Ij,createDepthIdentifier:()=>xf,date:()=>Gk,defaultReportMessage:()=>Ok,dictionary:()=>Cf,domain:()=>Af,double:()=>Ka,emailAddress:()=>ZF,entityGraph:()=>j7,falsy:()=>Ej,float:()=>p1,float32Array:()=>S1,float64Array:()=>v1,func:()=>W8,gen:()=>Q_,getDepthContextFor:()=>vf,hasAsyncToStringMethod:()=>yf,hasCloneMethod:()=>Qr,hasToStringMethod:()=>gf,hash:()=>za,infiniteStream:()=>M9,int16Array:()=>x1,int32Array:()=>k1,int8Array:()=>R1,integer:()=>ae,ipV4:()=>Lf,ipV4Extended:()=>g1,ipV6:()=>y1,json:()=>A9,jsonValue:()=>N1,letrec:()=>b1,limitShrink:()=>aB,lorem:()=>G7,map:()=>of,mapToConstant:()=>Vn,maxSafeInteger:()=>m1,maxSafeNat:()=>q8,memo:()=>Y7,mixedCase:()=>r9,modelRun:()=>P5,nat:()=>Pr,noBias:()=>Ha,noShrink:()=>Ga,object:()=>R9,oneof:()=>Ve,option:()=>cr,pre:()=>CD,property:()=>Q3,readConfigureGlobal:()=>Pt,record:()=>nf,resetConfigureGlobal:()=>Y3,sample:()=>G_,scheduledModelRun:()=>A5,scheduler:()=>O5,schedulerFor:()=>M5,set:()=>T1,shuffledSubarray:()=>H9,sparseArray:()=>A1,statistics:()=>K_,stream:()=>Ar,string:()=>De,stringMatching:()=>eB,stringify:()=>Me,subarray:()=>W9,toStringMethod:()=>It,tuple:()=>z,uint16Array:()=>C1,uint32Array:()=>E1,uint8Array:()=>P1,uint8ClampedArray:()=>I1,ulid:()=>Z9,uniqueArray:()=>tn,uuid:()=>i5,webAuthority:()=>j1,webFragments:()=>B1,webPath:()=>U1,webQueryParameters:()=>W1,webSegment:()=>V1,webUrl:()=>b5}),cB="module",uB="4.8.0",dB="c0da76fbcf6470339ad7bb2f0dfcebee06ede56c",We=lB;function Ya(e){return e?.values!=null&&e.values.length>0?We.constantFrom(...e.values):pB(e)}function pB(e){if(e?.type==="number")return We.integer();if(e?.type==="boolean")return We.boolean();let t=e?.generator==null?void 0:hB[e.generator];if(t!=null)return t;let r=e?.constraints?.kind==="string"?e.constraints:void 0;return We.string({maxLength:r?.maxLength,minLength:r?.minLength??1}).filter(n=>n.trim().length>0&&n===n.trim())}var fB="abcdefghijklmnopqrstuvwxyz0123456789".match(/./g)??[],Un=e=>We.array(We.constantFrom(...fB),{maxLength:e,minLength:1}).map(t=>t.join("")),jf=(e,t)=>We.array(Un(10),{maxLength:t,minLength:1}).map(r=>r.join(e)),hB={"company.name":jf(" ",3),"date.iso":mB(),"internet.email":gB(),"internet.url":yB(),"lorem.slug":jf("-",3),"lorem.word":Un(10),"person.fullName":jf(" ",2)};function mB(){return We.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 gB(){return We.tuple(Un(12),Un(10),We.constantFrom("com","dev","io","org","ai")).map(([e,t,r])=>`${e}@${t}.${r}`)}function yB(){return We.tuple(We.constantFrom("http","https"),Un(12),We.constantFrom("app","com","dev","io","org"),We.array(Un(8),{maxLength:3})).map(([e,t,r,n])=>{let o=n.length===0?"":`/${n.join("/")}`;return`${e}://${t}.${r}${o}`})}var t0=new WeakMap;function Ff(e){let t=t0.get(e);if(t!=null)return t;let r=Object.fromEntries(Object.entries(e.paramSpaces).map(([n,o])=>[n,wB(o)]));return t0.set(e,r),r}var bB=24301;function wB(e){let[t]=We.sample(Ya(e),{numRuns:1,seed:bB});if(t==null)throw new Error("arbitrary produced no sample");return t}function ui(e){return{aborted:!0,findings:[],fired:[],teardown:e}}function Vf(e,t){return new SB(vB(e,t))}async function vB({browser:e,hub:t,request:r},n){if(n.aborted)return Bf(ui("skipped"));let o=PB({lockfile:r.lockfile,options:r.options,runId:r.runId,signal:n}),i=async s=>{try{return Bf(await kB({browser:e,established:s,hub:t,request:r,signal:n}))}catch(a){return r0(co(a))}};return EB(o,r).match(i,s=>xB(s,o.teardown))}async function xB(e,t){return e.kind!=="aborted"?r0(e):Bf(ui(await n0(t)))}function n0(e){return e().match(()=>"done",()=>"failed")}async function kB(e){let t=await RB(e);if(t.kind==="completed")return await e.established.teardown().match(rs,ig),{aborted:!1,...t.result};let r=await n0(e.established.teardown);if(t.kind==="aborted")return ui(r);throw t.error}async function RB({browser:e,established:t,hub:r,request:n,signal:o}){try{Sr(o);let{close:i,driver:s,emitAssertion:a}=await Cu({baseUrl:n.options.baseUrl,browser:e,capture:n.capture?{hub:r,runId:n.runId}:null,clientState:t.clientState,engine:vu(AB(n.lockfile)),reader:t.reader,session:t.auth});try{return{kind:"completed",result:await yu({canon:_c(n.lockfile),classify:Dc(n.lockfile),driver:s,initialState:{snapshot:t.snapshot},onAssertion:a,onEvent:n.onEvent??rs,sequence:n.sequence??CB(n.lockfile,n.testName,n.params),...Xo(n.lockfile)},o)}}finally{await i()}}catch(i){return pg(i)?{kind:"aborted"}:{error:i,kind:"threw"}}}function CB(e,t,r){return us(e,t).map(n=>({params:{...Ff(n),...r},transition:n}))}function EB(e,t){return wo(t.lockfile,t.testName,{generate:Su(wu(t.options.generate,t.runId),new Date().toISOString()),materialize:e.materialize,params:t.params}).map(r=>({auth:r.auth,clientState:r.clientState,reader:e.reader,snapshot:r.snapshot,teardown:e.teardown}))}function PB({lockfile:e,options:t,runId:r,signal:n}){let o=Au({baseUrl:t.engineUrl,runId:r,secret:t.secret},n);return{materialize:Qc(o.setupWorld),reader:Iu(e.entities,IB(e),o.query),teardown:o.teardown}}function IB(e){return e.singletons.filter(t=>t.source==="backend").map(t=>t.name)}function AB(e){return e.singletons.filter(t=>t.source==="client").map(t=>t.name)}function di({debugDir:e,headed:t,writeOtlpPortFile:r}){let n=vy({headed:t}),o,i,s=async()=>(o??=cp({debugDir:e,writeOtlpPortFile:r}),i=await o,i),a=async(c,u)=>{if(u.aborted)return OB(ui("skipped"));try{let d=await s();return c.options.headed&&!t?await Eu(!0,async p=>Vf({browser:p,hub:d,request:c},u)):await Vf({browser:await n.acquire(),hub:d,request:c},u)}catch(d){return TB(co(d))}};return{close:async()=>{await n.close();let c=o;o=void 0,i=void 0,c!=null&&await c.then(u=>u.close()).catch(()=>{})},injectSpan:(c,u)=>{i?.injectSpan(c,u)},runOnce:(c,u)=>new MB(a(c,u))}}function pi(e,t){let r=e.axes.flatMap(n=>n.classify(t).map(([o,i])=>`${o}:${i}`));return[t.label,...r.toSorted((n,o)=>n.localeCompare(o))].join("|")}function Uf(e){return e.axes.map(t=>t.name).join("+")}function Wf(e){return{name:`counts(${e})`,classify:({pre:t})=>[...t.entities].flatMap(([r,n])=>n.size===0?[]:[[r,NB(e,n.size)]])}}function Hf(e){let t=o0(e);return{name:"enum-fields",classify:({pre:r})=>[...r.entities].flatMap(([n,o])=>[...o.values()].flatMap(i=>LB(n,i,t)))}}function LB(e,t,r){return Object.entries(t).flatMap(([n,o])=>r.has(`${e}.${n}`)?[[`${e}.${n}`,$B(o)]]:[])}function o0(e){let t=e.valueSpaces.flatMap(n=>n.values==null?[]:[n.name]),r=new Set(t);return new Set(e.entities.flatMap(n=>Object.entries(n.props).flatMap(([o,i])=>i.type==="boolean"||i.valueSpace!=null&&r.has(i.valueSpace)?[`${n.name}.${o}`]:[])))}function NB(e,t){return e==="presence"?"1+":e==="unit"?t===1?"1":"2+":t<=2?String(t):"3+"}function $B(e){return e==null?"\u2205":String(e)}import{createHash as DB}from"crypto";import{appendFile as _B,mkdir as jB,readFile as FB}from"fs/promises";import BB from"path";import{err as VB,ok as UB,ResultAsync as i0}from"neverthrow";import{z as W}from"zod";var WB=W.object({actionHash:W.string().min(1),at:W.string().min(1),kind:W.literal("discharge"),lensId:W.string().min(1),obligationKey:W.string().min(1)}),HB=W.object({actionHash:W.string().min(1),at:W.string().min(1),depot:W.string().min(1),kind:W.literal("finding"),lensId:W.string().min(1),lockfileHash:W.string().min(1),obligationKey:W.string().min(1),oracleLayer:W.enum(["crash","invariant","law","frame"]),runId:W.string().min(1).optional(),signature:W.string().min(1),trail:W.array(W.string().min(1))}),zB=W.object({actionHash:W.string().min(1),at:W.string().min(1),depot:W.string().min(1),kind:W.literal("flaky-candidate"),lensId:W.string().min(1),obligationKey:W.string().min(1),signature:W.string().min(1),trail:W.array(W.string().min(1))}),GB=W.object({at:W.string().min(1),kind:W.literal("saturation"),lensId:W.string().min(1),lockfileHash:W.string().min(1),ring:W.number().int().nonnegative()}),qB=W.object({arrangement:W.string().min(1),at:W.string().min(1),canonicalKey:W.string().min(1),kind:W.literal("derived-depot")}),Xa=W.discriminatedUnion("kind",[WB,HB,zB,GB,qB]);function dt(e){return`${e.lensId} ${e.actionHash} ${e.obligationKey}`}function zf(e){return e.reduce((t,r)=>QB(t,r),ZB())}function Gf(e){return i0.fromPromise(KB(e),t=>({error:t,kind:"io"})).andThen(YB)}function qf(e,t){let r=t.map(n=>`${JSON.stringify(n)}
212
- `).join("");return i0.fromPromise(jB(BB.dirname(e),{recursive:!0}).then(()=>_B(e,r)),n=>({error:n,kind:"io"}))}function rn(e,t){let r=Q({effect:t.effectStep,guard:t.guard,nav:t.nav,params:t.paramSpaces,steps:t.steps}),n=e.entities.filter(o=>r.includes(`"${o.name}"`));return s0(Q({entities:n,spec:r}))}function Kf(e){return s0(Q(e))}async function KB(e){return(await FB(e,"utf8").catch(r=>{if(JB(r))return"";throw r})).split(`
213
- `).filter(r=>r.length>0)}function JB(e){return e instanceof Error&&"code"in e&&e.code==="ENOENT"}function YB(e){let t=e.map((n,o)=>({index:o,result:Xa.safeParse(XB(n))})),r=t.find(({result:n})=>!n.success);return r!=null&&!r.result.success?VB({issues:r.result.error,kind:"corrupt-row",line:r.index+1}):UB(t.flatMap(({result:n})=>n.success?[n.data]:[]))}function XB(e){try{return JSON.parse(e)}catch{return null}}function s0(e){return DB("sha256").update(e).digest("hex")}function ZB(){return{discharged:new Set,findings:new Map,saturations:new Map}}function QB(e,t){if(t.kind==="discharge"||t.kind==="flaky-candidate")return{...e,discharged:new Set([...e.discharged,dt(t)])};if(t.kind==="finding")return{...e,discharged:new Set([...e.discharged,dt(t)]),findings:eV(e.findings,t)};if(t.kind==="saturation"){let r=`${t.lensId} ${String(t.ring)}`;return{...e,saturations:new Map([...e.saturations,[r,t]])}}return e}function eV(e,t){let r=e.get(t.signature),n=r==null?{first:t,occurrences:1}:{first:r.first,occurrences:r.occurrences+1};return new Map([...e,[t.signature,n]])}function Jf(e){let t={edges:new Map,obligations:new Map,saturationDepth:0,seen:new Set,states:0},r=e.depots.map(n=>(t.seen.add(Hr(n.snapshot)),{depot:n.name,lastLabel:null,snapshot:n.snapshot,trail:[]}));return rV(e,r,t),{edges:t.edges,obligations:t.obligations,saturationDepth:t.saturationDepth,states:t.seen.size}}var tV=24301,a0=new WeakMap;function Za(e,t){let r=a0.get(e)??new Map;a0.set(e,r);let n=r.get(t);if(n!=null)return n;let o=Object.fromEntries(Object.entries(e.paramSpaces).map(([i,s])=>[i,lV(s,t)]));return r.set(t,o),o}function rV(e,t,r){let n=[...t],o=0;for(;o<n.length;){let i=n[o];o+=1,i!=null&&nV(e,i,r).forEach(s=>n.push(s))}}function nV(e,t,r){let n={snapshot:t.snapshot},o=i=>Za(i,aV(t.trail,e.corpus,i));return hn(e.corpus,n,o).flatMap(i=>{let s=e.corpus[i.idx];if(s==null)return[];let a=[...t.trail,{idx:i.idx,params:i.params}],l={depot:t.depot,trail:a,transitionIndex:i.idx};return oV({acc:r,node:t,option:i,params:e,transition:s,witness:l}),iV({acc:r,node:t,option:i,params:e,trail:a})})}function oV({acc:e,node:t,option:r,params:n,transition:o,witness:i}){let s={label:r.label,params:r.params,pre:t.snapshot,spaces:o.paramSpaces},a=pi(n.lens,s);if(e.obligations.has(a)||(e.obligations.set(a,i),e.saturationDepth=Math.max(e.saturationDepth,i.trail.length)),t.lastLabel!=null){let l=`${t.lastLabel} \u2192 ${r.label}`;e.edges.has(l)||e.edges.set(l,i)}}function iV({acc:e,node:t,option:r,params:n,trail:o}){if(o.length>=n.maxDepth)return[];let i=r.firing.next.snapshot;if(sV(t.snapshot,i,n.maxCount))return[];let s=Hr(i);return e.seen.has(s)?[]:(e.seen.add(s),[{depot:t.depot,lastLabel:r.label,snapshot:i,trail:o}])}function sV(e,t,r){return[...t.entities].some(([n,o])=>{let i=e.entities.get(n)?.size??0;return o.size>i&&o.size>r})}function aV(e,t,r){return e.filter(n=>t[n.idx]===r).length}function lV(e,t){let[r]=We.sample(Ya(e),{numRuns:1,seed:tV+t});if(r==null)throw new Error("arbitrary produced no sample");return r}var cV=10;function Yf(e){let t=c0(e).map(i=>uV(e,i)),r=dV(e,t);if(r!=null)return r;let n=t.find(i=>i.length>0);return n==null?{kind:"saturated",ring:t.length}:{kind:"discharge",obligation:n.reduce((i,s)=>l0(e,s)>l0(e,i)?s:i)}}function c0(e){return[{entries:e.graph.obligations,index:1},{entries:e.graph.edges,index:2}]}function uV(e,t){return[...t.entries].flatMap(([r,n])=>{let o=u0({obligationKey:r,params:e,ring:t.index,witness:n});return e.discharged.has(d0(e,o))?[]:[o]})}function u0({obligationKey:e,params:t,ring:r,witness:n}){let o=t.actionHashes[n.transitionIndex];if(o==null)throw new Error("transition index out of corpus range");return{actionHash:o,obligationKey:e,ring:r,witness:n}}function d0(e,t){return dt({actionHash:t.actionHash,lensId:e.lensId,obligationKey:t.obligationKey})}function dV(e,t){if(e.tick===0||e.tick%cV!==0)return null;let r=c0(e).flatMap(o=>[...o.entries].flatMap(([i,s])=>{let a=u0({obligationKey:i,params:e,ring:o.index,witness:s});return e.discharged.has(d0(e,a))?[a]:[]}));if(r.length===0||t.every(o=>o.length===0))return null;let n=r[e.tick%r.length];return n==null?null:{kind:"revalidate",obligation:n}}var pV=/delete|remove|cancel|deactivate|revoke|archive/i;function l0(e,t){let r=t.ring===2&&fV(e,t)?4:0,n=pV.test(t.obligationKey)?2:0,o=1/(1+t.witness.trail.length);return r+n+o}function fV(e,t){return new Set(t.witness.trail.flatMap(n=>{let o=e.corpus[n.idx];return o==null?[]:[o.test]})).size>1}function fi(e){let t=hV(e,e.witnessTrail);return t==null?{covers:[],firings:[]}:gV(e,t)}function hV(e,t){return t.reduce((r,n)=>r==null?null:mV(e,r,n),{covers:[],firings:[],snapshot:e.depotSnapshot})}function mV(e,t,r){let n=e.corpus[r.idx];if(n==null)return null;let o=vo(n,{snapshot:t.snapshot},r.params);if(o==null)return null;let i=p0({params:e,planned:r,pre:t.snapshot,transition:n});return{covers:[...t.covers,i],firings:[...t.firings,r],snapshot:o.next.snapshot}}function p0({params:e,planned:t,pre:r,transition:n}){let o={label:`${n.test}#${String(n.index)}`,params:t.params,pre:r,spaces:n.paramSpaces},i=e.actionHashes[t.idx];if(i==null)throw new Error("transition index out of corpus range");return{actionHash:i,obligationKey:pi(e.lens,o)}}function gV(e,t){let r=new Set([...e.discharged,...t.covers.map(o=>dt({...o,lensId:e.lensId}))]),n=f0({params:e,seen:r,state:t});return{covers:n.covers,firings:n.firings}}function f0({params:e,seen:t,state:r}){if(r.firings.length>=e.maxLength)return r;let n=yV({params:e,seen:t,state:r});return n==null?r:(t.add(dt({...n.coverage,lensId:e.lensId})),f0({params:e,seen:t,state:{covers:[...r.covers,n.coverage],firings:[...r.firings,n.planned],snapshot:n.snapshot}}))}function yV({params:e,seen:t,state:r}){let n=i=>Za(i,bV(r.firings,e.corpus,i));return hn(e.corpus,{snapshot:r.snapshot},n).map(i=>{let s=e.corpus[i.idx];if(s==null)return null;let a={idx:i.idx,params:i.params};return{coverage:p0({params:e,planned:a,pre:r.snapshot,transition:s}),planned:a,snapshot:i.firing.next.snapshot}}).find(i=>i!=null&&!t.has(dt({...i.coverage,lensId:e.lensId})))??null}function bV(e,t,r){return e.filter(n=>t[n.idx]===r).length}function Xf(e,{sweep:t}){let r=Yt(e.tests.filter(n=>!n.stub),n=>Q({s:n.singletons,w:n.world})).map(n=>({name:n.name,test:n}));return t?[...r,...r.flatMap(n=>wV(n))]:r}function nn(e,t,r){return wo({...e,tests:[t.test]},t.test.name,r)}function wV(e){return SV(e.test).map(t=>{let r={...t,as:`${t.as}~2`},n=`${e.name} +${t.entity}`;return{name:n,test:{...e.test,name:n,world:[...e.test.world,r]}}})}function SV(e){return e.world.filter(t=>{let r=Q({...e,world:e.world.filter(n=>n!==t)});return!r.includes(`"${t.as}.`)&&!r.includes(`"ref":"${t.as}"`)})}async function hi(e,t){let r=await Qa({attemptIndex:0,capture:!1,firings:e.trail.firings,params:e},t);return r.kind!=="completed"?h0(r):r.findings.length===0?{kind:"clean",rows:EV(e)}:vV(e,mi(e,r.findings),t)}function h0(e){return e.kind==="aborted"?{kind:"aborted"}:{error:e.error,kind:"error"}}async function vV(e,t,r){let n=await Qa({attemptIndex:1,capture:!1,firings:e.trail.firings,params:e},r);return n.kind!=="completed"?h0(n):mi(e,n.findings)!==t?{kind:"flaky",rows:[PV(e,t)]}:xV({params:e,signal:r,signature:t})}async function Qa({attemptIndex:e,capture:t,firings:r,params:n},o){let i=n.runIdFor(e);return(await n.session.runOnce({capture:t,lockfile:CV(n),onEvent:void 0,options:n.options,params:void 0,runId:i,sequence:RV(n,r),testName:n.depot.test.name},o)).match(a=>a.aborted?{kind:"aborted"}:{findings:a.findings,kind:"completed",runId:i},a=>({error:a,kind:"error"}))}async function xV({params:e,signal:t,signature:r}){let n=await m0({attemptIndex:2,budget:e.shrinkBudget,firings:e.trail.firings,params:e,signal:t,signature:r});if(n.kind!=="shrunk")return n.outcome;let o=await kV({firings:n.firings,params:e,signal:t,signature:r});if(o.kind==="aborted")return{kind:"aborted"};let i=IV({minimal:n.firings,params:e,runId:o.kind==="reproduced"?o.runId:void 0,signature:r});return{finding:i,kind:"finding",minimal:n.firings,rows:[i],runId:o.kind==="reproduced"?o.runId:n.runId}}async function kV({firings:e,params:t,signal:r,signature:n}){let o=await Qa({attemptIndex:t.shrinkBudget+2,capture:!0,firings:e,params:t},r);return o.kind==="aborted"?{kind:"aborted"}:o.kind==="completed"&&mi(t,o.findings)===n?{kind:"reproduced",runId:o.runId}:{kind:"no-repro"}}async function m0(e){let t={firings:e.firings,kind:"shrunk",runId:e.params.runIdFor(e.attemptIndex-1)};if(e.budget<=0||e.firings.length<=1)return t;let r=e.firings.map((n,o)=>e.firings.filter((i,s)=>s!==o));return g0(e,r,t)}async function g0(e,t,r){let[n,...o]=t;if(n==null||e.budget-1<0)return r;let i=await Qa({attemptIndex:e.attemptIndex,capture:!1,firings:n,params:e.params},e.signal);if(i.kind==="aborted")return{kind:"halted",outcome:{kind:"aborted"}};let s={...e,attemptIndex:e.attemptIndex+1,budget:e.budget-1};return i.kind==="completed"&&mi(e.params,i.findings)===e.signature?m0({...s,firings:n}):g0(s,o,r)}function RV(e,t){return t.map(r=>{let n=e.corpus[r.idx];if(n==null)throw new Error("transition index out of corpus range");return{params:r.params,transition:n}})}function CV(e){return e.lockfile.tests.some(r=>r.name===e.depot.test.name)?e.lockfile:{...e.lockfile,tests:[...e.lockfile.tests,e.depot.test]}}function EV(e){return e.trail.covers.map(t=>({actionHash:t.actionHash,at:e.now(),kind:"discharge",lensId:e.lensId,obligationKey:t.obligationKey}))}function PV(e,t){return{actionHash:Zf(e).actionHash,at:e.now(),depot:e.depot.name,kind:"flaky-candidate",lensId:e.lensId,obligationKey:Zf(e).obligationKey,signature:t,trail:e.trail.covers.map(r=>r.obligationKey)}}function IV({minimal:e,params:t,runId:r,signature:n}){let o=Zf(t);return{actionHash:o.actionHash,at:t.now(),depot:t.depot.name,kind:"finding",lensId:t.lensId,lockfileHash:t.lockfileHash,obligationKey:o.obligationKey,oracleLayer:"frame",runId:r,signature:n,trail:e.map(i=>{let s=t.corpus[i.idx];if(s==null)throw new Error("transition index out of corpus range");return`${s.test}#${String(s.index)}`})}}function Zf(e){let t=e.trail.covers.at(-1);if(t==null)throw new Error("trail has no coverage");return t}function y0(e){return e.kind==="driver-error"||e.kind==="unfireable"?"crash":e.kind==="obligation"?e.source.kind==="invariant"?"invariant":e.source.kind==="law"?"law":"frame":"frame"}function mi(e,t){let r=t.map(n=>Q(AV(n))).toSorted((n,o)=>n.localeCompare(o));return Q({depot:e.depot.name,parts:r})}function AV(e){let t=y0(e);switch(e.kind){case"consistency":return{divergence:TV(e.divergence),layer:t,step:e.step==null?null:{intent:e.step.intent,test:e.step.test}};case"obligation":return{layer:t,source:e.source.kind,step:{intent:e.step.intent,test:e.step.test}};case"unfireable":return{intent:e.intent,layer:t,reason:e.reason,test:e.test};case"driver-error":return{error:e.error.kind,layer:t,step:e.step.intent};case"illegal-transition":return{layer:t,step:e.step.intent}}}function TV(e){return e.kind==="singleton-mismatch"?{kind:e.kind,singleton:e.singleton}:{entity:e.entity,kind:e.kind}}function Mr(e){let t=ht(e),r=Xo(e);return[...au(t,r.invariants).map(n=>({gap:n,kind:"cascade-gap"})),...su(r.laws).map(n=>({conflict:n,kind:"law-conflict"}))]}function b0(e){return`${_.good("OK")} \u2014 no static model violations (${String(e)} tests)`}function Lr(e){return[`${_.bad("FAIL")} \u2014 ${String(e.length)} static model violation(s):`,...e.map(t=>Nu(t))].join(`
214
-
215
- `)}function el(e){return[`${_.warn("WARN")} \u2014 ${String(e.length)} model coverage gap(s) (not blocking):`,...e.map(t=>` ${OV(t)}`),`Coverage gaps mean the model can't catch regressions there. Stub the missing flows. ${V("explore")}`].join(`
216
- `)}function OV(e){return e.kind==="entity-never-given"?`${e.entity} \u2014 declared but no implemented test seeds it; no flow exercises this state`:`${e.entity} \u2014 seeded but never asserted created/updated/deleted; mutations to it ship unchecked`}import{graphql as MV}from"gql.tada";var LV=MV(`
80
+ `)}function fe(e){return[`${C.warn("WARN")} \u2014 ${String(e.length)} model coverage gap(s) (not blocking):`,...e.map(t=>` ${ni(t)}`),`Coverage gaps mean the model can't catch regressions there. Stub the missing flows. ${d("explore")}`].join(`
81
+ `)}function ni(e){return e.kind==="entity-never-given"?`${e.entity} \u2014 declared but no implemented test seeds it; no flow exercises this state`:`${e.entity} \u2014 seeded but never asserted created/updated/deleted; mutations to it ship unchecked`}import{graphql as oi}from"gql.tada";var ii=oi(`
217
82
  query DoctorAuthViewer {
218
83
  currentUser {
219
84
  name
220
85
  email
221
86
  }
222
87
  }
223
- `),NV="Failed to connect to Ripplo server";async function w0({serverUrl:e,token:t}){try{let r=await D({config:yr({serverUrl:e,token:t}),document:LV,variables:void 0});return r.currentUser==null?{kind:"invalid"}:{email:r.currentUser.email,kind:"valid"}}catch(r){return(r instanceof Error?r.message:String(r)).startsWith(NV)?{kind:"unreachable"}:{kind:"invalid"}}}function v0(e){switch(e.type){case"settings":return!e.valid;case"env-files":return e.missing.length>0;case"token":return e.status==="missing"||e.status==="invalid";case"dev-server":return!e.reachable;case"dev-session":return e.status!=="active";case"preconditions":return e.count>0&&!e.configured;case"engine-endpoint":return!e.reachable;case"adapter-enabled":return e.status!=="enabled";case"webhook-verification":return!e.rejectsUnsigned;case"preconditions-validation":return!e.valid;case"workflows":return e.invalidNames.length>0;case"browser":return!e.installed;case"lockfile":return e.status!=="match";case"pre-commit-hook":return!e.installed}}async function x0(e){let t=await DV(e),r={missing:lc(e),type:"env-files"},n=await _V(),o=jV(),i=await ve(e),s=FV(i),a=BV(i),l=await VV(e,i),c=WV(e),u=await HV(t,i);return[t,r,n,...u,s,a,l,c,o]}async function DV(e){let t=await Um(e);return t.valid?{missingFields:[],type:"settings",valid:!0}:{missingFields:t.errors.map(n=>n.path).filter(n=>n.length>0),type:"settings",valid:!1}}async function _V(){let e=ft();if(e==null||e.length===0)return{email:void 0,status:"missing",type:"token"};let t=await w0({serverUrl:st(),token:e});return t.kind==="valid"?{email:t.email,status:"valid",type:"token"}:{email:void 0,status:t.kind,type:"token"}}function jV(){let e=$V.executablePath();return{installed:tl.existsSync(e),type:"browser"}}function FV(e){if(e.isErr())return{errorCount:1,errors:[{message:Pe(e.error),path:".ripplo/"}],found:!1,type:"preconditions-validation",valid:!1};let t=Mr(e.value);return{errorCount:t.length,errors:t.length===0?[]:[{message:Lr(t),path:""}],found:!0,type:"preconditions-validation",valid:t.length===0}}function BV(e){if(e.isErr())return{invalidNames:[],invalidWorkflows:[],total:0,type:"workflows",valid:0};let t=e.value.tests.length;return{invalidNames:[],invalidWorkflows:[],total:t,type:"workflows",valid:t}}async function VV(e,t){if(t.isErr())return{status:"missing",type:"lockfile"};let r=qt(bt,t.value),n=await tl.promises.readFile(S0.join(e,tt),"utf8").catch(()=>null);return{status:UV(n,r),type:"lockfile"}}function UV(e,t){return e==null?"missing":e===t?"match":"stale"}function WV(e){let t=S0.join(e,".git","hooks","pre-commit");return tl.existsSync(t)?{installed:tl.readFileSync(t,"utf8").includes("ripplo compile --check"),type:"pre-commit-hook"}:{installed:!1,type:"pre-commit-hook"}}async function HV(e,t){if(!e.valid||t.isErr())return[];let r=ln().map(a=>({appUrl:a.appUrl,engineUrl:a.engineUrl,webhookSecret:a.webhookSecret})).unwrapOr(void 0);if(r==null)return[];let n=[],o=await Lc(r.appUrl)==null;n.push({appUrl:r.appUrl,reachable:o,type:"dev-server"});let i=await Bm(process.cwd());n.push(i);let s=await zV(r,t);return n.push(...s),n}async function zV(e,t){let r=t.isOk()?t.value.entities.length:0,n=e.engineUrl.length>0,o={configured:n,count:r,endpointReachable:void 0,type:"preconditions"};if(r===0||!n)return[o];let i=qV(e.appUrl,e.engineUrl);if(i==null)return[o];let s=await Lc(i)==null,a=[];if(a.push({configured:!0,count:r,endpointReachable:s,type:"preconditions"}),k0(e.engineUrl)&&a.push({reachable:s,type:"engine-endpoint",url:i}),!s)return a;let l=await Wm({appUrl:e.appUrl,engineUrl:e.engineUrl});a.push({rejectsUnsigned:l==null,type:"webhook-verification"});let c=await GV({engineUrl:i,webhookSecret:e.webhookSecret});return a.push({status:c,type:"adapter-enabled",url:i}),a}async function GV({engineUrl:e,webhookSecret:t}){if(t.length===0)return"no-secret";let r=JSON.stringify({});try{let n=await fetch(`${e}/setup`,{body:r,headers:{"Content-Type":"application/json",...tc({body:r,secret:t})},method:"PUT",signal:AbortSignal.timeout(5e3)});return n.status===404?"disabled":n.status===401||n.status===403?"bad-secret":"enabled"}catch{return"unreachable"}}function k0(e){return e.startsWith("http://")||e.startsWith("https://")}function qV(e,t){return k0(t)?t:`${e}${t}`}async function R0(){let e=process.cwd(),t=await x0(e),r=t.map(o=>Vm(o));process.stdout.write(r.join(`
88
+ `),si="Failed to connect to Ripplo server";async function Sr({serverUrl:e,token:t}){try{let r=await p({config:U({serverUrl:e,token:t}),document:ii,variables:void 0});return r.currentUser==null?{kind:"invalid"}:{email:r.currentUser.email,kind:"valid"}}catch(r){return(r instanceof Error?r.message:String(r)).startsWith(si)?{kind:"unreachable"}:{kind:"invalid"}}}function Cr(e){switch(e.type){case"settings":return!e.valid;case"env-files":return e.missing.length>0;case"token":return e.status==="missing"||e.status==="invalid";case"dev-server":return!e.reachable;case"dev-session":return e.status!=="active";case"preconditions":return e.count>0&&!e.configured;case"engine-endpoint":return!e.reachable;case"adapter-enabled":return e.status!=="enabled";case"webhook-verification":return!e.rejectsUnsigned;case"preconditions-validation":return!e.valid;case"workflows":return e.invalidNames.length>0;case"browser":return!e.installed;case"lockfile":return e.status!=="match";case"pre-commit-hook":return!e.installed}}async function xr(e){let t=await ai(e),r={missing:at(e),type:"env-files"},n=await li(),o=await ci(),i=await S(e),a=di(i),s=pi(i),l=await ui(e,i),c=fi(e),b=await gi(t,i);return[t,r,n,...b,a,s,l,c,o]}async function ai(e){let t=await yt(e);return t.valid?{missingFields:[],type:"settings",valid:!0}:{missingFields:t.errors.map(n=>n.path).filter(n=>n.length>0),type:"settings",valid:!1}}async function li(){let e=O();if(e==null||e.length===0)return{email:void 0,status:"missing",type:"token"};let t=await Sr({serverUrl:I(),token:e});return t.kind==="valid"?{email:t.email,status:"valid",type:"token"}:{email:void 0,status:t.kind,type:"token"}}async function ci(){let{chromium:e}=await import("playwright"),t=e.executablePath();return{installed:ge.existsSync(t),type:"browser"}}function di(e){if(e.isErr())return{errorCount:1,errors:[{message:R(e.error),path:".ripplo/"}],found:!1,type:"preconditions-validation",valid:!1};let t=H(e.value);return{errorCount:t.length,errors:t.length===0?[]:[{message:M(t),path:""}],found:!0,type:"preconditions-validation",valid:t.length===0}}function pi(e){if(e.isErr())return{invalidNames:[],invalidWorkflows:[],total:0,type:"workflows",valid:0};let t=e.value.tests.length;return{invalidNames:[],invalidWorkflows:[],total:t,type:"workflows",valid:t}}async function ui(e,t){if(t.isErr())return{status:"missing",type:"lockfile"};let r=q(N,t.value),n=await ge.promises.readFile(Rr.join(e,L),"utf8").catch(()=>null);return{status:mi(n,r),type:"lockfile"}}function mi(e,t){return e==null?"missing":e===t?"match":"stale"}function fi(e){let t=Rr.join(e,".git","hooks","pre-commit");return ge.existsSync(t)?{installed:ge.readFileSync(t,"utf8").includes("ripplo compile --check"),type:"pre-commit-hook"}:{installed:!1,type:"pre-commit-hook"}}async function gi(e,t){if(!e.valid||t.isErr())return[];let r=st().map(s=>({appUrl:s.appUrl,engineUrl:s.engineUrl,webhookSecret:s.webhookSecret})).unwrapOr(void 0);if(r==null)return[];let n=[],o=await Z(r.appUrl)==null;n.push({appUrl:r.appUrl,reachable:o,type:"dev-server"});let i=await wr(process.cwd());n.push(i);let a=await hi(r,t);return n.push(...a),n}async function hi(e,t){let r=t.isOk()?t.value.entities.length:0,n=e.engineUrl.length>0,o={configured:n,count:r,endpointReachable:void 0,type:"preconditions"};if(r===0||!n)return[o];let i=ki(e.appUrl,e.engineUrl);if(i==null)return[o];let a=await Z(i)==null,s=[];if(s.push({configured:!0,count:r,endpointReachable:a,type:"preconditions"}),Pr(e.engineUrl)&&s.push({reachable:a,type:"engine-endpoint",url:i}),!a)return s;let l=await kt({appUrl:e.appUrl,engineUrl:e.engineUrl});s.push({rejectsUnsigned:l==null,type:"webhook-verification"});let c=await yi({engineUrl:i,webhookSecret:e.webhookSecret});return s.push({status:c,type:"adapter-enabled",url:i}),s}async function yi({engineUrl:e,webhookSecret:t}){if(t.length===0)return"no-secret";let r=JSON.stringify({});try{let n=await fetch(`${e}/setup`,{body:r,headers:{"Content-Type":"application/json",...nt({body:r,secret:t})},method:"PUT",signal:AbortSignal.timeout(5e3)});return n.status===404?"disabled":n.status===401||n.status===403?"bad-secret":"enabled"}catch{return"unreachable"}}function Pr(e){return e.startsWith("http://")||e.startsWith("https://")}function ki(e,t){return Pr(t)?t:`${e}${t}`}async function Er(){let e=process.cwd(),t=await xr(e),r=t.map(o=>vr(o));process.stdout.write(r.join(`
224
89
  `)+`
225
- `);let n=t.some(o=>v0(o));process.exit(n?1:0)}import rl from"fs";import{graphql as JV}from"gql.tada";import KV from"fs";function Nr(e){return Ot(e,"hooks-paused")}function je(e){return KV.existsSync(Nr(e))||es(e)?!1:dn(e)}var YV=JV(`
90
+ `);let n=t.some(o=>Cr(o));process.exit(n?1:0)}import he from"fs";import{graphql as wi}from"gql.tada";var vi=wi(`
226
91
  mutation CliSetHooksPaused($projectId: String!, $paused: Boolean!) {
227
92
  setHooksPaused(projectId: $projectId, paused: $paused) {
228
93
  id
229
94
  }
230
95
  }
231
- `);async function C0(){process.stdin.isTTY||(process.stderr.write("`ripplo hooks pause` must be invoked interactively from a terminal \u2014 refusing non-TTY invocation. Bypassing the gate is a human decision, not an agent decision.\n"),process.exit(1));let e=process.cwd();Ut(e);let t=Nr(e);if(rl.existsSync(t)){process.stdout.write("Hooks already paused. Run `ripplo hooks resume` to re-enable.\n");return}rl.writeFileSync(t,""),await P0(e,!0),process.stdout.write("Hooks paused. Pre-edit gates and stop enforcement are off until you run `ripplo hooks resume`.\n")}async function E0(){let e=process.cwd(),t=Nr(e);if(!rl.existsSync(t)){process.stdout.write(`Hooks already active.
232
- `);return}rl.unlinkSync(t),await P0(e,!1),process.stdout.write(`Hooks resumed.
233
- `)}async function P0(e,t){let r=xe(e).unwrapOr(void 0);r!=null&&await D({config:r,document:YV,variables:{paused:t,projectId:r.projectId}}).catch(n=>{process.stderr.write(`Warning: could not push hook-pause state to the server (${n instanceof Error?n.message:String(n)}) \u2014 the dashboard may show stale hook status.
234
- `)})}import zn from"fs";import Gn from"path";import{input as M0,select as L0}from"@inquirer/prompts";import{graphql as EU}from"gql.tada";import{exec as QV,execFile as eU}from"child_process";import{err as tU,ok as I0}from"neverthrow";import Ee from"fs";import{createRequire as rU}from"module";import be from"path";import{promisify as T0}from"util";import{chromium as nU}from"playwright";import{writeFile as XV}from"fs/promises";import ZV from"path";async function Wn(e){let t=await ve(e);return t.isOk()&&await XV(ZV.join(e,tt),qt(bt,t.value)),t}function dr(e){return e.tests.filter(t=>t.stub).map(t=>t.name)}var oU=["@ripplo/testing","@ripplo/instrument"],A0=".ripplo/ripplo.lock linguist-generated=true",iU=[".ripplo/debug/",".ripplo/.local/"],sU=T0(QV),aU=T0(eU);async function O0({cwd:e,onStep:t}){t("Scaffolding project files..."),bU({cwd:e}),t("Updating .gitignore..."),wU(e),t("Marking ripplo.lock as generated..."),dU(e),t("Installing dependencies...");let r=await cU(e),n=[];if(r.ok||n.push({manualCommand:r.cmd,message:`Couldn't auto-install dev dependencies (${r.reason}). Run the command below, then run \`ripplo lint\` to compile the lockfile.`}),r.ok){t("Compiling initial lockfile...");let i=await uU(e);i!=null&&n.push({manualCommand:void 0,message:i})}return t("Setting up browser..."),(await lU()).map(()=>n)}async function lU(){let e=nU.executablePath();if(Ee.existsSync(e))return I0(void 0);j.info("Chromium not found. Installing via Playwright...");let t=rU(import.meta.url),r=be.dirname(t.resolve("playwright/package.json")),n=be.join(r,"cli.js");return await aU(process.execPath,[n,"install","chromium"]),Ee.existsSync(e)?I0(void 0):tU({kind:"playwright-install-failed"})}async function cU(e){let t=pU({cwd:e,pm:yU(e)});j.info("Installing dependencies: %s",t);try{return await sU(t,{cwd:e}),{ok:!0}}catch(r){let n=r instanceof Error?r.message.split(`
235
- `)[0]??r.message:String(r);return j.warn("Install failed (%s): %s",t,n),{cmd:t,ok:!1,reason:n}}}async function uU(e){try{await Wn(e);return}catch(t){return`Couldn't compile initial lockfile: ${t instanceof Error?t.message:String(t)}.`}}function dU(e){let t=be.join(e,".gitattributes"),r=Ee.existsSync(t)?Ee.readFileSync(t,"utf8"):"";if(r.includes(A0))return;let n=r.length===0||r.endsWith(`
96
+ `);async function $r(){process.stdin.isTTY||(process.stderr.write("`ripplo hooks pause` must be invoked interactively from a terminal \u2014 refusing non-TTY invocation. Bypassing the gate is a human decision, not an agent decision.\n"),process.exit(1));let e=process.cwd();ce(e);let t=ee(e);if(he.existsSync(t)){process.stdout.write("Hooks already paused. Run `ripplo hooks resume` to re-enable.\n");return}he.writeFileSync(t,""),await jr(e,!0),process.stdout.write("Hooks paused. Pre-edit gates and stop enforcement are off until you run `ripplo hooks resume`.\n")}async function Ir(){let e=process.cwd(),t=ee(e);if(!he.existsSync(t)){process.stdout.write(`Hooks already active.
97
+ `);return}he.unlinkSync(t),await jr(e,!1),process.stdout.write(`Hooks resumed.
98
+ `)}async function jr(e,t){let r=k(e).unwrapOr(void 0);r!=null&&await p({config:r,document:vi,variables:{paused:t,projectId:r.projectId}}).catch(n=>{process.stderr.write(`Warning: could not push hook-pause state to the server (${n instanceof Error?n.message:String(n)}) \u2014 the dashboard may show stale hook status.
99
+ `)})}import G from"fs";import J from"path";import{input as Or,select as _r}from"@inquirer/prompts";import{graphql as Ki}from"gql.tada";import{exec as Ri,execFile as Ci}from"child_process";import{err as xi,ok as Ar}from"neverthrow";import h from"fs";import{createRequire as Pi}from"module";import g from"path";import{promisify as Tr}from"util";import{writeFile as bi}from"fs/promises";import Si from"path";async function B(e){let t=await S(e);return t.isOk()&&await bi(Si.join(e,L),q(N,t.value)),t}function F(e){return e.tests.filter(t=>t.stub).map(t=>t.name)}var Ei=["@ripplo/testing","@ripplo/instrument"],Lr=".ripplo/ripplo.lock linguist-generated=true",$i=[".ripplo/debug/",".ripplo/.local/"],Ii=Tr(Ri),ji=Tr(Ci);async function Dr({cwd:e,onStep:t}){t("Scaffolding project files..."),Mi({cwd:e}),t("Updating .gitignore..."),Wi(e),t("Marking ripplo.lock as generated..."),Di(e),t("Installing dependencies...");let r=await Li(e),n=[];if(r.ok||n.push({manualCommand:r.cmd,message:`Couldn't auto-install dev dependencies (${r.reason}). Run the command below, then run \`ripplo lint\` to compile the lockfile.`}),r.ok){t("Compiling initial lockfile...");let i=await Ti(e);i!=null&&n.push({manualCommand:void 0,message:i})}return t("Setting up browser..."),(await Ai()).map(()=>n)}async function Ai(){let{chromium:e}=await import("playwright"),t=e.executablePath();if(h.existsSync(t))return Ar(void 0);D.info("Chromium not found. Installing via Playwright...");let r=Pi(import.meta.url),n=g.dirname(r.resolve("playwright/package.json")),o=g.join(n,"cli.js");return await ji(process.execPath,[o,"install","chromium"]),h.existsSync(t)?Ar(void 0):xi({kind:"playwright-install-failed"})}async function Li(e){let t=Oi({cwd:e,pm:Hi(e)});D.info("Installing dependencies: %s",t);try{return await Ii(t,{cwd:e}),{ok:!0}}catch(r){let n=r instanceof Error?r.message.split(`
100
+ `)[0]??r.message:String(r);return D.warn("Install failed (%s): %s",t,n),{cmd:t,ok:!1,reason:n}}}async function Ti(e){try{await B(e);return}catch(t){return`Couldn't compile initial lockfile: ${t instanceof Error?t.message:String(t)}.`}}function Di(e){let t=g.join(e,".gitattributes"),r=h.existsSync(t)?h.readFileSync(t,"utf8"):"";if(r.includes(Lr))return;let n=r.length===0||r.endsWith(`
236
101
  `)?"":`
237
- `;Ee.writeFileSync(t,`${r}${n}${A0}
238
- `)}function pU({cwd:e,pm:t}){let r=oU.join(" ");return t==="pnpm"?fU(e)?`pnpm add -wD ${r}`:`pnpm add -D ${r}`:t==="yarn"?hU({cwd:e,deps:r}):t==="bun"?`bun add -d ${r}`:`npm install -D ${r}`}function fU(e){return Ee.existsSync(be.join(e,"pnpm-workspace.yaml"))||Ee.existsSync(be.join(e,"pnpm-workspace.yml"))}function hU({cwd:e,deps:t}){return mU(e)?`yarn add -D ${t}`:gU(e)?`yarn add -WD ${t}`:`yarn add -D ${t}`}function mU(e){if(Ee.existsSync(be.join(e,".yarnrc.yml"))||Ee.existsSync(be.join(e,".pnp.cjs"))||Ee.existsSync(be.join(e,".pnp.js")))return!0;let t=be.join(e,"package.json");if(!Ee.existsSync(t))return!1;try{let r=JSON.parse(Ee.readFileSync(t,"utf8"));if(r==null||typeof r!="object"||!("packageManager"in r))return!1;let n=r.packageManager;if(typeof n!="string")return!1;let o=/^yarn@(\d+)/.exec(n);return o!=null&&Number(o[1])>=2}catch{return!1}}function gU(e){let t=be.join(e,"package.json");if(!Ee.existsSync(t))return!1;try{let r=JSON.parse(Ee.readFileSync(t,"utf8"));if(r==null||typeof r!="object"||!("workspaces"in r))return!1;let n=r.workspaces;return Array.isArray(n)||n!=null&&typeof n=="object"}catch{return!1}}function yU(e){return Ee.existsSync(be.join(e,"pnpm-lock.yaml"))?"pnpm":Ee.existsSync(be.join(e,"yarn.lock"))?"yarn":Ee.existsSync(be.join(e,"bun.lockb"))||Ee.existsSync(be.join(e,"bun.lock"))?"bun":"npm"}function bU({cwd:e}){let t=be.join(e,".ripplo"),r=be.join(t,"entities"),n=be.join(t,"singletons"),o=be.join(t,"worlds"),i=be.join(t,"tests");[r,n,o,i].forEach(s=>{Ee.mkdirSync(s,{recursive:!0})}),Hn(be.join(t,"index.ts"),SU),Hn(be.join(r,"index.ts"),vU),Hn(be.join(n,"index.ts"),xU),Hn(be.join(o,"index.ts"),kU),Hn(be.join(i,"index.ts"),RU),Hn(be.join(t,"tsconfig.json"),CU)}function Hn(e,t){Ee.existsSync(e)||Ee.writeFileSync(e,t)}function wU(e){let t=be.join(e,".gitignore");if(!Ee.existsSync(t))return;let r=Ee.readFileSync(t,"utf8"),n=iU.filter(i=>!r.includes(i));if(n.length===0)return;let o=r.endsWith(`
102
+ `;h.writeFileSync(t,`${r}${n}${Lr}
103
+ `)}function Oi({cwd:e,pm:t}){let r=Ei.join(" ");return t==="pnpm"?_i(e)?`pnpm add -wD ${r}`:`pnpm add -D ${r}`:t==="yarn"?Fi({cwd:e,deps:r}):t==="bun"?`bun add -d ${r}`:`npm install -D ${r}`}function _i(e){return h.existsSync(g.join(e,"pnpm-workspace.yaml"))||h.existsSync(g.join(e,"pnpm-workspace.yml"))}function Fi({cwd:e,deps:t}){return Ni(e)?`yarn add -D ${t}`:Ui(e)?`yarn add -WD ${t}`:`yarn add -D ${t}`}function Ni(e){if(h.existsSync(g.join(e,".yarnrc.yml"))||h.existsSync(g.join(e,".pnp.cjs"))||h.existsSync(g.join(e,".pnp.js")))return!0;let t=g.join(e,"package.json");if(!h.existsSync(t))return!1;try{let r=JSON.parse(h.readFileSync(t,"utf8"));if(r==null||typeof r!="object"||!("packageManager"in r))return!1;let n=r.packageManager;if(typeof n!="string")return!1;let o=/^yarn@(\d+)/.exec(n);return o!=null&&Number(o[1])>=2}catch{return!1}}function Ui(e){let t=g.join(e,"package.json");if(!h.existsSync(t))return!1;try{let r=JSON.parse(h.readFileSync(t,"utf8"));if(r==null||typeof r!="object"||!("workspaces"in r))return!1;let n=r.workspaces;return Array.isArray(n)||n!=null&&typeof n=="object"}catch{return!1}}function Hi(e){return h.existsSync(g.join(e,"pnpm-lock.yaml"))?"pnpm":h.existsSync(g.join(e,"yarn.lock"))?"yarn":h.existsSync(g.join(e,"bun.lockb"))||h.existsSync(g.join(e,"bun.lock"))?"bun":"npm"}function Mi({cwd:e}){let t=g.join(e,".ripplo"),r=g.join(t,"entities"),n=g.join(t,"singletons"),o=g.join(t,"worlds"),i=g.join(t,"tests");[r,n,o,i].forEach(a=>{h.mkdirSync(a,{recursive:!0})}),V(g.join(t,"index.ts"),qi),V(g.join(r,"index.ts"),Bi),V(g.join(n,"index.ts"),Vi),V(g.join(o,"index.ts"),Gi),V(g.join(i,"index.ts"),Ji),V(g.join(t,"tsconfig.json"),zi)}function V(e,t){h.existsSync(e)||h.writeFileSync(e,t)}function Wi(e){let t=g.join(e,".gitignore");if(!h.existsSync(t))return;let r=h.readFileSync(t,"utf8"),n=$i.filter(i=>!r.includes(i));if(n.length===0)return;let o=r.endsWith(`
239
104
  `)?"":`
240
- `;Ee.writeFileSync(t,r+o+n.join(`
105
+ `;h.writeFileSync(t,r+o+n.join(`
241
106
  `)+`
242
- `)}var SU=`import { createRipplo } from "@ripplo/testing";
107
+ `)}var qi=`import { createRipplo } from "@ripplo/testing";
243
108
  import { entities } from "./entities/index";
244
109
  import { singletons } from "./singletons/index";
245
110
  import { tests } from "./tests/index";
@@ -249,7 +114,7 @@ export default createRipplo({
249
114
  singletons,
250
115
  tests,
251
116
  });
252
- `,vU=`// Model the app's state as entities. Each entity gets a \`seed\`/\`read\` impl in your
117
+ `,Bi=`// Model the app's state as entities. Each entity gets a \`seed\`/\`read\` impl in your
253
118
  // app's engine funnel (createEngine). See /ripplo:create "Adding an entity".
254
119
  //
255
120
  // Example:
@@ -265,7 +130,7 @@ export default createRipplo({
265
130
  // export const entities = [Project] as const;
266
131
 
267
132
  export const entities = [] as const;
268
- `,xU=`// Client/global state (e.g. localStorage flags) modeled as singletons.
133
+ `,Vi=`// Client/global state (e.g. localStorage flags) modeled as singletons.
269
134
  //
270
135
  // Example:
271
136
  // import { singleton, v } from "@ripplo/testing";
@@ -280,7 +145,7 @@ export const entities = [] as const;
280
145
  // export const singletons = [onboardingDismissed];
281
146
 
282
147
  export const singletons = [];
283
- `,kU=`// Pure builder functions returning a flat record of entity handles \u2014 the starting state
148
+ `,Gi=`// Pure builder functions returning a flat record of entity handles \u2014 the starting state
284
149
  // for tests. Compose from other worlds. See /ripplo:create "Adding a world".
285
150
  //
286
151
  // Example:
@@ -292,7 +157,7 @@ export const singletons = [];
292
157
  // const project = Project.of({ name: arbitrary(Project.field.name), ownerId: me.id });
293
158
  // return { me, project };
294
159
  // };
295
- `,RU=`// Each test file under ./tests exports a test. Import them here and add to the \`tests\`
160
+ `,Ji=`// Each test file under ./tests exports a test. Import them here and add to the \`tests\`
296
161
  // array \u2014 that's what createRipplo({ ..., tests }) receives. Stub with \`test("Intent")\`
297
162
  // (no body); implement later with \`test("Intent", () => ({ given, steps }))\`.
298
163
  //
@@ -301,7 +166,7 @@ export const singletons = [];
301
166
  // export const tests = [createProject] as const;
302
167
 
303
168
  export const tests = [] as const;
304
- `,CU=`{
169
+ `,zi=`{
305
170
  "compilerOptions": {
306
171
  "strict": true,
307
172
  "noUncheckedIndexedAccess": true,
@@ -317,48 +182,67 @@ export const tests = [] as const;
317
182
  "include": ["*.ts", "entities/**/*.ts", "singletons/**/*.ts", "worlds/**/*.ts", "tests/**/*.ts"],
318
183
  "exclude": ["node_modules"]
319
184
  }
320
- `;var PU=EU(`
185
+ `;var Qi=Ki(`
321
186
  query InitProjects {
322
187
  projects {
323
188
  id
324
189
  name
325
190
  }
326
191
  }
327
- `),Qf=["../.env.local","../.env"];async function N0(e=TU()){let t=process.cwd(),r=ft();r==null&&(process.stdout.write("Not authenticated. Run `ripplo auth login` first.\n"),process.exit(1));let n=st();IU(t)&&(process.stdout.write(`\`.ripplo/index.ts\` already exists at ${t}. Delete it first if you want to re-init.
328
- `),process.exit(1));let o=await AU({serverUrl:n,token:r});o.length===0&&(process.stdout.write("No projects found. Create one in the dashboard first, then re-run `ripplo init`.\n"),process.exit(1));let i=await MU(o,e.projectId),s=await LU(t,e.envFile),a=await $U(e.appUrl),l=OU(a,e.engineUrl),c=Gn.resolve(Gn.join(t,".ripplo"),s);Hh({cwd:t,envFiles:[s],projectId:i}),_U({appUrl:a,engineUrl:l,filePath:c});let d=(await O0({cwd:t,onStep:p=>{process.stdout.write(` ${p}
329
- `)}})).match(p=>p,p=>{process.stderr.write(`${He(p)}
330
- `),process.exit(1)});if(d.length>0){process.stdout.write(`Done with warnings:
331
- `),d.forEach(p=>{process.stdout.write(` - ${p.message}
332
- `),p.manualCommand!=null&&process.stdout.write(` run: ${p.manualCommand}
333
- `)});return}process.stdout.write("Ready. Start `npx ripplo daemon` as a background process (or run `/ripplo:start` in Claude Code), then write tests in `.ripplo/tests/`.\n")}function IU(e){return zn.existsSync(Gn.join(e,".ripplo","index.ts"))}async function AU({serverUrl:e,token:t}){return((await D({config:yr({serverUrl:e,token:t}),document:PU,variables:void 0})).projects??[]).map(n=>({id:n.id,name:n.name}))}function TU(){return{appUrl:void 0,engineUrl:void 0,envFile:void 0,projectId:void 0}}function OU(e,t){if(t!=null){try{new URL(t)}catch{process.stdout.write(`--engine-url is not a valid URL: ${t}
334
- `),process.exit(1)}return t}return`${e.replace(/\/$/,"")}/ripplo`}async function MU(e,t){if(t!=null){let r=e.find(n=>n.id===t);return r==null&&(process.stdout.write(`Unknown project id: ${t}
192
+ `),Me=["../.env.local","../.env"];async function Fr(e=Zi()){let t=process.cwd(),r=O();r==null&&(process.stdout.write("Not authenticated. Run `ripplo auth login` first.\n"),process.exit(1));let n=I();Yi(t)&&(process.stdout.write(`\`.ripplo/index.ts\` already exists at ${t}. Delete it first if you want to re-init.
193
+ `),process.exit(1));let o=await Xi({serverUrl:n,token:r});o.length===0&&(process.stdout.write("No projects found. Create one in the dashboard first, then re-run `ripplo init`.\n"),process.exit(1));let i=await ts(o,e.projectId),a=await rs(t,e.envFile),s=await os(e.appUrl),l=es(s,e.engineUrl),c=J.resolve(J.join(t,".ripplo"),a);it({cwd:t,envFiles:[a],projectId:i}),ss({appUrl:s,engineUrl:l,filePath:c});let u=(await Dr({cwd:t,onStep:y=>{process.stdout.write(` ${y}
194
+ `)}})).match(y=>y,y=>{process.stderr.write(`${E(y)}
195
+ `),process.exit(1)});if(u.length>0){process.stdout.write(`Done with warnings:
196
+ `),u.forEach(y=>{process.stdout.write(` - ${y.message}
197
+ `),y.manualCommand!=null&&process.stdout.write(` run: ${y.manualCommand}
198
+ `)});return}process.stdout.write("Ready. Start `npx ripplo daemon` as a background process (or run `/ripplo:start` in Claude Code), then write tests in `.ripplo/tests/`.\n")}function Yi(e){return G.existsSync(J.join(e,".ripplo","index.ts"))}async function Xi({serverUrl:e,token:t}){return((await p({config:U({serverUrl:e,token:t}),document:Qi,variables:void 0})).projects??[]).map(n=>({id:n.id,name:n.name}))}function Zi(){return{appUrl:void 0,engineUrl:void 0,envFile:void 0,projectId:void 0}}function es(e,t){if(t!=null){try{new URL(t)}catch{process.stdout.write(`--engine-url is not a valid URL: ${t}
199
+ `),process.exit(1)}return t}return`${e.replace(/\/$/,"")}/ripplo`}async function ts(e,t){if(t!=null){let r=e.find(n=>n.id===t);return r==null&&(process.stdout.write(`Unknown project id: ${t}
335
200
  `),process.exit(1)),process.stdout.write(`Using project: ${r.name} (${r.id})
336
201
  `),r.id}if(e.length===1){let r=e[0];if(r==null)throw new Error("unreachable");return process.stdout.write(`Using project: ${r.name} (${r.id})
337
- `),r.id}return L0({choices:e.map(r=>({name:r.name,value:r.id})),message:"Select a project"})}async function LU(e,t){return t!=null?(t.trim().length===0&&(process.stdout.write(`--env must not be empty
338
- `),process.exit(1)),t):NU(e)}async function NU(e){let t=Gn.join(e,".ripplo"),r=Qf.find(o=>zn.existsSync(Gn.resolve(t,o))),n=await L0({choices:[...Qf.map(o=>({name:r===o?`${o} (detected)`:o,value:o})),{name:"custom path",value:"__custom__"}],default:r??Qf[0],message:"Which env file should ripplo write RIPPLO_APP_URL, RIPPLO_ENGINE_URL, RIPPLO_WEBHOOK_SECRET, and ENABLE_RIPPLO_TESTING to?"});return n!=="__custom__"?n:M0({message:"Path to env file (relative to .ripplo/, e.g. ../apps/server/.env)",validate:o=>o.trim().length>0?!0:"required"})}async function $U(e){if(e!=null){try{new URL(e)}catch{process.stdout.write(`--app-url is not a valid URL: ${e}
339
- `),process.exit(1)}return e}return DU()}async function DU(){return M0({default:"http://localhost:3000",message:"Where does your dev server run? (RIPPLO_APP_URL)",validate:e=>{try{return new URL(e),!0}catch{return"must be a valid URL"}}})}function _U({appUrl:e,engineUrl:t,filePath:r}){zn.mkdirSync(Gn.dirname(r),{recursive:!0});let n=zn.existsSync(r)?zn.readFileSync(r,"utf8"):"",o=[];if(/^RIPPLO_APP_URL=/m.test(n)||o.push(`RIPPLO_APP_URL=${e}`),/^RIPPLO_ENGINE_URL=/m.test(n)||o.push(`RIPPLO_ENGINE_URL=${t}`),/^RIPPLO_WEBHOOK_SECRET=/m.test(n)||o.push(`RIPPLO_WEBHOOK_SECRET=${rc()}`),/^ENABLE_RIPPLO_TESTING=/m.test(n)||o.push("ENABLE_RIPPLO_TESTING=true"),o.length===0)return;let i=n.length===0||n.endsWith(`
202
+ `),r.id}return _r({choices:e.map(r=>({name:r.name,value:r.id})),message:"Select a project"})}async function rs(e,t){return t!=null?(t.trim().length===0&&(process.stdout.write(`--env must not be empty
203
+ `),process.exit(1)),t):ns(e)}async function ns(e){let t=J.join(e,".ripplo"),r=Me.find(o=>G.existsSync(J.resolve(t,o))),n=await _r({choices:[...Me.map(o=>({name:r===o?`${o} (detected)`:o,value:o})),{name:"custom path",value:"__custom__"}],default:r??Me[0],message:"Which env file should ripplo write RIPPLO_APP_URL, RIPPLO_ENGINE_URL, RIPPLO_WEBHOOK_SECRET, and ENABLE_RIPPLO_TESTING to?"});return n!=="__custom__"?n:Or({message:"Path to env file (relative to .ripplo/, e.g. ../apps/server/.env)",validate:o=>o.trim().length>0?!0:"required"})}async function os(e){if(e!=null){try{new URL(e)}catch{process.stdout.write(`--app-url is not a valid URL: ${e}
204
+ `),process.exit(1)}return e}return is()}async function is(){return Or({default:"http://localhost:3000",message:"Where does your dev server run? (RIPPLO_APP_URL)",validate:e=>{try{return new URL(e),!0}catch{return"must be a valid URL"}}})}function ss({appUrl:e,engineUrl:t,filePath:r}){G.mkdirSync(J.dirname(r),{recursive:!0});let n=G.existsSync(r)?G.readFileSync(r,"utf8"):"",o=[];if(/^RIPPLO_APP_URL=/m.test(n)||o.push(`RIPPLO_APP_URL=${e}`),/^RIPPLO_ENGINE_URL=/m.test(n)||o.push(`RIPPLO_ENGINE_URL=${t}`),/^RIPPLO_WEBHOOK_SECRET=/m.test(n)||o.push(`RIPPLO_WEBHOOK_SECRET=${ot()}`),/^ENABLE_RIPPLO_TESTING=/m.test(n)||o.push("ENABLE_RIPPLO_TESTING=true"),o.length===0)return;let i=n.length===0||n.endsWith(`
340
205
  `)?"":`
341
- `;zn.writeFileSync(r,`${n}${i}${o.join(`
206
+ `;G.writeFileSync(r,`${n}${i}${o.join(`
342
207
  `)}
343
- `)}function nl(e){let t=e.tests.filter(o=>!o.stub);if(t.length===0)return[];let r=new Set(t.flatMap(o=>jU(o))),n=new Set(t.flatMap(o=>FU(o)));return[...e.entities.filter(o=>!r.has(o.name)).map(o=>({entity:o.name,kind:"entity-never-given"})),...e.entities.filter(o=>r.has(o.name)&&!n.has(o.name)).map(o=>({entity:o.name,kind:"entity-never-mutated"}))]}function jU(e){return[...e.world,...e.maybe].map(t=>t.entity)}function FU(e){return e.steps.flatMap(t=>t.expect.flatMap(r=>gi(r)))}function gi(e){return e.kind==="state"?[e.entity]:e.kind==="not"?gi(e.predicate):e.kind==="and"?e.predicates.flatMap(t=>gi(t)):e.kind==="when"?[...gi(e.condition),...gi(e.consequence)]:[]}async function $0(){let e=process.cwd(),r=(await ve(e)).match(o=>o,o=>BU(Pe(o))),n=Mr(r);if(n.length===0){let o=nl(r);o.length>0&&process.stdout.write(`${el(o)}
344
- `),process.stdout.write(`${b0(r.tests.length)}
345
- `);return}process.stderr.write(`${Lr(n)}
346
- `),process.exit(1)}function BU(e){process.stderr.write(`${e}
347
- `),process.exit(1)}import tW from"path";import{randomUUID as rW}from"crypto";function qn(e){return{axes:[Wf("unit"),Hf(e)]}}var D0=12,ol=15,_0=4,j0=2,F0=18e4;import VU from"path";import{randomUUID as UU}from"crypto";function B0(){return{priority:"p3",next:()=>null,onResult:()=>{},ready:()=>Promise.resolve(),status:()=>({discharged:0,findings:0,obligations:0,saturated:!1}),stop:()=>Promise.resolve()}}function il(e){let t={avoided:new Set,claimed:new Set,consecutiveErrors:0,discharged:new Set,findings:0,halted:!1,prepared:null,preparing:!1,saturated:!1,tick:0},r=V0(e,t);return{priority:"p3",next:()=>GU(e,t),onResult:()=>{},ready:()=>r,status:()=>t.prepared==null?{discharged:0,findings:0,obligations:0,saturated:!1}:{discharged:t.discharged.size,findings:t.findings,obligations:t.prepared.graph.obligations.size,saturated:t.saturated},stop:()=>Promise.resolve()}}async function V0(e,t){if(!t.preparing){t.preparing=!0;try{let r=await e.loadLockfile();if(r==null)return;let n=await WU(r);if(n==null)return;await Gf(U0(e.cwd)).match(o=>{let i=zf(o);t.discharged=new Set(i.discharged),t.findings=i.findings.size,t.prepared=n,t.consecutiveErrors=0,e.notifyWork()},o=>{j.warn("explore ledger unreadable, exploration disabled: %s",o.kind)})}finally{t.preparing=!1}}}async function WU({fingerprint:e,lockfile:t}){let r=qn(t),n=ht(t);if(n.length===0)return null;let o=Xf(t,{sweep:!1}),i=await HU(t,o),s=Jf({corpus:n,depots:i,lens:r,maxCount:j0,maxDepth:_0});return{actionHashes:n.map(a=>rn(t,a)),corpus:n,depots:o,fingerprint:e,graph:s,lens:r,lensIdValue:Uf(r),lockfile:t,lockfileHashValue:Kf(t)}}async function HU(e,t){let r={generate:rt,materialize:Wr(rt,e.valueSpaces),params:void 0};return(await Promise.all(t.map(async o=>(await nn(e,o,r)).match(s=>({name:o.name,snapshot:s.snapshot}),()=>null)))).flatMap(o=>o==null?[]:[o])}var zU=20;function GU(e,t){let r=t.prepared;if(r==null||t.halted)return null;let n=Yf({actionHashes:r.actionHashes,corpus:r.corpus,discharged:new Set([...t.discharged,...t.claimed,...t.avoided]),graph:r.graph,lensId:r.lensIdValue,tick:t.tick});if(t.tick+=1,n.kind==="saturated")return t.saturated=!0,null;t.saturated=!1;let o=eW(r,n.obligation);return t.claimed.add(o),{id:`explore:${UU()}`,run:i=>qU({choice:n.obligation,key:o,params:e,prepared:r,signal:i,state:t})}}async function qU({choice:e,key:t,params:r,prepared:n,signal:o,state:i}){try{let s=KU({choice:e,prepared:n});if(s==null)return;let a=AbortSignal.timeout(F0),l=await r.executeTrail(s,AbortSignal.any([o,a]));if(l.kind==="aborted"){YU({deadline:a,key:t,signal:o,state:i});return}if(l.kind==="error"){XU({params:r,reason:l.reason,state:i});return}i.consecutiveErrors=0,await JU({outcome:l,params:r,state:i})}finally{i.claimed.delete(t)}}function KU({choice:e,prepared:t}){let r=t.depots.find(n=>n.name===e.witness.depot);return r==null?null:{depotTest:r.test,firings:e.witness.trail.map(n=>({idx:n.idx,params:n.params})),lensId:t.lensIdValue,lockfileFingerprint:t.fingerprint,lockfileHash:t.lockfileHashValue,maxLength:D0,shrinkBudget:ol}}async function JU({outcome:e,params:t,state:r}){let n=e.rows.filter(o=>o.kind!=="discharge"||!r.discharged.has(dt(o)));n.forEach(o=>{(o.kind==="discharge"||o.kind==="finding"||o.kind==="flaky-candidate")&&r.discharged.add(dt(o))}),e.kind==="finding"&&(r.findings+=1,j.info("exploration finding recorded")),n.length!==0&&await qf(U0(t.cwd),n).match(()=>{},o=>{j.warn("explore ledger append failed: %s",o.kind)})}function U0(e){return VU.join(e,".ripplo",".local","explore-ledger.jsonl")}function YU({deadline:e,key:t,signal:r,state:n}){e.aborted&&!r.aborted&&(n.avoided.add(t),j.warn("exploration trail timed out, obligation parked for this session"))}function XU({params:e,reason:t,state:r}){if(t==="lockfile:fingerprint-mismatch"){ZU(e,r);return}QU(r,t)}function ZU(e,t){t.preparing||(t.prepared=null,V0(e,t))}function QU(e,t){e.consecutiveErrors+=1,j.debug("exploration trail error: %s",t),e.consecutiveErrors>=zU&&!e.halted&&(e.halted=!0,j.warn("exploration halted after %d consecutive trail errors (last: %s)",e.consecutiveErrors,t))}function eW(e,t){return dt({actionHash:t.actionHash,lensId:e.lensIdValue,obligationKey:t.obligationKey})}async function W0(e){let t=xe(e.cwd).match(c=>({config:c}),c=>({failure:c}));if("failure"in t)return{failure:t.failure,kind:"config-failed"};let r=t.config,n=await Kt(e.cwd);if(n.result.isErr())return{error:n.result.error,kind:"compile-failed"};let o={fingerprint:n.fingerprint,lockfile:n.result.value},i=di({debugDir:tW.join(e.cwd,".ripplo","debug"),headed:!1,writeOtlpPortFile:!1}),s=il({cwd:e.cwd,executeTrail:(c,u)=>nW({assign:c,config:r,lockfile:o.lockfile,session:i,signal:u}),loadLockfile:()=>Promise.resolve(o),notifyWork:()=>{}});await s.ready(),e.onReady(s.status());let a=await iW(s,e),l=s.status();return await s.stop(),await i.close(),a===0&&l.obligations===0?{kind:"no-work"}:{executed:a,kind:"completed",progress:l}}async function nW({assign:e,config:t,lockfile:r,session:n,signal:o}){let i=ht(r),s=await oW({assign:e,corpus:i,lockfile:r});if(s==null||s.firings.length===0)return{kind:"error",rows:[]};let a=await hi({corpus:i,depot:{name:e.depotTest.name,test:e.depotTest},lensId:e.lensId,lockfile:r,lockfileHash:e.lockfileHash,options:{baseUrl:t.appUrl,engineUrl:t.engineUrl,generate:rt,headed:!1,secret:t.webhookSecret},session:n,shrinkBudget:ol,trail:s,now:()=>new Date().toISOString(),runIdFor:l=>`explore-${rW()}-${String(l)}`},o);return a.kind==="aborted"||a.kind==="error"?{kind:a.kind,rows:[]}:{kind:a.kind,rows:[...a.rows]}}async function oW({assign:e,corpus:t,lockfile:r}){return(await nn(r,{name:e.depotTest.name,test:e.depotTest},{generate:rt,materialize:Wr(rt,r.valueSpaces),params:void 0})).match(o=>fi({actionHashes:t.map(i=>rn(r,i)),corpus:t,depotSnapshot:o.snapshot,discharged:new Set,lens:qn(r),lensId:e.lensId,maxLength:e.maxLength,witnessTrail:e.firings}),()=>null)}async function iW(e,t){let r=new AbortController().signal,n=async o=>{if(o>=t.trails)return o;let i=e.next();return i==null?o:(await i.run(r),t.onTrail(o+1,e.status()),n(o+1))};return n(0)}function H0(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 z0({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(`
348
- `)}function G0(e){return`ripplo daemon: ready as local executor for session ${e} (sync happens on each \`ripplo run\`; Ctrl-C to stop)`}function q0({cwd:e,pid:t}){return`ripplo daemon: another daemon is already running for this project${t==null?"":` (pid ${String(t)})`} (cwd ${e}).`}function K0(){return"ripplo daemon: lock compromised \u2014 another daemon likely took over this project; shutting down."}function J0(e){if(e.kind==="not-running")return"daemon: not running";if(e.kind==="unresponsive")return`daemon: running but did not reply within ${String(e.timeoutMs/1e3)}s \u2014 likely busy executing runs (event loop saturated); retry when the batch drains`;let{status:t}=e,r=`${String(t.active)} active, ${String(t.queued)} queued`,n=`explorer: ${t.explorer}, ${String(t.exploring)} exploring`;return`daemon: running (${r}; ${n}; ${Kn(t.progress)})`}function Kn(e){if(e.obligations===0)return"explore: idle";let t=`${String(e.discharged)}/${String(e.obligations)} obligations`,r=e.saturated?"saturated":"searching";return`explore: ${t}, ${String(e.findings)} findings, ${r}`}function Y0(e){switch(e.kind){case"pass":return{kind:"pass"};case"findings":return{findingLines:e.findings.map(t=>Co(t)),kind:"findings"};case"error":return{detail:br(e.error),kind:"error"};case"dispatch-failed":return{detail:e.reason,kind:"dispatch-error"}}}function X0(e,t){return`trail ${String(e)} done \u2014 ${Kn(t)}`}function Z0(e){switch(e.kind){case"config-failed":return He(e.failure);case"compile-failed":return Pe(e.error);case"no-work":return"explore: nothing to explore \u2014 no transitions harvested from the suite";case"completed":return`${`explore: ${String(e.executed)} trails executed`}
349
- ${Kn(e.progress)}
350
- findings land in .ripplo/.local/explore-ledger.jsonl`}}async function Q0(e){let t=await W0({cwd:process.cwd(),trails:e.trails,onReady:r=>{process.stdout.write(`${Kn(r)}
351
- `)},onTrail:(r,n)=>{process.stdout.write(`${X0(r,n)}
352
- `)}});process.stdout.write(`${Z0(t)}
353
- `),(t.kind==="config-failed"||t.kind==="compile-failed")&&process.exit(1)}import{graphql as sW}from"gql.tada";var aW=sW(`
208
+ `)}function ye(e){let t=e.tests.filter(o=>!o.stub);if(t.length===0)return[];let r=new Set(t.flatMap(o=>as(o))),n=new Set(t.flatMap(o=>ls(o)));return[...e.entities.filter(o=>!r.has(o.name)).map(o=>({entity:o.name,kind:"entity-never-given"})),...e.entities.filter(o=>r.has(o.name)&&!n.has(o.name)).map(o=>({entity:o.name,kind:"entity-never-mutated"}))]}function as(e){return[...e.world,...e.maybe].map(t=>t.entity)}function ls(e){return e.steps.flatMap(t=>t.expect.flatMap(r=>oe(r)))}function oe(e){return e.kind==="state"?[e.entity]:e.kind==="not"?oe(e.predicate):e.kind==="and"?e.predicates.flatMap(t=>oe(t)):e.kind==="when"?[...oe(e.condition),...oe(e.consequence)]:[]}async function Nr(){let e=process.cwd(),r=(await S(e)).match(o=>o,o=>cs(R(o))),n=H(r);if(n.length===0){let o=ye(r);o.length>0&&process.stdout.write(`${fe(o)}
209
+ `),process.stdout.write(`${br(r.tests.length)}
210
+ `);return}process.stderr.write(`${M(n)}
211
+ `),process.exit(1)}function cs(e){process.stderr.write(`${e}
212
+ `),process.exit(1)}import{CancellationTokenSource as Ls}from"vscode-jsonrpc/node";import ms from"path";import{randomUUID as ds}from"crypto";async function ke({assign:e,config:t,headed:r,lockfile:n,session:o,signal:i}){let a=pe(n),s=await ps({assign:e,corpus:a,lockfile:n});if(s==null)return{kind:"error",reason:"depot-arrange-failed",rows:[]};if(s.firings.length===0)return{kind:"error",reason:"empty-trail",rows:[]};let l=await $t({corpus:a,depot:{name:e.depotTest.name,test:e.depotTest},lensId:e.lensId,lockfile:n,lockfileHash:e.lockfileHash,options:{baseUrl:t.appUrl,engineUrl:t.engineUrl,generate:ue,headed:r,secret:t.webhookSecret},session:o,shrinkBudget:e.shrinkBudget,trail:s,now:()=>new Date().toISOString(),runIdFor:c=>`explore-${ds()}-${String(c)}`},i);return us(l)}async function ps({assign:e,corpus:t,lockfile:r}){return(await Et(r,{name:e.depotTest.name,test:e.depotTest},{generate:ue,materialize:wt(ue,r.valueSpaces),params:void 0})).match(o=>Pt({actionHashes:t.map(i=>xt(r,i)),corpus:t,covered:new Set,depotSnapshot:o.snapshot,lens:jt(r),lensId:e.lensId,maxLength:e.maxLength,witnessTrail:e.firings}),()=>null)}function us(e){return e.kind==="error"?{kind:e.kind,reason:`runtime:${e.error.kind}`,rows:[]}:e.kind==="aborted"?{kind:e.kind,rows:[]}:{kind:e.kind,rows:[...e.rows]}}async function Ur(e){let t=k(e.cwd).match(l=>({config:l}),l=>({failure:l}));if("failure"in t)return{failure:t.failure,kind:"config-failed"};let r=t.config,n=await ct(e.cwd);if(n.result.isErr())return{error:n.result.error,kind:"compile-failed"};let o={fingerprint:n.fingerprint,lockfile:n.result.value},i=It({onChange:()=>{}});if(!i.holder())return i.stop(),{kind:"explorer-busy"};let a=me({debugDir:ms.join(e.cwd,".ripplo","debug"),headed:e.headed,writeOtlpPortFile:!1}),s=At({cwd:e.cwd,executeTrail:(l,c)=>ke({assign:l,config:r,headed:e.headed,lockfile:o.lockfile,session:a,signal:c}),loadLockfile:()=>Promise.resolve(o),notifyWork:()=>{},probeApp:async()=>await Z(r.appUrl)==null});try{await s.ready(),e.onReady(s.status());let l=await fs(s,e),c=s.status();return await s.stop(),await a.close(),l===0&&c.total===0?{kind:"no-work"}:{executed:l,kind:"completed",progress:c}}finally{i.stop()}}async function fs(e,t){let r=new AbortController().signal,n=async o=>{if(o>=t.trails)return o;let i=e.next();return i==null?o:(await i.run(r),t.onTrail(o+1,{firings:i.firings,label:i.label,path:i.path},e.status()),n(o+1))};return n(0)}import{spawn as gs}from"child_process";import Hr from"fs";import hs from"net";import{setTimeout as Wr}from"timers/promises";import{err as ie,ok as we}from"neverthrow";import{ResponseError as ys}from"vscode-jsonrpc/node";var qr=12e4,ks=300,Mr=5e3;async function z({cliEntry:e,cwd:t}){let r=_e(t),n=await ve(r);if(n!=null)return we(We(n,!1));let o=Ss({cliEntry:e,cwd:t});if(o!=null)return ie(o);let i=await Rs(r);return i==null?ie({deadlineMs:qr,kind:"connect-timeout",logPath:Fe(t)}):we(We(i,!0))}async function be({connection:e,onEvent:t,request:r,token:n}){let o=await vs({connection:e,onEvent:t,request:r,token:n});return o.kind==="transport"?ie(o.error):we(o)}async function Br({connection:e,findingId:t,token:r}){try{let n=await e.rpc.sendRequest(Ht,{findingId:t},r),o=Ut.safeParse(n);return o.success?we(o.data):ie({kind:"bad-frame"})}catch{return ie({kind:"connection-lost"})}}async function K(e){try{await e.rpc.sendRequest(qt)}catch{}}async function Vr(e){let t=await ve(_e(e));if(t==null)return{kind:"not-running"};let r=We(t,!1),n=await Promise.race([ws(r),Wr(Mr).then(()=>null)]);return t.destroy(),n==null?{kind:"unresponsive",timeoutMs:Mr}:{kind:"running",status:n}}async function ws(e){try{let t=await e.rpc.sendRequest(Wt),r=Ot.safeParse(t);return r.success?r.data:null}catch{return null}}function vs({connection:e,onEvent:t,request:r,token:n}){let{rpc:o}=e;return new Promise(i=>{let a=s=>{i(s)};o.onNotification(Bt,s=>{let l=_t.safeParse(s);if(!l.success){a({error:{kind:"bad-frame"},kind:"transport"});return}t(l.data.event)}),o.onNotification(Vt,s=>{let l=Ft.safeParse(s);if(!l.success){a({error:{kind:"bad-frame"},kind:"transport"});return}a({failed:l.data.failed,kind:"done",notRun:l.data.notRun,passed:l.data.passed})}),o.onClose(()=>{a({error:{kind:"connection-lost"},kind:"transport"})}),o.sendRequest(Mt,r,n).then(s=>{Dt.safeParse(s).success||a({error:{kind:"bad-frame"},kind:"transport"})}).catch(s=>{a(bs(s))})})}function bs(e){if(e instanceof ys){let t=Nt.safeParse(e.data);return t.success?{error:t.data,kind:"daemon-error"}:{error:{kind:"bad-frame"},kind:"transport"}}return{error:{kind:"connection-lost"},kind:"transport"}}function We(e,t){let r=Tt(e);return r.listen(),{rpc:r,socket:e,spawned:t}}function ve(e){return new Promise(t=>{let r=hs.connect(e);r.once("connect",()=>{t(r)}),r.once("error",()=>{t(null)})})}function Ss({cliEntry:e,cwd:t}){try{ce(t);let r=Hr.openSync(Fe(t),"a");return gs(process.execPath,[e,"daemon"],{cwd:t,detached:!0,stdio:["ignore",r,r]}).unref(),Hr.closeSync(r),null}catch(r){return{kind:"spawn-failed",message:r instanceof Error?r.message:String(r)}}}async function Rs(e){let t=Date.now()+qr,r=await ve(e);for(;r==null&&Date.now()<t;)await Wr(ks),r=await ve(e);return r}function Gr(e){if(e.pending.length===0&&e.recurrentFlaky.length===0)return"explore: no pending findings";let t=e.pending.length===0?[]:[`explore: ${String(e.pending.length)} pending finding(s) \u2014 triage in layer order, top first`,...e.pending.map(o=>Cs(o))],r=e.recurrentFlaky.length===0?[]:[`recurrent flaky-candidates (same divergence ${String(e.recurrentFlaky.length)}x, no deterministic repro \u2014 triage after findings):`,...e.recurrentFlaky.map(o=>Es(o))],n=d("debug","triaging each finding (evidence -> classify -> fix -> replay)");return[...t,...r,"","replay after a fix: npx ripplo explore replay <id>",n].join(`
213
+ `).trim()}function Jr(e,t){switch(t.kind){case"resolved":return`explore: ${e} replayed clean \u2014 finding resolved, its targets covered under the current model`;case"unreachable":return`explore: ${e}'s trail is no longer plannable under the current model \u2014 the violating composition is unreachable; finding resolved (if you narrowed a given/when, make sure a test covers the excluded state)`;case"still-failing":{let r=t.runId==null?"":` (fresh evidence: run ${t.runId})`;return`explore: ${e} still reproduces \u2014 same divergence signature${r}`}case"diverged":{let r=t.runId==null?"":` (captured run ${t.runId})`;return`explore: ${e} failed with a DIFFERENT divergence signature \u2014 new finding recorded${r}`}case"flaky":return`explore: ${e} did not reproduce deterministically \u2014 recorded as flaky-candidate, finding stays pending`;case"aborted":return`explore: replay of ${e} was aborted`;case"finding-not-found":return`explore: no pending finding ${e} \u2014 check ids with: npx ripplo explore findings`;case"unreplayable":return`explore: ${e} cannot be replayed (${t.reason})`;case"error":return`explore: replay of ${e} failed (${t.reason})`}}function zr({executed:e,firings:t,label:r,progress:n}){let o=t.flatMap(i=>[` ${i.label}`,...i.actions.map(a=>` ${a}`)]);return[`trail ${String(e)} done \u2014 ${te(n)}`,...o,` state: ${r}`].join(`
214
+ `)}function Kr(e){switch(e.kind){case"config-failed":return E(e.failure);case"compile-failed":return R(e.error);case"no-work":return"explore: nothing to explore \u2014 no transitions harvested from the suite";case"explorer-busy":return"explore: another explorer holds the machine lock (likely the daemon's background explorer) \u2014 watch it with `npx ripplo status`, or stop it to explore in the foreground";case"completed":return`${`explore: ${String(e.executed)} trails executed`}
215
+ ${te(e.progress)}
216
+ findings land in .ripplo/.local/explore-ledger.jsonl`}}function Qr(e){let t=e.evidence.map(n=>` ${n}`),r=e.runId==null?[" no captured run \u2014 replay to capture one"]:[` run: ${e.runId}`,` behavior: .ripplo/debug/${e.runId}/behavior.jsonl`];return[`${e.id} layer=${e.oracleLayer} depot=${e.depot}`,` seen ${String(e.occurrences)}x between ${qe(e.firstSeen)} and ${qe(e.lastSeen)}`,` trail: ${e.trail.join(" -> ")}`," evidence:",...t,...r,` replay after a fix: npx ripplo explore replay ${e.id}`].join(`
217
+ `)}function Yr(e){return`explore: no pending finding ${e} \u2014 check ids with: npx ripplo explore findings`}function Cs(e){let t=e.runId==null?"no captured run":`run ${e.runId}`;return[` ${e.id} layer=${e.oracleLayer} seen ${String(e.occurrences)}x (last ${qe(e.lastSeen)}) depot=${e.depot} ${t}`,` diverged: ${xs(e.parts)}`,` trail: ${e.trail.join(" -> ")}`].join(`
218
+ `)}function qe(e){return e.slice(0,16).replace("T"," ")}function xs(e){let t=e.at(0);if(t==null)return"no parts recorded";let r=e.length>1?` (+${String(e.length-1)} more)`:"";return`${Ps(t)}${r}`}function Ps(e){switch(e.kind){case"consistency":{let t="entity"in e.divergence?e.divergence.entity:e.divergence.singleton,r=e.step==null?"":` at "${e.step.intent}"`;return`${e.divergence.kind} on ${t}${r}`}case"obligation":return`${e.source} check failed at "${e.step.intent}"`;case"unfireable":return`step "${e.intent}" unfireable (${e.reason})`;case"driver-error":return`${e.error} at "${e.step}"`;case"illegal-transition":return`illegal transition at "${e.step}"`}}function Es(e){let t=e.trail.map(r=>r.split("|").at(0)??r);return` ${e.id} seen ${String(e.occurrences)}x depot=${e.depot}
219
+ trail: ${t.join(" -> ")}`}import Is from"fuse.js";var $s=3e3;async function Se(e){W(e);let t=k(e).unwrapOr(void 0);if(t==null)return null;try{return await fetch(`${t.ripploServerUrl}/health`,{signal:AbortSignal.timeout($s)}),null}catch(r){return{detail:r instanceof Error?r.message:String(r),serverUrl:t.ripploServerUrl}}}function Re(e){return e.includes("localhost")||e.includes("127.0.0.1")}function Be(e){switch(e.kind){case"conflicting-flags":return"Pass either --all or test ids, not both.";case"nothing-selected":return`No tests selected \u2014 scope is empty and no .ripplo/tests files are dirty. Pass test ids, add tests to scope (${d("scope")}), or use --all.`;case"unknown-ids":{let t=e.known.map(o=>P(o)),r=e.unknown.flatMap(o=>js(o,t)),n=r.length>0?[`Did you mean: ${[...new Set(r)].join(", ")}`]:[];return[`Unknown test id(s): ${e.unknown.join(", ")}`,...n,"The test id is the slug shown in run output and scope listings (the quoted intent string also works). All known ids:",...t.map(o=>` ${o}`)].join(`
220
+ `)}}}function Xr({failed:e,notRun:t,passed:r}){let n=t>0?`, ${String(t)} not run`:"",o=e>0?`
221
+ ${d("debug")}`:"";return`${String(r)} passed, ${String(e)} failed${n} (${String(r+e+t)} total)${o}`}function Ce({debugDir:e,event:t}){if(t.kind==="test-started")return`${C.dim("RUN ")} ${t.testName}`;switch(t.outcome.kind){case"pass":return`${C.good("PASS")} ${t.testName}`;case"findings":return[`${C.bad("FAIL")} ${t.testName} \u2014 ${String(t.outcome.findingLines.length)} finding(s)`,...t.outcome.findingLines,St({debugDir:e,runId:t.runId})].join(`
222
+ `);case"error":return`${C.bad("ERROR")} ${t.testName} \u2014 ${t.outcome.detail}`;case"dispatch-error":return`${C.bad("ERROR")} ${t.testName} \u2014 failed to dispatch (${t.outcome.detail})`;case"infra-error":return`${C.bad("ERROR")} ${t.testName} \u2014 not run: Ripplo server unreachable (server-side issue, not your local environment): ${t.outcome.detail}`}}function xe({detail:e,serverUrl:t}){return Re(t)?`Ripplo server at ${t} is not running (${e}). Tests were not started. Start the dev server (\`pnpm dev\`) and re-run.`:`Ripplo server at ${t} is unreachable (${e}). Tests were not started. This is a server-side issue, not your local environment \u2014 wait a moment and re-run.`}function Pe(e){switch(e.code){case"compile-failed":{let t=e.diagnostics.length===0?[]:["",...e.diagnostics];return[`Compilation failed in the daemon (${e.detail}). Run \`npx ripplo compile\` for the full output.`,...t].join(`
223
+ `)}case"selection-conflicting-flags":return Be({kind:"conflicting-flags"});case"selection-nothing-selected":return Be({kind:"nothing-selected"});case"selection-unknown-ids":return Be({kind:"unknown-ids",known:e.known,unknown:e.unknown});case"app-unreachable":return`Your dev server is not running: nothing responded at ${e.url} (${e.detail}). Tests were not started. Start the app (e.g. \`pnpm dev\`) and re-run. This is your local environment, not the Ripplo server.`;case"scope-failed":return`Could not resolve the dev-session scope: ${e.detail}
224
+ Verify the dev session is live (\`npx ripplo doctor\`, ${d("start")}), or pass test ids / --all explicitly.`;case"sync-failed":{let t=/401|unauthor/i.test(e.detail)?"\nLooks like an auth failure \u2014 run `npx ripplo auth login` and retry.":"";return`Sync to the Ripplo server failed: ${e.detail}${t}`}case"bad-message":return"Daemon rejected the request (protocol mismatch \u2014 rebuild/update the CLI and restart the daemon)."}}function A(e){switch(e.kind){case"spawn-failed":return`Failed to start \`ripplo daemon\`: ${As(e.message)}`;case"connect-timeout":return[`Daemon did not come up within ${String(Math.round(e.deadlineMs/1e3))}s.`,`Check ${e.logPath} for startup errors (tail it: \`tail -50 ${e.logPath}\`).`,"Common causes: a stale socket (`rm .ripplo/.local/daemon.sock`), another daemon holding the dev lock, or the Ripplo server being unreachable."].join(`
225
+ `);case"connection-lost":return["Connection to the daemon was lost before the run finished \u2014 the daemon likely crashed or was killed.","Check .ripplo/.local/daemon.log, then restart with `npx ripplo daemon` (or rerun \u2014 `ripplo run` auto-starts it)."].join(`
226
+ `);case"bad-frame":return"Received a malformed frame from the daemon (version mismatch \u2014 rebuild/update the CLI and restart the daemon)."}}function js(e,t){return new Is(t,{includeScore:!0,threshold:.5}).search(P(e)).slice(0,3).map(n=>n.item)}function As(e){return e.includes("ENOENT")?`${e} \u2014 the node executable or CLI entry was not found on PATH.`:e.includes("EACCES")?`${e} \u2014 permission denied executing the CLI entry.`:e}async function Zr({findingId:e,json:t}){await Lt(process.cwd()).match(r=>{if(e==null){let i=t?JSON.stringify(r,null,2):Gr(r);process.stdout.write(`${i}
227
+ `);return}let n=r.pending.find(i=>i.id===e);n==null&&(process.stderr.write(`${Yr(e)}
228
+ `),process.exit(1));let o=t?JSON.stringify(n,null,2):Qr(n);process.stdout.write(`${o}
229
+ `)},r=>{process.stderr.write(`explore: ledger unreadable (${r.kind})
230
+ `),process.exit(1)})}async function en({findingId:e}){let t=process.argv[1];t==null&&(process.stderr.write(`${A({kind:"spawn-failed",message:"process.argv[1] missing"})}
231
+ `),process.exit(1));let r=await z({cliEntry:t,cwd:process.cwd()});r.isErr()&&(process.stderr.write(`${A(r.error)}
232
+ `),process.exit(1));let n=r.value,o=new Ls;process.once("SIGINT",()=>{o.cancel(),n.socket.destroy(),process.exit(130)});let a=await(await Br({connection:n,findingId:e,token:o.token})).match(async s=>(process.stdout.write(`${Jr(e,s)}
233
+ `),n.spawned&&await K(n),s.kind==="resolved"||s.kind==="unreachable"?0:1),s=>(process.stderr.write(`${A(s)}
234
+ `),Promise.resolve(1)));n.socket.destroy(),process.exit(a)}async function tn(e){let t=await Ur({cwd:process.cwd(),headed:e.headed,trails:e.trails,onReady:r=>{process.stdout.write(`${te(r)}
235
+ `)},onTrail:(r,n,o)=>{process.stdout.write(`${zr({executed:r,firings:n.firings,label:n.label,progress:o})}
236
+ `)}});process.stdout.write(`${Kr(t)}
237
+ `),(t.kind==="config-failed"||t.kind==="compile-failed")&&process.exit(1)}import{graphql as Ts}from"gql.tada";var Ds=Ts(`
354
238
  query ProjectsList {
355
239
  projects {
356
240
  id
357
241
  name
358
242
  }
359
243
  }
360
- `);async function eR(){let e=ft();e==null&&(process.stderr.write("Not authenticated. Run `ripplo auth login` first.\n"),process.exit(1));let t=st(),n=((await D({config:yr({serverUrl:t,token:e}),document:aW,variables:void 0})).projects??[]).map(o=>({id:o.id,name:o.name}));process.stdout.write(`${JSON.stringify({projects:n},null,2)}
361
- `)}import{graphql as lW}from"gql.tada";function tR({id:e,kind:t,title:r}){return`Caught bug reported (${t}): "${r}" [${e}]`}var cW=lW(`
244
+ `);async function rn(){let e=O();e==null&&(process.stderr.write("Not authenticated. Run `ripplo auth login` first.\n"),process.exit(1));let t=I(),n=((await p({config:U({serverUrl:t,token:e}),document:Ds,variables:void 0})).projects??[]).map(o=>({id:o.id,name:o.name}));process.stdout.write(`${JSON.stringify({projects:n},null,2)}
245
+ `)}import{graphql as Os}from"gql.tada";function nn({id:e,kind:t,title:r}){return`Caught bug reported (${t}): "${r}" [${e}]`}var _s=Os(`
362
246
  mutation ReportCaughtBug(
363
247
  $projectId: String!
364
248
  $kind: CaughtBugKind!
@@ -388,197 +272,41 @@ findings land in .ripplo/.local/explore-ledger.jsonl`}}async function Q0(e){let
388
272
  }
389
273
  }
390
274
  }
391
- `);async function rR(e){let t=wt(),n=(await D({config:t,document:cW,variables:{kind:e.kind,projectId:t.projectId,rootCause:e.rootCause,runId:e.runId??null,surfacedBy:e.surfacedBy,title:e.title,workflowSlug:e.testId==null?null:fe(e.testId)}})).reportCaughtBug;if(n?.__typename!=="CaughtBug"){let o=n?.__typename==="WorkflowNotFoundError"?n.message:null;process.stderr.write(`${o??"reportCaughtBug failed"}
392
- `),process.exit(1)}process.stdout.write(`${tR({id:n.id,kind:e.kind,title:e.title})}
393
- `)}import MW from"path";import{CancellationTokenSource as LW}from"vscode-jsonrpc/node";import{spawn as wW}from"child_process";import dR from"fs";import SW from"net";import{setTimeout as fR}from"timers/promises";import{err as rh,ok as nh}from"neverthrow";import{ResponseError as vW}from"vscode-jsonrpc/node";import{createMessageConnection as uW,NotificationType as nR,RequestType as dW,RequestType0 as oR,SocketMessageReader as pW,SocketMessageWriter as fW}from"vscode-jsonrpc/node";import{z as R}from"zod";var hW="daemon.sock",mW="daemon.log";function yi(e){return Ot(e,hW)}function eh(e){return Ot(e,mW)}function sl(e){return uW(new pW(e),new fW(e))}var iR=R.object({all:R.boolean(),headed:R.boolean(),tests:R.array(R.string())}),sR=R.object({jobId:R.string(),total:R.number()}),gW=R.enum(["holder","standby","off"]),yW=R.object({discharged:R.number(),findings:R.number(),obligations:R.number(),saturated:R.boolean()}),aR=R.object({active:R.number(),explorer:gW,exploring:R.number(),progress:yW,queued:R.number()}),th=R.discriminatedUnion("kind",[R.object({kind:R.literal("pass")}),R.object({findingLines:R.array(R.string()),kind:R.literal("findings")}),R.object({detail:R.string(),kind:R.literal("error")}),R.object({detail:R.string(),kind:R.literal("dispatch-error")}),R.object({detail:R.string(),kind:R.literal("infra-error")})]),bW=R.discriminatedUnion("kind",[R.object({kind:R.literal("test-started"),runId:R.string(),testName:R.string()}),R.object({kind:R.literal("test-outcome"),outcome:th,runId:R.string(),testName:R.string()})]),lR=R.object({event:bW,jobId:R.string()}),cR=R.object({failed:R.number(),jobId:R.string(),notRun:R.number(),passed:R.number()}),uR=R.discriminatedUnion("code",[R.object({code:R.literal("compile-failed"),detail:R.string(),diagnostics:R.array(R.string()).default([])}),R.object({code:R.literal("selection-conflicting-flags")}),R.object({code:R.literal("selection-nothing-selected")}),R.object({code:R.literal("selection-unknown-ids"),known:R.array(R.string()),unknown:R.array(R.string())}),R.object({code:R.literal("scope-failed"),detail:R.string()}),R.object({code:R.literal("app-unreachable"),detail:R.string(),url:R.string()}),R.object({code:R.literal("sync-failed"),detail:R.string()}),R.object({code:R.literal("bad-message")})]),al=new dW("ripplo/enqueue"),ll=new oR("ripplo/status"),cl=new oR("ripplo/shutdownIfIdle"),ul=new nR("ripplo/jobEvent"),dl=new nR("ripplo/jobDone");var hR=12e4,xW=300,pR=5e3;async function fl({cliEntry:e,cwd:t}){let r=yi(t),n=await pl(r);if(n!=null)return nh(oh(n,!1));let o=EW({cliEntry:e,cwd:t});if(o!=null)return rh(o);let i=await PW(r);return i==null?rh({deadlineMs:hR,kind:"connect-timeout",logPath:eh(t)}):nh(oh(i,!0))}async function hl({connection:e,onEvent:t,request:r,token:n}){let o=await RW({connection:e,onEvent:t,request:r,token:n});return o.kind==="transport"?rh(o.error):nh(o)}async function ml(e){try{await e.rpc.sendRequest(cl)}catch{}}async function mR(e){let t=await pl(yi(e));if(t==null)return{kind:"not-running"};let r=oh(t,!1),n=await Promise.race([kW(r),fR(pR).then(()=>null)]);return t.destroy(),n==null?{kind:"unresponsive",timeoutMs:pR}:{kind:"running",status:n}}async function kW(e){try{let t=await e.rpc.sendRequest(ll),r=aR.safeParse(t);return r.success?r.data:null}catch{return null}}function RW({connection:e,onEvent:t,request:r,token:n}){let{rpc:o}=e;return new Promise(i=>{let s=a=>{i(a)};o.onNotification(ul,a=>{let l=lR.safeParse(a);if(!l.success){s({error:{kind:"bad-frame"},kind:"transport"});return}t(l.data.event)}),o.onNotification(dl,a=>{let l=cR.safeParse(a);if(!l.success){s({error:{kind:"bad-frame"},kind:"transport"});return}s({failed:l.data.failed,kind:"done",notRun:l.data.notRun,passed:l.data.passed})}),o.onClose(()=>{s({error:{kind:"connection-lost"},kind:"transport"})}),o.sendRequest(al,r,n).then(a=>{sR.safeParse(a).success||s({error:{kind:"bad-frame"},kind:"transport"})}).catch(a=>{s(CW(a))})})}function CW(e){if(e instanceof vW){let t=uR.safeParse(e.data);return t.success?{error:t.data,kind:"daemon-error"}:{error:{kind:"bad-frame"},kind:"transport"}}return{error:{kind:"connection-lost"},kind:"transport"}}function oh(e,t){let r=sl(e);return r.listen(),{rpc:r,socket:e,spawned:t}}function pl(e){return new Promise(t=>{let r=SW.connect(e);r.once("connect",()=>{t(r)}),r.once("error",()=>{t(null)})})}function EW({cliEntry:e,cwd:t}){try{Ut(t);let r=dR.openSync(eh(t),"a");return wW(process.execPath,[e,"daemon"],{cwd:t,detached:!0,stdio:["ignore",r,r]}).unref(),dR.closeSync(r),null}catch(r){return{kind:"spawn-failed",message:r instanceof Error?r.message:String(r)}}}async function PW(e){let t=Date.now()+hR,r=await pl(e);for(;r==null&&Date.now()<t;)await fR(xW),r=await pl(e);return r}var IW=3e3;async function gl(e){Wt(e);let t=xe(e).unwrapOr(void 0);if(t==null)return null;try{return await fetch(`${t.ripploServerUrl}/health`,{signal:AbortSignal.timeout(IW)}),null}catch(r){return{detail:r instanceof Error?r.message:String(r),serverUrl:t.ripploServerUrl}}}function yl(e){return e.includes("localhost")||e.includes("127.0.0.1")}import AW from"fuse.js";function ih(e){switch(e.kind){case"conflicting-flags":return"Pass either --all or test ids, not both.";case"nothing-selected":return`No tests selected \u2014 scope is empty and no .ripplo/tests files are dirty. Pass test ids, add tests to scope (${V("scope")}), or use --all.`;case"unknown-ids":{let t=e.known.map(o=>fe(o)),r=e.unknown.flatMap(o=>TW(o,t)),n=r.length>0?[`Did you mean: ${[...new Set(r)].join(", ")}`]:[];return[`Unknown test id(s): ${e.unknown.join(", ")}`,...n,"The test id is the slug shown in run output and scope listings (the quoted intent string also works). All known ids:",...t.map(o=>` ${o}`)].join(`
394
- `)}}}function gR({failed:e,notRun:t,passed:r}){let n=t>0?`, ${String(t)} not run`:"",o=e>0?`
395
- ${V("debug")}`:"";return`${String(r)} passed, ${String(e)} failed${n} (${String(r+e+t)} total)${o}`}function bl({debugDir:e,event:t}){if(t.kind==="test-started")return`${_.dim("RUN ")} ${t.testName}`;switch(t.outcome.kind){case"pass":return`${_.good("PASS")} ${t.testName}`;case"findings":return[`${_.bad("FAIL")} ${t.testName} \u2014 ${String(t.outcome.findingLines.length)} finding(s)`,...t.outcome.findingLines,Lu({debugDir:e,runId:t.runId})].join(`
396
- `);case"error":return`${_.bad("ERROR")} ${t.testName} \u2014 ${t.outcome.detail}`;case"dispatch-error":return`${_.bad("ERROR")} ${t.testName} \u2014 failed to dispatch (${t.outcome.detail})`;case"infra-error":return`${_.bad("ERROR")} ${t.testName} \u2014 not run: Ripplo server unreachable (server-side issue, not your local environment): ${t.outcome.detail}`}}function wl({detail:e,serverUrl:t}){return yl(t)?`Ripplo server at ${t} is not running (${e}). Tests were not started. Start the dev server (\`pnpm dev\`) and re-run.`:`Ripplo server at ${t} is unreachable (${e}). Tests were not started. This is a server-side issue, not your local environment \u2014 wait a moment and re-run.`}function Sl(e){switch(e.code){case"compile-failed":{let t=e.diagnostics.length===0?[]:["",...e.diagnostics];return[`Compilation failed in the daemon (${e.detail}). Run \`npx ripplo compile\` for the full output.`,...t].join(`
397
- `)}case"selection-conflicting-flags":return ih({kind:"conflicting-flags"});case"selection-nothing-selected":return ih({kind:"nothing-selected"});case"selection-unknown-ids":return ih({kind:"unknown-ids",known:e.known,unknown:e.unknown});case"app-unreachable":return`Your dev server is not running: nothing responded at ${e.url} (${e.detail}). Tests were not started. Start the app (e.g. \`pnpm dev\`) and re-run. This is your local environment, not the Ripplo server.`;case"scope-failed":return`Could not resolve the dev-session scope: ${e.detail}
398
- Verify the dev session is live (\`npx ripplo doctor\`, ${V("start")}), or pass test ids / --all explicitly.`;case"sync-failed":{let t=/401|unauthor/i.test(e.detail)?"\nLooks like an auth failure \u2014 run `npx ripplo auth login` and retry.":"";return`Sync to the Ripplo server failed: ${e.detail}${t}`}case"bad-message":return"Daemon rejected the request (protocol mismatch \u2014 rebuild/update the CLI and restart the daemon)."}}function on(e){switch(e.kind){case"spawn-failed":return`Failed to start \`ripplo daemon\`: ${OW(e.message)}`;case"connect-timeout":return[`Daemon did not come up within ${String(Math.round(e.deadlineMs/1e3))}s.`,`Check ${e.logPath} for startup errors (tail it: \`tail -50 ${e.logPath}\`).`,"Common causes: a stale socket (`rm .ripplo/.local/daemon.sock`), another daemon holding the dev lock, or the Ripplo server being unreachable."].join(`
399
- `);case"connection-lost":return["Connection to the daemon was lost before the run finished \u2014 the daemon likely crashed or was killed.","Check .ripplo/.local/daemon.log, then restart with `npx ripplo daemon` (or rerun \u2014 `ripplo run` auto-starts it)."].join(`
400
- `);case"bad-frame":return"Received a malformed frame from the daemon (version mismatch \u2014 rebuild/update the CLI and restart the daemon)."}}function TW(e,t){return new AW(t,{includeScore:!0,threshold:.5}).search(fe(e)).slice(0,3).map(n=>n.item)}function OW(e){return e.includes("ENOENT")?`${e} \u2014 the node executable or CLI entry was not found on PATH.`:e.includes("EACCES")?`${e} \u2014 permission denied executing the CLI entry.`:e}async function yR({all:e,headed:t,ids:r,keepAlive:n}){let o=process.cwd(),i=process.argv[1];i==null&&bi(on({kind:"spawn-failed",message:"process.argv[1] missing"}));let s=await gl(o);s!=null&&bi(wl(s));let l=(await fl({cliEntry:i,cwd:o})).match(h=>h,h=>bi(on(h))),c=new LW;process.once("SIGINT",()=>{c.cancel(),l.socket.destroy(),process.exit(130)});let u=MW.join(o,".ripplo","debug"),p=(await hl({connection:l,request:{all:e,headed:t,tests:[...r]},token:c.token,onEvent:h=>{let f=bl({debugDir:u,event:h});f!=null&&process.stdout.write(`${f}
401
- `)}})).match(h=>h,h=>bi(on(h)));await NW({connection:l,keepAlive:n,result:p})}async function NW({connection:e,keepAlive:t,result:r}){e.spawned&&!t&&await ml(e),await new Promise(n=>{e.socket.end(n)}),r.kind==="daemon-error"&&bi(Sl(r.error)),process.stdout.write(`${gR(r)}
402
- `),r.failed>0&&process.exit(1),process.exit(r.notRun>0?2:0)}function bi(e){process.stderr.write(`${e}
403
- `),process.exit(1)}import tz from"path";import{randomUUID as rz}from"crypto";import{err as Ll,ok as ph}from"neverthrow";import{randomUUID as iH}from"crypto";import{CancellationTokenSource as sH,ResponseError as aH}from"vscode-jsonrpc/node";import{graphql as IR}from"gql.tada";import $W from"p-queue";var DW=4,_W={"p0-ui":3,"p1-cli":2,"p2-cover":1,"p3-explore":0},vl=new $W({concurrency:DW}),pr={headedActive:0,interactiveActive:0,interactiveQueued:0},bR={current:null};function kl({headed:e,task:t,workClass:r}){let n=_W[r];return r==="p3-explore"?vl.add(t,{priority:n}):(pr.interactiveQueued+=1,xl(),vl.add(()=>jW({headed:e,task:t}),{priority:n}))}function Rl(e){!Number.isFinite(e)||e<1||(vl.concurrency=Math.floor(e),xl())}function wi(){return{active:pr.interactiveActive,headedActive:pr.headedActive,poolSize:vl.concurrency,queued:pr.interactiveQueued}}function sh(e){bR.current=e}async function jW({headed:e,task:t}){pr.interactiveQueued-=1,pr.interactiveActive+=1,pr.headedActive+=e?1:0,xl();try{return await t()}finally{pr.interactiveActive-=1,pr.headedActive-=e?1:0,xl()}}function xl(){bR.current?.()}import{err as ah,ok as wR}from"neverthrow";function SR({all:e,ids:t,lockfile:r}){let n=r.tests.map(a=>a.name);if(e&&t.length>0)return ah({kind:"conflicting-flags"});if(e)return wR(r.tests.filter(a=>!a.stub).map(a=>a.name));if(t.length===0)return ah({kind:"nothing-selected"});let o=new Map(n.map(a=>[fe(a),a])),i=t.map(a=>({id:a,name:n.includes(a)?a:o.get(fe(a))})),s=i.filter(a=>a.name==null).map(a=>a.id);return s.length>0?ah({kind:"unknown-ids",known:n,unknown:s}):wR(i.flatMap(a=>a.name==null?[]:[a.name]))}import{err as lh,ok as xR}from"neverthrow";import{graphql as kR}from"gql.tada";async function RR({config:e,cwd:t,lockfile:r}){await BW({config:e,cwd:t,lockfile:r});let n=await UW(e);if(n.isErr())return lh(n.error);let o=new Map(r.tests.filter(s=>!s.stub).map(s=>[fe(s.name),s.name])),i=[...new Set(n.value)].flatMap(s=>{let a=o.get(s);return a==null?[]:[a]});return i.length===0?lh({kind:"scope-empty"}):xR(i)}var FW=kR(`
404
- mutation AddDirtyTestsToScope($projectId: String!, $cwd: String!, $workflowSlugs: [String!]!) {
405
- addDirtyTestsToScope(projectId: $projectId, cwd: $cwd, workflowSlugs: $workflowSlugs) {
406
- __typename
407
- }
408
- }
409
- `);async function BW({config:e,cwd:t,lockfile:r}){let n=new Set(WW(t)),o=r.tests.filter(i=>i.sourcePath!=null&&n.has(i.sourcePath)).map(i=>fe(i.name));o.length!==0&&await D({config:e,document:FW,variables:{cwd:e.cwd,projectId:e.projectId,workflowSlugs:o}}).catch(i=>{j.warn({err:i},"auto-scope of dirty tests failed")})}var VW=kR(`
410
- query ScopeSelection($projectId: String!, $cwd: String!) {
411
- project(id: $projectId) {
412
- id
413
- devSession(cwd: $cwd) {
414
- id
415
- scopeItems {
416
- id
417
- workflow {
418
- id
419
- slug
420
- }
421
- }
422
- }
423
- }
424
- }
425
- `);async function UW(e){try{let r=(await D({config:e,document:VW,variables:{cwd:e.cwd,projectId:e.projectId}})).project?.devSession?.scopeItems??[];return xR(r.flatMap(n=>n.workflow==null?[]:[n.workflow.slug]))}catch(t){return lh({detail:t instanceof Error?t.message:String(t),kind:"scope-fetch-failed"})}}var vR=".ripplo/tests/";function WW(e){try{return at(["status","--porcelain","--",".ripplo/tests"],e).split(`
426
- `).map(t=>t.slice(3).trim()).filter(t=>t.startsWith(vR)&&t.endsWith(".ts")).map(t=>t.slice(vR.length)).filter(t=>t!=="index.ts"&&!t.endsWith("/index.ts"))}catch{return[]}}import zW from"crypto";import{graphql as GW}from"gql.tada";import{err as qW,ok as KW}from"neverthrow";import ch from"fs";import uh from"path";function Cl(e){try{let t=HW(e);if(t==null)return;let r=uh.join(t,"HEAD"),n=ch.readFileSync(r,"utf8").trim(),o="ref: refs/heads/";return n.startsWith(o)?n.slice(o.length):n.length===0?void 0:n.slice(0,7)}catch{return}}function HW(e){let t=uh.join(e,".git");if(ch.statSync(t).isDirectory())return t;let n=ch.readFileSync(t,"utf8").trim(),o="gitdir:";if(!n.startsWith(o))return;let i=n.slice(o.length).trim();if(i.length!==0)return uh.resolve(e,i)}var JW=GW(`
427
- mutation SyncDevSession(
428
- $projectId: String!
429
- $cwd: String!
430
- $branch: String
431
- $preconditions: [SyncDevPreconditionInput!]!
432
- $workflows: [SyncDevWorkflowInput!]!
433
- ) {
434
- syncDevSession(
435
- projectId: $projectId
436
- cwd: $cwd
437
- branch: $branch
438
- preconditions: $preconditions
439
- workflows: $workflows
440
- ) {
441
- id
442
- hooksPaused
443
- }
444
- }
445
- `);async function Si(e,t){let r=await ve(e);if(r.isErr())return qW({error:r.error,kind:"compilation-failed"});let n=await $r({config:t,cwd:e,lockfile:r.value});return KW({devSessionId:n.devSessionId,lockfile:r.value})}async function $r(e){let t=YW(e.lockfile);return oH({config:e.config,cwd:e.cwd,payload:t})}function YW(e){let t=XW(e);return{preconditions:e.entities.map(r=>({depends:t.get(r.name)??[],description:r.description??"",name:r.name,returns:r.identity})),workflows:e.tests.map(r=>({expectedOutcome:r.intent,name:r.name,preconditions:tH(rH(r),t),requiresKeys:r.world.map(n=>({namespace:n.as,preconditionName:n.entity})),slug:fe(r.name),sourcePath:r.sourcePath??null,spec:JSON.stringify({steps:r.steps.map((n,o)=>oo(n,o)),stub:r.stub})}))}}function XW(e){let t=e.tests.reduce((r,n)=>ZW(r,n),new Map);return new Map([...t].map(([r,n])=>[r,[...n]]))}function ZW(e,t){let r=[...t.world,...t.maybe],n=new Map(r.map(o=>[o.as,o.entity]));return r.reduce((o,i)=>{let s=QW(i,n),a=o.get(i.entity)??new Set;return new Map([...o,[i.entity,new Set([...a,...s])]])},e)}function QW(e,t){return Object.values(e.set).flatMap(r=>eH(r)).map(r=>t.get(r)).filter(r=>r!=null&&r!==e.entity)}function eH(e){return e==null||typeof e!="object"?[]:"ref"in e?[CR(e.ref)]:e.template.filter(t=>typeof t!="string").map(t=>CR(t.ref))}function CR(e){let[t]=e.split(".");return t??e}function tH(e,t){let r=(n,o)=>n.has(o)?n:(t.get(o)??[]).reduce((i,s)=>r(i,s),new Set([...n,o]));return[...e.reduce((n,o)=>r(n,o),new Set)]}function rH(e){return[...new Set(e.world.map(t=>t.entity))]}function nH(e){return zW.createHash("sha256").update(JSON.stringify(e)).digest("hex")}async function oH({config:e,cwd:t,payload:r}){let n=nH(r),o=Cl(t),i=await D({config:e,document:JW,variables:{branch:o??null,cwd:t,preconditions:r.preconditions.map(s=>({depends:[...s.depends],description:s.description,name:s.name,returns:[...s.returns]})),projectId:e.projectId,workflows:r.workflows.map(s=>({expectedOutcome:s.expectedOutcome,name:s.name,preconditions:[...s.preconditions],requiresKeys:s.requiresKeys.map(a=>({namespace:a.namespace,preconditionName:a.preconditionName})),slug:s.slug,sourcePath:s.sourcePath,spec:s.spec??null}))}});if(i.syncDevSession==null)throw new Error("syncDevSession returned null");return{devSessionId:i.syncDevSession.id,hash:n,hooksPaused:i.syncDevSession.hooksPaused}}var lH=12e4,cH=-32099;function xi(e){let t=new AbortController;return e.isCancellationRequested?(t.abort(),t.signal):(e.onCancellationRequested(()=>{t.abort()}),t.signal)}function AR(e){let t={...e,expectations:new Map,jobs:new Map};return{claim:r=>gH(t,r),handleConnection:r=>{uH(t,r)},idle:()=>TR(t)}}function uH(e,t){let r=sl(t);r.onRequest(al,(n,o)=>dH({connection:r,ctx:e,params:n,token:o})),r.onRequest(ll,()=>{let n=wi();return{active:n.active,queued:n.queued,...e.explorationStatus()}}),r.onRequest(cl,()=>{let n=TR(e);return n&&e.onShutdownRequest(),n}),r.onClose(()=>{pH(e,r)}),r.onError(n=>{j.warn({err:n},"ipc connection error")}),t.on("error",n=>{j.warn({err:n},"ipc socket error")}),r.listen()}function TR(e){let t=wi();return e.jobs.size===0&&t.active===0&&t.queued===0}async function dH({connection:e,ctx:t,params:r,token:n}){let o=iR.safeParse(r);if(!o.success)throw ER({code:"bad-message"});await t.ready;let i=await bH({config:t.config,cwd:t.cwd,message:o.data});if(i.kind==="error")throw ER(i.error);let s=iH(),a=new sH;return n.onCancellationRequested(()=>{OR(t,s)}),t.jobs.set(s,{cancellation:a,connection:e,failed:0,notRun:0,passed:0,total:i.testNames.length}),AH({ctx:t,headed:o.data.headed,jobId:s,testNames:i.testNames,token:a.token,workflowIdsBySlug:i.workflowIdsBySlug}).catch(l=>{j.error({err:l},"ipc dispatch failed")}),{jobId:s,total:i.testNames.length}}function ER(e){return new aH(cH,e.code,e)}function OR(e,t){let r=e.jobs.get(t);r!=null&&(r.cancellation.cancel(),e.jobs.delete(t),e.expectations.forEach((n,o)=>{n.filter(i=>i.jobId===t).forEach(i=>{clearTimeout(i.timer)}),e.expectations.set(o,n.filter(i=>i.jobId!==t))}))}function pH(e,t){[...e.jobs.entries()].filter(([,r])=>r.connection===t).forEach(([r])=>{OR(e,r)})}function vi(e,t,r){let n=e.jobs.get(t);n!=null&&(PR(()=>n.connection.sendNotification(ul,{event:r,jobId:t})),r.kind==="test-outcome"&&(fH(n,r.outcome.kind),n.passed+n.failed+n.notRun>=n.total&&(PR(()=>n.connection.sendNotification(dl,{failed:n.failed,jobId:t,notRun:n.notRun,passed:n.passed})),e.jobs.delete(t))))}function PR(e){e().catch(t=>{j.warn({err:t},"ipc notification failed")})}function fH(e,t){if(t==="pass"){e.passed+=1;return}if(t==="dispatch-error"||t==="infra-error"){e.notRun+=1;return}e.failed+=1}function MR(e,t){let n=e.expectations.get(t)?.shift();return n==null?null:(clearTimeout(n.timer),n)}function hH(e,t){let{headed:r,jobId:n,slug:o,testName:i}=t,s=setTimeout(()=>{mH({ctx:e,jobId:n,slug:o,testName:i,timer:s})},lH);e.expectations.set(o,[...e.expectations.get(o)??[],{headed:r,jobId:n,testName:i,timer:s}])}function mH({ctx:e,jobId:t,slug:r,testName:n,timer:o}){let i=e.expectations.get(r)??[],s=i.findIndex(a=>a.timer===o);s!==-1&&(e.expectations.set(r,i.toSpliced(s,1)),vi(e,t,{kind:"test-outcome",outcome:{detail:"dispatch-timeout",kind:"dispatch-error"},runId:"",testName:n}))}function gH(e,t){let r=MR(e,t);if(r==null)return null;let n=e.jobs.get(r.jobId);return n==null?null:{headed:r.headed,token:n.cancellation.token,finished:(o,i)=>{vi(e,r.jobId,{kind:"test-outcome",outcome:i,runId:o,testName:r.testName})},started:o=>{vi(e,r.jobId,{kind:"test-started",runId:o,testName:r.testName})}}}function yH(e){return e.kind==="typecheck-failed"?e.diagnostics.slice(0,5):e.kind==="invalid-lockfile"?e.issues.slice(0,5):e.kind==="load-threw"?[e.message]:[]}async function bH({config:e,cwd:t,message:r}){return(await fm(t)).match(o=>wH({config:e,cwd:t,lockfile:o,message:r}),o=>Promise.resolve({error:{code:"compile-failed",detail:o.kind,diagnostics:[...yH(o)]},kind:"error"}))}async function wH({config:e,cwd:t,lockfile:r,message:n}){let o=await vH(e.appUrl);if(o!=null)return{error:{code:"app-unreachable",detail:o,url:e.appUrl},kind:"error"};let i=await xH({config:e,cwd:t,lockfile:r});return i!=null?{error:{code:"sync-failed",detail:i},kind:"error"}:(await kH({config:e,cwd:t,lockfile:r,message:n})).match(async a=>({kind:"ready",testNames:a,workflowIdsBySlug:await PH(e,t)}),a=>Promise.resolve({error:a,kind:"error"}))}var SH=2e3;async function vH(e){try{return await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(SH)}),null}catch(t){return t instanceof Error?t.message:String(t)}}async function xH(e){try{return await $r(e),null}catch(t){return t instanceof Error?t.message:String(t)}}async function kH({config:e,cwd:t,lockfile:r,message:n}){return!n.all&&n.tests.length===0?(await RR({config:e,cwd:t,lockfile:r})).mapErr(RH):SR({all:n.all,ids:n.tests,lockfile:r}).mapErr(CH)}function RH(e){return e.kind==="scope-empty"?{code:"selection-nothing-selected"}:{code:"scope-failed",detail:e.detail}}function CH(e){switch(e.kind){case"conflicting-flags":return{code:"selection-conflicting-flags"};case"nothing-selected":return{code:"selection-nothing-selected"};case"unknown-ids":return{code:"selection-unknown-ids",known:[...e.known],unknown:[...e.unknown]}}}var EH=IR(`
446
- query DaemonWorkflows($projectId: String!, $cwd: String!) {
447
- project(id: $projectId) {
448
- id
449
- devSession(cwd: $cwd) {
450
- id
451
- workflows {
452
- id
453
- slug
454
- }
455
- }
456
- }
457
- }
458
- `);async function PH(e,t){let n=(await D({config:e,document:EH,variables:{cwd:t,projectId:e.projectId}})).project?.devSession?.workflows??[];return new Map(n.map(o=>[o.slug,o.id]))}var IH=IR(`
459
- mutation DaemonCreateRun($workflowId: String!) {
460
- createRun(workflowId: $workflowId, executor: local) {
461
- __typename
462
- ... on Run {
463
- id
464
- }
465
- }
466
- }
467
- `);async function AH(e){await e.testNames.reduce((t,r)=>t.then(()=>TH(e,r)),Promise.resolve())}async function TH(e,t){let{ctx:r,headed:n,jobId:o,token:i,workflowIdsBySlug:s}=e;if(i.isCancellationRequested)return;let a=fe(t),l=s.get(a);if(l==null){vi(r,o,{kind:"test-outcome",outcome:{detail:"workflow-not-found",kind:"dispatch-error"},runId:"",testName:t});return}hH(r,{headed:n,jobId:o,slug:a,testName:t});let c=await OH(r.config,l);c!=null&&(MR(r,a),vi(r,o,{kind:"test-outcome",outcome:c,runId:"",testName:t}))}async function OH(e,t){try{let n=(await D({config:e,document:IH,variables:{workflowId:t}})).createRun;return n==null?{detail:"create-run-null",kind:"dispatch-error"}:n.__typename==="Run"?null:{detail:n.__typename,kind:"dispatch-error"}}catch(r){return r instanceof fr?{detail:r.message,kind:"infra-error"}:{detail:r instanceof Error?r.message:String(r),kind:"dispatch-error"}}}import{gzip as MH}from"zlib";import{promisify as LH}from"util";import{existsSync as NH,readFileSync as $H}from"fs";import NR from"path";import{graphql as ki}from"gql.tada";function LR(e){return[e.kind,e.target,e.value].filter(t=>t.length>0).join(" ")}async function $R({config:e,cwd:t,headed:r,lockfile:n,runId:o,session:i,signal:s,test:a}){if(!await zH(e,o))return{kind:"dispatch-failed",reason:"already-claimed",runId:o};let c=NR.join(t,".ripplo","debug"),u=[];return(await i.runOnce({capture:!0,lockfile:n,options:{baseUrl:e.appUrl,engineUrl:e.engineUrl,generate:rt,headed:r,secret:e.webhookSecret},params:void 0,runId:o,sequence:void 0,testName:a.name,onEvent:p=>{u.push(p)}},s)).match(async p=>{await DH({config:e,debugDir:c,events:u,runId:o,test:a,total:p.fired.length});let h=DR(u).flatMap(f=>f.findings);return h.length>0?{findings:h,kind:"findings",runId:o}:{kind:"pass",runId:o}},async p=>(await Ri(e,o,br(p)),{error:p,kind:"error",runId:o}))}async function DH({config:e,debugDir:t,events:r,runId:n,test:o}){let i=DR(r),s=_H(t,n);await Promise.all([BH({config:e,origin:s?.origin??0,records:i,runId:n,test:o}),s==null?Promise.resolve():WH(e,n,s)]),await HH(e,n,i)}function DR(e){return e.flatMap(t=>t.kind==="step"?[{endMs:t.endMs,findings:t.findings,index:t.index,startMs:t.startMs}]:[])}function _H(e,t){let r=NR.join(e,t,"behavior.jsonl");if(!NH(r))return null;let n=$H(r,"utf8").split(`
468
- `).filter(i=>i.length>0).map(i=>jH(i)).flatMap(i=>FH(i)?[i.event]:[]),o=n[0];return o==null?null:{events:n,origin:o.timestamp}}function jH(e){return JSON.parse(e)}function FH(e){return typeof e=="object"&&e!=null&&Reflect.get(e,"kind")==="rrweb"}async function BH({config:e,origin:t,records:r,runId:n,test:o}){let i=r.map(s=>VH({origin:t,record:s,test:o}));await D({config:e,document:qH,variables:{items:[{runId:n,steps:i}]}})}function VH({origin:e,record:t,test:r}){let n=r.steps[t.index],o=n==null?null:oo(n,t.index);return{assertions:t.findings.map(i=>({description:Co(i),detail:null,status:"failed"})),detail:null,duration:Math.max(0,t.endMs-t.startMs),nodeType:o?.kind??"step",recordingEndMs:Math.max(0,t.endMs-e),recordingStartMs:Math.max(0,t.startMs-e),rrwebIds:[],snapshotTimestamp:Math.max(0,t.endMs-e),status:t.findings.length>0?"failed":"passed",stepIndex:t.index,title:o==null?`step ${String(t.index)}`:LR(o),url:""}}var UH=LH(MH);async function Ri(e,t,r){await D({config:e,document:YH,variables:{reason:r,runId:t}}).catch(n=>{j.error(n,"failRun submission failed")})}async function WH(e,t,r){let n=r.events.map(s=>JSON.stringify(s)).join(`
469
- `),o=await UH(Buffer.from(n,"utf8")),i=r.events.at(-1);await D({config:e,document:KH,variables:{input:{bodyBase64:o.toString("base64"),chunkIndex:0,endTimestamp:Math.max(0,(i?.timestamp??r.origin)-r.origin),eventCount:r.events.length,runId:t,startTimestamp:0}}})}async function HH(e,t,r){let n=r.filter(s=>s.findings.length>0).length,o=r.length-n,i=r.reduce((s,a)=>s+Math.max(0,a.endMs-a.startMs),0);await D({config:e,document:JH,variables:{items:[{duration:i,failCount:n,passCount:o,runId:t,status:n>0?"failed":"passed",summary:null,warnCount:0}]}})}async function zH(e,t){return((await D({config:e,document:GH,variables:{runIds:[t]}})).startRunsBatch??[]).some(n=>n.id===t)}var GH=ki(`
470
- mutation StartRunsBatch($runIds: [String!]!) {
471
- startRunsBatch(runIds: $runIds) {
472
- id
473
- }
474
- }
475
- `),qH=ki(`
476
- mutation SubmitRunStepsBatch($items: [SubmitRunStepsItem!]!) {
477
- submitRunStepsBatch(items: $items)
478
- }
479
- `),KH=ki(`
480
- mutation SubmitRunRecordingChunk($input: SubmitRunRecordingChunkInput!) {
481
- submitRunRecordingChunk(input: $input)
482
- }
483
- `),JH=ki(`
484
- mutation CompleteRunsBatch($items: [CompleteRunItem!]!) {
485
- completeRunsBatch(items: $items) {
486
- id
487
- status
488
- }
489
- }
490
- `),YH=ki(`
491
- mutation FailRun($runId: String!, $reason: String!) {
492
- failRun(runId: $runId, reason: $reason)
493
- }
494
- `);import{createMessageConnection as _R,IPCMessageReader as jR,IPCMessageWriter as FR,NotificationType as XH,NotificationType0 as BR,RequestType as dh}from"vscode-jsonrpc/node";import{z as F}from"zod";var VR=F.object({headed:F.boolean(),lockfileFingerprint:F.string(),runId:F.string().min(1),workflowSlug:F.string().min(1)}),UR=F.object({fingerprint:F.string()}),cle=F.object({lockfileJson:F.string().optional(),unavailable:F.string().optional()}),ZH=F.enum(["unspecified","internal","server","client","producer","consumer"]),QH=F.enum(["unset","ok","error"]),ez=F.object({attributes:F.record(F.string(),F.string()),durationMs:F.number(),kind:F.literal("span"),name:F.string(),parentSpanId:F.union([F.string(),F.undefined()]),source:F.literal("server"),spanId:F.string(),spanKind:ZH,status:F.object({code:QH,message:F.union([F.string(),F.undefined()])}),timeNanos:F.string(),traceId:F.string()}),WR=F.object({runId:F.string().min(1),span:ez}),HR=F.object({outcome:th,serverNotified:F.boolean()}),zR=F.object({depotTest:qi,firings:F.array(F.object({idx:F.number().int().nonnegative(),params:F.record(F.string(),F.union([Lt,F.null()]))})),lensId:F.string().min(1),lockfileFingerprint:F.string(),lockfileHash:F.string().min(1),maxLength:F.number().int().positive(),shrinkBudget:F.number().int().nonnegative()}),GR=F.object({kind:F.enum(["aborted","clean","error","flaky","finding"]),reason:F.string().optional(),rows:F.array(Xa)}),El=new BR("worker/ready"),Pl=new dh("worker/run"),Il=new dh("worker/lockfile"),Al=new dh("worker/exploreTrail"),Tl=new XH("worker/span"),Ol=new BR("worker/shutdown");function qR(e){let t=_R(new jR(e),new FR(e));return t.listen(),t}function KR(){let e=_R(new jR(process),new FR(process));return e.listen(),e}async function JR(){let e=process.cwd(),t=j.child({worker:process.pid}),r=KR(),n=di({debugDir:tz.join(e,".ripplo","debug"),headed:!1,writeOtlpPortFile:!1}),o={entry:void 0},i=s=>{n.close().catch(()=>{}).then(()=>{process.exit(s)})};process.on("disconnect",()=>{i(1)}),process.on("unhandledRejection",s=>{t.error({err:s},"worker unhandled rejection")}),process.on("uncaughtException",s=>{t.error({err:s},"worker uncaught exception"),i(1)}),r.onRequest(Pl,async(s,a)=>{let l=VR.safeParse(s);if(!l.success)return Ml("bad-run-assign");let c=l.data;Wt(e);let u=xe(e).match(f=>f,f=>f.kind);if(typeof u=="string")return Ml(`config:${u}`);let d=await YR(c.lockfileFingerprint,o,r);if(d.isErr())return Ml(`lockfile-unavailable:${d.error}`);let p=d.value,h=p.tests.find(f=>fe(f.name)===c.workflowSlug);if(h==null)return Ml(`no-test:${c.workflowSlug}`);try{let f=await $R({config:u,cwd:e,headed:c.headed,lockfile:p,runId:c.runId,session:n,signal:xi(a),test:h});return{outcome:Y0(f),serverNotified:!0}}catch(f){if(f instanceof fr)return{outcome:{detail:f.message,kind:"infra-error"},serverNotified:!1};throw f}}),r.onRequest(Al,(s,a)=>nz({cache:o,connection:r,cwd:e,raw:s,session:n,token:a})),r.onNotification(Tl,s=>{let a=WR.safeParse(s);a.success&&n.injectSpan(a.data.runId,a.data.span)}),r.onNotification(Ol,()=>{i(0)}),r.sendNotification(El),await new Promise(()=>{})}function Ml(e){return{outcome:{detail:e,kind:"error"},serverNotified:!1}}async function nz({cache:e,connection:t,cwd:r,raw:n,session:o,token:i}){let s=zR.safeParse(n);if(!s.success)return{kind:"error",reason:"bad-assign",rows:[]};let a=s.data;Wt(r);let l=xe(r).match(f=>f,f=>f.kind);if(typeof l=="string")return{kind:"error",reason:`config:${l}`,rows:[]};let c=await YR(a.lockfileFingerprint,e,t);if(c.isErr())return{kind:"error",reason:`lockfile:${c.error}`,rows:[]};let u=c.value,d=ht(u),p=await oz({assign:a,corpus:d,lockfile:u});if(p==null)return{kind:"error",reason:"depot-arrange-failed",rows:[]};if(p.firings.length===0)return{kind:"error",reason:"empty-trail",rows:[]};let h=await hi({corpus:d,depot:{name:a.depotTest.name,test:a.depotTest},lensId:a.lensId,lockfile:u,lockfileHash:a.lockfileHash,options:{baseUrl:l.appUrl,engineUrl:l.engineUrl,generate:rt,headed:!1,secret:l.webhookSecret},session:o,shrinkBudget:a.shrinkBudget,trail:p,now:()=>new Date().toISOString(),runIdFor:f=>`explore-${rz()}-${String(f)}`},xi(i));return az(h)}async function oz({assign:e,corpus:t,lockfile:r}){return(await nn(r,{name:e.depotTest.name,test:e.depotTest},{generate:rt,materialize:Wr(rt,r.valueSpaces),params:void 0})).match(o=>fi({actionHashes:t.map(i=>rn(r,i)),corpus:t,depotSnapshot:o.snapshot,discharged:new Set,lens:qn(r),lensId:e.lensId,maxLength:e.maxLength,witnessTrail:e.firings}),()=>null)}async function YR(e,t,r){return t.entry!=null&&t.entry.fingerprint===e?ph(t.entry.lockfile):(await iz(r,e)).andThen(o=>o.unavailable!=null?Ll(o.unavailable):o.lockfileJson==null?Ll("empty-reply"):sz(o.lockfileJson).map(i=>(t.entry={fingerprint:e,lockfile:i},i)))}async function iz(e,t){try{return ph(await e.sendRequest(Il,{fingerprint:t}))}catch(r){return Ll(`transport:${r instanceof Error?r.message:"unknown"}`)}}function sz(e){try{return ph(bc(bt,e))}catch(t){return Ll(`worker-decode-failed:${t instanceof Error?t.message.slice(0,200):"unknown"}`)}}function az(e){return e.kind==="error"?{kind:e.kind,reason:`runtime:${e.error.kind}`,rows:[]}:e.kind==="aborted"?{kind:e.kind,rows:[]}:{kind:e.kind,rows:[...e.rows]}}async function XR(){await JR()}import{createRequire as lz}from"module";import{existsSync as cz}from"fs";import{readFile as QR,writeFile as uz}from"fs/promises";import{fileURLToPath as dz}from"url";import fh from"path";import{chromium as pz}from"playwright";import{err as Ci,ok as fz}from"neverthrow";import{z as Vt}from"zod";var hz={height:800,width:1280};async function eC({cwd:e,moment:t,runId:r}){let n=fh.join(e,".ripplo","debug",r),o=fh.join(n,"behavior.jsonl");if(!cz(o))return Ci({kind:"run-not-found",runId:r});let i=await gz(o),s=i[0],a=i.at(-1);if(s==null||a==null)return Ci({kind:"no-rrweb-events",runId:r});let l=a.timestamp-s.timestamp,c=t.kind==="offset"?t.offsetMs:t.at-s.timestamp;if(c<0||c>l)return Ci({durationMs:l,firstTimestamp:s.timestamp,kind:"moment-out-of-range",lastTimestamp:a.timestamp,moment:t});let u=fh.join(n,`snapshot-${String(Math.round(c))}ms.png`);return(await xz({events:i,offsetMs:c,pngPath:u})).map(()=>({durationMs:l,offsetMs:c,pngPath:u}))}var mz=Vt.object({event:Vt.looseObject({timestamp:Vt.number(),type:Vt.number()}),kind:Vt.literal("rrweb")});async function gz(e){return(await QR(e,"utf8")).split(`
495
- `).filter(r=>r.length>0).map(r=>yz(r)).map(r=>mz.safeParse(r)).flatMap(r=>r.success?[r.data.event]:[])}function yz(e){try{return JSON.parse(e)}catch{return null}}var bz=Vt.object({data:Vt.looseObject({height:Vt.number(),width:Vt.number()}),type:Vt.literal(4)});function wz(e){let t=e.flatMap(r=>{let n=bz.safeParse(r);return n.success?[n.data]:[]})[0];return t==null?hz:{height:t.data.height,width:t.data.width}}var Sz=`<!doctype html><html><head><style>
275
+ `);async function on(e){let t=j(),n=(await p({config:t,document:_s,variables:{kind:e.kind,projectId:t.projectId,rootCause:e.rootCause,runId:e.runId??null,surfacedBy:e.surfacedBy,title:e.title,workflowSlug:e.testId==null?null:P(e.testId)}})).reportCaughtBug;if(n?.__typename!=="CaughtBug"){let o=n?.__typename==="WorkflowNotFoundError"?n.message:null;process.stderr.write(`${o??"reportCaughtBug failed"}
276
+ `),process.exit(1)}process.stdout.write(`${nn({id:n.id,kind:e.kind,title:e.title})}
277
+ `)}import Fs from"path";import{CancellationTokenSource as Ns}from"vscode-jsonrpc/node";async function sn({all:e,headed:t,ids:r,keepAlive:n}){let o=process.cwd(),i=process.argv[1];i==null&&se(A({kind:"spawn-failed",message:"process.argv[1] missing"}));let a=await Se(o);a!=null&&se(xe(a));let l=(await z({cliEntry:i,cwd:o})).match($=>$,$=>se(A($))),c=new Ns;process.once("SIGINT",()=>{c.cancel(),l.socket.destroy(),process.exit(130)});let b=Fs.join(o,".ripplo","debug"),y=(await be({connection:l,request:{all:e,headed:t,tests:[...r]},token:c.token,onEvent:$=>{let x=Ce({debugDir:b,event:$});x!=null&&process.stdout.write(`${x}
278
+ `)}})).match($=>$,$=>se(A($)));await Us({connection:l,keepAlive:n,result:y})}async function Us({connection:e,keepAlive:t,result:r}){e.spawned&&!t&&await K(e),await new Promise(n=>{e.socket.end(n)}),r.kind==="daemon-error"&&se(Pe(r.error)),process.stdout.write(`${Xr(r)}
279
+ `),r.failed>0&&process.exit(1),process.exit(r.notRun>0?2:0)}function se(e){process.stderr.write(`${e}
280
+ `),process.exit(1)}import Hs from"path";import{err as $e,ok as Ve}from"neverthrow";async function an(){let e=process.cwd(),t=D.child({worker:process.pid}),r=ir(),n=me({debugDir:Hs.join(e,".ripplo","debug"),headed:!1,writeOtlpPortFile:!1}),o={entry:void 0},i=a=>{n.close().catch(()=>{}).then(()=>{process.exit(a)})};process.on("disconnect",()=>{i(1)}),process.on("unhandledRejection",a=>{t.error({err:a},"worker unhandled rejection")}),process.on("uncaughtException",a=>{t.error({err:a},"worker uncaught exception"),i(1)}),r.onRequest(er,async(a,s)=>{let l=Qt.safeParse(a);if(!l.success)return Ee("bad-run-assign");let c=l.data;W(e);let b=k(e).match(x=>x,x=>x.kind);if(typeof b=="string")return Ee(`config:${b}`);let u=await ln(c.lockfileFingerprint,o,r);if(u.isErr())return Ee(`lockfile-unavailable:${u.error}`);let y=u.value,$=y.tests.find(x=>P(x.name)===c.workflowSlug);if($==null)return Ee(`no-test:${c.workflowSlug}`);try{let x=await Kt({config:b,cwd:e,headed:c.headed,lockfile:y,runId:c.runId,session:n,signal:Ne(s),test:$});return{outcome:Jt(x),serverNotified:!0}}catch(x){if(x instanceof Ye)return{outcome:{detail:x.message,kind:"infra-error"},serverNotified:!1};throw x}}),r.onRequest(rr,(a,s)=>Ms({cache:o,connection:r,cwd:e,raw:a,session:n,token:s})),r.onNotification(nr,a=>{let s=Yt.safeParse(a);s.success&&n.injectSpan(s.data.runId,s.data.span)}),r.onNotification(or,()=>{i(0)}),r.sendNotification(Zt),await new Promise(()=>{})}function Ee(e){return{outcome:{detail:e,kind:"error"},serverNotified:!1}}async function Ms({cache:e,connection:t,cwd:r,raw:n,session:o,token:i}){let a=Xt.safeParse(n);if(!a.success)return{kind:"error",reason:"bad-assign",rows:[]};let s=a.data;W(r);let l=k(r).match(u=>u,u=>u.kind);if(typeof l=="string")return{kind:"error",reason:`config:${l}`,rows:[]};let c=await ln(s.lockfileFingerprint,e,t);if(c.isErr())return{kind:"error",reason:`lockfile:${c.error}`,rows:[]};let b=c.value;return ke({assign:s,config:l,headed:!1,lockfile:b,session:o,signal:Ne(i)})}async function ln(e,t,r){return t.entry!=null&&t.entry.fingerprint===e?Ve(t.entry.lockfile):(await Ws(r,e)).andThen(o=>o.unavailable!=null?$e(o.unavailable):o.lockfileJson==null?$e("empty-reply"):qs(o.lockfileJson).map(i=>(t.entry={fingerprint:e,lockfile:i},i)))}async function Ws(e,t){try{return Ve(await e.sendRequest(tr,{fingerprint:t}))}catch(r){return $e(`transport:${r instanceof Error?r.message:"unknown"}`)}}function qs(e){try{return Ve(lt(N,e))}catch(t){return $e(`worker-decode-failed:${t instanceof Error?t.message.slice(0,200):"unknown"}`)}}async function cn(){await an()}import{createRequire as Bs}from"module";import{existsSync as Vs}from"fs";import{readFile as pn,writeFile as Gs}from"fs/promises";import{fileURLToPath as Js}from"url";import Ge from"path";import{err as ae,ok as zs}from"neverthrow";import{z as T}from"zod";var Ks={height:800,width:1280};async function un({cwd:e,moment:t,runId:r}){let n=Ge.join(e,".ripplo","debug",r),o=Ge.join(n,"behavior.jsonl");if(!Vs(o))return ae({kind:"run-not-found",runId:r});let i=await Ys(o),a=i[0],s=i.at(-1);if(a==null||s==null)return ae({kind:"no-rrweb-events",runId:r});let l=s.timestamp-a.timestamp,c=t.kind==="offset"?t.offsetMs:t.at-a.timestamp;if(c<0||c>l)return ae({durationMs:l,firstTimestamp:a.timestamp,kind:"moment-out-of-range",lastTimestamp:s.timestamp,moment:t});let b=Ge.join(n,`snapshot-${String(Math.round(c))}ms.png`);return(await na({events:i,offsetMs:c,pngPath:b})).map(()=>({durationMs:l,offsetMs:c,pngPath:b}))}var Qs=T.object({event:T.looseObject({timestamp:T.number(),type:T.number()}),kind:T.literal("rrweb")});async function Ys(e){return(await pn(e,"utf8")).split(`
281
+ `).filter(r=>r.length>0).map(r=>Xs(r)).map(r=>Qs.safeParse(r)).flatMap(r=>r.success?[r.data.event]:[])}function Xs(e){try{return JSON.parse(e)}catch{return null}}var Zs=T.object({data:T.looseObject({height:T.number(),width:T.number()}),type:T.literal(4)});function ea(e){let t=e.flatMap(r=>{let n=Zs.safeParse(r);return n.success?[n.data]:[]})[0];return t==null?Ks:{height:t.data.height,width:t.data.width}}var ta=`<!doctype html><html><head><style>
496
282
  html, body { margin: 0; padding: 0; }
497
283
  .replayer-wrapper { position: relative; }
498
284
  .replayer-mouse, .replayer-mouse-tail { display: none; }
499
285
  iframe { border: none; }
500
- </style></head><body></body></html>`,vz="*, *::before, *::after { animation-duration: 0s !important; animation-delay: 0s !important; transition-duration: 0s !important; transition-delay: 0s !important; }";async function xz({events:e,offsetMs:t,pngPath:r}){let n=await pz.launch({headless:!0}).catch(()=>null);if(n==null)return Ci({detail:"chromium launch",kind:"browser-failed"});try{let o=await kz({browser:n,events:e,offsetMs:t});return await uz(r,o),fz(void 0)}catch(o){return Ci({detail:o instanceof Error?o.message:String(o),kind:"browser-failed"})}finally{await n.close()}}async function kz({browser:e,events:t,offsetMs:r}){let n=wz(t),o=await e.newPage({viewport:n});await o.setContent(Sz),await o.addScriptTag({content:await Ez()}),await o.evaluate(Rz({events:t,offsetMs:r})),await o.evaluate(Cz());let i=o.locator(".replayer-wrapper iframe").first();return(await i.count()>0?i:o).screenshot({type:"png"})}function Rz({events:e,offsetMs:t}){return`(() => {
286
+ </style></head><body></body></html>`,ra="*, *::before, *::after { animation-duration: 0s !important; animation-delay: 0s !important; transition-duration: 0s !important; transition-delay: 0s !important; }";async function na({events:e,offsetMs:t,pngPath:r}){let n=await import("playwright").then(({chromium:o})=>o.launch({headless:!0})).catch(()=>null);if(n==null)return ae({detail:"chromium launch",kind:"browser-failed"});try{let o=await oa({browser:n,events:e,offsetMs:t});return await Gs(r,o),zs(void 0)}catch(o){return ae({detail:o instanceof Error?o.message:String(o),kind:"browser-failed"})}finally{await n.close()}}async function oa({browser:e,events:t,offsetMs:r}){let n=ea(t),o=await e.newPage({viewport:n});await o.setContent(ta),await o.addScriptTag({content:await aa()}),await o.evaluate(ia({events:t,offsetMs:r})),await o.evaluate(sa());let i=o.locator(".replayer-wrapper iframe").first();return(await i.count()>0?i:o).screenshot({type:"png"})}function ia({events:e,offsetMs:t}){return`(() => {
501
287
  const replayer = new globalThis.__RipploReplayer(${JSON.stringify(e)}, {
502
- insertStyleRules: [${JSON.stringify(vz)}],
288
+ insertStyleRules: [${JSON.stringify(ra)}],
503
289
  mouseTail: false,
504
290
  root: document.body,
505
291
  showWarning: false,
506
292
  });
507
293
  replayer.pause(${String(t)});
508
- })()`}function Cz(){return`(async () => {
294
+ })()`}function sa(){return`(async () => {
509
295
  const doc = document.querySelector(".replayer-wrapper iframe")?.contentDocument;
510
296
  if (doc?.fonts != null) {
511
297
  await doc.fonts.ready;
512
298
  }
513
299
  await new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(resolve)));
514
- })()`}var ZR;function Ez(){return ZR??=QR(Pz(),"utf8"),ZR}function Pz(){let e=lz(import.meta.url);try{return e.resolve("@ripplo/rrweb-bundle/replay")}catch{return dz(new URL("assets/rrweb-replay.js",import.meta.url))}}function tC(e){return[`${_.good("OK")} \u2014 rendered the page at ${String(Math.round(e.offsetMs))}ms into the recording (duration ${String(Math.round(e.durationMs))}ms)`,e.pngPath,"Read the PNG above to see the page state. Layout and text are faithful; URL-referenced images may be blank if the dev server is down."].join(`
515
- `)}function rC(e){return`${_.bad("FAIL")} \u2014 ${Iz(e)}`}function nC(){return`${_.bad("FAIL")} \u2014 pass exactly one of --at <epoch-ms from behavior.jsonl> or --offset <ms from the start of the recording>.`}function Iz(e){switch(e.kind){case"run-not-found":return`no debug artifacts for run ${e.runId} (.ripplo/debug/${e.runId}/behavior.jsonl missing). ${V("debug")}`;case"no-rrweb-events":return`run ${e.runId} has a behavior.jsonl but no rrweb events \u2014 nothing to replay.`;case"moment-out-of-range":return`${e.moment.kind==="offset"?"--offset":"--at"} is outside the recording, which spans ${String(e.firstTimestamp)}\u2013${String(e.lastTimestamp)} (duration ${String(e.durationMs)}ms). Pass --at <epoch-ms from behavior.jsonl> or --offset <0\u2013${String(e.durationMs)}>.`;case"browser-failed":return`replay browser failed (${e.detail}). Is chromium installed? Try \`npx playwright install chromium\`.`}}async function oC({at:e,offset:t,runId:r}){let n=Az({at:e,offset:t});n==null&&(process.stderr.write(`${nC()}
516
- `),process.exit(1)),(await eC({cwd:process.cwd(),moment:n,runId:r})).match(i=>{process.stdout.write(`${tC(i)}
517
- `)},i=>{process.stderr.write(`${rC(i)}
518
- `),process.exit(1)})}function Az({at:e,offset:t}){if(e!=null&&t==null)return{at:e,kind:"absolute"};if(t!=null&&e==null)return{kind:"offset",offsetMs:t}}async function iC(){let e=wt();try{let r=(await Si(e.cwd,e)).match(i=>i,i=>{process.stderr.write(`${He(i)}
300
+ })()`}var dn;function aa(){return dn??=pn(la(),"utf8"),dn}function la(){let e=Bs(import.meta.url);try{return e.resolve("@ripplo/rrweb-bundle/replay")}catch{return Js(new URL("assets/rrweb-replay.js",import.meta.url))}}function mn(e){return[`${C.good("OK")} \u2014 rendered the page at ${String(Math.round(e.offsetMs))}ms into the recording (duration ${String(Math.round(e.durationMs))}ms)`,e.pngPath,"Read the PNG above to see the page state. Layout and text are faithful; URL-referenced images may be blank if the dev server is down."].join(`
301
+ `)}function fn(e){return`${C.bad("FAIL")} \u2014 ${ca(e)}`}function gn(){return`${C.bad("FAIL")} \u2014 pass exactly one of --at <epoch-ms from behavior.jsonl> or --offset <ms from the start of the recording>.`}function ca(e){switch(e.kind){case"run-not-found":return`no debug artifacts for run ${e.runId} (.ripplo/debug/${e.runId}/behavior.jsonl missing). ${d("debug")}`;case"no-rrweb-events":return`run ${e.runId} has a behavior.jsonl but no rrweb events \u2014 nothing to replay.`;case"moment-out-of-range":return`${e.moment.kind==="offset"?"--offset":"--at"} is outside the recording, which spans ${String(e.firstTimestamp)}\u2013${String(e.lastTimestamp)} (duration ${String(e.durationMs)}ms). Pass --at <epoch-ms from behavior.jsonl> or --offset <0\u2013${String(e.durationMs)}>.`;case"browser-failed":return`replay browser failed (${e.detail}). Is chromium installed? Try \`npx playwright install chromium\`.`}}async function hn({at:e,offset:t,runId:r}){let n=da({at:e,offset:t});n==null&&(process.stderr.write(`${gn()}
302
+ `),process.exit(1)),(await un({cwd:process.cwd(),moment:n,runId:r})).match(i=>{process.stdout.write(`${mn(i)}
303
+ `)},i=>{process.stderr.write(`${fn(i)}
304
+ `),process.exit(1)})}function da({at:e,offset:t}){if(e!=null&&t==null)return{at:e,kind:"absolute"};if(t!=null&&e==null)return{kind:"offset",offsetMs:t}}async function yn(){let e=j();try{let r=(await re(e.cwd,e)).match(i=>i,i=>{process.stderr.write(`${E(i)}
519
305
  `),process.exit(1)}),n=r.lockfile.tests.length,o=r.lockfile.entities.length;process.stdout.write(`synced ${String(n)} tests, ${String(o)} entities to dev session ${r.devSessionId}
520
306
  `)}catch(t){let r=t instanceof Error?t.message:String(t);process.stderr.write(`ripplo sync failed: ${r}
521
- `),process.stderr.write(`${V("setup","verify auth + server reachability")}
522
- `),process.exit(1)}}import aG from"path";import{createClient as lG}from"graphql-sse";import cG,{AbortError as uG}from"p-retry";import{graphql as Dl}from"gql.tada";import{print as dG}from"graphql";import Tz from"fs";import cC from"net";import{err as uC,ok as Oz}from"neverthrow";async function dC({cwd:e,onConnection:t}){Ut(e);let r=yi(e),n=await sC({onConnection:t,socketPath:r});return n.isOk()||n.error.kind!=="stale-candidate"?n.map(aC(r)).mapErr(lC(r)):await Mz(r)?uC({kind:"already-running",socketPath:r}):(pC(r),(await sC({onConnection:t,socketPath:r})).map(aC(r)).mapErr(lC(r)))}function Mz(e){return new Promise(t=>{let r=cC.connect(e);r.once("connect",()=>{r.destroy(),t(!0)}),r.once("error",()=>{t(!1)})})}async function sC(e){let t=await Lz(e);return t.kind==="listening"?Oz(t.server):uC(t.error)}function Lz({onConnection:e,socketPath:t}){return new Promise(r=>{let n=cC.createServer(e);n.once("error",o=>{r({error:o.code==="EADDRINUSE"?{kind:"stale-candidate"}:{kind:"listen-failed",message:o.message},kind:"failed"})}),n.listen(t,()=>{r({kind:"listening",server:n})})})}function aC(e){return t=>({socketPath:e,close:()=>{t.close(),pC(e)}})}function pC(e){Tz.rmSync(e,{force:!0})}function lC(e){return t=>t.kind==="stale-candidate"?{kind:"already-running",socketPath:e}:{kind:"bind-failed",message:t.message}}import Nz from"fs";import{lockSync as $z}from"proper-lockfile";var Dz="explorer.lock",_z=15e3,jz=15e3;function Fz(){return Mt(Dz)}function fC({onChange:e}){let t={release:null,stopped:!1},r=()=>{t.release=null,t.stopped||e(!1)},n=()=>{if(t.stopped||t.release!=null)return;let i=Bz(r);i!=null&&(t.release=i,e(!0))};n();let o=setInterval(n,jz);return{holder:()=>t.release!=null,stop:()=>{t.stopped=!0,clearInterval(o),t.release?.(),t.release=null}}}function Bz(e){try{to();let t=Fz(),r=$z(t,{onCompromised:e,realpath:!1,stale:_z});return Nz.writeFileSync(t,String(process.pid)),()=>{try{r()}catch{}}}catch{return null}}function Vz(e){let{backoffActive:t,explorerHolder:r,headedActive:n,interactiveActive:o,interactiveQueued:i}=e,{explorationActive:s,poolSize:a}=e;if(!r||n||i>0)return{abortCount:s,refillCount:0};if(t)return{abortCount:0,refillCount:0};let l=Math.min(a-1,a-o)-s;return{abortCount:0,refillCount:Math.max(0,l)}}function gC(e){let t={active:new Map,backoffUntil:0,cancelBackoffTimer:null,cancelHeartbeat:null,holder:!1,prevInteractiveActive:e.probe().interactiveActive,stopped:!1};return yC(t,e),{explorationActive:()=>t.active.size,explorerHolder:()=>t.holder,notifyQueueChange:()=>{Uz(t,e)},setExplorerHolder:r=>{t.holder=r,Ei(t,e)},stop:()=>{t.stopped=!0,t.cancelBackoffTimer?.(),t.cancelBackoffTimer=null,t.cancelHeartbeat?.(),t.cancelHeartbeat=null,bC(t,t.active.size)}}}function yC(e,t){e.stopped||(e.cancelHeartbeat=t.setTimer(()=>{Ei(e,t),yC(e,t)},15e3))}function Ei(e,t){if(e.stopped)return;let r=t.probe(),n=Vz({backoffActive:t.now()<e.backoffUntil,explorationActive:e.active.size,explorerHolder:e.holder&&t.exploreEnabled,headedActive:r.headedActive>0,interactiveActive:r.interactiveActive,interactiveQueued:r.interactiveQueued,poolSize:r.poolSize});bC(e,n.abortCount),wC({count:n.refillCount,params:t,state:e})}function bC(e,t){[...e.active.values()].slice(0,t).forEach(({controller:r})=>{r.abort()})}function Uz(e,t){let r=t.probe();r.interactiveActive<e.prevInteractiveActive&&Wz(e,t),e.prevInteractiveActive=r.interactiveActive,Ei(e,t)}function Wz(e,t){e.backoffUntil=t.now()+3e4,e.cancelBackoffTimer?.(),e.cancelBackoffTimer=t.setTimer(()=>{e.cancelBackoffTimer=null,Ei(e,t)},3e4)}function wC({count:e,params:t,state:r}){if(e<=0)return;let n=Hz(t.sources);n!=null&&(zz({params:t,pulled:n,state:r}),wC({count:e-1,params:t,state:r}))}function Hz(e){return e.reduce((t,r)=>{if(t!=null)return t;let n=r.next();return n==null?null:{job:n,source:r}},null)}function zz({params:e,pulled:t,state:r}){let{job:n,source:o}=t,i=new AbortController;r.active.set(n.id,{controller:i,job:n,source:o}),e.execute({job:n,priority:o.priority,signal:i.signal}).then(()=>{mC({job:n,outcome:hC(i.signal,null),params:e,source:o,state:r})}).catch(s=>{mC({job:n,outcome:hC(i.signal,{error:s}),params:e,source:o,state:r})})}function hC(e,t){return e.aborted?{kind:"aborted"}:t==null?{kind:"completed"}:{error:t.error,kind:"error"}}function mC({job:e,outcome:t,params:r,source:n,state:o}){o.active.delete(e.id),n.onResult(e,t),Ei(o,r)}function hh(e){return{priority:e,next:()=>null,onResult:()=>{}}}function SC({cwd:e,executeTrail:t,explore:r}){let n={notify:()=>{}},o=r?Gz({cwd:e,executeTrail:t,notifyWork:()=>{n.notify()}}):B0(),i=gC({exploreEnabled:r,now:Date.now,probe:qz,setTimer:Kz,sources:[hh("p0"),hh("p1"),o],execute:({job:a,priority:l,signal:c})=>kl({headed:!1,workClass:Jz(l),task:()=>a.run(c)})});sh(()=>{i.notifyQueueChange()}),n.notify=()=>{i.notifyQueueChange()};let s=r?fC({onChange:a=>{i.setExplorerHolder(a)}}):null;return{status:()=>({explorer:Yz({explore:r,holder:i.explorerHolder()}),exploring:i.explorationActive(),progress:o.status()}),stop:()=>{s?.stop(),i.stop(),sh(null),o.stop()}}}function Gz({cwd:e,executeTrail:t,notifyWork:r}){return il({cwd:e,executeTrail:t,notifyWork:r,loadLockfile:async()=>{let{fingerprint:n,result:o}=await Kt(e);return o.match(i=>({fingerprint:n,lockfile:i}),()=>null)}})}function qz(){let e=wi();return{headedActive:e.headedActive,interactiveActive:e.active,interactiveQueued:e.queued,poolSize:e.poolSize}}function Kz(e,t){let r=setTimeout(e,t);return()=>{clearTimeout(r)}}function Jz(e){switch(e){case"p0":return"p0-ui";case"p1":return"p1-cli";case"p2":return"p2-cover";case"p3":return"p3-explore"}}function Yz({explore:e,holder:t}){return e?t?"holder":"standby":"off"}async function vC({config:e,cwd:t,headed:r,pool:n,runId:o,signal:i,workClass:s,workflowSlug:a}){let{fingerprint:l,result:c}=await Kt(t);if(c.isErr())return await Ri(e,o,`lockfile:${c.error.kind}`),{detail:`lockfile:${c.error.kind}`,kind:"dispatch-error"};if(c.value.tests.find(p=>fe(p.name)===a)==null)return await Ri(e,o,`no-test:${a}`),{detail:`no-test:${a}`,kind:"dispatch-error"};let d=await kl({headed:r,workClass:s,task:()=>n.execute({headed:r,lockfileFingerprint:l,runId:o,workflowSlug:a},i)});return!d.serverNotified&&d.outcome.kind==="error"&&await Ri(e,o,d.outcome.detail),d.outcome}import{fork as Xz}from"child_process";import xC from"os";import{CancellationTokenSource as kC,ResponseError as RC}from"vscode-jsonrpc/node";function CC(e,t){return()=>{let r=Xz(e,["run-worker"],{cwd:t,stdio:["ignore","inherit","inherit","ipc"]});return{connection:qR(r),kill:()=>{r.kill("SIGKILL")},onExit:n=>{r.once("exit",n)}}}}function EC(e){let t={closed:!1,lockfileProvider:e.lockfileProvider,nextId:0,size:e.initialSize,spawn:e.spawn,waiters:[],workers:[]};return{close:async()=>{t.closed=!0,await Promise.all([...t.workers].map(r=>mh(r,t)))},execute:(r,n)=>Qz(r,n,t),exploreTrail:(r,n)=>rG(r,n,t),routeSpan:(r,n)=>{let o=t.workers.find(i=>i.runId===r);o?.worker.connection.sendNotification(Tl,{runId:r,span:n})},setSize:r=>{oG(r,t)}}}var Zz=1e4,PC=-32800;async function Qz(e,t,r){let n=await IC(r);if(n.runId=e.runId,!n.alive)return Nl(n,r),{outcome:{detail:"worker-exit",kind:"error"},serverNotified:!1};let o=new kC,i=()=>{o.cancel()};t.aborted&&o.cancel(),t.addEventListener("abort",i,{once:!0});try{let s=await n.worker.connection.sendRequest(Pl,e,o.token),a=HR.safeParse(s);return a.success?a.data:{outcome:{detail:"bad-outcome-frame",kind:"error"},serverNotified:!1}}catch(s){return tG(s,n)}finally{t.removeEventListener("abort",i),o.dispose(),Nl(n,r)}}async function IC(e){let t=e.workers.find(r=>r.alive&&r.runId===void 0);if(t!=null)return t.runId="pending",t;if(e.workers.length<e.size){let r=eG(e);return r.runId="pending",await r.ready,r}return new Promise(r=>{e.waiters.push(n=>{n.runId="pending",r(n)})})}function eG(e){let t=e.spawn(),r={resolve:()=>{}},n={alive:!0,id:e.nextId,ready:new Promise(o=>{r.resolve=o,t.connection.onNotification(El,o)}),runId:void 0,worker:t};return e.nextId+=1,t.connection.onRequest(Il,async o=>{let i=UR.safeParse(o);return i.success?e.lockfileProvider(i.data.fingerprint):{unavailable:"bad-lockfile-request"}}),t.onExit(()=>{n.alive=!1,e.workers=e.workers.filter(o=>o!==n),t.connection.dispose(),r.resolve()}),e.workers.push(n),n}function Nl(e,t){if(e.runId=void 0,!e.alive||t.closed)return;if(t.workers.length>t.size){mh(e,t);return}let r=t.waiters.shift();r?.(e)}async function mh(e,t){if(t.workers=t.workers.filter(o=>o!==e),!e.alive)return;let r=new Promise(o=>{e.worker.onExit(o)});await e.worker.connection.sendNotification(Ol).catch(()=>{});let n=setTimeout(()=>{e.worker.kill()},Zz);await r,clearTimeout(n)}function tG(e,t){return e instanceof RC&&e.code===PC?{outcome:{detail:"aborted",kind:"error"},serverNotified:!1}:t.alive?{outcome:{detail:e instanceof Error?e.message:String(e),kind:"error"},serverNotified:!1}:{outcome:{detail:"worker-exit",kind:"error"},serverNotified:!1}}async function rG(e,t,r){let n=await IC(r);if(n.runId="explore",!n.alive)return Nl(n,r),{kind:"error",rows:[]};let o=new kC,i=()=>{o.cancel()};t.aborted&&o.cancel(),t.addEventListener("abort",i,{once:!0});try{let s=await n.worker.connection.sendRequest(Al,e,o.token),a=GR.safeParse(s);return a.success?a.data:{kind:"error",rows:[]}}catch(s){return nG(s)}finally{t.removeEventListener("abort",i),o.dispose(),Nl(n,r)}}function nG(e){return e instanceof RC&&e.code===PC?{kind:"aborted",rows:[]}:{kind:"error",reason:`transport:${e instanceof Error?e.message.slice(0,120):"unknown"}`,rows:[]}}function oG(e,t){t.size=e,e>xC.availableParallelism()&&j.warn({cores:xC.availableParallelism(),size:e},"worker pool size exceeds available cores");let r=t.workers.filter(o=>o.alive&&o.runId===void 0),n=t.workers.length-e;r.slice(0,Math.max(0,n)).forEach(o=>{mh(o,t)})}import $l from"fs";import{graphql as AC}from"gql.tada";import{print as TC}from"graphql";var iG=AC(`
523
- subscription HooksPausedWatch($projectId: String!) {
524
- hooksPausedRequested(projectId: $projectId) {
525
- paused
526
- projectId
527
- }
528
- }
529
- `),sG=AC(`
530
- subscription WatchLocalConcurrencyChanged {
531
- myMaxLocalConcurrentRunsChanged
532
- }
533
- `);function OC({pool:e,sseClient:t}){return t.subscribe({query:TC(sG)},{complete:()=>{},error:r=>{j.error(r,"localConcurrency subscription error")},next:r=>{let n=r.data?.myMaxLocalConcurrentRunsChanged;n!=null&&(Rl(n),e.setSize(n))}})}function MC({cwd:e,projectId:t,sseClient:r}){return r.subscribe({query:TC(iG),variables:{projectId:t}},{complete:()=>{},error:n=>{j.error(n,"hooksPaused subscription error")},next:n=>{let o=n.data?.hooksPausedRequested?.paused;o!=null&&gh({cwd:e,paused:o})}})}function gh({cwd:e,paused:t}){let r=Nr(e);if(t&&!$l.existsSync(r)){$l.writeFileSync(r,"");return}!t&&$l.existsSync(r)&&$l.unlinkSync(r)}var pG=6e4,LC=500,fG=15e3,hG=Dl(`
534
- subscription RunRequestedWatch($devSessionId: String!) {
535
- runRequested(devSessionId: $devSessionId) {
536
- runId
537
- workflowId
538
- workflowSlug
539
- }
540
- }
541
- `),mG=Dl(`
542
- mutation HeartbeatDevSessionWatch($id: String!) {
543
- heartbeatDevSession(id: $id) {
544
- __typename
545
- ... on DevSession {
546
- id
547
- }
548
- ... on DevSessionEndedError {
549
- message
550
- }
551
- }
552
- }
553
- `),gG=Dl(`
554
- query WatchLocalConcurrency {
555
- currentUser {
556
- id
557
- maxLocalConcurrentRuns
558
- }
559
- }
560
- `),yG=Dl(`
561
- mutation EndDevSessionWatch($projectId: String!, $cwd: String!) {
562
- endDevSession(projectId: $projectId, cwd: $cwd) {
563
- __typename
564
- ... on DevSession {
565
- id
566
- }
567
- ... on NoActiveDevSessionError {
568
- message
569
- }
570
- }
571
- }
572
- `);async function NC({explore:e}){TG();let t=PG(process.cwd()),r=t.cwd,n=vG(r),o=CG(),i=SC({cwd:r,executeTrail:EG(o.pool),explore:e}),s={handler:()=>{}},a=kG(),l=AR({config:t,cwd:r,explorationStatus:i.status,ready:a.promise,onShutdownRequest:()=>{s.handler()}}),c=await RG({cwd:r,ipc:l,releasePid:n}),u=await ve(r);u.isErr()&&(process.stderr.write(`ripplo: ${Pe(u.error)}
573
- `),process.exit(1));let d=u.value,p=await $C(()=>$r({config:t,cwd:r,lockfile:d}),{config:t,label:"initial sync"}),h=await MG(t);gh({cwd:r,paused:p.hooksPaused});let f=Cl(r);f!=null&&j.info("watching branch %s in %s",f,r);let m=lG({headers:{Authorization:`Bearer ${t.token}`},retryAttempts:1/0,url:`${t.ripploServerUrl}/graphql`}),g=EC({initialSize:h,spawn:CC(LG(),r),lockfileProvider:async x=>{let B=await Kt(r);return B.result.isErr()?{unavailable:`daemon-load-failed:${B.result.error.kind}`}:B.fingerprint!==x?{unavailable:"fingerprint-mismatch"}:{lockfileJson:qt(bt,B.result.value)}}});o.provide(g);let w=await Po({localDir:aG.join(r,".ripplo",".local"),writePortFile:!0,onRrwebBatch:()=>{},onSpan:x=>{let B=x.attributes["ripplo.run"];B!=null&&g.routeSpan(B,x)}}),S=SG({claim:l.claim,config:t,cwd:r,initialId:p.devSessionId,pool:g,sseClient:m}),y=MC({cwd:r,projectId:t.projectId,sseClient:m}),v=OC({pool:g,sseClient:m}),C=wG({config:t,session:S}),M=AG();a.resolve(),process.stdout.write(`${G0(p.devSessionId)}
574
- `);let I=async()=>{C(),M(),i.stop(),c.close(),S.stop(),y(),v(),await g.close(),await w.stop().catch(()=>{}),await Promise.race([D({config:t,document:yG,variables:{cwd:t.cwd,projectId:t.projectId}}).catch(()=>{}),new Promise(x=>setTimeout(x,3e3))]),n()},E=()=>{I().finally(()=>process.exit(0))};s.handler=E,process.on("SIGINT",E),process.on("SIGTERM",E),process.on("SIGHUP",E),process.on("SIGBREAK",E),await new Promise(()=>{})}function bG({claim:e,cwd:t,devSessionId:r,onSubscriptionDead:n,pool:o,sseClient:i}){let s=new Set;return i.subscribe({query:dG(hG),variables:{devSessionId:r}},{complete:()=>{},error:a=>{j.warn("runRequested SSE failed: %s; re-registering session",a instanceof Error?a.message:String(a)),n()},next:a=>{let l=a.data?.runRequested;if(l==null)return;if(s.has(l.runId)){j.warn({runId:l.runId,workflowSlug:l.workflowSlug},"duplicate runRequested event; skipping dispatch");return}s.add(l.runId),process.stdout.write(`ripplo: run ${l.workflowSlug}
575
- `),Wt(t);let c=xe(t).match(d=>d,d=>{j.error({failure:d,runId:l.runId},"failed to load env for run dispatch; skipping")});if(c==null){s.delete(l.runId);return}let u=e(l.workflowSlug);u?.started(l.runId),vC({config:c,cwd:t,headed:u?.headed??!1,pool:o,runId:l.runId,signal:u==null?new AbortController().signal:xi(u.token),workClass:u==null?"p0-ui":"p1-cli",workflowSlug:l.workflowSlug}).then(d=>{u?.finished(l.runId,d)}).catch(d=>{j.error({err:d,runId:l.runId,workflowSlug:l.workflowSlug},"run execution failed; daemon continuing"),u?.finished(l.runId,{detail:d instanceof Error?d.message:String(d),kind:"error"})}).finally(()=>{s.delete(l.runId)})}},{connecting:a=>{a&&j.warn("runRequested SSE reconnecting")}})}function wG({config:e,session:t}){let r=async()=>{try{let o=await D({config:e,document:mG,variables:{id:t.getId()}});o.heartbeatDevSession?.__typename==="DevSessionEndedError"&&(j.warn("dev session ended server-side (%s); re-registering",o.heartbeatDevSession.message),await t.reregister())}catch(o){j.warn("heartbeat failed: %s",o instanceof Error?o.message:String(o))}},n=setInterval(()=>{r()},fG);return()=>{clearInterval(n)}}function SG({claim:e,config:t,cwd:r,initialId:n,pool:o,sseClient:i}){let s=n,a=null,l=()=>{p()},c=()=>bG({claim:e,cwd:r,devSessionId:s,onSubscriptionDead:l,pool:o,sseClient:i}),u=c(),d=async()=>{let h=await ve(r);if(h.isErr()){j.error("re-register: compile failed: %s",Pe(h.error));return}let f=await $C(()=>$r({config:t,cwd:r,lockfile:h.value}),{config:t,label:"re-register sync"});u(),s=f.devSessionId,u=c(),j.info("re-registered dev session as %s",s)},p=()=>(a!=null||(a=d().finally(()=>{a=null})),a);return{reregister:p,getId:()=>s,stop:()=>{u()}}}function vG(e){try{return jm({cwd:e,onCompromised:xG})}catch(t){throw t instanceof lo&&(process.stderr.write(`${q0({cwd:t.cwd,pid:t.pid})}
576
- `),process.exit(1)),t}}function xG(){j.error("daemon lock compromised; shutting down"),process.stderr.write(`${K0()}
577
- `),process.exit(1)}function kG(){let e={handler:()=>{}};return{promise:new Promise(r=>{e.handler=r}),resolve:()=>{e.handler()}}}async function RG({cwd:e,ipc:t,releasePid:r}){return(await dC({cwd:e,onConnection:t.handleConnection})).match(o=>o,o=>{process.stderr.write(`${H0(o)}
578
- `),r(),process.exit(1)})}function CG(){let e={provide:()=>{}};return{pool:new Promise(r=>{e.provide=r}),provide:r=>{e.provide(r)}}}function EG(e){return async(t,r)=>(await e).exploreTrail(t,r)}function PG(e){return xe(e).match(t=>t,t=>{process.stderr.write(`${He(t)}
579
- `),process.exit(1)})}function $C(e,{config:t,label:r}){let n=t.ripploServerUrl.includes("localhost")||t.ripploServerUrl.includes("127.0.0.1");return cG(async()=>{try{return await e()}catch(o){let i=o instanceof Error?o.message:String(o);throw Qn(o)==="FORBIDDEN"&&(process.stderr.write(`ripplo: ${z0({projectId:t.projectId,serverUrl:t.ripploServerUrl})}
580
- `),process.exit(1)),IG(i)?o:(j.error("%s failed: %s",r,i),new uG(i))}},{factor:2,maxTimeout:n?2e3:1e4,minTimeout:n?100:1e3,retries:1/0,onFailedAttempt:({attemptNumber:o,error:i})=>{j.warn("%s attempt %d failed; retrying: %s",r,o,i.message)}})}function IG(e){return e.includes("status 502")||e.includes("ECONNREFUSED")||e.includes("Failed to connect")||e.includes("fetch failed")}function AG(){Mi({maxRuns:LC});let e=setInterval(()=>{Mi({maxRuns:LC})},pG);return()=>{clearInterval(e)}}function TG(){process.on("unhandledRejection",e=>{j.error({err:e},"unhandledRejection in watch; continuing")}),process.on("uncaughtException",e=>{j.error({err:e},"uncaughtException in watch; continuing")})}var OG=4;async function MG(e){try{let r=(await D({config:e,document:gG,variables:void 0})).currentUser?.maxLocalConcurrentRuns;if(r!=null)return Rl(r),r}catch(t){j.warn({err:t},"failed to fetch local concurrency setting; using default")}return OG}function LG(){let e=process.argv[1];if(e==null)throw new Error("cli entry unavailable");return e}async function DC({explore:e}){await NC({explore:e})}import{graphql as _l}from"gql.tada";function _C(){return"No scope items added \u2014 the matched tests are already in scope (check `ripplo scope status`)."}function jC(e){return[`No test found for: ${e.join(", ")}`,"Pass a test id (kebab-case slug of the test name) or the exact intent string.","List known tests with `ripplo status`; stub a new one first via the testing DSL.",V("create")].join(`
581
- `)}import{graphql as NG}from"gql.tada";var FC=NG(`
307
+ `),process.stderr.write(`${d("setup","verify auth + server reachability")}
308
+ `),process.exit(1)}}async function kn({explore:e,exploreConcurrency:t}){let{runDaemon:r}=await import("./daemon-PM5KE7TX.js");await r({explore:e,exploreConcurrency:t})}import{graphql as Ie}from"gql.tada";function wn(){return"No scope items added \u2014 the matched tests are already in scope (check `ripplo scope status`)."}function vn(e){return[`No test found for: ${e.join(", ")}`,"Pass a test id (kebab-case slug of the test name) or the exact intent string.","List known tests with `ripplo status`; stub a new one first via the testing DSL.",d("create")].join(`
309
+ `)}import{graphql as pa}from"gql.tada";var bn=pa(`
582
310
  query ScopeStatus($projectId: String!, $cwd: String!) {
583
311
  project(id: $projectId) {
584
312
  id
@@ -598,7 +326,7 @@ iframe { border: none; }
598
326
  }
599
327
  }
600
328
  }
601
- `);var $G=_l(`
329
+ `);var ua=Ie(`
602
330
  query ScopeWorkflowBySlug($projectId: String!, $cwd: String!, $slug: String!) {
603
331
  project(id: $projectId) {
604
332
  id
@@ -611,7 +339,7 @@ iframe { border: none; }
611
339
  }
612
340
  }
613
341
  }
614
- `),DG=_l(`
342
+ `),ma=Ie(`
615
343
  mutation ScopeAddDirtyTests($projectId: String!, $cwd: String!, $workflowSlugs: [String!]!) {
616
344
  addDirtyTestsToScope(projectId: $projectId, cwd: $cwd, workflowSlugs: $workflowSlugs) {
617
345
  __typename
@@ -633,38 +361,38 @@ iframe { border: none; }
633
361
  }
634
362
  }
635
363
  }
636
- `),_G=_l(`
364
+ `),fa=Ie(`
637
365
  mutation ScopeLink($id: ID!, $workflowId: String!) {
638
366
  linkScopeItem(id: $id, workflowId: $workflowId) {
639
367
  id
640
368
  }
641
369
  }
642
- `),jG=_l(`
370
+ `),ga=Ie(`
643
371
  mutation ScopeRemoveMany($ids: [ID!]!) {
644
372
  removeScopeItems(ids: $ids)
645
373
  }
646
- `);async function BC(e){let t=wt();await ao(t);let n=(await D({config:t,document:FC,variables:{cwd:t.cwd,projectId:t.projectId}})).project?.devSession?.scopeItems??[];if(e.format==="json"){process.stdout.write(`${JSON.stringify(n,null,2)}
374
+ `);async function Sn(e){let t=j();await ne(t);let n=(await p({config:t,document:bn,variables:{cwd:t.cwd,projectId:t.projectId}})).project?.devSession?.scopeItems??[];if(e.format==="json"){process.stdout.write(`${JSON.stringify(n,null,2)}
647
375
  `);return}if(n.length===0){process.stdout.write("No scope items. Add via `ripplo scope add <test-ids..>` (variadic) or from the dashboard.\n");return}n.forEach(o=>{let i=o.workflow;if(i==null){process.stdout.write(` [intent] (${o.id}) ${o.label??""}
648
- `);return}let s=i.spec==null?"stub":"implemented";process.stdout.write(` [${s}] (${o.id}) ${i.slug} \u2014 ${i.name}
649
- `)})}async function VC({testIds:e}){let t=wt();await ao(t),(await Si(t.cwd,t)).match(()=>{},a=>{process.stderr.write(`${He(a)}
650
- `),process.exit(1)});let o=(await D({config:t,document:DG,variables:{cwd:t.cwd,projectId:t.projectId,workflowSlugs:e.map(a=>fe(a))}})).addDirtyTestsToScope;o?.__typename==="NoActiveDevSessionError"&&(process.stderr.write(`${o.message}
651
- `),process.exit(1)),o?.__typename==="UnknownWorkflowSlugsError"&&(process.stderr.write(`${jC(o.slugs)}
652
- `),process.exit(1));let i=o?.__typename==="MutationAddDirtyTestsToScopeSuccess"?o.data:[];if(i.length===0){process.stdout.write(`${_C()}
653
- `);return}let s=i.map(a=>a.workflow?.slug??"?").join(", ");process.stdout.write(`Added ${String(i.length)} scope item(s): ${s}
654
- `)}async function UC({id:e,testId:t}){let r=wt();await ao(r),(await Si(r.cwd,r)).match(()=>{},i=>{process.stderr.write(`${He(i)}
655
- `),process.exit(1)});let o=await FG({cfg:r,slug:t});await D({config:r,document:_G,variables:{id:e,workflowId:o}}),process.stdout.write(`Linked scope item ${e} to ${t}
656
- `)}async function WC({ids:e}){let t=wt();await ao(t);let n=(await D({config:t,document:jG,variables:{ids:[...e]}})).removeScopeItems??0;process.stdout.write(`Removed ${String(n)} scope item(s)
657
- `)}async function FG({cfg:e,slug:t}){let n=(await D({config:e,document:$G,variables:{cwd:e.cwd,projectId:e.projectId,slug:t}})).project?.devSession?.workflows?.[0];return n==null&&(process.stderr.write(`No workflow found with id "${t}". Create a stub first via the testing DSL.
658
- `),process.stderr.write(`${V("create")}
659
- `),process.exit(1)),n.id}async function HC(e){let t=process.cwd(),r=await ve(t);r.isErr()&&(process.stderr.write(`${Pe(r.error)}
660
- `),process.exit(1));let n=dr(r.value),o=await mR(t);if(e.format==="summary"){n.length>0&&process.stdout.write(`stub tests: ${n.join(", ")}
661
- `),process.stdout.write(`${J0(o)}
662
- `);return}let i={daemon:o.kind==="running"?{active:o.status.active,explorer:o.status.explorer,exploring:o.status.exploring,progress:o.status.progress,queued:o.status.queued,running:!0}:{running:o.kind==="unresponsive",state:o.kind},tests:n.map(s=>({id:s,implemented:!1}))};process.stdout.write(`${JSON.stringify(i,null,2)}
663
- `)}import jl from"fs";import VG from"os";import zC from"path";import{z as BG}from"zod";function pe(e,t){let r=BG.custom(n=>typeof n=="object"&&n!==null&&"hook_event_name"in n&&n.hook_event_name===e);return{event:e,run:async n=>await t(r.parse(n))??void 0}}var GC=pe("PreToolUse",e=>{if(e.tool_name!=="ExitPlanMode"||!je(e.cwd))return;let t=UG();if(t==null)return{hookSpecificOutput:{additionalContext:`Ripplo plan gate: no plan file found \u2014 the "Tests to implement" requirement was not checked. Before implementing, stub a .ripplo/tests/ test per affected flow. ${V("explore")}`,hookEventName:"PreToolUse"}};let r=jl.readFileSync(t,"utf8");if(!/\.ripplo\/tests|Tests to implement|No e2e coverage needed/.test(r))return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`Plan must cite ripplo test stubs. Add a "Tests to implement" section listing .ripplo/tests/<id>.ts per affected flow, OR add "No e2e coverage needed: <reason>" if this plan touches no user-facing behavior. ${V("explore")}`}}});function UG(){let e=zC.join(VG.homedir(),".claude","plans");return jl.existsSync(e)?jl.readdirSync(e).filter(r=>r.endsWith(".md")).map(r=>zC.join(e,r)).map(r=>({full:r,mtime:jl.statSync(r).mtimeMs})).sort((r,n)=>n.mtime-r.mtime)[0]?.full??null:null}var qC=pe("UserPromptSubmit",async e=>{if(e.permission_mode!=="plan"||!ce(e.cwd)||!je(e.cwd))return;let t=await ve(e.cwd);if(t.isErr())return;let r=dr(t.value),n=['Plan must include "Tests to implement" with a .ripplo/tests/ file per affected flow (ExitPlanMode blocks otherwise). Stub each with `test("Intent")` (no body).'];return r.length>0&&n.push(`Existing stubs: ${r.join(", ")}`),{hookSpecificOutput:{additionalContext:n.join(`
664
- `),hookEventName:"UserPromptSubmit"}}});import tq from"path";import rE from"picomatch";import{z as nE}from"zod";import{mkdirSync as qG,readFileSync as KG,writeFileSync as JG}from"fs";import YG from"path";import{z as qe}from"zod";import{createHash as Fue}from"crypto";import Fl from"picomatch";function WG(e){return at(["diff","--name-only","HEAD"],e).split(`
665
- `).filter(t=>t.length>0)}function KC({cwd:e,ignoreGlobs:t,watchGlobs:r}){let n=Fl([...r]),o=Fl([...t]);return WG(e).filter(i=>n(i)&&!o(i))}function HG(e){return at(["ls-files","--others","--exclude-standard"],e).split(`
666
- `).filter(t=>t.length>0)}function JC({cwd:e,ignoreGlobs:t,watchGlobs:r}){let n=Fl([...r]),o=Fl([...t]);return HG(e).filter(i=>n(i)&&!o(i))}var zG=["**/src/**","**/app/**","**/apps/**","**/pages/**","**/routes/**","**/components/**","**/server/**","**/api/**","**/backend/**","**/features/**","**/modules/**","**/views/**","**/ui/**","**/hooks/**","**/contexts/**","**/providers/**","**/controllers/**","**/handlers/**","**/resolvers/**","**/services/**","**/middleware/**","**/lib/**"],GG=["**/*.gen.*","**/generated/**","**/*.d.ts","**/*.test.*","**/*.spec.*","**/node_modules/**","**/dist/**","**/build/**",".ripplo/**","**/*.md","**/.next/**","**/.turbo/**","**/.vercel/**","**/.svelte-kit/**","**/.nuxt/**","**/.astro/**","**/coverage/**","**/storybook-static/**","**/*.stories.*","**/*.story.*","**/cli/**","**/scripts/**","**/tools/**","**/__tests__/**","**/__mocks__/**","**/__fixtures__/**","**/*.config.*","**/*.setup.*","**/public/**","**/static/**","**/assets/**","**/migrations/**","**/prisma/migrations/**"];function Jn(){return{ignorePaths:GG,watchPaths:zG}}var XG=qe.object({label:qe.string().nullable(),slug:qe.string().nullable(),status:qe.enum(["intent","stub","implemented"])}),ZG=qe.object({intent:qe.string(),name:qe.string(),sourcePath:qe.string().nullable(),stub:qe.boolean()}),QG=qe.object({changedAppFiles:qe.array(qe.string()).readonly(),scope:qe.object({available:qe.boolean(),items:qe.array(XG).readonly()}),tests:qe.array(ZG).readonly().default([]),untrackedAppFiles:qe.array(qe.string()).readonly()});function YC({cwd:e,scope:t}){let r=ZC(e);eE(e,{...tE(e),scope:t,tests:r?.tests??[]})}function XC({cwd:e,tests:t}){let r=ZC(e);eE(e,{...tE(e),scope:r?.scope??{available:!1,items:[]},tests:t??r?.tests??[]})}function ZC(e){let t=QG.safeParse(eq(QC(e)));return t.success?t.data:null}function eq(e){try{return JSON.parse(KG(e,"utf8"))}catch{return null}}function QC(e){return Ot(e,"coverage-context.json")}function eE(e,t){let r=QC(e);qG(YG.dirname(r),{recursive:!0}),JG(r,JSON.stringify(t,null,2))}function tE(e){let{ignorePaths:t,watchPaths:r}=Jn(),n={cwd:e,ignoreGlobs:t,watchGlobs:r};return{changedAppFiles:KC(n),untrackedAppFiles:JC(n)}}var rq=nE.looseObject({file_path:nE.string()}),oE=pe("PostToolUse",async e=>{let t=rq.safeParse(e.tool_input);if(!t.success)return;let r=t.data.file_path,{cwd:n}=e;if(!ce(n)||!je(n))return;let o=tq.relative(n,r);if(o.startsWith(".."))return;let{ignorePaths:i,watchPaths:s}=Jn(),a=rE([...s]),l=rE([...i]);if(!a(o)||l(o))return;let c=await ve(n);if(XC({cwd:n,tests:c.isOk()?c.value.tests.map(d=>({intent:d.intent,name:d.name,sourcePath:d.sourcePath??null,stub:d.stub})):void 0}),c.isErr())return;let u=dr(c.value);if(u.length!==0)return{hookSpecificOutput:{additionalContext:`Reminder: stub tests still unimplemented \u2014 ${u.join(", ")}. Implement with \`test("Intent", () => ({ given, steps }))\`.`,hookEventName:"PostToolUse"}}});import{createHash as pq}from"crypto";import{z as cE}from"zod";import{createHash as nq}from"crypto";import{mkdirSync as oq,readFileSync as iE,writeFileSync as iq}from"fs";import yh from"path";var sq=[".ts",".tsx",".js",".jsx"];function Bl(e){let t=nq("sha256");return t.update(at(["rev-parse","HEAD"],e)),t.update("\0"),t.update(at(["diff","HEAD"],e)),t.update("\0"),at(["ls-files","--others","--exclude-standard"],e).split(`
667
- `).filter(n=>n.length>0).filter(n=>sq.some(o=>n.endsWith(o))).toSorted((n,o)=>n.localeCompare(o)).forEach(n=>{t.update(n),t.update("\0"),t.update(aq(yh.join(e,n))),t.update("\0")}),t.digest("hex")}function Yn(e,t){try{return iE(sE(e,t),"utf8").trim()}catch{return null}}function Xn(e,t,r){let n=sE(e,t);oq(yh.dirname(n),{recursive:!0}),iq(n,r)}function aq(e){try{return iE(e)}catch{return Buffer.alloc(0)}}function sE(e,t){return yh.join(e,".ripplo",".local",`${t}.hash`)}import{graphql as lq}from"gql.tada";var cq=lq(`
376
+ `);return}let a=i.spec==null?"stub":"implemented";process.stdout.write(` [${a}] (${o.id}) ${i.slug} \u2014 ${i.name}
377
+ `)})}async function Rn({testIds:e}){let t=j();await ne(t),(await re(t.cwd,t)).match(()=>{},s=>{process.stderr.write(`${E(s)}
378
+ `),process.exit(1)});let o=(await p({config:t,document:ma,variables:{cwd:t.cwd,projectId:t.projectId,workflowSlugs:e.map(s=>P(s))}})).addDirtyTestsToScope;o?.__typename==="NoActiveDevSessionError"&&(process.stderr.write(`${o.message}
379
+ `),process.exit(1)),o?.__typename==="UnknownWorkflowSlugsError"&&(process.stderr.write(`${vn(o.slugs)}
380
+ `),process.exit(1));let i=o?.__typename==="MutationAddDirtyTestsToScopeSuccess"?o.data:[];if(i.length===0){process.stdout.write(`${wn()}
381
+ `);return}let a=i.map(s=>s.workflow?.slug??"?").join(", ");process.stdout.write(`Added ${String(i.length)} scope item(s): ${a}
382
+ `)}async function Cn({id:e,testId:t}){let r=j();await ne(r),(await re(r.cwd,r)).match(()=>{},i=>{process.stderr.write(`${E(i)}
383
+ `),process.exit(1)});let o=await ha({cfg:r,slug:t});await p({config:r,document:fa,variables:{id:e,workflowId:o}}),process.stdout.write(`Linked scope item ${e} to ${t}
384
+ `)}async function xn({ids:e}){let t=j();await ne(t);let n=(await p({config:t,document:ga,variables:{ids:[...e]}})).removeScopeItems??0;process.stdout.write(`Removed ${String(n)} scope item(s)
385
+ `)}async function ha({cfg:e,slug:t}){let n=(await p({config:e,document:ua,variables:{cwd:e.cwd,projectId:e.projectId,slug:t}})).project?.devSession?.workflows?.[0];return n==null&&(process.stderr.write(`No workflow found with id "${t}". Create a stub first via the testing DSL.
386
+ `),process.stderr.write(`${d("create")}
387
+ `),process.exit(1)),n.id}async function Pn(e){let t=process.cwd(),r=await S(t);r.isErr()&&(process.stderr.write(`${R(r.error)}
388
+ `),process.exit(1));let n=F(r.value),o=await Vr(t);if(e.format==="summary"){n.length>0&&process.stdout.write(`stub tests: ${n.join(", ")}
389
+ `),process.stdout.write(`${Gt(o)}
390
+ `);return}let i={daemon:o.kind==="running"?{active:o.status.active,explorer:o.status.explorer,exploring:o.status.exploring,progress:o.status.progress,queued:o.status.queued,running:!0}:{running:o.kind==="unresponsive",state:o.kind},tests:n.map(a=>({id:a,implemented:!1}))};process.stdout.write(`${JSON.stringify(i,null,2)}
391
+ `)}import je from"fs";import ka from"os";import En from"path";import{z as ya}from"zod";function f(e,t){let r=ya.custom(n=>typeof n=="object"&&n!==null&&"hook_event_name"in n&&n.hook_event_name===e);return{event:e,run:async n=>await t(r.parse(n))??void 0}}var $n=f("PreToolUse",e=>{if(e.tool_name!=="ExitPlanMode"||!w(e.cwd))return;let t=wa();if(t==null)return{hookSpecificOutput:{additionalContext:`Ripplo plan gate: no plan file found \u2014 the "Tests to implement" requirement was not checked. Before implementing, stub a .ripplo/tests/ test per affected flow. ${d("explore")}`,hookEventName:"PreToolUse"}};let r=je.readFileSync(t,"utf8");if(!/\.ripplo\/tests|Tests to implement|No e2e coverage needed/.test(r))return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`Plan must cite ripplo test stubs. Add a "Tests to implement" section listing .ripplo/tests/<id>.ts per affected flow, OR add "No e2e coverage needed: <reason>" if this plan touches no user-facing behavior. ${d("explore")}`}}});function wa(){let e=En.join(ka.homedir(),".claude","plans");return je.existsSync(e)?je.readdirSync(e).filter(r=>r.endsWith(".md")).map(r=>En.join(e,r)).map(r=>({full:r,mtime:je.statSync(r).mtimeMs})).sort((r,n)=>n.mtime-r.mtime)[0]?.full??null:null}var In=f("UserPromptSubmit",async e=>{if(e.permission_mode!=="plan"||!m(e.cwd)||!w(e.cwd))return;let t=await S(e.cwd);if(t.isErr())return;let r=F(t.value),n=['Plan must include "Tests to implement" with a .ripplo/tests/ file per affected flow (ExitPlanMode blocks otherwise). Stub each with `test("Intent")` (no body).'];return r.length>0&&n.push(`Existing stubs: ${r.join(", ")}`),{hookSpecificOutput:{additionalContext:n.join(`
392
+ `),hookEventName:"UserPromptSubmit"}}});import La from"path";import Nn from"picomatch";import{z as Un}from"zod";import{mkdirSync as Ca,readFileSync as xa,writeFileSync as Pa}from"fs";import Ea from"path";import{z as v}from"zod";import{createHash as Nm}from"crypto";import Ae from"picomatch";function va(e){return _(["diff","--name-only","HEAD"],e).split(`
393
+ `).filter(t=>t.length>0)}function jn({cwd:e,ignoreGlobs:t,watchGlobs:r}){let n=Ae([...r]),o=Ae([...t]);return va(e).filter(i=>n(i)&&!o(i))}function ba(e){return _(["ls-files","--others","--exclude-standard"],e).split(`
394
+ `).filter(t=>t.length>0)}function An({cwd:e,ignoreGlobs:t,watchGlobs:r}){let n=Ae([...r]),o=Ae([...t]);return ba(e).filter(i=>n(i)&&!o(i))}var Sa=["**/src/**","**/app/**","**/apps/**","**/pages/**","**/routes/**","**/components/**","**/server/**","**/api/**","**/backend/**","**/features/**","**/modules/**","**/views/**","**/ui/**","**/hooks/**","**/contexts/**","**/providers/**","**/controllers/**","**/handlers/**","**/resolvers/**","**/services/**","**/middleware/**","**/lib/**"],Ra=["**/*.gen.*","**/generated/**","**/*.d.ts","**/*.test.*","**/*.spec.*","**/node_modules/**","**/dist/**","**/build/**",".ripplo/**","**/*.md","**/.next/**","**/.turbo/**","**/.vercel/**","**/.svelte-kit/**","**/.nuxt/**","**/.astro/**","**/coverage/**","**/storybook-static/**","**/*.stories.*","**/*.story.*","**/cli/**","**/scripts/**","**/tools/**","**/__tests__/**","**/__mocks__/**","**/__fixtures__/**","**/*.config.*","**/*.setup.*","**/public/**","**/static/**","**/assets/**","**/migrations/**","**/prisma/migrations/**"];function Q(){return{ignorePaths:Ra,watchPaths:Sa}}var $a=v.object({label:v.string().nullable(),slug:v.string().nullable(),status:v.enum(["intent","stub","implemented"])}),Ia=v.object({intent:v.string(),name:v.string(),sourcePath:v.string().nullable(),stub:v.boolean()}),ja=v.object({changedAppFiles:v.array(v.string()).readonly(),scope:v.object({available:v.boolean(),items:v.array($a).readonly()}),tests:v.array(Ia).readonly().default([]),untrackedAppFiles:v.array(v.string()).readonly()});function Ln({cwd:e,scope:t}){let r=Dn(e);_n(e,{...Fn(e),scope:t,tests:r?.tests??[]})}function Tn({cwd:e,tests:t}){let r=Dn(e);_n(e,{...Fn(e),scope:r?.scope??{available:!1,items:[]},tests:t??r?.tests??[]})}function Dn(e){let t=ja.safeParse(Aa(On(e)));return t.success?t.data:null}function Aa(e){try{return JSON.parse(xa(e,"utf8"))}catch{return null}}function On(e){return Ze(e,"coverage-context.json")}function _n(e,t){let r=On(e);Ca(Ea.dirname(r),{recursive:!0}),Pa(r,JSON.stringify(t,null,2))}function Fn(e){let{ignorePaths:t,watchPaths:r}=Q(),n={cwd:e,ignoreGlobs:t,watchGlobs:r};return{changedAppFiles:jn(n),untrackedAppFiles:An(n)}}var Ta=Un.looseObject({file_path:Un.string()}),Hn=f("PostToolUse",async e=>{let t=Ta.safeParse(e.tool_input);if(!t.success)return;let r=t.data.file_path,{cwd:n}=e;if(!m(n)||!w(n))return;let o=La.relative(n,r);if(o.startsWith(".."))return;let{ignorePaths:i,watchPaths:a}=Q(),s=Nn([...a]),l=Nn([...i]);if(!s(o)||l(o))return;let c=await S(n);if(Tn({cwd:n,tests:c.isOk()?c.value.tests.map(u=>({intent:u.intent,name:u.name,sourcePath:u.sourcePath??null,stub:u.stub})):void 0}),c.isErr())return;let b=F(c.value);if(b.length!==0)return{hookSpecificOutput:{additionalContext:`Reminder: stub tests still unimplemented \u2014 ${b.join(", ")}. Implement with \`test("Intent", () => ({ given, steps }))\`.`,hookEventName:"PostToolUse"}}});import{createHash as qa}from"crypto";import{z as Vn}from"zod";import{createHash as Da}from"crypto";import{mkdirSync as Oa,readFileSync as Mn,writeFileSync as _a}from"fs";import Je from"path";var Fa=[".ts",".tsx",".js",".jsx"];function Le(e){let t=Da("sha256");return t.update(_(["rev-parse","HEAD"],e)),t.update("\0"),t.update(_(["diff","HEAD"],e)),t.update("\0"),_(["ls-files","--others","--exclude-standard"],e).split(`
395
+ `).filter(n=>n.length>0).filter(n=>Fa.some(o=>n.endsWith(o))).toSorted((n,o)=>n.localeCompare(o)).forEach(n=>{t.update(n),t.update("\0"),t.update(Na(Je.join(e,n))),t.update("\0")}),t.digest("hex")}function Y(e,t){try{return Mn(Wn(e,t),"utf8").trim()}catch{return null}}function X(e,t,r){let n=Wn(e,t);Oa(Je.dirname(n),{recursive:!0}),_a(n,r)}function Na(e){try{return Mn(e)}catch{return Buffer.alloc(0)}}function Wn(e,t){return Je.join(e,".ripplo",".local",`${t}.hash`)}import{graphql as Ua}from"gql.tada";var Ha=Ua(`
668
396
  mutation AutoScopeAddDirty($projectId: String!, $cwd: String!, $workflowSlugs: [String!]!) {
669
397
  addDirtyTestsToScope(projectId: $projectId, cwd: $cwd, workflowSlugs: $workflowSlugs) {
670
398
  __typename
@@ -675,11 +403,11 @@ iframe { border: none; }
675
403
  }
676
404
  }
677
405
  }
678
- `);async function lE({cwd:e,lockfile:t}){if(!je(e))return{addedSlugs:[]};let r=dq(e);if(r.length===0)return{addedSlugs:[]};let n=new Set(r),o=t.tests.filter(l=>l.sourcePath!=null&&n.has(l.sourcePath)).map(l=>fe(l.name));if(o.length===0)return{addedSlugs:[]};let i=xe(e).unwrapOr(void 0);return i==null?{addedSlugs:[]}:await $r({config:i,cwd:e,lockfile:t}).catch(l=>(j.warn("auto-sync failed: %s",l instanceof Error?l.message:String(l)),null))==null?{addedSlugs:[]}:{addedSlugs:await uq({cfg:i,slugs:o})?o:[]}}async function uq({cfg:e,slugs:t}){let n=(await D({config:e,document:cq,variables:{cwd:e.cwd,projectId:e.projectId,workflowSlugs:[...t]}}).catch(o=>(j.warn("auto-scope failed: %s",o instanceof Error?o.message:String(o)),null)))?.addDirtyTestsToScope;return n?.__typename!=="MutationAddDirtyTestsToScopeSuccess"?!1:n.data.length>0}var aE=".ripplo/tests/";function dq(e){let t;try{t=at(["status","--porcelain","--",".ripplo/tests"],e)}catch{return[]}return t.split(`
679
- `).map(r=>r.slice(3).trim()).filter(r=>r.startsWith(aE)&&r.endsWith(".ts")).map(r=>r.slice(aE.length)).filter(r=>r!=="index.ts"&&!r.endsWith("/index.ts"))}var fq=cE.looseObject({file_path:cE.string()}),uE=pe("PostToolUse",async e=>{let t=fq.safeParse(e.tool_input);if(!t.success||!/\/\.ripplo\/.*\.ts$/.test(t.data.file_path))return;let{cwd:r}=e;if(!ce(r))return;if(!je(r))return{hookSpecificOutput:{additionalContext:"Ripplo hooks are paused \u2014 DSL lint and lockfile sync did not run for this edit. Resume with `npx ripplo hooks resume` when ready.",hookEventName:"PostToolUse"}};let n=await Wn(r);if(n.isErr())return{decision:"block",reason:`${Pe(n.error)}
680
- ${V("create","DSL authoring + lint rules")}`};let o=Mr(n.value);if(o.length>0)return{decision:"block",reason:`${Lr(o)}
681
- ${V("create")}`};let{addedSlugs:i}=await lE({cwd:r,lockfile:n.value});return hq([...i.length>0?[`Auto-scoped ${i.join(", ")} (dirty tests).`]:[],...mq(r,n.value)])});function hq(e){if(e.length!==0)return{hookSpecificOutput:{additionalContext:e.join(`
682
- `),hookEventName:"PostToolUse"}}}function mq(e,t){let r=nl(t),n=pq("sha256").update(JSON.stringify(r)).digest("hex");return Yn(e,"coverage-warn")===n?[]:(Xn(e,"coverage-warn",n),r.length===0?[]:[el(r)])}import{z as dE}from"zod";var gq=dE.looseObject({command:dE.string()}),yq=/\bripplo\s+hooks\s+pause\b/,pE=pe("PreToolUse",e=>{if(e.tool_name!=="Bash")return;let t=gq.safeParse(e.tool_input);if(!t.success||!yq.test(t.data.command))return;let{cwd:r}=e;if(ce(r))return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:"`ripplo hooks pause` is a human-only escape hatch \u2014 agents can't bypass Ripplo guardrails on their own. If the daemon genuinely can't start (auth, server down, intentional offline work), surface the blocker to the user and ask them to run `npx ripplo hooks pause` themselves from their terminal."}}});import{parse as xq}from"shell-quote";import{z as hE}from"zod";import{existsSync as bq,mkdirSync as wq,rmSync as Bde,writeFileSync as Sq}from"fs";import bh from"path";function Vl(e,t,r){let n=fE(e,t,r);wq(bh.dirname(n),{recursive:!0}),Sq(n,"")}function Ul(e,t,r){return bq(fE(e,t,r))}function fE(e,t,r){return bh.join(vq(e,t),r)}function vq(e,t){return bh.join(e,".ripplo",".local","skills-loaded",t)}var kq=hE.looseObject({command:hE.string()}),Rq="debug",Cq=new Set(["tail","head","less","more","wc","sort","uniq","awk","sed","grep"]),gE=pe("PreToolUse",e=>{if(e.tool_name!=="Bash")return;let t=kq.safeParse(e.tool_input);if(!t.success)return;let r=Eq(t.data.command);if(!Pq(r))return;let{cwd:n}=e;if(!ce(n)||!je(n))return;if(!Ul(n,e.session_id,Rq))return mE("Running `ripplo run` requires the `/ripplo:debug` skill loaded first. Load `/ripplo:debug` then retry \u2014 it carries the artifact-read order and the no-grep-piping guidance for run failures.");let i=Aq(r);if(i!=null)return mE(`Don't pipe \`ripplo run\` through \`${i}\` \u2014 buffering filters hold all stdout until EOF, hiding live progress; if you kill the pipeline mid-run the run is orphaned on the server. Redirect to a file instead: \`ripplo run <id> > /tmp/run.log 2>&1\` and Read the file, or use \`run_in_background: true\`.`)});function Eq(e){try{return xq(e)}catch{return[]}}function Pq(e){return e.some((t,r)=>t==="ripplo"&&e[r+1]==="run")}function Iq(e){return typeof e=="object"&&"op"in e&&e.op==="|"}function Aq(e){let t=e.find((r,n)=>{let o=e[n-1];return o!=null&&Iq(o)&&typeof r=="string"&&Cq.has(r)});return typeof t=="string"?t:null}function mE(e){return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:e}}}import Tq from"path";import{z as yE}from"zod";var Oq=new Set(["Edit","Write","NotebookEdit"]),Mq=yE.looseObject({file_path:yE.string()}),Lq="create",bE=pe("PreToolUse",e=>{if(!Oq.has(e.tool_name))return;let t=Mq.safeParse(e.tool_input);if(!t.success)return;let{cwd:r}=e;if(!ce(r)||!je(r))return;let n=Tq.relative(r,t.data.file_path);if(!(n.startsWith("..")||n!==".ripplo"&&!n.startsWith(".ripplo/"))&&!Ul(r,e.session_id,Lq))return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`Editing \`.ripplo/\` files (${n}) requires the \`/ripplo:create\` skill loaded first. Load \`/ripplo:create\` then retry \u2014 it carries the DSL builder shape, lint rules, and the parallelization guidance you'll need.`}}});import Nq from"path";import wE from"picomatch";import{graphql as $q}from"gql.tada";import{z as SE}from"zod";var Dq=new Set(["Edit","Write","NotebookEdit"]),_q=SE.looseObject({file_path:SE.string()}),jq=$q(`
406
+ `);async function Bn({cwd:e,lockfile:t}){if(!w(e))return{addedSlugs:[]};let r=Wa(e);if(r.length===0)return{addedSlugs:[]};let n=new Set(r),o=t.tests.filter(l=>l.sourcePath!=null&&n.has(l.sourcePath)).map(l=>P(l.name));if(o.length===0)return{addedSlugs:[]};let i=k(e).unwrapOr(void 0);return i==null?{addedSlugs:[]}:await zt({config:i,cwd:e,lockfile:t}).catch(l=>(D.warn("auto-sync failed: %s",l instanceof Error?l.message:String(l)),null))==null?{addedSlugs:[]}:{addedSlugs:await Ma({cfg:i,slugs:o})?o:[]}}async function Ma({cfg:e,slugs:t}){let n=(await p({config:e,document:Ha,variables:{cwd:e.cwd,projectId:e.projectId,workflowSlugs:[...t]}}).catch(o=>(D.warn("auto-scope failed: %s",o instanceof Error?o.message:String(o)),null)))?.addDirtyTestsToScope;return n?.__typename!=="MutationAddDirtyTestsToScopeSuccess"?!1:n.data.length>0}var qn=".ripplo/tests/";function Wa(e){let t;try{t=_(["status","--porcelain","--",".ripplo/tests"],e)}catch{return[]}return t.split(`
407
+ `).map(r=>r.slice(3).trim()).filter(r=>r.startsWith(qn)&&r.endsWith(".ts")).map(r=>r.slice(qn.length)).filter(r=>r!=="index.ts"&&!r.endsWith("/index.ts"))}var Ba=Vn.looseObject({file_path:Vn.string()}),Gn=f("PostToolUse",async e=>{let t=Ba.safeParse(e.tool_input);if(!t.success||!/\/\.ripplo\/.*\.ts$/.test(t.data.file_path))return;let{cwd:r}=e;if(!m(r))return;if(!w(r))return{hookSpecificOutput:{additionalContext:"Ripplo hooks are paused \u2014 DSL lint and lockfile sync did not run for this edit. Resume with `npx ripplo hooks resume` when ready.",hookEventName:"PostToolUse"}};let n=await B(r);if(n.isErr())return{decision:"block",reason:`${R(n.error)}
408
+ ${d("create","DSL authoring + lint rules")}`};let o=H(n.value);if(o.length>0)return{decision:"block",reason:`${M(o)}
409
+ ${d("create")}`};let{addedSlugs:i}=await Bn({cwd:r,lockfile:n.value});return Va([...i.length>0?[`Auto-scoped ${i.join(", ")} (dirty tests).`]:[],...Ga(r,n.value)])});function Va(e){if(e.length!==0)return{hookSpecificOutput:{additionalContext:e.join(`
410
+ `),hookEventName:"PostToolUse"}}}function Ga(e,t){let r=ye(t),n=qa("sha256").update(JSON.stringify(r)).digest("hex");return Y(e,"coverage-warn")===n?[]:(X(e,"coverage-warn",n),r.length===0?[]:[fe(r)])}import{z as Jn}from"zod";var Ja=Jn.looseObject({command:Jn.string()}),za=/\bripplo\s+hooks\s+pause\b/,zn=f("PreToolUse",e=>{if(e.tool_name!=="Bash")return;let t=Ja.safeParse(e.tool_input);if(!t.success||!za.test(t.data.command))return;let{cwd:r}=e;if(m(r))return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:"`ripplo hooks pause` is a human-only escape hatch \u2014 agents can't bypass Ripplo guardrails on their own. If the daemon genuinely can't start (auth, server down, intentional offline work), surface the blocker to the user and ask them to run `npx ripplo hooks pause` themselves from their terminal."}}});import{parse as Za}from"shell-quote";import{z as Qn}from"zod";import{existsSync as Ka,mkdirSync as Qa,rmSync as Hf,writeFileSync as Ya}from"fs";import ze from"path";function Te(e,t,r){let n=Kn(e,t,r);Qa(ze.dirname(n),{recursive:!0}),Ya(n,"")}function De(e,t,r){return Ka(Kn(e,t,r))}function Kn(e,t,r){return ze.join(Xa(e,t),r)}function Xa(e,t){return ze.join(e,".ripplo",".local","skills-loaded",t)}var el=Qn.looseObject({command:Qn.string()}),tl="debug",rl=new Set(["tail","head","less","more","wc","sort","uniq","awk","sed","grep"]),Xn=f("PreToolUse",e=>{if(e.tool_name!=="Bash")return;let t=el.safeParse(e.tool_input);if(!t.success)return;let r=nl(t.data.command);if(!ol(r))return;let{cwd:n}=e;if(!m(n)||!w(n))return;if(!De(n,e.session_id,tl))return Yn("Running `ripplo run` requires the `/ripplo:debug` skill loaded first. Load `/ripplo:debug` then retry \u2014 it carries the artifact-read order and the no-grep-piping guidance for run failures.");let i=sl(r);if(i!=null)return Yn(`Don't pipe \`ripplo run\` through \`${i}\` \u2014 buffering filters hold all stdout until EOF, hiding live progress; if you kill the pipeline mid-run the run is orphaned on the server. Redirect to a file instead: \`ripplo run <id> > /tmp/run.log 2>&1\` and Read the file, or use \`run_in_background: true\`.`)});function nl(e){try{return Za(e)}catch{return[]}}function ol(e){return e.some((t,r)=>t==="ripplo"&&e[r+1]==="run")}function il(e){return typeof e=="object"&&"op"in e&&e.op==="|"}function sl(e){let t=e.find((r,n)=>{let o=e[n-1];return o!=null&&il(o)&&typeof r=="string"&&rl.has(r)});return typeof t=="string"?t:null}function Yn(e){return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:e}}}import al from"path";import{z as Zn}from"zod";var ll=new Set(["Edit","Write","NotebookEdit"]),cl=Zn.looseObject({file_path:Zn.string()}),dl="create",eo=f("PreToolUse",e=>{if(!ll.has(e.tool_name))return;let t=cl.safeParse(e.tool_input);if(!t.success)return;let{cwd:r}=e;if(!m(r)||!w(r))return;let n=al.relative(r,t.data.file_path);if(!(n.startsWith("..")||n!==".ripplo"&&!n.startsWith(".ripplo/"))&&!De(r,e.session_id,dl))return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`Editing \`.ripplo/\` files (${n}) requires the \`/ripplo:create\` skill loaded first. Load \`/ripplo:create\` then retry \u2014 it carries the DSL builder shape, lint rules, and the parallelization guidance you'll need.`}}});import pl from"path";import to from"picomatch";import{graphql as ul}from"gql.tada";import{z as ro}from"zod";var ml=new Set(["Edit","Write","NotebookEdit"]),fl=ro.looseObject({file_path:ro.string()}),gl=ul(`
683
411
  query PreEditScopeGate($projectId: String!, $cwd: String!) {
684
412
  project(id: $projectId) {
685
413
  id
@@ -691,9 +419,9 @@ ${V("create")}`};let{addedSlugs:i}=await lE({cwd:r,lockfile:n.value});return hq(
691
419
  }
692
420
  }
693
421
  }
694
- `),vE=pe("PreToolUse",async e=>{if(!Dq.has(e.tool_name))return;let t=_q.safeParse(e.tool_input);if(!t.success)return;let{cwd:r}=e;if(!ce(r)||!je(r))return;let n=Nq.relative(r,t.data.file_path);if(n.startsWith("..")||n===".ripplo"||n.startsWith(".ripplo/")||!Fq(n))return;let o=await Bq(r);return o.populated?o.degradedReason!=null?{hookSpecificOutput:{additionalContext:`Scope check skipped (${o.degradedReason}) \u2014 edit allowed through, but the scope guardrail isn't enforcing on this edit.`,hookEventName:"PreToolUse"}}:void 0:{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`Scope empty; edit touches app code (${n}). Stub a test or \`scope add\` an existing one before proceeding \u2014 or acknowledge "no user-facing behavior" if pure refactor. Hook re-fires until scope is populated (or hooks paused via the web UI). ${mm(["scope","create"])}`}}});function Fq(e){let{ignorePaths:t,watchPaths:r}=Jn(),n=wE([...r]),o=wE([...t]);return n(e)&&!o(e)}async function Bq(e){let t=xe(e).unwrapOr(void 0);if(t==null)return{degradedReason:"no project config \u2014 `ripplo init` not run here",populated:!0};let r=await D({config:t,document:jq,variables:{cwd:t.cwd,projectId:t.projectId}}).catch(()=>null);return r==null?{degradedReason:"server unreachable",populated:!0}:{degradedReason:null,populated:(r.project?.devSession?.scopeItems??[]).length>0}}import Vq from"fs";import Uq from"path";import{z as xE}from"zod";var Wq=new Set(["Edit","Write","NotebookEdit"]),Hq=xE.looseObject({file_path:xE.string()}),kE=pe("PreToolUse",async e=>{if(!Wq.has(e.tool_name))return;let t=zq(e);if(t==null)return;let{cwd:r}=e;if(Vq.existsSync(Nr(r))||dn(r))return;let n=await ve(r);return n.isErr()?{hookSpecificOutput:{additionalContext:`\`ripplo daemon\` isn't running and the DSL is currently failing to compile, so the daemon gate is letting this edit through \u2014 fix the compile error before relying on dev-mode guardrails. Compile error:
695
- ${Pe(n.error)}
696
- ${V("create","DSL authoring + lint rules")}`,hookEventName:"PreToolUse"}}:{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`\`ripplo daemon\` is not running, so this edit to \`${t}\` won't sync to the server and dev-mode guardrails won't fire. Run \`/ripplo:start\` (or spawn \`npx ripplo daemon\` directly via Bash with run_in_background), then retry. The app's dev server also needs to be running \u2014 \`npx ripplo doctor\` reports both. If the daemon can't start (auth, server down, intentional offline work), the user can run \`npx ripplo hooks pause\` to bypass this gate; \`npx ripplo hooks resume\` re-enables it. ${V("start")}`}}});function zq(e){let t=Hq.safeParse(e.tool_input);if(!t.success||!ce(e.cwd))return null;let r=Uq.relative(e.cwd,t.data.file_path);return r.startsWith("..")||r!==".ripplo"&&!r.startsWith(".ripplo/")?null:r}import{graphql as Gq}from"gql.tada";var qq=Gq(`
422
+ `),no=f("PreToolUse",async e=>{if(!ml.has(e.tool_name))return;let t=fl.safeParse(e.tool_input);if(!t.success)return;let{cwd:r}=e;if(!m(r)||!w(r))return;let n=pl.relative(r,t.data.file_path);if(n.startsWith("..")||n===".ripplo"||n.startsWith(".ripplo/")||!hl(n))return;let o=await yl(r);return o.populated?o.degradedReason!=null?{hookSpecificOutput:{additionalContext:`Scope check skipped (${o.degradedReason}) \u2014 edit allowed through, but the scope guardrail isn't enforcing on this edit.`,hookEventName:"PreToolUse"}}:void 0:{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`Scope empty; edit touches app code (${n}). Stub a test or \`scope add\` an existing one before proceeding \u2014 or acknowledge "no user-facing behavior" if pure refactor. Hook re-fires until scope is populated (or hooks paused via the web UI). ${dt(["scope","create"])}`}}});function hl(e){let{ignorePaths:t,watchPaths:r}=Q(),n=to([...r]),o=to([...t]);return n(e)&&!o(e)}async function yl(e){let t=k(e).unwrapOr(void 0);if(t==null)return{degradedReason:"no project config \u2014 `ripplo init` not run here",populated:!0};let r=await p({config:t,document:gl,variables:{cwd:t.cwd,projectId:t.projectId}}).catch(()=>null);return r==null?{degradedReason:"server unreachable",populated:!0}:{degradedReason:null,populated:(r.project?.devSession?.scopeItems??[]).length>0}}import kl from"fs";import wl from"path";import{z as oo}from"zod";var vl=new Set(["Edit","Write","NotebookEdit"]),bl=oo.looseObject({file_path:oo.string()}),io=f("PreToolUse",async e=>{if(!vl.has(e.tool_name))return;let t=Sl(e);if(t==null)return;let{cwd:r}=e;if(kl.existsSync(ee(r))||de(r))return;let n=await S(r);return n.isErr()?{hookSpecificOutput:{additionalContext:`\`ripplo daemon\` isn't running and the DSL is currently failing to compile, so the daemon gate is letting this edit through \u2014 fix the compile error before relying on dev-mode guardrails. Compile error:
423
+ ${R(n.error)}
424
+ ${d("create","DSL authoring + lint rules")}`,hookEventName:"PreToolUse"}}:{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`\`ripplo daemon\` is not running, so this edit to \`${t}\` won't sync to the server and dev-mode guardrails won't fire. Run \`/ripplo:start\` (or spawn \`npx ripplo daemon\` directly via Bash with run_in_background), then retry. The app's dev server also needs to be running \u2014 \`npx ripplo doctor\` reports both. If the daemon can't start (auth, server down, intentional offline work), the user can run \`npx ripplo hooks pause\` to bypass this gate; \`npx ripplo hooks resume\` re-enables it. ${d("start")}`}}});function Sl(e){let t=bl.safeParse(e.tool_input);if(!t.success||!m(e.cwd))return null;let r=wl.relative(e.cwd,t.data.file_path);return r.startsWith("..")||r!==".ripplo"&&!r.startsWith(".ripplo/")?null:r}import{graphql as Rl}from"gql.tada";var Cl=Rl(`
697
425
  query ScopeReminder($projectId: String!, $cwd: String!) {
698
426
  project(id: $projectId) {
699
427
  id
@@ -710,15 +438,15 @@ ${V("create","DSL authoring + lint rules")}`,hookEventName:"PreToolUse"}}:{hookS
710
438
  }
711
439
  }
712
440
  }
713
- `),RE=pe("UserPromptSubmit",async e=>{let{cwd:t}=e;if(!ce(t)||!je(t))return;let r=Bl(t);if(Yn(t,"scope-reminder")===r)return;let n=xe(t).unwrapOr(void 0);if(n==null)return;let o=await D({config:n,document:qq,variables:{cwd:n.cwd,projectId:n.projectId}}).catch(()=>null);Xn(t,"scope-reminder",r);let i=o?.project?.devSession?.scopeItems??[];return YC({cwd:t,scope:{available:o!=null,items:i.map(a=>Kq(a))}}),o==null?{hookSpecificOutput:{additionalContext:`RIPPLO SCOPE: unknown \u2014 server unreachable, scope guardrails are not enforcing. Check the dev session (\`npx ripplo doctor\`). ${V("start")}`,hookEventName:"UserPromptSubmit"}}:{hookSpecificOutput:{additionalContext:i.length===0?`RIPPLO SCOPE: empty. ${V("scope")}`:`RIPPLO SCOPE (${String(i.length)}):
714
- ${i.map(a=>{let l=a.workflow;return l==null?` [intent] (${a.id}) ${a.label??""}`:` [${l.spec==null?"stub":"implemented"}] (${a.id}) ${l.slug}`}).join(`
715
- `)}`,hookEventName:"UserPromptSubmit"}}});function Kq(e){let t=e.workflow;return t==null?{label:e.label,slug:null,status:"intent"}:{label:e.label,slug:t.slug,status:t.spec==null?"stub":"implemented"}}var Jq="# Ripplo \u2014 always-on session context\n\nEvery user-facing change in this repo ships with a deterministic, backend-aware test that proves it works end-to-end.\n\n## Load the right skill before acting \u2014 this is critical\n\nThe skills below carry the procedural detail you need to do Ripplo work correctly: entity/world modeling, parallel-isolation in engine impls, oracle-based backend assertions, scope discipline, artifact-read order on failures, parallelization patterns. **None of that is reproduced in this preamble** \u2014 only the always-on guardrails are. If you act on a Ripplo task without loading the matching skill, you will skip rules that exist to prevent specific past failure modes (cross-run data leakage, \"passing\" tests that never asserted backend state, etc.).\n\nMatch the task to a skill from the triage table; if unsure between two, load both. If completely unsure, load `/ripplo:explore` or `/ripplo:create`. Loading is cheap; acting under-informed is not.\n\n## Skill triage\n\n- Load `/ripplo:setup` skill for instructions on initializing Ripplo in a project; `ripplo doctor` reports the engine endpoint missing.\n- Load `/ripplo:explore` skill for instructions on planning/stubbing test coverage for a new project or new feature area.\n- Load `/ripplo:scope` skill for instructions on managing the working set of tests this session is responsible for.\n- Load `/ripplo:create` skill for instructions on authoring a single test spec for a user flow.\n- Load `/ripplo:run` skill for instructions on executing existing tests.\n- Load `/ripplo:debug` skill for instructions on a failed run; read artifacts in `.ripplo/debug/<runId>/` before re-running.\n\n## Universal rules\n\n- **Two background processes must be running before feature work.** (1) The app's dev server, so the app is reachable; (2) `npx ripplo daemon` (run `/ripplo:start` to spawn it, or invoke it directly via Bash with `run_in_background`), so the dev session is live. Without the daemon, dev-mode hooks don't arm (`ripplo run` will auto-start one if absent). Without the dev server, runs fail when they try to hit the app. `npx ripplo doctor` reports both.\n- **Two funnels.** Definitions \u2192 `createRipplo({ entities, singletons, tests })` in `.ripplo/index.ts`. Implementations \u2192 `createEngine(ripplo, { entities: impls, singletons })` in your app server's `test/engine.ts` \u2014 one `seed`/`read` impl per entity. Never call either elsewhere. TS enforces exhaustiveness across both.\n- **\"Done\" = app code delivers the behavior AND a passing test proves it.** Both halves. Shipping without a test isn't done; writing a test against broken UI/API isn't done.\n- **Scope is your job.** For any non-trivial change, enumerate every flow it could affect and either `scope add` existing tests or stub new ones with `test(\"Intent\")` (no body). Don't wait to be told.\n- **`scope remove` is never for size/effort.** Valid only when an item is genuinely out of scope (wrong flow, duplicate, user said \"not this session,\" feature cut). \"Too many stubs\" \u2192 parallelize with subagents. Don't present \"implement vs. remove\" as a neutral A/B.\n- **Stub gates are not a question.** When `stop-enforce` blocks on unimplemented stubs, implement them \u2014 don't ask the user \"implement or defer?\", don't propose pausing hooks as option B. The fix isn't done until the test is. New scaffolding (entity, world, engine impl) is in-scope work, not follow-up.\n- **Backend assertions are mandatory on mutations.** Every mutation step carries an `Entity.created/updated/deleted` in its `.expect(...)` \u2014 the oracle checks observed-vs-model. A UI-only check on a mutation ships the bug as green.\n- **Never weaken a test to make it pass.** No `contains`/regex for exact text, no removed assertions, no fabricated locators. App lacks an accessible name \u2192 add one to the app, don't fall back to `testId()`. App bug \u2192 report with evidence.\n- **Artifacts first, re-run last.** Failed runs write `.ripplo/debug/<runId>/behavior.jsonl` \u2014 a causal stream of actions, assertions, rrweb DOM, console, network, and server spans \u2014 and the run output renders the oracle's findings. Read them. Never pipe `ripplo run` through `grep`/`tail`/`head`. Form a hypothesis citing an event, make ONE change, re-run once.\n- **`.ripplo/ripplo.lock` is committed, never hand-edited.** `ripplo lint` / `ripplo compile` regenerates it. Pre-commit runs `ripplo compile --check`.\n- **Scratch files live in `.ripplo/.local/`.** Never loose in `.ripplo/`.\n- **Worktrees are self-contained.** Each worktree has its own `.ripplo/` checkout, DevSession, scope, and debug artifacts. Auth and projectId are shared globally. Env files (typically gitignored) won't carry over to a fresh worktree \u2014 copy from main or point at a shared file. **If sibling worktrees run dev servers on different ports, the worktree's env file MUST update both `RIPPLO_APP_URL` and `RIPPLO_ENGINE_URL` to match the port that worktree's dev server is bound to** (e.g. main on `:3000`, this worktree on `:3001` \u2192 set `RIPPLO_APP_URL=http://localhost:3001` and `RIPPLO_ENGINE_URL=http://localhost:3001/ripplo` in the worktree's env file). Mismatched ports = `npx ripplo daemon` talks to the wrong server, runs silently fail or hit the sibling worktree's app.\n- **DSL locators are semantic.** Use `role`/`button`/`textbox`/`heading`/`link`; `testId` only when no ARIA role exists.\n- **New backend state?** Add an `entity(...)` in `.ripplo/entities/` and a `seed`/`read` impl in your app's engine funnel (TS flags the missing impl).\n\n## Key files\n\n- `.ripplo/index.ts` \u2014 `createRipplo` call.\n- `.ripplo/{entities,singletons,worlds,tests}/index.ts` \u2014 registry aggregators.\n- `.ripplo/project.json` \u2014 project id + env-file pointers.\n- `<app>/src/test/engine.ts` \u2014 single impl funnel via `createEngine`.\n- `/ripplo:create` skill \u2014 DSL reference (entities, worlds, tests, oracle); full primitive catalog at `node_modules/@ripplo/testing/DSL.md`.\n",CE=pe("SessionStart",e=>{if(ce(e.cwd))return{hookSpecificOutput:{additionalContext:Jq,hookEventName:"SessionStart"}}});import Yq from"path";import Xq from"process";import{CancellationTokenSource as Zq}from"vscode-jsonrpc/node";import{graphql as Qq}from"gql.tada";function EE(e){return`--- Ripplo Run Failures (scope) ---
441
+ `),so=f("UserPromptSubmit",async e=>{let{cwd:t}=e;if(!m(t)||!w(t))return;let r=Le(t);if(Y(t,"scope-reminder")===r)return;let n=k(t).unwrapOr(void 0);if(n==null)return;let o=await p({config:n,document:Cl,variables:{cwd:n.cwd,projectId:n.projectId}}).catch(()=>null);X(t,"scope-reminder",r);let i=o?.project?.devSession?.scopeItems??[];return Ln({cwd:t,scope:{available:o!=null,items:i.map(s=>xl(s))}}),o==null?{hookSpecificOutput:{additionalContext:`RIPPLO SCOPE: unknown \u2014 server unreachable, scope guardrails are not enforcing. Check the dev session (\`npx ripplo doctor\`). ${d("start")}`,hookEventName:"UserPromptSubmit"}}:{hookSpecificOutput:{additionalContext:i.length===0?`RIPPLO SCOPE: empty. ${d("scope")}`:`RIPPLO SCOPE (${String(i.length)}):
442
+ ${i.map(s=>{let l=s.workflow;return l==null?` [intent] (${s.id}) ${s.label??""}`:` [${l.spec==null?"stub":"implemented"}] (${s.id}) ${l.slug}`}).join(`
443
+ `)}`,hookEventName:"UserPromptSubmit"}}});function xl(e){let t=e.workflow;return t==null?{label:e.label,slug:null,status:"intent"}:{label:e.label,slug:t.slug,status:t.spec==null?"stub":"implemented"}}var Pl="# Ripplo \u2014 always-on session context\n\nEvery user-facing change in this repo ships with a deterministic, backend-aware test that proves it works end-to-end.\n\n## Load the right skill before acting \u2014 this is critical\n\nThe skills below carry the procedural detail you need to do Ripplo work correctly: entity/world modeling, parallel-isolation in engine impls, oracle-based backend assertions, scope discipline, artifact-read order on failures, parallelization patterns. **None of that is reproduced in this preamble** \u2014 only the always-on guardrails are. If you act on a Ripplo task without loading the matching skill, you will skip rules that exist to prevent specific past failure modes (cross-run data leakage, \"passing\" tests that never asserted backend state, etc.).\n\nMatch the task to a skill from the triage table; if unsure between two, load both. If completely unsure, load `/ripplo:explore` or `/ripplo:create`. Loading is cheap; acting under-informed is not.\n\n## Skill triage\n\n- Load `/ripplo:setup` skill for instructions on initializing Ripplo in a project; `ripplo doctor` reports the engine endpoint missing.\n- Load `/ripplo:explore` skill for instructions on planning/stubbing test coverage for a new project or new feature area.\n- Load `/ripplo:scope` skill for instructions on managing the working set of tests this session is responsible for.\n- Load `/ripplo:create` skill for instructions on authoring a single test spec for a user flow.\n- Load `/ripplo:run` skill for instructions on executing existing tests.\n- Load `/ripplo:debug` skill for instructions on a failed run; read artifacts in `.ripplo/debug/<runId>/` before re-running.\n\n## Universal rules\n\n- **Two background processes must be running before feature work.** (1) The app's dev server, so the app is reachable; (2) `npx ripplo daemon` (run `/ripplo:start` to spawn it, or invoke it directly via Bash with `run_in_background`), so the dev session is live. Without the daemon, dev-mode hooks don't arm (`ripplo run` will auto-start one if absent). Without the dev server, runs fail when they try to hit the app. `npx ripplo doctor` reports both.\n- **Two funnels.** Definitions \u2192 `createRipplo({ entities, singletons, tests })` in `.ripplo/index.ts`. Implementations \u2192 `createEngine(ripplo, { entities: impls, singletons })` in your app server's `test/engine.ts` \u2014 one `seed`/`read` impl per entity. Never call either elsewhere. TS enforces exhaustiveness across both.\n- **\"Done\" = app code delivers the behavior AND a passing test proves it.** Both halves. Shipping without a test isn't done; writing a test against broken UI/API isn't done.\n- **Scope is your job.** For any non-trivial change, enumerate every flow it could affect and either `scope add` existing tests or stub new ones with `test(\"Intent\")` (no body). Don't wait to be told.\n- **`scope remove` is never for size/effort.** Valid only when an item is genuinely out of scope (wrong flow, duplicate, user said \"not this session,\" feature cut). \"Too many stubs\" \u2192 parallelize with subagents. Don't present \"implement vs. remove\" as a neutral A/B.\n- **Stub gates are not a question.** When `stop-enforce` blocks on unimplemented stubs, implement them \u2014 don't ask the user \"implement or defer?\", don't propose pausing hooks as option B. The fix isn't done until the test is. New scaffolding (entity, world, engine impl) is in-scope work, not follow-up.\n- **Backend assertions are mandatory on mutations.** Every mutation step carries an `Entity.created/updated/deleted` in its `.expect(...)` \u2014 the oracle checks observed-vs-model. A UI-only check on a mutation ships the bug as green.\n- **Never weaken a test to make it pass.** No `contains`/regex for exact text, no removed assertions, no fabricated locators. App lacks an accessible name \u2192 add one to the app, don't fall back to `testId()`. App bug \u2192 report with evidence.\n- **Artifacts first, re-run last.** Failed runs write `.ripplo/debug/<runId>/behavior.jsonl` \u2014 a causal stream of actions, assertions, rrweb DOM, console, network, and server spans \u2014 and the run output renders the oracle's findings. Read them. Never pipe `ripplo run` through `grep`/`tail`/`head`. Form a hypothesis citing an event, make ONE change, re-run once.\n- **`.ripplo/ripplo.lock` is committed, never hand-edited.** `ripplo lint` / `ripplo compile` regenerates it. Pre-commit runs `ripplo compile --check`.\n- **Scratch files live in `.ripplo/.local/`.** Never loose in `.ripplo/`.\n- **Worktrees are self-contained.** Each worktree has its own `.ripplo/` checkout, DevSession, scope, and debug artifacts. Auth and projectId are shared globally. Env files (typically gitignored) won't carry over to a fresh worktree \u2014 copy from main or point at a shared file. **If sibling worktrees run dev servers on different ports, the worktree's env file MUST update both `RIPPLO_APP_URL` and `RIPPLO_ENGINE_URL` to match the port that worktree's dev server is bound to** (e.g. main on `:3000`, this worktree on `:3001` \u2192 set `RIPPLO_APP_URL=http://localhost:3001` and `RIPPLO_ENGINE_URL=http://localhost:3001/ripplo` in the worktree's env file). Mismatched ports = `npx ripplo daemon` talks to the wrong server, runs silently fail or hit the sibling worktree's app.\n- **DSL locators are semantic.** Use `role`/`button`/`textbox`/`heading`/`link`; `testId` only when no ARIA role exists.\n- **New backend state?** Add an `entity(...)` in `.ripplo/entities/` and a `seed`/`read` impl in your app's engine funnel (TS flags the missing impl).\n\n## Key files\n\n- `.ripplo/index.ts` \u2014 `createRipplo` call.\n- `.ripplo/{entities,singletons,worlds,tests}/index.ts` \u2014 registry aggregators.\n- `.ripplo/project.json` \u2014 project id + env-file pointers.\n- `<app>/src/test/engine.ts` \u2014 single impl funnel via `createEngine`.\n- `/ripplo:create` skill \u2014 DSL reference (entities, worlds, tests, oracle); full primitive catalog at `node_modules/@ripplo/testing/DSL.md`.\n",ao=f("SessionStart",e=>{if(m(e.cwd))return{hookSpecificOutput:{additionalContext:Pl,hookEventName:"SessionStart"}}});import El from"path";import $l from"process";import{CancellationTokenSource as Il}from"vscode-jsonrpc/node";import{graphql as jl}from"gql.tada";function lo(e){return`--- Ripplo Run Failures (scope) ---
716
444
  ${e.join(`
717
445
  `)}
718
- Artifacts: .ripplo/debug/<runId>/. ${V("debug")}`}function wh({lines:e,retried:t}){let r=t?"These tests were already retried once inside this gate and the server was still unreachable.":"";return["--- Ripplo Run Not Verified (Ripplo server unreachable) ---",...e,"The Ripplo server could not be reached while running these tests. This is a server-side transient, NOT a problem with your local environment \u2014 do not debug the daemon, dev server, or auth (`npx ripplo doctor` will be green).",r,"Wait a moment, then attempt to stop again so the gate can re-verify."].filter(n=>n.length>0).join(`
719
- `)}function Pi(e){return`--- Ripplo Run Could Not Execute ---
446
+ Artifacts: .ripplo/debug/<runId>/. ${d("debug")}`}function Ke({lines:e,retried:t}){let r=t?"These tests were already retried once inside this gate and the server was still unreachable.":"";return["--- Ripplo Run Not Verified (Ripplo server unreachable) ---",...e,"The Ripplo server could not be reached while running these tests. This is a server-side transient, NOT a problem with your local environment \u2014 do not debug the daemon, dev server, or auth (`npx ripplo doctor` will be green).",r,"Wait a moment, then attempt to stop again so the gate can re-verify."].filter(n=>n.length>0).join(`
447
+ `)}function le(e){return`--- Ripplo Run Could Not Execute ---
720
448
  ${e}
721
- Fix the run environment (daemon, dev server, auth \u2014 \`npx ripplo doctor\`) and re-run before declaring work done. ${V("start")}`}var eK=Qq(`
449
+ Fix the run environment (daemon, dev server, auth \u2014 \`npx ripplo doctor\`) and re-run before declaring work done. ${d("start")}`}var Al=jl(`
722
450
  query ScopeEnforce($projectId: String!, $cwd: String!) {
723
451
  project(id: $projectId) {
724
452
  id
@@ -737,44 +465,26 @@ Fix the run environment (daemon, dev server, auth \u2014 \`npx ripplo doctor\`)
737
465
  }
738
466
  }
739
467
  }
740
- `),IE=pe("Stop",async e=>{let{cwd:t}=e;if(!ce(t)||!je(t))return;let r=Bl(t),n=Yn(t,"stop-enforce")===r;if(n&&!e.stop_hook_active)return;let o=await tK(t);if(Xn(t,"stop-enforce",r),o.errors.length!==0)return n&&e.stop_hook_active&&!o.infraOnly?{continue:!1,stopReason:`Stop-enforce: same repo state across consecutive stop attempts; agent appears stuck. Errors:
468
+ `),po=f("Stop",async e=>{let{cwd:t}=e;if(!m(t)||!w(t))return;let r=Le(t),n=Y(t,"stop-enforce")===r;if(n&&!e.stop_hook_active)return;let o=await Ll(t);if(X(t,"stop-enforce",r),o.errors.length!==0)return n&&e.stop_hook_active&&!o.infraOnly?{continue:!1,stopReason:`Stop-enforce: same repo state across consecutive stop attempts; agent appears stuck. Errors:
741
469
  ${o.errors.join(`
742
470
 
743
471
  `)}`}:{decision:"block",reason:o.errors.join(`
744
472
 
745
- `)}});async function tK(e){let t=await Wn(e);if(t.isErr())return{errors:[`--- Compilation failed ---
746
- ${Pe(t.error)}
747
- ${V("create")}`],infraOnly:!1};let r=t.value,n=await oK(e,r),o=rK(r),i=nK(r),s=n.runnableSlugs.length>0?await sK(e):null,a=[o,i,s?.error??null,n.error].filter(c=>c!=null),l=a.length>0&&o==null&&i==null&&n.error==null&&(s?.infra??!1);return{errors:a,infraOnly:l}}function rK(e){let t=Mr(e);return t.length===0?null:`--- Ripplo Lint ---
748
- ${Lr(t)}
749
- ${V("create")}`}function nK(e){let t=dr(e);return t.length===0?null:`--- Unimplemented stubs ---
473
+ `)}});async function Ll(e){let t=await B(e);if(t.isErr())return{errors:[`--- Compilation failed ---
474
+ ${R(t.error)}
475
+ ${d("create")}`],infraOnly:!1};let r=t.value,n=await Ol(e,r),o=Tl(r),i=Dl(r),a=n.runnableSlugs.length>0?await Fl(e):null,s=[o,i,a?.error??null,n.error].filter(c=>c!=null),l=s.length>0&&o==null&&i==null&&n.error==null&&(a?.infra??!1);return{errors:s,infraOnly:l}}function Tl(e){let t=H(e);return t.length===0?null:`--- Ripplo Lint ---
476
+ ${M(t)}
477
+ ${d("create")}`}function Dl(e){let t=F(e);return t.length===0?null:`--- Unimplemented stubs ---
750
478
  ${t.join(", ")}
751
479
  Implement the stub now with \`test("Intent", () => ({ given, steps }))\`. Do not ask the user "implement or defer?" \u2014 that framing is forbidden by /ripplo:create. New scaffolding (entity, world, engine impl) is in-scope, not follow-up.
752
- ${V("create")}`}async function oK(e,t){let r=new Set(dr(t).map(d=>fe(d))),n=new Set(t.tests.map(d=>fe(d.name))),o=(d,p)=>n.has(d)?r.has(d):iK(p),i=xe(e).unwrapOr(void 0);if(i==null)return{error:`--- Testing Scope (NOT CHECKED) ---
753
- No project config \u2014 \`ripplo init\` hasn't run here, so scope/stub done-checks are not enforcing. ${V("setup")}`,runnableSlugs:[]};let s=await D({config:i,document:eK,variables:{cwd:i.cwd,projectId:i.projectId}}).catch(()=>null);if(s==null)return{error:`--- Testing Scope (NOT CHECKED) ---
754
- Ripplo server unreachable \u2014 scope/stub done-checks are not enforcing. Verify the dev session is live (\`npx ripplo doctor\`, ${V("start")}) before declaring work done.`,runnableSlugs:[]};let a=s.project?.devSession?.scopeItems??[],l=a.flatMap(d=>{let p=d.workflow;return p==null?[` [intent] ${d.label??"(no label)"} \u2014 write a test for this flow`]:o(p.slug,p.spec)?[` [stub] ${p.slug} \u2014 implement \`${p.name}\``]:[]}),c=a.flatMap(d=>d.workflow!=null&&!o(d.workflow.slug,d.workflow.spec)?[d.workflow.slug]:[]);return{error:l.length===0?null:`--- Testing Scope ---
480
+ ${d("create")}`}async function Ol(e,t){let r=new Set(F(t).map(u=>P(u))),n=new Set(t.tests.map(u=>P(u.name))),o=(u,y)=>n.has(u)?r.has(u):_l(y),i=k(e).unwrapOr(void 0);if(i==null)return{error:`--- Testing Scope (NOT CHECKED) ---
481
+ No project config \u2014 \`ripplo init\` hasn't run here, so scope/stub done-checks are not enforcing. ${d("setup")}`,runnableSlugs:[]};let a=await p({config:i,document:Al,variables:{cwd:i.cwd,projectId:i.projectId}}).catch(()=>null);if(a==null)return{error:`--- Testing Scope (NOT CHECKED) ---
482
+ Ripplo server unreachable \u2014 scope/stub done-checks are not enforcing. Verify the dev session is live (\`npx ripplo doctor\`, ${d("start")}) before declaring work done.`,runnableSlugs:[]};let s=a.project?.devSession?.scopeItems??[],l=s.flatMap(u=>{let y=u.workflow;return y==null?[` [intent] ${u.label??"(no label)"} \u2014 write a test for this flow`]:o(y.slug,y.spec)?[` [stub] ${y.slug} \u2014 implement \`${y.name}\``]:[]}),c=s.flatMap(u=>u.workflow!=null&&!o(u.workflow.slug,u.workflow.spec)?[u.workflow.slug]:[]);return{error:l.length===0?null:`--- Testing Scope ---
755
483
  ${l.join(`
756
484
  `)}
757
- ${V("create")}`,runnableSlugs:c}}function iK(e){return typeof e=="object"&&e!=null&&Reflect.get(e,"stub")===!0}async function sK(e){let t=Xq.argv[1];if(t==null)return{error:Pi("CLI entry missing (process.argv[1])"),infra:!1};let r=await gl(e);if(r!=null){let i=wl(r);return yl(r.serverUrl)?{error:Pi(i),infra:!1}:{error:wh({lines:[i],retried:!1}),infra:!0}}let n=await fl({cliEntry:t,cwd:e});if(n.isErr())return{error:Pi(on(n.error)),infra:!1};let o=n.value;try{return await aK({connection:o,cwd:e})}finally{o.spawned&&await ml(o),o.socket.destroy()}}async function aK({connection:e,cwd:t}){let r=await PE({connection:e,cwd:t,tests:[]});if(r.kind==="transport")return{error:Pi(r.message),infra:!1};let n=r.notRun.length>0?await PE({connection:e,cwd:t,tests:r.notRun.map(s=>s.testName)}):null,o=n==null||n.kind==="transport"?r.notRun:n.notRun,i=[...r.failedLines,...n!=null&&n.kind==="done"?n.failedLines:[]];return lK({failedLines:i,notRun:o,retried:n!=null})}function lK({failedLines:e,notRun:t,retried:r}){if(e.length===0&&t.length===0)return{error:null,infra:!1};let n=e.length>0?EE(e):null,o=t.length>0?wh({lines:t.map(i=>i.line),retried:r}):null;return{error:[n,o].filter(i=>i!=null).join(`
758
-
759
- `),infra:n==null}}async function PE({connection:e,cwd:t,tests:r}){let n=[],o=[],i=Yq.join(t,".ripplo","debug"),s=new Zq;return(await hl({connection:e,request:{all:!1,headed:!1,tests:[...r]},token:s.token,onEvent:l=>{cK({debugDir:i,event:l,failedLines:n,notRun:o})}})).match(l=>l.kind==="daemon-error"?{kind:"transport",message:Sl(l.error)}:{failedLines:n,kind:"done",notRun:o},l=>({kind:"transport",message:on(l)}))}function cK({debugDir:e,event:t,failedLines:r,notRun:n}){if(t.kind!=="test-outcome"||t.outcome.kind==="pass")return;let o=bl({debugDir:e,event:t})??t.testName;if(t.outcome.kind==="dispatch-error"||t.outcome.kind==="infra-error"){n.push({line:o,testName:t.testName});return}r.push(o)}import{z as AE}from"zod";var uK=AE.looseObject({skill:AE.string()}),TE=pe("PostToolUse",e=>{if(e.tool_name!=="Skill")return;let t=uK.safeParse(e.tool_input);if(!t.success)return;let r=/^ripplo:(.+)$/.exec(t.data.skill);if(r==null)return;let n=r[1];n!=null&&ce(e.cwd)&&Vl(e.cwd,e.session_id,n)});var dK=/(?:^|\s)\/ripplo:([a-z][a-z0-9-]*)\b/gi,OE=pe("UserPromptSubmit",e=>{ce(e.cwd)&&[...e.prompt.matchAll(dK)].map(t=>t[1]).filter(t=>t!=null).forEach(t=>{Vl(e.cwd,e.session_id,t)})});CK();Wt(process.cwd());Xl();var ME={"exit-plan-gate":GC,"plan-reminder":qC,"post-edit-flag-stubs":oE,"post-edit-lint":uE,"pre-bash-hooks-pause-gate":pE,"pre-bash-run-gate":gE,"pre-edit-ripplo-skill-gate":bE,"pre-edit-scope-gate":vE,"pre-edit-watch-gate":kE,"scope-reminder":RE,"session-preamble":CE,"stop-enforce":IE,"track-skill-load":TE,"track-skill-prompt":OE};async function hK(){await pK(fK(process.argv)).scriptName("ripplo").version(Kh()).command("daemon","Run the long-lived local executor (IPC socket + run subscription)",e=>e.option("explore",{default:!1,describe:"Opt in to background exploration when idle (experimental)",type:"boolean"}),e=>DC({explore:e.explore})).command("concurrency [value]","Show or set max local concurrent runs (daemon applies live)",e=>e.positional("value",{type:"number"}),e=>Nm({value:e.value})).command("auth <subcommand>","Manage authentication",RK).command("projects <subcommand>","Inspect Ripplo projects",kK).command("hooks <subcommand>","Pause or resume Ripplo hooks",xK).command("init","Scaffold .ripplo/ in this project",e=>e.option("project",{type:"string"}).option("env",{type:"string"}).option("app-url",{type:"string"}).option("engine-url",{type:"string"}),e=>N0({appUrl:e["app-url"],engineUrl:e["engine-url"],envFile:e.env,projectId:e.project})).command("run [ids..]","Run tests locally via the daemon (auto-starts it if absent)",SK,e=>yR({all:e.all,headed:e.headed,ids:e.ids,keepAlive:e["keep-alive"]})).command(wK()).command(yK()).command(bK()).command("lint","Static model analysis (cascade gaps + law conflicts; no live app)",()=>{},()=>$0()).command("sync","Push the compiled .ripplo/ resources to the server (no run)",()=>{},()=>iC()).command("compile","Compile the DSL and write .ripplo/ripplo.lock",e=>e.option("check",{default:!1,describe:"Exit non-zero if the lockfile is missing or stale (does not write)",type:"boolean"}),e=>Tm({check:e.check})).command("doctor","Check project health",()=>{},()=>R0()).command("status","Report unimplemented tests and preconditions",e=>e.option("format",{choices:["json","summary"],default:"json",describe:"Output format"}),e=>HC({format:e.format})).command("scope <subcommand>","Manage testing scope",vK).command("run-worker",!1,()=>{},()=>XR()).command("hook <name>","Internal: run a Claude Code plugin hook",e=>e.positional("name",{choices:Object.keys(ME),demandOption:!0,type:"string"}),e=>mK(e.name)).strict().help().parse()}async function mK(e){let t=ME[e];t==null&&(process.stderr.write(`Unknown hook: ${e}
760
- `),process.exit(1));let r=await gK(),n=r.trim()===""?{}:JSON.parse(r),o=await t.run(n);o!=null&&process.stdout.write(JSON.stringify(o))}function gK(){return new Promise((e,t)=>{if(process.stdin.isTTY){e("");return}let r=[];process.stdin.on("data",n=>r.push(n)),process.stdin.on("end",()=>{e(Buffer.concat(r).toString("utf8"))}),process.stdin.on("error",t)})}hK().catch(e=>{process.stderr.write(`${Sm(e)}
761
- `),process.exit(1)});function yK(){return{command:"report-bug",describe:"Report a critical application bug caught while building or testing",builder:e=>e.option("kind",{choices:["new_feature_bug","regression","latent_bug"],demandOption:!0,describe:"new_feature_bug: broke the new thing being built; regression: broke previously working behavior; latent_bug: pre-existing bug exposed by new test coverage"}).option("title",{demandOption:!0,describe:"Short bug name",type:"string"}).option("root-cause",{demandOption:!0,describe:"What was actually wrong",type:"string"}).option("surfaced-by",{demandOption:!0,describe:"How the test/run exposed it (cite evidence)",type:"string"}).option("run",{describe:"Run id where it surfaced",type:"string"}).option("test",{describe:"Test id that surfaced it",type:"string"}),handler:e=>rR({kind:e.kind,rootCause:e["root-cause"],runId:e.run,surfacedBy:e["surfaced-by"],testId:e.test,title:e.title})}}function bK(){return{command:"explore",describe:"Run state-space exploration trails in the foreground (app + engine must be running)",builder:e=>e.option("trails",{default:10,describe:"Number of trails to execute before stopping (stops early on saturation)",type:"number"}),handler:e=>Q0({trails:e.trails})}}function wK(){return{command:"snapshot <runId>",describe:"Render a PNG of the page at a point in a run's rrweb recording",builder:e=>e.positional("runId",{demandOption:!0,type:"string"}).option("at",{describe:"Moment to render: epoch-ms timestamp exactly as found in behavior.jsonl",type:"number"}).option("offset",{describe:"Moment to render: ms from the start of the recording (alternative to --at)",type:"number"}).conflicts("at","offset"),handler:e=>oC({at:e.at,offset:e.offset,runId:e.runId})}}function SK(e){let t=[];return e.positional("ids",{array:!0,default:t,describe:"Test ids to run",type:"string"}).option("all",{default:!1,describe:"Run every test in the suite (expensive)",type:"boolean"}).option("headed",{default:!1,describe:"Run with a visible browser window",type:"boolean"}).option("keep-alive",{default:!1,describe:"Leave an auto-started daemon running after the batch",type:"boolean"})}function vK(e){return e.command("status","Print the current scope",t=>t.option("format",{choices:["json","text"],default:"text",describe:"Output format"}),t=>BC({format:t.format})).command("add <test-ids..>","Bind one or more existing tests (stubs or implemented) to scope as agent intent",t=>{let r=[];return t.positional("test-ids",{array:!0,default:r,demandOption:!0,describe:"Slugs of existing workflows",type:"string"})},t=>VC({testIds:t["test-ids"]})).command("link <id> <test-id>","Link an existing scope item to a test",t=>t.positional("id",{demandOption:!0,describe:"Scope item id",type:"string"}).positional("test-id",{demandOption:!0,describe:"Slug of the workflow to link",type:"string"}),t=>UC({id:t.id,testId:t["test-id"]})).command("remove <ids..>","Remove one or more scope items by id",t=>{let r=[];return t.positional("ids",{array:!0,default:r,demandOption:!0,describe:"Scope item ids",type:"string"})},t=>WC({ids:t.ids})).demandCommand(1)}function xK(e){return e.command("pause","Disable all Ripplo pre-edit gates and stop enforcement until resumed",()=>{},()=>C0()).command("resume","Re-enable Ripplo hooks paused via `ripplo hooks pause`",()=>{},()=>E0()).demandCommand(1)}function kK(e){return e.command("list","List projects you have access to (JSON)",()=>{},()=>eR()).demandCommand(1)}function RK(e){return e.command("login","Authenticate via device flow",()=>{},()=>Pm()).command("status","Show authentication status",()=>{},()=>Im()).command("logout","Remove the saved token",()=>{},()=>{Am()}).demandCommand(1)}function CK(){let e=process.cwd(),t=Gl(e);t!=null&&t!==e&&(process.chdir(t),process.stderr.write(`ripplo: resolved .ripplo/ at ${t}
762
- `))}export{hK as main};
763
- /*! Bundled license information:
485
+ ${d("create")}`,runnableSlugs:c}}function _l(e){return typeof e=="object"&&e!=null&&Reflect.get(e,"stub")===!0}async function Fl(e){let t=$l.argv[1];if(t==null)return{error:le("CLI entry missing (process.argv[1])"),infra:!1};let r=await Se(e);if(r!=null){let i=xe(r);return Re(r.serverUrl)?{error:le(i),infra:!1}:{error:Ke({lines:[i],retried:!1}),infra:!0}}let n=await z({cliEntry:t,cwd:e});if(n.isErr())return{error:le(A(n.error)),infra:!1};let o=n.value;try{return await Nl({connection:o,cwd:e})}finally{o.spawned&&await K(o),o.socket.destroy()}}async function Nl({connection:e,cwd:t}){let r=await co({connection:e,cwd:t,tests:[]});if(r.kind==="transport")return{error:le(r.message),infra:!1};let n=r.notRun.length>0?await co({connection:e,cwd:t,tests:r.notRun.map(a=>a.testName)}):null,o=n==null||n.kind==="transport"?r.notRun:n.notRun,i=[...r.failedLines,...n!=null&&n.kind==="done"?n.failedLines:[]];return Ul({failedLines:i,notRun:o,retried:n!=null})}function Ul({failedLines:e,notRun:t,retried:r}){if(e.length===0&&t.length===0)return{error:null,infra:!1};let n=e.length>0?lo(e):null,o=t.length>0?Ke({lines:t.map(i=>i.line),retried:r}):null;return{error:[n,o].filter(i=>i!=null).join(`
764
486
 
765
- rrweb/dist/rrweb.js:
766
- (*! *****************************************************************************
767
- Copyright (c) Microsoft Corporation.
768
-
769
- Permission to use, copy, modify, and/or distribute this software for any
770
- purpose with or without fee is hereby granted.
771
-
772
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
773
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
774
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
775
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
776
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
777
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
778
- PERFORMANCE OF THIS SOFTWARE.
779
- ***************************************************************************** *)
780
- */
487
+ `),infra:n==null}}async function co({connection:e,cwd:t,tests:r}){let n=[],o=[],i=El.join(t,".ripplo","debug"),a=new Il;return(await be({connection:e,request:{all:!1,headed:!1,tests:[...r]},token:a.token,onEvent:l=>{Hl({debugDir:i,event:l,failedLines:n,notRun:o})}})).match(l=>l.kind==="daemon-error"?{kind:"transport",message:Pe(l.error)}:{failedLines:n,kind:"done",notRun:o},l=>({kind:"transport",message:A(l)}))}function Hl({debugDir:e,event:t,failedLines:r,notRun:n}){if(t.kind!=="test-outcome"||t.outcome.kind==="pass")return;let o=Ce({debugDir:e,event:t})??t.testName;if(t.outcome.kind==="dispatch-error"||t.outcome.kind==="infra-error"){n.push({line:o,testName:t.testName});return}r.push(o)}import{z as uo}from"zod";var Ml=uo.looseObject({skill:uo.string()}),mo=f("PostToolUse",e=>{if(e.tool_name!=="Skill")return;let t=Ml.safeParse(e.tool_input);if(!t.success)return;let r=/^ripplo:(.+)$/.exec(t.data.skill);if(r==null)return;let n=r[1];n!=null&&m(e.cwd)&&Te(e.cwd,e.session_id,n)});var Wl=/(?:^|\s)\/ripplo:([a-z][a-z0-9-]*)\b/gi,fo=f("UserPromptSubmit",e=>{m(e.cwd)&&[...e.prompt.matchAll(Wl)].map(t=>t[1]).filter(t=>t!=null).forEach(t=>{Te(e.cwd,e.session_id,t)})});oc();W(process.cwd());rt();var go={"exit-plan-gate":$n,"plan-reminder":In,"post-edit-flag-stubs":Hn,"post-edit-lint":Gn,"pre-bash-hooks-pause-gate":zn,"pre-bash-run-gate":Xn,"pre-edit-ripplo-skill-gate":eo,"pre-edit-scope-gate":no,"pre-edit-watch-gate":io,"scope-reminder":so,"session-preamble":ao,"stop-enforce":po,"track-skill-load":mo,"track-skill-prompt":fo};async function Gl(){await Bl(Vl(process.argv)).scriptName("ripplo").version(ar()).command(Ql()).command("concurrency [value]","Show or set max local concurrent runs (daemon applies live)",e=>e.positional("value",{type:"number"}),e=>yr({value:e.value})).command("auth <subcommand>","Manage authentication",nc).command("projects <subcommand>","Inspect Ripplo projects",rc).command("hooks <subcommand>","Pause or resume Ripplo hooks",tc).command("init","Scaffold .ripplo/ in this project",e=>e.option("project",{type:"string"}).option("env",{type:"string"}).option("app-url",{type:"string"}).option("engine-url",{type:"string"}),e=>Fr({appUrl:e["app-url"],engineUrl:e["engine-url"],envFile:e.env,projectId:e.project})).command("run [ids..]","Run tests locally via the daemon (auto-starts it if absent)",Zl,e=>sn({all:e.all,headed:e.headed,ids:e.ids,keepAlive:e["keep-alive"]})).command(Xl()).command(Kl()).command(Yl()).command("lint","Static model analysis (cascade gaps + law conflicts; no live app)",()=>{},()=>Nr()).command("sync","Push the compiled .ripplo/ resources to the server (no run)",()=>{},()=>yn()).command("compile","Compile the DSL and write .ripplo/ripplo.lock",e=>e.option("check",{default:!1,describe:"Exit non-zero if the lockfile is missing or stale (does not write)",type:"boolean"}),e=>gr({check:e.check})).command("doctor","Check project health",()=>{},()=>Er()).command("status","Report unimplemented tests and preconditions",e=>e.option("format",{choices:["json","summary"],default:"json",describe:"Output format"}),e=>Pn({format:e.format})).command("scope <subcommand>","Manage testing scope",ec).command("run-worker",!1,()=>{},()=>cn()).command("hook <name>","Internal: run a Claude Code plugin hook",e=>e.positional("name",{choices:Object.keys(go),demandOption:!0,type:"string"}),e=>Jl(e.name)).strict().help().parse()}async function Jl(e){let t=go[e];t==null&&(process.stderr.write(`Unknown hook: ${e}
488
+ `),process.exit(1));let r=await zl(),n=r.trim()===""?{}:JSON.parse(r),o=await t.run(n);o!=null&&process.stdout.write(JSON.stringify(o))}function zl(){return new Promise((e,t)=>{if(process.stdin.isTTY){e("");return}let r=[];process.stdin.on("data",n=>r.push(n)),process.stdin.on("end",()=>{e(Buffer.concat(r).toString("utf8"))}),process.stdin.on("error",t)})}Gl().catch(e=>{process.stderr.write(`${ft(e)}
489
+ `),process.exit(1)});function Kl(){return{command:"report-bug",describe:"Report a critical application bug caught while building or testing",builder:e=>e.option("kind",{choices:["new_feature_bug","regression","latent_bug"],demandOption:!0,describe:"new_feature_bug: broke the new thing being built; regression: broke previously working behavior; latent_bug: pre-existing bug exposed by new test coverage"}).option("title",{demandOption:!0,describe:"Short bug name",type:"string"}).option("root-cause",{demandOption:!0,describe:"What was actually wrong",type:"string"}).option("surfaced-by",{demandOption:!0,describe:"How the test/run exposed it (cite evidence)",type:"string"}).option("run",{describe:"Run id where it surfaced",type:"string"}).option("test",{describe:"Test id that surfaced it",type:"string"}),handler:e=>on({kind:e.kind,rootCause:e["root-cause"],runId:e.run,surfacedBy:e["surfaced-by"],testId:e.test,title:e.title})}}function Ql(){return{command:"daemon",describe:"Run the long-lived local executor (IPC socket + run subscription)",builder:e=>e.option("explore",{default:!1,describe:"Opt in to background exploration when idle (experimental)",type:"boolean"}).option("exploreConcurrency",{default:2,describe:"Max concurrent background exploration trails (keeps the machine responsive)",type:"number"}),handler:e=>kn({explore:e.explore,exploreConcurrency:e.exploreConcurrency})}}function Yl(){return{command:"explore",describe:"Run state-space exploration trails in the foreground (app + engine must be running)",builder:e=>e.option("trails",{default:10,describe:"Number of trails to execute before stopping (stops early on saturation)",type:"number"}).option("headed",{default:!1,describe:"Watch trails in a visible browser (stop the daemon explorer first if it holds the machine lock)",type:"boolean"}).command("findings [findingId]","List pending exploration findings, or show one finding's full detail",t=>t.positional("findingId",{type:"string"}).option("json",{default:!1,describe:"Emit the findings list as JSON",type:"boolean"}),t=>Zr({findingId:t.findingId,json:t.json})).command("replay <findingId>","Replay a finding's minimal trail; a clean replay resolves the finding and covers its targets",t=>t.positional("findingId",{demandOption:!0,type:"string"}),t=>en({findingId:t.findingId})),handler:e=>tn({headed:e.headed,trails:e.trails})}}function Xl(){return{command:"snapshot <runId>",describe:"Render a PNG of the page at a point in a run's rrweb recording",builder:e=>e.positional("runId",{demandOption:!0,type:"string"}).option("at",{describe:"Moment to render: epoch-ms timestamp exactly as found in behavior.jsonl",type:"number"}).option("offset",{describe:"Moment to render: ms from the start of the recording (alternative to --at)",type:"number"}).conflicts("at","offset"),handler:e=>hn({at:e.at,offset:e.offset,runId:e.runId})}}function Zl(e){let t=[];return e.positional("ids",{array:!0,default:t,describe:"Test ids to run",type:"string"}).option("all",{default:!1,describe:"Run every test in the suite (expensive)",type:"boolean"}).option("headed",{default:!1,describe:"Run with a visible browser window",type:"boolean"}).option("keep-alive",{default:!1,describe:"Leave an auto-started daemon running after the batch",type:"boolean"})}function ec(e){return e.command("status","Print the current scope",t=>t.option("format",{choices:["json","text"],default:"text",describe:"Output format"}),t=>Sn({format:t.format})).command("add <test-ids..>","Bind one or more existing tests (stubs or implemented) to scope as agent intent",t=>{let r=[];return t.positional("test-ids",{array:!0,default:r,demandOption:!0,describe:"Slugs of existing workflows",type:"string"})},t=>Rn({testIds:t["test-ids"]})).command("link <id> <test-id>","Link an existing scope item to a test",t=>t.positional("id",{demandOption:!0,describe:"Scope item id",type:"string"}).positional("test-id",{demandOption:!0,describe:"Slug of the workflow to link",type:"string"}),t=>Cn({id:t.id,testId:t["test-id"]})).command("remove <ids..>","Remove one or more scope items by id",t=>{let r=[];return t.positional("ids",{array:!0,default:r,demandOption:!0,describe:"Scope item ids",type:"string"})},t=>xn({ids:t.ids})).demandCommand(1)}function tc(e){return e.command("pause","Disable all Ripplo pre-edit gates and stop enforcement until resumed",()=>{},()=>$r()).command("resume","Re-enable Ripplo hooks paused via `ripplo hooks pause`",()=>{},()=>Ir()).demandCommand(1)}function rc(e){return e.command("list","List projects you have access to (JSON)",()=>{},()=>rn()).demandCommand(1)}function nc(e){return e.command("login","Authenticate via device flow",()=>{},()=>ur()).command("status","Show authentication status",()=>{},()=>mr()).command("logout","Remove the saved token",()=>{},()=>{fr()}).demandCommand(1)}function oc(){let e=process.cwd(),t=Qe(e);t!=null&&t!==e&&(process.chdir(t),process.stderr.write(`ripplo: resolved .ripplo/ at ${t}
490
+ `))}export{Gl as main};