@reason-machines/cli-linux-x64 0.2.542 → 0.2.545

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.
Files changed (49) hide show
  1. package/bin/reason +2 -2
  2. package/bin/vm-hands/{api-credentials-3z26de9c.js → api-credentials-ka0tgvfr.js} +1 -1
  3. package/bin/vm-hands/{api-xa565k61.js → api-vct1jx91.js} +1 -1
  4. package/bin/vm-hands/connect-cli-6pa06bp4.js +2 -0
  5. package/bin/vm-hands/{custom-endpoint-device-7tgcmhbz.js → custom-endpoint-device-rrzyx1tx.js} +1 -1
  6. package/bin/vm-hands/local-automation-nfmdd0bj.js +2 -0
  7. package/bin/vm-hands/{local-capabilities-6k3ggmw7.js → local-capabilities-9qs476nx.js} +1 -1
  8. package/bin/vm-hands/{local-display-session-91zf0wbr.js → local-display-session-v6se296d.js} +1 -1
  9. package/bin/vm-hands/local-display-video-s2447446.js +2 -0
  10. package/bin/vm-hands/{local-managed-process-wg791jcn.js → local-managed-process-j6dxwzsg.js} +1 -1
  11. package/bin/vm-hands/{local-pty-session-tnz6jwtt.js → local-pty-session-92d5hy1c.js} +1 -1
  12. package/bin/vm-hands/{managed-runtime-sz5vac4e.js → managed-runtime-g5ypgdzd.js} +1 -1
  13. package/bin/vm-hands/{network-contract-e98v6mwd.js → network-contract-dp38yj78.js} +1 -1
  14. package/bin/vm-hands/{permissions-dcx63j6r.js → permissions-nes7hvyb.js} +1 -1
  15. package/bin/vm-hands/{serve-service-shedp64y.js → serve-service-kr5ggkqy.js} +1 -1
  16. package/bin/vm-hands/{status-sxzr9ehz.js → status-gkdk2phq.js} +2 -2
  17. package/bin/vm-hands/version-qtakrr9g.js +2 -0
  18. package/bin/vm-hands/{vm-hands-entry-lite-wjrgcv8a.js → vm-hands-entry-lite-1b3x8f9z.js} +1 -1
  19. package/bin/vm-hands/{vm-hands-entry-lite-k3jm8km9.js → vm-hands-entry-lite-8jcb5jqm.js} +3 -3
  20. package/bin/vm-hands/{vm-hands-entry-lite-ngcc8fh4.js → vm-hands-entry-lite-8x8940ky.js} +1 -1
  21. package/bin/vm-hands/{vm-hands-entry-lite-dn5310w0.js → vm-hands-entry-lite-9r9tfka9.js} +1 -1
  22. package/bin/vm-hands/{vm-hands-entry-lite-nzxfr7dn.js → vm-hands-entry-lite-ax1rvy38.js} +1 -1
  23. package/bin/vm-hands/{vm-hands-entry-lite-ztsp4gs8.js → vm-hands-entry-lite-dszmx6yf.js} +1 -1
  24. package/bin/vm-hands/{vm-hands-entry-lite-hhrrfapg.js → vm-hands-entry-lite-eragp1xm.js} +5 -5
  25. package/bin/vm-hands/{vm-hands-entry-lite-4j8pm02n.js → vm-hands-entry-lite-gz65ybc2.js} +1 -1
  26. package/bin/vm-hands/{vm-hands-entry-lite-j5t2pj4v.js → vm-hands-entry-lite-hhk4h552.js} +1 -1
  27. package/bin/vm-hands/{vm-hands-entry-lite-qnyrqhac.js → vm-hands-entry-lite-kng982rg.js} +1 -1
  28. package/bin/vm-hands/{vm-hands-entry-lite-47bs0018.js → vm-hands-entry-lite-mbv4mqha.js} +1 -1
  29. package/bin/vm-hands/{vm-hands-entry-lite-qc6gxqgs.js → vm-hands-entry-lite-nxd394w3.js} +5 -5
  30. package/bin/vm-hands/{vm-hands-entry-lite-pp4a4cnb.js → vm-hands-entry-lite-p4z0dgch.js} +4 -4
  31. package/bin/vm-hands/{vm-hands-entry-lite-d5y2c61c.js → vm-hands-entry-lite-pfqj73fy.js} +1 -1
  32. package/bin/vm-hands/vm-hands-entry-lite-r34f55z4.js +2 -0
  33. package/bin/vm-hands/vm-hands-entry-lite-sxs29kff.js +3 -0
  34. package/bin/vm-hands/{vm-hands-entry-lite-vyeh8zkv.js → vm-hands-entry-lite-tpjqd8qx.js} +1 -1
  35. package/bin/vm-hands/{vm-hands-entry-lite-cgddp0y3.js → vm-hands-entry-lite-vj0gm694.js} +1 -1
  36. package/bin/vm-hands/{vm-hands-entry-lite-vczbtjs6.js → vm-hands-entry-lite-wb4fppse.js} +1 -1
  37. package/bin/vm-hands/{vm-hands-entry-lite-hcyfcznj.js → vm-hands-entry-lite-x7w4n87s.js} +1 -1
  38. package/bin/vm-hands/{vm-hands-entry-lite-37b5045h.js → vm-hands-entry-lite-xv7tgef8.js} +1 -1
  39. package/bin/vm-hands/vm-hands-entry-lite.js +2 -2
  40. package/bin/vm-hands/{vm-hands-executor-r1ezy9yp.js → vm-hands-executor-x1dympcw.js} +1 -1
  41. package/bin/vm-hands/{vm-hands-op-runner-4f4mrc13.js → vm-hands-op-runner-az83nsye.js} +1 -1
  42. package/bin/vm-hands/{vm-hands-runtime-27s7tm13.js → vm-hands-runtime-wfp8q87s.js} +3 -3
  43. package/package.json +1 -1
  44. package/bin/vm-hands/connect-cli-sg53pha8.js +0 -2
  45. package/bin/vm-hands/local-automation-xnb9ct37.js +0 -2
  46. package/bin/vm-hands/local-display-video-nhxmbq3q.js +0 -2
  47. package/bin/vm-hands/version-fa0dpe1d.js +0 -2
  48. package/bin/vm-hands/vm-hands-entry-lite-107tpag5.js +0 -2
  49. package/bin/vm-hands/vm-hands-entry-lite-mvq9xskq.js +0 -3
@@ -62,4 +62,4 @@ import{ys}from"./vm-hands-entry-lite-pzj5s203.js";var Xr,Xo=Object.freeze({statu
62
62
 
63
63
  `)}Z.write("payload.value = newResult;"),Z.write("return payload;");let Xs=Z.compile();return(B,j)=>Xs(P,B,j)},f,m=se,h=!ne.jitless,x=h&&rt.value,v=r.catchall,w;e._zod.parse=(P,Z)=>{w??(w=p.value);let O=P.value;if(!m(O))return P.issues.push({expected:"object",code:"invalid_type",input:O,inst:e}),P;if(h&&x&&Z?.async===!1&&Z.jitless!==!0){if(!f)f=l(r.shape);if(P=f(P,Z),!v)return P;return Qo([],O,P,Z,w,e)}return a(P,Z)}});function lo(e,r,a,p){for(let f of e)if(f.issues.length===0)return r.value=f.value,r;let l=e.filter((f)=>!re(f));if(l.length===1)return r.value=l[0].value,l[0];return r.issues.push({code:"invalid_union",input:r.value,inst:a,errors:e.map((f)=>f.issues.map((m)=>J(m,p,L())))}),r}var or=z("$ZodUnion",(e,r)=>{I.init(e,r),S(e._zod,"optin",()=>r.options.some((p)=>p._zod.optin==="optional")?"optional":void 0),S(e._zod,"optout",()=>r.options.some((p)=>p._zod.optout==="optional")?"optional":void 0),S(e._zod,"values",()=>{if(r.options.every((p)=>p._zod.values))return new Set(r.options.flatMap((p)=>Array.from(p._zod.values)));return}),S(e._zod,"pattern",()=>{if(r.options.every((p)=>p._zod.pattern)){let p=r.options.map((l)=>l._zod.pattern);return new RegExp(`^(${p.map((l)=>ke(l.source)).join("|")})$`)}return});let a=r.options.length===1?r.options[0]._zod.run:null;e._zod.parse=(p,l)=>{if(a)return a(p,l);let f=!1,m=[];for(let h of r.options){let _=h._zod.run({value:p.value,issues:[]},l);if(_ instanceof Promise)m.push(_),f=!0;else{if(_.issues.length===0)return _;m.push(_)}}if(!f)return lo(m,p,e,l);return Promise.all(m).then((h)=>lo(h,p,e,l))}});var rn=z("$ZodDiscriminatedUnion",(e,r)=>{r.inclusive=!1,or.init(e,r);let a=e._zod.parse;S(e._zod,"propValues",()=>{let l={};for(let f of r.options){let m=f._zod.propValues;if(!m||Object.keys(m).length===0)throw Error(`Invalid discriminated union option at index "${r.options.indexOf(f)}"`);for(let[h,_]of Object.entries(m)){if(!l[h])l[h]=new Set;for(let x of _)l[h].add(x)}}return l});let p=pe(()=>{let l=r.options,f=new Map;for(let m of l){let h=m._zod.propValues?.[r.discriminator];if(!h||h.size===0)throw Error(`Invalid discriminated union option at index "${r.options.indexOf(m)}"`);for(let _ of h){if(f.has(_))throw Error(`Duplicate discriminator value "${String(_)}"`);f.set(_,m)}}return f});e._zod.parse=(l,f)=>{let m=l.value;if(!se(m))return l.issues.push({code:"invalid_type",expected:"object",input:m,inst:e}),l;let h=p.value.get(m?.[r.discriminator]);if(h)return h._zod.run(l,f);if(r.unionFallback||f.direction==="backward")return a(l,f);return l.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:r.discriminator,options:Array.from(p.value.keys()),input:m,path:[r.discriminator],inst:e}),l}}),tn=z("$ZodIntersection",(e,r)=>{I.init(e,r),e._zod.parse=(a,p)=>{let l=a.value,f=r.left._zod.run({value:l,issues:[]},p),m=r.right._zod.run({value:l,issues:[]},p);if(f instanceof Promise||m instanceof Promise)return Promise.all([f,m]).then(([_,x])=>fo(a,_,x));return fo(a,f,m)}});function rr(e,r){if(e===r)return{valid:!0,data:e};if(e instanceof Date&&r instanceof Date&&+e===+r)return{valid:!0,data:e};if(Q(e)&&Q(r)){let a=Object.keys(r),p=Object.keys(e).filter((f)=>a.indexOf(f)!==-1),l={...e,...r};for(let f of p){let m=rr(e[f],r[f]);if(!m.valid)return{valid:!1,mergeErrorPath:[f,...m.mergeErrorPath]};l[f]=m.data}return{valid:!0,data:l}}if(Array.isArray(e)&&Array.isArray(r)){if(e.length!==r.length)return{valid:!1,mergeErrorPath:[]};let a=[];for(let p=0;p<e.length;p++){let l=e[p],f=r[p],m=rr(l,f);if(!m.valid)return{valid:!1,mergeErrorPath:[p,...m.mergeErrorPath]};a.push(m.data)}return{valid:!0,data:a}}return{valid:!1,mergeErrorPath:[]}}function fo(e,r,a){let p=new Map,l;for(let h of r.issues)if(h.code==="unrecognized_keys"){l??(l=h);for(let _ of h.keys){if(!p.has(_))p.set(_,{});p.get(_).l=!0}}else e.issues.push(h);for(let h of a.issues)if(h.code==="unrecognized_keys")for(let _ of h.keys){if(!p.has(_))p.set(_,{});p.get(_).r=!0}else e.issues.push(h);let f=[...p].filter(([,h])=>h.l&&h.r).map(([h])=>h);if(f.length&&l)e.issues.push({...l,keys:f});if(re(e))return e;let m=rr(r.value,a.value);if(!m.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(m.mergeErrorPath)}`);return e.value=m.data,e}var on=z("$ZodRecord",(e,r)=>{I.init(e,r),e._zod.parse=(a,p)=>{let l=a.value;if(!Q(l))return a.issues.push({expected:"record",code:"invalid_type",input:l,inst:e}),a;let f=[],m=r.keyType._zod.values;if(m){a.value={};let h=new Set;for(let x of m)if(typeof x==="string"||typeof x==="number"||typeof x==="symbol"){h.add(typeof x==="number"?x.toString():x);let v=r.keyType._zod.run({value:x,issues:[]},p);if(v instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(v.issues.length){a.issues.push({code:"invalid_key",origin:"record",issues:v.issues.map((Z)=>J(Z,p,L())),input:x,path:[x],inst:e});continue}let w=v.value,P=r.valueType._zod.run({value:l[x],issues:[]},p);if(P instanceof Promise)f.push(P.then((Z)=>{if(Z.issues.length)a.issues.push(...q(x,Z.issues));a.value[w]=Z.value}));else{if(P.issues.length)a.issues.push(...q(x,P.issues));a.value[w]=P.value}}let _;for(let x in l)if(!h.has(x))_=_??[],_.push(x);if(_&&_.length>0)a.issues.push({code:"unrecognized_keys",input:l,inst:e,keys:_})}else{a.value={};for(let h of Reflect.ownKeys(l)){if(h==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(l,h))continue;let _=r.keyType._zod.run({value:h,issues:[]},p);if(_ instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof h==="string"&&Xe.test(h)&&_.issues.length){let w=r.keyType._zod.run({value:Number(h),issues:[]},p);if(w instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(w.issues.length===0)_=w}if(_.issues.length){if(r.mode==="loose")a.value[h]=l[h];else a.issues.push({code:"invalid_key",origin:"record",issues:_.issues.map((w)=>J(w,p,L())),input:h,path:[h],inst:e});continue}let v=r.valueType._zod.run({value:l[h],issues:[]},p);if(v instanceof Promise)f.push(v.then((w)=>{if(w.issues.length)a.issues.push(...q(h,w.issues));a.value[_.value]=w.value}));else{if(v.issues.length)a.issues.push(...q(h,v.issues));a.value[_.value]=v.value}}}if(f.length)return Promise.all(f).then(()=>a);return a}});var nn=z("$ZodEnum",(e,r)=>{I.init(e,r);let a=be(r.entries),p=new Set(a);e._zod.values=p,e._zod.pattern=new RegExp(`^(${a.filter((l)=>tt.has(typeof l)).map((l)=>typeof l==="string"?G(l):l.toString()).join("|")})$`),e._zod.parse=(l,f)=>{let m=l.value;if(p.has(m))return l;return l.issues.push({code:"invalid_value",values:a,input:m,inst:e}),l}}),sn=z("$ZodLiteral",(e,r)=>{if(I.init(e,r),r.values.length===0)throw Error("Cannot create literal schema with no valid values");let a=new Set(r.values);e._zod.values=a,e._zod.pattern=new RegExp(`^(${r.values.map((p)=>typeof p==="string"?G(p):p?G(p.toString()):String(p)).join("|")})$`),e._zod.parse=(p,l)=>{let f=p.value;if(a.has(f))return p;return p.issues.push({code:"invalid_value",values:r.values,input:f,inst:e}),p}});var un=z("$ZodTransform",(e,r)=>{I.init(e,r),e._zod.optin="optional",e._zod.parse=(a,p)=>{if(p.direction==="backward")throw new ue(e.constructor.name);let l=r.transform(a.value,a);if(p.async)return(l instanceof Promise?l:Promise.resolve(l)).then((m)=>(a.value=m,a.fallback=!0,a));if(l instanceof Promise)throw new V;return a.value=l,a.fallback=!0,a}});function mo(e,r){if(r===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}var nr=z("$ZodOptional",(e,r)=>{I.init(e,r),e._zod.optin="optional",e._zod.optout="optional",S(e._zod,"values",()=>r.innerType._zod.values?new Set([...r.innerType._zod.values,void 0]):void 0),S(e._zod,"pattern",()=>{let a=r.innerType._zod.pattern;return a?new RegExp(`^(${ke(a.source)})?$`):void 0}),e._zod.parse=(a,p)=>{if(r.innerType._zod.optin==="optional"){let l=a.value,f=r.innerType._zod.run(a,p);if(f instanceof Promise)return f.then((m)=>mo(m,l));return mo(f,l)}if(a.value===void 0)return a;return r.innerType._zod.run(a,p)}}),pn=z("$ZodExactOptional",(e,r)=>{nr.init(e,r),S(e._zod,"values",()=>r.innerType._zod.values),S(e._zod,"pattern",()=>r.innerType._zod.pattern),e._zod.parse=(a,p)=>r.innerType._zod.run(a,p)}),ln=z("$ZodNullable",(e,r)=>{I.init(e,r),S(e._zod,"optin",()=>r.innerType._zod.optin),S(e._zod,"optout",()=>r.innerType._zod.optout),S(e._zod,"pattern",()=>{let a=r.innerType._zod.pattern;return a?new RegExp(`^(${ke(a.source)}|null)$`):void 0}),S(e._zod,"values",()=>r.innerType._zod.values?new Set([...r.innerType._zod.values,null]):void 0),e._zod.parse=(a,p)=>{if(a.value===null)return a;return r.innerType._zod.run(a,p)}}),fn=z("$ZodDefault",(e,r)=>{I.init(e,r),e._zod.optin="optional",S(e._zod,"values",()=>r.innerType._zod.values),e._zod.parse=(a,p)=>{if(p.direction==="backward")return r.innerType._zod.run(a,p);if(a.value===void 0)return a.value=r.defaultValue,a;let l=r.innerType._zod.run(a,p);if(l instanceof Promise)return l.then((f)=>ho(f,r));return ho(l,r)}});function ho(e,r){if(e.value===void 0)e.value=r.defaultValue;return e}var dn=z("$ZodPrefault",(e,r)=>{I.init(e,r),e._zod.optin="optional",S(e._zod,"values",()=>r.innerType._zod.values),e._zod.parse=(a,p)=>{if(p.direction==="backward")return r.innerType._zod.run(a,p);if(a.value===void 0)a.value=r.defaultValue;return r.innerType._zod.run(a,p)}}),mn=z("$ZodNonOptional",(e,r)=>{I.init(e,r),S(e._zod,"values",()=>{let a=r.innerType._zod.values;return a?new Set([...a].filter((p)=>p!==void 0)):void 0}),e._zod.parse=(a,p)=>{let l=r.innerType._zod.run(a,p);if(l instanceof Promise)return l.then((f)=>_o(f,e));return _o(l,e)}});function _o(e,r){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:r});return e}var hn=z("$ZodCatch",(e,r)=>{I.init(e,r),e._zod.optin="optional",S(e._zod,"optout",()=>r.innerType._zod.optout),S(e._zod,"values",()=>r.innerType._zod.values),e._zod.parse=(a,p)=>{if(p.direction==="backward")return r.innerType._zod.run(a,p);let l=r.innerType._zod.run(a,p);if(l instanceof Promise)return l.then((f)=>{if(a.value=f.value,f.issues.length)a.value=r.catchValue({...a,error:{issues:f.issues.map((m)=>J(m,p,L()))},input:a.value}),a.issues=[],a.fallback=!0;return a});if(a.value=l.value,l.issues.length)a.value=r.catchValue({...a,error:{issues:l.issues.map((f)=>J(f,p,L()))},input:a.value}),a.issues=[],a.fallback=!0;return a}});var _n=z("$ZodPipe",(e,r)=>{I.init(e,r),S(e._zod,"values",()=>r.in._zod.values),S(e._zod,"optin",()=>r.in._zod.optin),S(e._zod,"optout",()=>r.out._zod.optout),S(e._zod,"propValues",()=>r.in._zod.propValues),e._zod.parse=(a,p)=>{if(p.direction==="backward"){let f=r.out._zod.run(a,p);if(f instanceof Promise)return f.then((m)=>Te(m,r.in,p));return Te(f,r.in,p)}let l=r.in._zod.run(a,p);if(l instanceof Promise)return l.then((f)=>Te(f,r.out,p));return Te(l,r.out,p)}});function Te(e,r,a){if(e.issues.length)return e.aborted=!0,e;return r._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},a)}var gn=z("$ZodReadonly",(e,r)=>{I.init(e,r),S(e._zod,"propValues",()=>r.innerType._zod.propValues),S(e._zod,"values",()=>r.innerType._zod.values),S(e._zod,"optin",()=>r.innerType?._zod?.optin),S(e._zod,"optout",()=>r.innerType?._zod?.optout),e._zod.parse=(a,p)=>{if(p.direction==="backward")return r.innerType._zod.run(a,p);let l=r.innerType._zod.run(a,p);if(l instanceof Promise)return l.then(go);return go(l)}});function go(e){return e.value=Object.freeze(e.value),e}var xn=z("$ZodLazy",(e,r)=>{I.init(e,r),S(e._zod,"innerType",()=>{let a=r;if(!a._cachedInner)a._cachedInner=r.getter();return a._cachedInner}),S(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),S(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),S(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),S(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(a,p)=>e._zod.innerType._zod.run(a,p)}),zn=z("$ZodCustom",(e,r)=>{D.init(e,r),I.init(e,r),e._zod.parse=(a,p)=>a,e._zod.check=(a)=>{let p=a.value,l=r.fn(p);if(l instanceof Promise)return l.then((f)=>xo(f,a,p,e));xo(l,a,p,e);return}});function xo(e,r,a,p){if(!e){let l={code:"custom",input:a,inst:p,path:[...p._zod.def.path??[]],continue:!p._zod.def.abort};if(p._zod.def.params)l.params=p._zod.def.params;r.issues.push(te(l))}}var vn,Rc=Symbol("ZodOutput"),Dc=Symbol("ZodInput");class yn{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let a=r[0];if(this._map.set(e,a),a&&typeof a==="object"&&"id"in a)this._idmap.set(a.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);if(r&&typeof r==="object"&&"id"in r)this._idmap.delete(r.id);return this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let a={...this.get(r)??{}};delete a.id;let p={...a,...this._map.get(e)};return Object.keys(p).length?p:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function li(){return new yn}(vn=globalThis).__zod_globalRegistry??(vn.__zod_globalRegistry=li());var oe=globalThis.__zod_globalRegistry;function $n(e,r){return new e({type:"string",...b(r)})}function bn(e,r){return new e({type:"string",format:"email",check:"string_format",abort:!1,...b(r)})}function je(e,r){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...b(r)})}function sr(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...b(r)})}function wn(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...b(r)})}function kn(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...b(r)})}function Zn(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...b(r)})}function ir(e,r){return new e({type:"string",format:"url",check:"string_format",abort:!1,...b(r)})}function Pn(e,r){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...b(r)})}function Sn(e,r){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...b(r)})}function On(e,r){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...b(r)})}function En(e,r){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...b(r)})}function In(e,r){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...b(r)})}function Tn(e,r){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...b(r)})}function Nn(e,r){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...b(r)})}function An(e,r){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...b(r)})}function jn(e,r){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...b(r)})}function Cn(e,r){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...b(r)})}function Rn(e,r){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...b(r)})}function Dn(e,r){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...b(r)})}function Ln(e,r){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...b(r)})}function Fn(e,r){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...b(r)})}function Un(e,r){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...b(r)})}function Mn(e,r){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...b(r)})}function Jn(e,r){return new e({type:"string",format:"date",check:"string_format",...b(r)})}function Bn(e,r){return new e({type:"string",format:"time",check:"string_format",precision:null,...b(r)})}function Vn(e,r){return new e({type:"string",format:"duration",check:"string_format",...b(r)})}function Wn(e,r){return new e({type:"number",checks:[],...b(r)})}function Kn(e,r){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...b(r)})}function Gn(e,r){return new e({type:"boolean",...b(r)})}function qn(e,r){return new e({type:"null",...b(r)})}function Yn(e){return new e({type:"unknown"})}function Xn(e,r){return new e({type:"never",...b(r)})}function Ce(e,r){return new He({check:"less_than",...b(r),value:e,inclusive:!1})}function me(e,r){return new He({check:"less_than",...b(r),value:e,inclusive:!0})}function Re(e,r){return new Qe({check:"greater_than",...b(r),value:e,inclusive:!1})}function he(e,r){return new Qe({check:"greater_than",...b(r),value:e,inclusive:!0})}function De(e,r){return new Yt({check:"multiple_of",...b(r),value:e})}function Le(e,r){return new Ht({check:"max_length",...b(r),maximum:e})}function ie(e,r){return new Qt({check:"min_length",...b(r),minimum:e})}function Fe(e,r){return new eo({check:"length_equals",...b(r),length:e})}function cr(e,r){return new ro({check:"string_format",format:"regex",...b(r),pattern:e})}function ur(e){return new to({check:"string_format",format:"lowercase",...b(e)})}function ar(e){return new oo({check:"string_format",format:"uppercase",...b(e)})}function pr(e,r){return new no({check:"string_format",format:"includes",...b(r),includes:e})}function lr(e,r){return new so({check:"string_format",format:"starts_with",...b(r),prefix:e})}function fr(e,r){return new io({check:"string_format",format:"ends_with",...b(r),suffix:e})}function X(e){return new co({check:"overwrite",tx:e})}function dr(e){return X((r)=>r.normalize(e))}function mr(){return X((e)=>e.trim())}function hr(){return X((e)=>e.toLowerCase())}function _r(){return X((e)=>e.toUpperCase())}function gr(){return X((e)=>et(e))}function Hn(e,r,a){return new e({type:"array",element:r,...b(a)})}function Qn(e,r,a){let p=b(a);return p.abort??(p.abort=!0),new e({type:"custom",check:"custom",fn:r,...p})}function es(e,r,a){return new e({type:"custom",check:"custom",fn:r,...b(a)})}function rs(e,r){let a=fi((p)=>(p.addIssue=(l)=>{if(typeof l==="string")p.issues.push(te(l,p.value,a._zod.def));else{let f=l;if(f.fatal)f.continue=!1;f.code??(f.code="custom"),f.input??(f.input=p.value),f.inst??(f.inst=a),f.continue??(f.continue=!a._zod.def.abort),p.issues.push(te(f))}},e(p.value,p)),r);return a}function fi(e,r){let a=new D({check:"custom",...b(r)});return a._zod.check=e,a}function ge(e){let r=e?.target??"draft-2020-12";if(r==="draft-4")r="draft-04";if(r==="draft-7")r="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??oe,target:r,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function E(e,r,a={path:[],schemaPath:[]}){var p;let l=e._zod.def,f=r.seen.get(e);if(f){if(f.count++,a.schemaPath.includes(e))f.cycle=a.path;return f.schema}let m={schema:{},count:1,cycle:void 0,path:a.path};r.seen.set(e,m);let h=e._zod.toJSONSchema?.();if(h)m.schema=h;else{let v={...a,schemaPath:[...a.schemaPath,e],path:a.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(r,m.schema,v);else{let P=m.schema,Z=r.processors[l.type];if(!Z)throw Error(`[toJSONSchema]: Non-representable type encountered: ${l.type}`);Z(e,r,P,v)}let w=e._zod.parent;if(w){if(!m.ref)m.ref=w;E(w,r,v),r.seen.get(w).isParent=!0}}let _=r.metadataRegistry.get(e);if(_)Object.assign(m.schema,_);if(r.io==="input"&&F(e))delete m.schema.examples,delete m.schema.default;if(r.io==="input"&&"_prefault"in m.schema)(p=m.schema).default??(p.default=m.schema._prefault);return delete m.schema._prefault,r.seen.get(e).schema}function xe(e,r){let a=e.seen.get(r);if(!a)throw Error("Unprocessed schema. This is a bug in Zod.");let p=new Map;for(let m of e.seen.entries()){let h=e.metadataRegistry.get(m[0])?.id;if(h){let _=p.get(h);if(_&&_!==m[0])throw Error(`Duplicate schema id "${h}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);p.set(h,m[0])}}let l=(m)=>{let h=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let w=e.external.registry.get(m[0])?.id,P=e.external.uri??((O)=>O);if(w)return{ref:P(w)};let Z=m[1].defId??m[1].schema.id??`schema${e.counter++}`;return m[1].defId=Z,{defId:Z,ref:`${P("__shared")}#/${h}/${Z}`}}if(m[1]===a)return{ref:"#"};let x=`${"#"}/${h}/`,v=m[1].schema.id??`__schema${e.counter++}`;return{defId:v,ref:x+v}},f=(m)=>{if(m[1].schema.$ref)return;let h=m[1],{ref:_,defId:x}=l(m);if(h.def={...h.schema},x)h.defId=x;let v=h.schema;for(let w in v)delete v[w];v.$ref=_};if(e.cycles==="throw")for(let m of e.seen.entries()){let h=m[1];if(h.cycle)throw Error(`Cycle detected: #/${h.cycle?.join("/")}/<root>
64
64
 
65
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let m of e.seen.entries()){let h=m[1];if(r===m[0]){f(m);continue}if(e.external){let x=e.external.registry.get(m[0])?.id;if(r!==m[0]&&x){f(m);continue}}if(e.metadataRegistry.get(m[0])?.id){f(m);continue}if(h.cycle){f(m);continue}if(h.count>1){if(e.reused==="ref"){f(m);continue}}}}function ze(e,r){let a=e.seen.get(r);if(!a)throw Error("Unprocessed schema. This is a bug in Zod.");let p=(h)=>{let _=e.seen.get(h);if(_.ref===null)return;let x=_.def??_.schema,v={...x},w=_.ref;if(_.ref=null,w){p(w);let Z=e.seen.get(w),O=Z.schema;if(O.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))x.allOf=x.allOf??[],x.allOf.push(O);else Object.assign(x,O);if(Object.assign(x,v),h._zod.parent===w)for(let C in x){if(C==="$ref"||C==="allOf")continue;if(!(C in v))delete x[C]}if(O.$ref&&Z.def)for(let C in x){if(C==="$ref"||C==="allOf")continue;if(C in Z.def&&JSON.stringify(x[C])===JSON.stringify(Z.def[C]))delete x[C]}}let P=h._zod.parent;if(P&&P!==w){p(P);let Z=e.seen.get(P);if(Z?.schema.$ref){if(x.$ref=Z.schema.$ref,Z.def)for(let O in x){if(O==="$ref"||O==="allOf")continue;if(O in Z.def&&JSON.stringify(x[O])===JSON.stringify(Z.def[O]))delete x[O]}}}e.override({zodSchema:h,jsonSchema:x,path:_.path??[]})};for(let h of[...e.seen.entries()].reverse())p(h[0]);let l={};if(e.target==="draft-2020-12")l.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")l.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")l.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let h=e.external.registry.get(r)?.id;if(!h)throw Error("Schema is missing an `id` property");l.$id=e.external.uri(h)}Object.assign(l,a.def??a.schema);let f=e.metadataRegistry.get(r)?.id;if(f!==void 0&&l.id===f)delete l.id;let m=e.external?.defs??{};for(let h of e.seen.entries()){let _=h[1];if(_.def&&_.defId){if(_.def.id===_.defId)delete _.def.id;m[_.defId]=_.def}}if(e.external);else if(Object.keys(m).length>0)if(e.target==="draft-2020-12")l.$defs=m;else l.definitions=m;try{let h=JSON.parse(JSON.stringify(l));return Object.defineProperty(h,"~standard",{value:{...r["~standard"],jsonSchema:{input:_e(r,"input",e.processors),output:_e(r,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch(h){throw Error("Error converting schema to JSON.")}}function F(e,r){let a=r??{seen:new Set};if(a.seen.has(e))return!1;a.seen.add(e);let p=e._zod.def;if(p.type==="transform")return!0;if(p.type==="array")return F(p.element,a);if(p.type==="set")return F(p.valueType,a);if(p.type==="lazy")return F(p.getter(),a);if(p.type==="promise"||p.type==="optional"||p.type==="nonoptional"||p.type==="nullable"||p.type==="readonly"||p.type==="default"||p.type==="prefault")return F(p.innerType,a);if(p.type==="intersection")return F(p.left,a)||F(p.right,a);if(p.type==="record"||p.type==="map")return F(p.keyType,a)||F(p.valueType,a);if(p.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return F(p.in,a)||F(p.out,a)}if(p.type==="object"){for(let l in p.shape)if(F(p.shape[l],a))return!0;return!1}if(p.type==="union"){for(let l of p.options)if(F(l,a))return!0;return!1}if(p.type==="tuple"){for(let l of p.items)if(F(l,a))return!0;if(p.rest&&F(p.rest,a))return!0;return!1}return!1}var ts=(e,r={})=>(a)=>{let p=ge({...a,processors:r});return E(e,p),xe(p,e),ze(p,e)},_e=(e,r,a={})=>(p)=>{let{libraryOptions:l,target:f}=p??{},m=ge({...l??{},target:f,io:r,processors:a});return E(e,m),xe(m,e),ze(m,e)};var di={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},xr=(e,r,a,p)=>{let l=a;l.type="string";let{minimum:f,maximum:m,format:h,patterns:_,contentEncoding:x}=e._zod.bag;if(typeof f==="number")l.minLength=f;if(typeof m==="number")l.maxLength=m;if(h){if(l.format=di[h]??h,l.format==="")delete l.format;if(h==="time")delete l.format}if(x)l.contentEncoding=x;if(_&&_.size>0){let v=[..._];if(v.length===1)l.pattern=v[0].source;else if(v.length>1)l.allOf=[...v.map((w)=>({...r.target==="draft-07"||r.target==="draft-04"||r.target==="openapi-3.0"?{type:"string"}:{},pattern:w.source}))]}},zr=(e,r,a,p)=>{let l=a,{minimum:f,maximum:m,format:h,multipleOf:_,exclusiveMaximum:x,exclusiveMinimum:v}=e._zod.bag;if(typeof h==="string"&&h.includes("int"))l.type="integer";else l.type="number";let w=typeof v==="number"&&v>=(f??Number.NEGATIVE_INFINITY),P=typeof x==="number"&&x<=(m??Number.POSITIVE_INFINITY),Z=r.target==="draft-04"||r.target==="openapi-3.0";if(w)if(Z)l.minimum=v,l.exclusiveMinimum=!0;else l.exclusiveMinimum=v;else if(typeof f==="number")l.minimum=f;if(P)if(Z)l.maximum=x,l.exclusiveMaximum=!0;else l.exclusiveMaximum=x;else if(typeof m==="number")l.maximum=m;if(typeof _==="number")l.multipleOf=_},vr=(e,r,a,p)=>{a.type="boolean"},ns=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},ss=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},yr=(e,r,a,p)=>{if(r.target==="openapi-3.0")a.type="string",a.nullable=!0,a.enum=[null];else a.type="null"},is=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},cs=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},$r=(e,r,a,p)=>{a.not={}},us=(e,r,a,p)=>{},br=(e,r,a,p)=>{},as=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},wr=(e,r,a,p)=>{let l=e._zod.def,f=be(l.entries);if(f.every((m)=>typeof m==="number"))a.type="number";if(f.every((m)=>typeof m==="string"))a.type="string";a.enum=f},kr=(e,r,a,p)=>{let l=e._zod.def,f=[];for(let m of l.values)if(m===void 0){if(r.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof m==="bigint")if(r.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else f.push(Number(m));else f.push(m);if(f.length===0);else if(f.length===1){let m=f[0];if(a.type=m===null?"null":typeof m,r.target==="draft-04"||r.target==="openapi-3.0")a.enum=[m];else a.const=m}else{if(f.every((m)=>typeof m==="number"))a.type="number";if(f.every((m)=>typeof m==="string"))a.type="string";if(f.every((m)=>typeof m==="boolean"))a.type="boolean";if(f.every((m)=>m===null))a.type="null";a.enum=f}},ps=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},ls=(e,r,a,p)=>{let l=a,f=e._zod.pattern;if(!f)throw Error("Pattern not found in template literal");l.type="string",l.pattern=f.source},fs=(e,r,a,p)=>{let l=a,f={type:"string",format:"binary",contentEncoding:"binary"},{minimum:m,maximum:h,mime:_}=e._zod.bag;if(m!==void 0)f.minLength=m;if(h!==void 0)f.maxLength=h;if(_)if(_.length===1)f.contentMediaType=_[0],Object.assign(l,f);else Object.assign(l,f),l.anyOf=_.map((x)=>({contentMediaType:x}));else Object.assign(l,f)},ds=(e,r,a,p)=>{a.type="boolean"},Zr=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},hs=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},Pr=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},xs=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},zs=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},Sr=(e,r,a,p)=>{let l=a,f=e._zod.def,{minimum:m,maximum:h}=e._zod.bag;if(typeof m==="number")l.minItems=m;if(typeof h==="number")l.maxItems=h;l.type="array",l.items=E(f.element,r,{...p,path:[...p.path,"items"]})},Or=(e,r,a,p)=>{let l=a,f=e._zod.def;l.type="object",l.properties={};let m=f.shape;for(let x in m)l.properties[x]=E(m[x],r,{...p,path:[...p.path,"properties",x]});let h=new Set(Object.keys(m)),_=new Set([...h].filter((x)=>{let v=f.shape[x]._zod;if(r.io==="input")return v.optin===void 0;else return v.optout===void 0}));if(_.size>0)l.required=Array.from(_);if(f.catchall?._zod.def.type==="never")l.additionalProperties=!1;else if(!f.catchall){if(r.io==="output")l.additionalProperties=!1}else if(f.catchall)l.additionalProperties=E(f.catchall,r,{...p,path:[...p.path,"additionalProperties"]})},Er=(e,r,a,p)=>{let l=e._zod.def,f=l.inclusive===!1,m=l.options.map((h,_)=>E(h,r,{...p,path:[...p.path,f?"oneOf":"anyOf",_]}));if(f)a.oneOf=m;else a.anyOf=m},Ir=(e,r,a,p)=>{let l=e._zod.def,f=E(l.left,r,{...p,path:[...p.path,"allOf",0]}),m=E(l.right,r,{...p,path:[...p.path,"allOf",1]}),h=(x)=>("allOf"in x)&&Object.keys(x).length===1,_=[...h(f)?f.allOf:[f],...h(m)?m.allOf:[m]];a.allOf=_},vs=(e,r,a,p)=>{let l=a,f=e._zod.def;l.type="array";let m=r.target==="draft-2020-12"?"prefixItems":"items",h=r.target==="draft-2020-12"?"items":r.target==="openapi-3.0"?"items":"additionalItems",_=f.items.map((P,Z)=>E(P,r,{...p,path:[...p.path,m,Z]})),x=f.rest?E(f.rest,r,{...p,path:[...p.path,h,...r.target==="openapi-3.0"?[f.items.length]:[]]}):null;if(r.target==="draft-2020-12"){if(l.prefixItems=_,x)l.items=x}else if(r.target==="openapi-3.0"){if(l.items={anyOf:_},x)l.items.anyOf.push(x);if(l.minItems=_.length,!x)l.maxItems=_.length}else if(l.items=_,x)l.additionalItems=x;let{minimum:v,maximum:w}=e._zod.bag;if(typeof v==="number")l.minItems=v;if(typeof w==="number")l.maxItems=w},Tr=(e,r,a,p)=>{let l=a,f=e._zod.def;l.type="object";let m=f.keyType,_=m._zod.bag?.patterns;if(f.mode==="loose"&&_&&_.size>0){let v=E(f.valueType,r,{...p,path:[...p.path,"patternProperties","*"]});l.patternProperties={};for(let w of _)l.patternProperties[w.source]=v}else{if(r.target==="draft-07"||r.target==="draft-2020-12")l.propertyNames=E(f.keyType,r,{...p,path:[...p.path,"propertyNames"]});l.additionalProperties=E(f.valueType,r,{...p,path:[...p.path,"additionalProperties"]})}let x=m._zod.values;if(x){let v=[...x].filter((w)=>typeof w==="string"||typeof w==="number");if(v.length>0)l.required=v}},Nr=(e,r,a,p)=>{let l=e._zod.def,f=E(l.innerType,r,p),m=r.seen.get(e);if(r.target==="openapi-3.0")m.ref=l.innerType,a.nullable=!0;else a.anyOf=[f,{type:"null"}]},Ar=(e,r,a,p)=>{let l=e._zod.def;E(l.innerType,r,p);let f=r.seen.get(e);f.ref=l.innerType},jr=(e,r,a,p)=>{let l=e._zod.def;E(l.innerType,r,p);let f=r.seen.get(e);f.ref=l.innerType,a.default=JSON.parse(JSON.stringify(l.defaultValue))},Cr=(e,r,a,p)=>{let l=e._zod.def;E(l.innerType,r,p);let f=r.seen.get(e);if(f.ref=l.innerType,r.io==="input")a._prefault=JSON.parse(JSON.stringify(l.defaultValue))},Rr=(e,r,a,p)=>{let l=e._zod.def;E(l.innerType,r,p);let f=r.seen.get(e);f.ref=l.innerType;let m;try{m=l.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}a.default=m},Dr=(e,r,a,p)=>{let l=e._zod.def,f=l.in._zod.traits.has("$ZodTransform"),m=r.io==="input"?f?l.out:l.in:l.out;E(m,r,p);let h=r.seen.get(e);h.ref=m},Lr=(e,r,a,p)=>{let l=e._zod.def;E(l.innerType,r,p);let f=r.seen.get(e);f.ref=l.innerType,a.readOnly=!0},$s=(e,r,a,p)=>{let l=e._zod.def;E(l.innerType,r,p);let f=r.seen.get(e);f.ref=l.innerType},Ue=(e,r,a,p)=>{let l=e._zod.def;E(l.innerType,r,p);let f=r.seen.get(e);f.ref=l.innerType},Fr=(e,r,a,p)=>{let l=e._zod.innerType;E(l,r,p);let f=r.seen.get(e);f.ref=l},os={string:xr,number:zr,boolean:vr,bigint:ns,symbol:ss,null:yr,undefined:is,void:cs,never:$r,any:us,unknown:br,date:as,enum:wr,literal:kr,nan:ps,template_literal:ls,file:fs,success:ds,custom:Zr,function:hs,transform:Pr,map:xs,set:zs,array:Sr,object:Or,union:Er,intersection:Ir,tuple:vs,record:Tr,nullable:Nr,nonoptional:Ar,default:jr,prefault:Cr,catch:Rr,pipe:Dr,readonly:Lr,promise:$s,optional:Ue,lazy:Fr};function an(e,r){if("_idmap"in e){let p=e,l=ge({...r,processors:os}),f={};for(let _ of p._idmap.entries()){let[x,v]=_;E(v,l)}let m={},h={registry:p,uri:r?.uri,defs:f};l.external=h;for(let _ of p._idmap.entries()){let[x,v]=_;xe(l,v),m[x]=ze(l,v)}if(Object.keys(f).length>0){let _=l.target==="draft-2020-12"?"$defs":"definitions";m.__shared={[_]:f}}return{schemas:m}}let a=ge({...r,processors:os});return E(e,a),xe(a,e),ze(a,e)}var y={};ys(y,{ZodISODate:()=>ws,ZodISODateTime:()=>bs,ZodISODuration:()=>Zs,ZodISOTime:()=>ks,date:()=>Mr,datetime:()=>Ur,duration:()=>Br,time:()=>Jr});var bs=z("ZodISODateTime",(e,r)=>{Io.init(e,r),A.init(e,r)});function Ur(e){return Mn(bs,e)}var ws=z("ZodISODate",(e,r)=>{To.init(e,r),A.init(e,r)});function Mr(e){return Jn(ws,e)}var ks=z("ZodISOTime",(e,r)=>{No.init(e,r),A.init(e,r)});function Jr(e){return Bn(ks,e)}var Zs=z("ZodISODuration",(e,r)=>{Ao.init(e,r),A.init(e,r)});function Br(e){return Vn(Zs,e)}var yi=(e,r)=>{Pe.init(e,r),e.name="ZodError",Object.defineProperties(e,{format:{value:(a)=>ut(e,a)},flatten:{value:(a)=>ct(e,a)},addIssue:{value:(a)=>{e.issues.push(a),e.message=JSON.stringify(e.issues,ae,2)}},addIssues:{value:(a)=>{e.issues.push(...a),e.message=JSON.stringify(e.issues,ae,2)}},isEmpty:{get(){return e.issues.length===0}}})};var U=z("ZodError",yi,{Parent:Error});var Ps=Se(U),Ss=Oe(U),Os=le(U),Es=fe(U),Is=lt(U),Ts=ft(U),Ns=dt(U),As=mt(U),js=ht(U),Cs=_t(U),Rs=gt(U),Ds=xt(U);var Ls=new WeakMap;function ye(e,r,a){let p=Object.getPrototypeOf(e),l=Ls.get(p);if(!l)l=new Set,Ls.set(p,l);if(l.has(r))return;l.add(r);for(let f in a){let m=a[f];Object.defineProperty(p,f,{configurable:!0,enumerable:!1,get(){let h=m.bind(this);return Object.defineProperty(this,f,{configurable:!0,writable:!0,enumerable:!0,value:h}),h},set(h){Object.defineProperty(this,f,{configurable:!0,writable:!0,enumerable:!0,value:h})}})}}var N=z("ZodType",(e,r)=>(I.init(e,r),Object.assign(e["~standard"],{jsonSchema:{input:_e(e,"input"),output:_e(e,"output")}}),e.toJSONSchema=ts(e,{}),e.def=r,e.type=r.type,Object.defineProperty(e,"_def",{value:r}),e.parse=(a,p)=>Ps(e,a,p,{callee:e.parse}),e.safeParse=(a,p)=>Os(e,a,p),e.parseAsync=async(a,p)=>Ss(e,a,p,{callee:e.parseAsync}),e.safeParseAsync=async(a,p)=>Es(e,a,p),e.spa=e.safeParseAsync,e.encode=(a,p)=>Is(e,a,p),e.decode=(a,p)=>Ts(e,a,p),e.encodeAsync=async(a,p)=>Ns(e,a,p),e.decodeAsync=async(a,p)=>As(e,a,p),e.safeEncode=(a,p)=>js(e,a,p),e.safeDecode=(a,p)=>Cs(e,a,p),e.safeEncodeAsync=async(a,p)=>Rs(e,a,p),e.safeDecodeAsync=async(a,p)=>Ds(e,a,p),ye(e,"ZodType",{check(...a){let p=this.def;return this.clone(K(p,{checks:[...p.checks??[],...a.map((l)=>typeof l==="function"?{_zod:{check:l,def:{check:"custom"},onattach:[]}}:l)]}),{parent:!0})},with(...a){return this.check(...a)},clone(a,p){return M(this,a,p)},brand(){return this},register(a,p){return a.add(this,p),this},refine(a,p){return this.check(hc(a,p))},superRefine(a,p){return this.check(_c(a,p))},overwrite(a){return this.check(X(a))},optional(){return Us(this)},exactOptional(){return tc(this)},nullable(){return Ms(this)},nullish(){return Us(Ms(this))},nonoptional(a){return uc(this,a)},array(){return u(this)},or(a){return W([this,a])},and(a){return Xi(this,a)},transform(a){return Js(this,ec(a))},default(a){return sc(this,a)},prefault(a){return cc(this,a)},catch(a){return pc(this,a)},pipe(a){return Js(this,a)},readonly(){return dc(this)},describe(a){let p=this.clone();return oe.add(p,{description:a}),p},meta(...a){if(a.length===0)return oe.get(this);let p=this.clone();return oe.add(p,a[0]),p},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(a){return a(this)}}),Object.defineProperty(e,"description",{get(){return oe.get(e)?.description},configurable:!0}),e)),Bs=z("_ZodString",(e,r)=>{Ae.init(e,r),N.init(e,r),e._zod.processJSONSchema=(p,l,f)=>xr(e,p,l,f);let a=e._zod.bag;e.format=a.format??null,e.minLength=a.minimum??null,e.maxLength=a.maximum??null,ye(e,"_ZodString",{regex(...p){return this.check(cr(...p))},includes(...p){return this.check(pr(...p))},startsWith(...p){return this.check(lr(...p))},endsWith(...p){return this.check(fr(...p))},min(...p){return this.check(ie(...p))},max(...p){return this.check(Le(...p))},length(...p){return this.check(Fe(...p))},nonempty(...p){return this.check(ie(1,...p))},lowercase(p){return this.check(ur(p))},uppercase(p){return this.check(ar(p))},trim(){return this.check(mr())},normalize(...p){return this.check(dr(...p))},toLowerCase(){return this.check(hr())},toUpperCase(){return this.check(_r())},slugify(){return this.check(gr())}})}),wi=z("ZodString",(e,r)=>{Ae.init(e,r),Bs.init(e,r),e.email=(a)=>e.check(bn(ki,a)),e.url=(a)=>e.check(ir(Vs,a)),e.jwt=(a)=>e.check(Un(Fi,a)),e.emoji=(a)=>e.check(Pn(Zi,a)),e.guid=(a)=>e.check(je(Vr,a)),e.uuid=(a)=>e.check(sr(ve,a)),e.uuidv4=(a)=>e.check(wn(ve,a)),e.uuidv6=(a)=>e.check(kn(ve,a)),e.uuidv7=(a)=>e.check(Zn(ve,a)),e.nanoid=(a)=>e.check(Sn(Pi,a)),e.guid=(a)=>e.check(je(Vr,a)),e.cuid=(a)=>e.check(On(Si,a)),e.cuid2=(a)=>e.check(En(Oi,a)),e.ulid=(a)=>e.check(In(Ei,a)),e.base64=(a)=>e.check(Dn(Ri,a)),e.base64url=(a)=>e.check(Ln(Di,a)),e.xid=(a)=>e.check(Tn(Ii,a)),e.ksuid=(a)=>e.check(Nn(Ti,a)),e.ipv4=(a)=>e.check(An(Ni,a)),e.ipv6=(a)=>e.check(jn(Ai,a)),e.cidrv4=(a)=>e.check(Cn(ji,a)),e.cidrv6=(a)=>e.check(Rn(Ci,a)),e.e164=(a)=>e.check(Fn(Li,a)),e.datetime=(a)=>e.check(Ur(a)),e.date=(a)=>e.check(Mr(a)),e.time=(a)=>e.check(Jr(a)),e.duration=(a)=>e.check(Br(a))});function t(e){return $n(wi,e)}var A=z("ZodStringFormat",(e,r)=>{T.init(e,r),Bs.init(e,r)}),ki=z("ZodEmail",(e,r)=>{yo.init(e,r),A.init(e,r)});var Vr=z("ZodGUID",(e,r)=>{zo.init(e,r),A.init(e,r)});function Ct(e){return je(Vr,e)}var ve=z("ZodUUID",(e,r)=>{vo.init(e,r),A.init(e,r)});function k(e){return sr(ve,e)}var Vs=z("ZodURL",(e,r)=>{$o.init(e,r),A.init(e,r)});function At(e){return ir(Vs,e)}var Zi=z("ZodEmoji",(e,r)=>{bo.init(e,r),A.init(e,r)});var Pi=z("ZodNanoID",(e,r)=>{wo.init(e,r),A.init(e,r)});var Si=z("ZodCUID",(e,r)=>{ko.init(e,r),A.init(e,r)});var Oi=z("ZodCUID2",(e,r)=>{Po.init(e,r),A.init(e,r)});var Ei=z("ZodULID",(e,r)=>{So.init(e,r),A.init(e,r)});var Ii=z("ZodXID",(e,r)=>{Oo.init(e,r),A.init(e,r)});var Ti=z("ZodKSUID",(e,r)=>{Eo.init(e,r),A.init(e,r)});var Ni=z("ZodIPv4",(e,r)=>{jo.init(e,r),A.init(e,r)});var Ai=z("ZodIPv6",(e,r)=>{Co.init(e,r),A.init(e,r)});var ji=z("ZodCIDRv4",(e,r)=>{Ro.init(e,r),A.init(e,r)});var Ci=z("ZodCIDRv6",(e,r)=>{Do.init(e,r),A.init(e,r)});var Ri=z("ZodBase64",(e,r)=>{Fo.init(e,r),A.init(e,r)});var Di=z("ZodBase64URL",(e,r)=>{Uo.init(e,r),A.init(e,r)});var Li=z("ZodE164",(e,r)=>{Mo.init(e,r),A.init(e,r)});var Fi=z("ZodJWT",(e,r)=>{Jo.init(e,r),A.init(e,r)});var Ws=z("ZodNumber",(e,r)=>{tr.init(e,r),N.init(e,r),e._zod.processJSONSchema=(p,l,f)=>zr(e,p,l,f),ye(e,"ZodNumber",{gt(p,l){return this.check(Re(p,l))},gte(p,l){return this.check(he(p,l))},min(p,l){return this.check(he(p,l))},lt(p,l){return this.check(Ce(p,l))},lte(p,l){return this.check(me(p,l))},max(p,l){return this.check(me(p,l))},int(p){return this.check(Fs(p))},safe(p){return this.check(Fs(p))},positive(p){return this.check(Re(0,p))},nonnegative(p){return this.check(he(0,p))},negative(p){return this.check(Ce(0,p))},nonpositive(p){return this.check(me(0,p))},multipleOf(p,l){return this.check(De(p,l))},step(p,l){return this.check(De(p,l))},finite(){return this}});let a=e._zod.bag;e.minValue=Math.max(a.minimum??Number.NEGATIVE_INFINITY,a.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(a.maximum??Number.POSITIVE_INFINITY,a.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(a.format??"").includes("int")||Number.isSafeInteger(a.multipleOf??0.5),e.isFinite=!0,e.format=a.format??null});function o(e){return Wn(Ws,e)}var Ui=z("ZodNumberFormat",(e,r)=>{Bo.init(e,r),Ws.init(e,r)});function Fs(e){return Kn(Ui,e)}var Ji=z("ZodBoolean",(e,r)=>{Vo.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>vr(e,a,p,l)});function d(e){return Gn(Ji,e)}var Vi=z("ZodNull",(e,r)=>{Wo.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>yr(e,a,p,l)});function ms(e){return qn(Vi,e)}var Wi=z("ZodUnknown",(e,r)=>{Ko.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>br(e,a,p,l)});function Ie(){return Yn(Wi)}var Ki=z("ZodNever",(e,r)=>{Go.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>$r(e,a,p,l)});function Bi(e){return Xn(Ki,e)}var Gi=z("ZodArray",(e,r)=>{qo.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Sr(e,a,p,l),e.element=r.element,ye(e,"ZodArray",{min(a,p){return this.check(ie(a,p))},nonempty(a){return this.check(ie(1,a))},max(a,p){return this.check(Le(a,p))},length(a,p){return this.check(Fe(a,p))},unwrap(){return this.element}})});function u(e,r){return Hn(Gi,e,r)}var Gr=z("ZodObject",(e,r)=>{en.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Or(e,a,p,l),S(e,"shape",()=>r.shape),ye(e,"ZodObject",{keyof(){return s(Object.keys(this._zod.def.shape))},catchall(a){return this.clone({...this._zod.def,catchall:a})},passthrough(){return this.clone({...this._zod.def,catchall:Ie()})},loose(){return this.clone({...this._zod.def,catchall:Ie()})},strict(){return this.clone({...this._zod.def,catchall:Bi()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(a){return ri(this,a)},safeExtend(a){return ti(this,a)},merge(a){return oi(this,a)},pick(a){return Qs(this,a)},omit(a){return ei(this,a)},partial(...a){return ni(Gs,this,a[0])},required(...a){return si(qs,this,a[0])}})});function i(e,r){let a={type:"object",shape:e??{},...b(r)};return new Gr(a)}function c(e,r){return new Gr({type:"object",shape:e,catchall:Bi(),...b(r)})}function gs(e,r){return new Gr({type:"object",shape:e,catchall:Ie(),...b(r)})}var Ks=z("ZodUnion",(e,r)=>{or.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Er(e,a,p,l),e.options=r.options});function W(e,r){return new Ks({type:"union",options:e,...b(r)})}var qi=z("ZodDiscriminatedUnion",(e,r)=>{Ks.init(e,r),rn.init(e,r)});function g(e,r,a){return new qi({type:"union",options:r,discriminator:e,...b(a)})}var Yi=z("ZodIntersection",(e,r)=>{tn.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Ir(e,a,p,l)});function Xi(e,r){return new Yi({type:"intersection",left:e,right:r})}var Wr=z("ZodRecord",(e,r)=>{on.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Tr(e,a,p,l),e.keyType=r.keyType,e.valueType=r.valueType});function ee(e,r,a){if(!r||!r._zod)return new Wr({type:"record",keyType:t(),valueType:e,...b(r)});return new Wr({type:"record",keyType:e,valueType:r,...b(a)})}function _s(e,r,a){let p=M(e);return p._zod.values=void 0,new Wr({type:"record",keyType:p,valueType:r,...b(a)})}var Kr=z("ZodEnum",(e,r)=>{nn.init(e,r),N.init(e,r),e._zod.processJSONSchema=(p,l,f)=>wr(e,p,l,f),e.enum=r.entries,e.options=Object.values(r.entries);let a=new Set(Object.keys(r.entries));e.extract=(p,l)=>{let f={};for(let m of p)if(a.has(m))f[m]=r.entries[m];else throw Error(`Key ${m} not found in enum`);return new Kr({...r,checks:[],...b(l),entries:f})},e.exclude=(p,l)=>{let f={...r.entries};for(let m of p)if(a.has(m))delete f[m];else throw Error(`Key ${m} not found in enum`);return new Kr({...r,checks:[],...b(l),entries:f})}});function s(e,r){let a=Array.isArray(e)?Object.fromEntries(e.map((p)=>[p,p])):e;return new Kr({type:"enum",entries:a,...b(r)})}var Hi=z("ZodLiteral",(e,r)=>{sn.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>kr(e,a,p,l),e.values=new Set(r.values),Object.defineProperty(e,"value",{get(){if(r.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return r.values[0]}})});function n(e,r){return new Hi({type:"literal",values:Array.isArray(e)?e:[e],...b(r)})}var Qi=z("ZodTransform",(e,r)=>{un.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Pr(e,a,p,l),e._zod.parse=(a,p)=>{if(p.direction==="backward")throw new ue(e.constructor.name);a.addIssue=(f)=>{if(typeof f==="string")a.issues.push(te(f,a.value,r));else{let m=f;if(m.fatal)m.continue=!1;m.code??(m.code="custom"),m.input??(m.input=a.value),m.inst??(m.inst=e),a.issues.push(te(m))}};let l=r.transform(a.value,a);if(l instanceof Promise)return l.then((f)=>(a.value=f,a.fallback=!0,a));return a.value=l,a.fallback=!0,a}});function ec(e){return new Qi({type:"transform",transform:e})}var Gs=z("ZodOptional",(e,r)=>{nr.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Ue(e,a,p,l),e.unwrap=()=>e._zod.def.innerType});function Us(e){return new Gs({type:"optional",innerType:e})}var rc=z("ZodExactOptional",(e,r)=>{pn.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Ue(e,a,p,l),e.unwrap=()=>e._zod.def.innerType});function tc(e){return new rc({type:"optional",innerType:e})}var oc=z("ZodNullable",(e,r)=>{ln.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Nr(e,a,p,l),e.unwrap=()=>e._zod.def.innerType});function Ms(e){return new oc({type:"nullable",innerType:e})}var nc=z("ZodDefault",(e,r)=>{fn.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>jr(e,a,p,l),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function sc(e,r){return new nc({type:"default",innerType:e,get defaultValue(){return typeof r==="function"?r():Ke(r)}})}var ic=z("ZodPrefault",(e,r)=>{dn.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Cr(e,a,p,l),e.unwrap=()=>e._zod.def.innerType});function cc(e,r){return new ic({type:"prefault",innerType:e,get defaultValue(){return typeof r==="function"?r():Ke(r)}})}var qs=z("ZodNonOptional",(e,r)=>{mn.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Ar(e,a,p,l),e.unwrap=()=>e._zod.def.innerType});function uc(e,r){return new qs({type:"nonoptional",innerType:e,...b(r)})}var ac=z("ZodCatch",(e,r)=>{hn.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Rr(e,a,p,l),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function pc(e,r){return new ac({type:"catch",innerType:e,catchValue:typeof r==="function"?r:()=>r})}var lc=z("ZodPipe",(e,r)=>{_n.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Dr(e,a,p,l),e.in=r.in,e.out=r.out});function Js(e,r){return new lc({type:"pipe",in:e,out:r})}var fc=z("ZodReadonly",(e,r)=>{gn.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Lr(e,a,p,l),e.unwrap=()=>e._zod.def.innerType});function dc(e){return new fc({type:"readonly",innerType:e})}var mc=z("ZodLazy",(e,r)=>{xn.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Fr(e,a,p,l),e.unwrap=()=>e._zod.def.getter()});function Zo(e){return new mc({type:"lazy",getter:e})}var Ys=z("ZodCustom",(e,r)=>{zn.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Zr(e,a,p,l)});function cn(e,r){return Qn(Ys,e??(()=>!0),r)}function hc(e,r={}){return es(Ys,e,r)}function _c(e,r){return rs(e,r)}export{Xo,L,$i,Mi,Yo,an,y,t,Ct,k,At,o,d,ms,Ie,Bi,u,i,c,gs,W,g,ee,_s,s,n,Zo,cn};
65
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let m of e.seen.entries()){let h=m[1];if(r===m[0]){f(m);continue}if(e.external){let x=e.external.registry.get(m[0])?.id;if(r!==m[0]&&x){f(m);continue}}if(e.metadataRegistry.get(m[0])?.id){f(m);continue}if(h.cycle){f(m);continue}if(h.count>1){if(e.reused==="ref"){f(m);continue}}}}function ze(e,r){let a=e.seen.get(r);if(!a)throw Error("Unprocessed schema. This is a bug in Zod.");let p=(h)=>{let _=e.seen.get(h);if(_.ref===null)return;let x=_.def??_.schema,v={...x},w=_.ref;if(_.ref=null,w){p(w);let Z=e.seen.get(w),O=Z.schema;if(O.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))x.allOf=x.allOf??[],x.allOf.push(O);else Object.assign(x,O);if(Object.assign(x,v),h._zod.parent===w)for(let C in x){if(C==="$ref"||C==="allOf")continue;if(!(C in v))delete x[C]}if(O.$ref&&Z.def)for(let C in x){if(C==="$ref"||C==="allOf")continue;if(C in Z.def&&JSON.stringify(x[C])===JSON.stringify(Z.def[C]))delete x[C]}}let P=h._zod.parent;if(P&&P!==w){p(P);let Z=e.seen.get(P);if(Z?.schema.$ref){if(x.$ref=Z.schema.$ref,Z.def)for(let O in x){if(O==="$ref"||O==="allOf")continue;if(O in Z.def&&JSON.stringify(x[O])===JSON.stringify(Z.def[O]))delete x[O]}}}e.override({zodSchema:h,jsonSchema:x,path:_.path??[]})};for(let h of[...e.seen.entries()].reverse())p(h[0]);let l={};if(e.target==="draft-2020-12")l.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")l.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")l.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let h=e.external.registry.get(r)?.id;if(!h)throw Error("Schema is missing an `id` property");l.$id=e.external.uri(h)}Object.assign(l,a.def??a.schema);let f=e.metadataRegistry.get(r)?.id;if(f!==void 0&&l.id===f)delete l.id;let m=e.external?.defs??{};for(let h of e.seen.entries()){let _=h[1];if(_.def&&_.defId){if(_.def.id===_.defId)delete _.def.id;m[_.defId]=_.def}}if(e.external);else if(Object.keys(m).length>0)if(e.target==="draft-2020-12")l.$defs=m;else l.definitions=m;try{let h=JSON.parse(JSON.stringify(l));return Object.defineProperty(h,"~standard",{value:{...r["~standard"],jsonSchema:{input:_e(r,"input",e.processors),output:_e(r,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch(h){throw Error("Error converting schema to JSON.")}}function F(e,r){let a=r??{seen:new Set};if(a.seen.has(e))return!1;a.seen.add(e);let p=e._zod.def;if(p.type==="transform")return!0;if(p.type==="array")return F(p.element,a);if(p.type==="set")return F(p.valueType,a);if(p.type==="lazy")return F(p.getter(),a);if(p.type==="promise"||p.type==="optional"||p.type==="nonoptional"||p.type==="nullable"||p.type==="readonly"||p.type==="default"||p.type==="prefault")return F(p.innerType,a);if(p.type==="intersection")return F(p.left,a)||F(p.right,a);if(p.type==="record"||p.type==="map")return F(p.keyType,a)||F(p.valueType,a);if(p.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return F(p.in,a)||F(p.out,a)}if(p.type==="object"){for(let l in p.shape)if(F(p.shape[l],a))return!0;return!1}if(p.type==="union"){for(let l of p.options)if(F(l,a))return!0;return!1}if(p.type==="tuple"){for(let l of p.items)if(F(l,a))return!0;if(p.rest&&F(p.rest,a))return!0;return!1}return!1}var ts=(e,r={})=>(a)=>{let p=ge({...a,processors:r});return E(e,p),xe(p,e),ze(p,e)},_e=(e,r,a={})=>(p)=>{let{libraryOptions:l,target:f}=p??{},m=ge({...l??{},target:f,io:r,processors:a});return E(e,m),xe(m,e),ze(m,e)};var di={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},xr=(e,r,a,p)=>{let l=a;l.type="string";let{minimum:f,maximum:m,format:h,patterns:_,contentEncoding:x}=e._zod.bag;if(typeof f==="number")l.minLength=f;if(typeof m==="number")l.maxLength=m;if(h){if(l.format=di[h]??h,l.format==="")delete l.format;if(h==="time")delete l.format}if(x)l.contentEncoding=x;if(_&&_.size>0){let v=[..._];if(v.length===1)l.pattern=v[0].source;else if(v.length>1)l.allOf=[...v.map((w)=>({...r.target==="draft-07"||r.target==="draft-04"||r.target==="openapi-3.0"?{type:"string"}:{},pattern:w.source}))]}},zr=(e,r,a,p)=>{let l=a,{minimum:f,maximum:m,format:h,multipleOf:_,exclusiveMaximum:x,exclusiveMinimum:v}=e._zod.bag;if(typeof h==="string"&&h.includes("int"))l.type="integer";else l.type="number";let w=typeof v==="number"&&v>=(f??Number.NEGATIVE_INFINITY),P=typeof x==="number"&&x<=(m??Number.POSITIVE_INFINITY),Z=r.target==="draft-04"||r.target==="openapi-3.0";if(w)if(Z)l.minimum=v,l.exclusiveMinimum=!0;else l.exclusiveMinimum=v;else if(typeof f==="number")l.minimum=f;if(P)if(Z)l.maximum=x,l.exclusiveMaximum=!0;else l.exclusiveMaximum=x;else if(typeof m==="number")l.maximum=m;if(typeof _==="number")l.multipleOf=_},vr=(e,r,a,p)=>{a.type="boolean"},ns=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},ss=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},yr=(e,r,a,p)=>{if(r.target==="openapi-3.0")a.type="string",a.nullable=!0,a.enum=[null];else a.type="null"},is=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},cs=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},$r=(e,r,a,p)=>{a.not={}},us=(e,r,a,p)=>{},br=(e,r,a,p)=>{},as=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},wr=(e,r,a,p)=>{let l=e._zod.def,f=be(l.entries);if(f.every((m)=>typeof m==="number"))a.type="number";if(f.every((m)=>typeof m==="string"))a.type="string";a.enum=f},kr=(e,r,a,p)=>{let l=e._zod.def,f=[];for(let m of l.values)if(m===void 0){if(r.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof m==="bigint")if(r.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else f.push(Number(m));else f.push(m);if(f.length===0);else if(f.length===1){let m=f[0];if(a.type=m===null?"null":typeof m,r.target==="draft-04"||r.target==="openapi-3.0")a.enum=[m];else a.const=m}else{if(f.every((m)=>typeof m==="number"))a.type="number";if(f.every((m)=>typeof m==="string"))a.type="string";if(f.every((m)=>typeof m==="boolean"))a.type="boolean";if(f.every((m)=>m===null))a.type="null";a.enum=f}},ps=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},ls=(e,r,a,p)=>{let l=a,f=e._zod.pattern;if(!f)throw Error("Pattern not found in template literal");l.type="string",l.pattern=f.source},fs=(e,r,a,p)=>{let l=a,f={type:"string",format:"binary",contentEncoding:"binary"},{minimum:m,maximum:h,mime:_}=e._zod.bag;if(m!==void 0)f.minLength=m;if(h!==void 0)f.maxLength=h;if(_)if(_.length===1)f.contentMediaType=_[0],Object.assign(l,f);else Object.assign(l,f),l.anyOf=_.map((x)=>({contentMediaType:x}));else Object.assign(l,f)},ds=(e,r,a,p)=>{a.type="boolean"},Zr=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},hs=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},Pr=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},xs=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},zs=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},Sr=(e,r,a,p)=>{let l=a,f=e._zod.def,{minimum:m,maximum:h}=e._zod.bag;if(typeof m==="number")l.minItems=m;if(typeof h==="number")l.maxItems=h;l.type="array",l.items=E(f.element,r,{...p,path:[...p.path,"items"]})},Or=(e,r,a,p)=>{let l=a,f=e._zod.def;l.type="object",l.properties={};let m=f.shape;for(let x in m)l.properties[x]=E(m[x],r,{...p,path:[...p.path,"properties",x]});let h=new Set(Object.keys(m)),_=new Set([...h].filter((x)=>{let v=f.shape[x]._zod;if(r.io==="input")return v.optin===void 0;else return v.optout===void 0}));if(_.size>0)l.required=Array.from(_);if(f.catchall?._zod.def.type==="never")l.additionalProperties=!1;else if(!f.catchall){if(r.io==="output")l.additionalProperties=!1}else if(f.catchall)l.additionalProperties=E(f.catchall,r,{...p,path:[...p.path,"additionalProperties"]})},Er=(e,r,a,p)=>{let l=e._zod.def,f=l.inclusive===!1,m=l.options.map((h,_)=>E(h,r,{...p,path:[...p.path,f?"oneOf":"anyOf",_]}));if(f)a.oneOf=m;else a.anyOf=m},Ir=(e,r,a,p)=>{let l=e._zod.def,f=E(l.left,r,{...p,path:[...p.path,"allOf",0]}),m=E(l.right,r,{...p,path:[...p.path,"allOf",1]}),h=(x)=>("allOf"in x)&&Object.keys(x).length===1,_=[...h(f)?f.allOf:[f],...h(m)?m.allOf:[m]];a.allOf=_},vs=(e,r,a,p)=>{let l=a,f=e._zod.def;l.type="array";let m=r.target==="draft-2020-12"?"prefixItems":"items",h=r.target==="draft-2020-12"?"items":r.target==="openapi-3.0"?"items":"additionalItems",_=f.items.map((P,Z)=>E(P,r,{...p,path:[...p.path,m,Z]})),x=f.rest?E(f.rest,r,{...p,path:[...p.path,h,...r.target==="openapi-3.0"?[f.items.length]:[]]}):null;if(r.target==="draft-2020-12"){if(l.prefixItems=_,x)l.items=x}else if(r.target==="openapi-3.0"){if(l.items={anyOf:_},x)l.items.anyOf.push(x);if(l.minItems=_.length,!x)l.maxItems=_.length}else if(l.items=_,x)l.additionalItems=x;let{minimum:v,maximum:w}=e._zod.bag;if(typeof v==="number")l.minItems=v;if(typeof w==="number")l.maxItems=w},Tr=(e,r,a,p)=>{let l=a,f=e._zod.def;l.type="object";let m=f.keyType,_=m._zod.bag?.patterns;if(f.mode==="loose"&&_&&_.size>0){let v=E(f.valueType,r,{...p,path:[...p.path,"patternProperties","*"]});l.patternProperties={};for(let w of _)l.patternProperties[w.source]=v}else{if(r.target==="draft-07"||r.target==="draft-2020-12")l.propertyNames=E(f.keyType,r,{...p,path:[...p.path,"propertyNames"]});l.additionalProperties=E(f.valueType,r,{...p,path:[...p.path,"additionalProperties"]})}let x=m._zod.values;if(x){let v=[...x].filter((w)=>typeof w==="string"||typeof w==="number");if(v.length>0)l.required=v}},Nr=(e,r,a,p)=>{let l=e._zod.def,f=E(l.innerType,r,p),m=r.seen.get(e);if(r.target==="openapi-3.0")m.ref=l.innerType,a.nullable=!0;else a.anyOf=[f,{type:"null"}]},Ar=(e,r,a,p)=>{let l=e._zod.def;E(l.innerType,r,p);let f=r.seen.get(e);f.ref=l.innerType},jr=(e,r,a,p)=>{let l=e._zod.def;E(l.innerType,r,p);let f=r.seen.get(e);f.ref=l.innerType,a.default=JSON.parse(JSON.stringify(l.defaultValue))},Cr=(e,r,a,p)=>{let l=e._zod.def;E(l.innerType,r,p);let f=r.seen.get(e);if(f.ref=l.innerType,r.io==="input")a._prefault=JSON.parse(JSON.stringify(l.defaultValue))},Rr=(e,r,a,p)=>{let l=e._zod.def;E(l.innerType,r,p);let f=r.seen.get(e);f.ref=l.innerType;let m;try{m=l.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}a.default=m},Dr=(e,r,a,p)=>{let l=e._zod.def,f=l.in._zod.traits.has("$ZodTransform"),m=r.io==="input"?f?l.out:l.in:l.out;E(m,r,p);let h=r.seen.get(e);h.ref=m},Lr=(e,r,a,p)=>{let l=e._zod.def;E(l.innerType,r,p);let f=r.seen.get(e);f.ref=l.innerType,a.readOnly=!0},$s=(e,r,a,p)=>{let l=e._zod.def;E(l.innerType,r,p);let f=r.seen.get(e);f.ref=l.innerType},Ue=(e,r,a,p)=>{let l=e._zod.def;E(l.innerType,r,p);let f=r.seen.get(e);f.ref=l.innerType},Fr=(e,r,a,p)=>{let l=e._zod.innerType;E(l,r,p);let f=r.seen.get(e);f.ref=l},os={string:xr,number:zr,boolean:vr,bigint:ns,symbol:ss,null:yr,undefined:is,void:cs,never:$r,any:us,unknown:br,date:as,enum:wr,literal:kr,nan:ps,template_literal:ls,file:fs,success:ds,custom:Zr,function:hs,transform:Pr,map:xs,set:zs,array:Sr,object:Or,union:Er,intersection:Ir,tuple:vs,record:Tr,nullable:Nr,nonoptional:Ar,default:jr,prefault:Cr,catch:Rr,pipe:Dr,readonly:Lr,promise:$s,optional:Ue,lazy:Fr};function an(e,r){if("_idmap"in e){let p=e,l=ge({...r,processors:os}),f={};for(let _ of p._idmap.entries()){let[x,v]=_;E(v,l)}let m={},h={registry:p,uri:r?.uri,defs:f};l.external=h;for(let _ of p._idmap.entries()){let[x,v]=_;xe(l,v),m[x]=ze(l,v)}if(Object.keys(f).length>0){let _=l.target==="draft-2020-12"?"$defs":"definitions";m.__shared={[_]:f}}return{schemas:m}}let a=ge({...r,processors:os});return E(e,a),xe(a,e),ze(a,e)}var y={};ys(y,{ZodISODate:()=>ws,ZodISODateTime:()=>bs,ZodISODuration:()=>Zs,ZodISOTime:()=>ks,date:()=>Mr,datetime:()=>Ur,duration:()=>Br,time:()=>Jr});var bs=z("ZodISODateTime",(e,r)=>{Io.init(e,r),A.init(e,r)});function Ur(e){return Mn(bs,e)}var ws=z("ZodISODate",(e,r)=>{To.init(e,r),A.init(e,r)});function Mr(e){return Jn(ws,e)}var ks=z("ZodISOTime",(e,r)=>{No.init(e,r),A.init(e,r)});function Jr(e){return Bn(ks,e)}var Zs=z("ZodISODuration",(e,r)=>{Ao.init(e,r),A.init(e,r)});function Br(e){return Vn(Zs,e)}var yi=(e,r)=>{Pe.init(e,r),e.name="ZodError",Object.defineProperties(e,{format:{value:(a)=>ut(e,a)},flatten:{value:(a)=>ct(e,a)},addIssue:{value:(a)=>{e.issues.push(a),e.message=JSON.stringify(e.issues,ae,2)}},addIssues:{value:(a)=>{e.issues.push(...a),e.message=JSON.stringify(e.issues,ae,2)}},isEmpty:{get(){return e.issues.length===0}}})};var U=z("ZodError",yi,{Parent:Error});var Ps=Se(U),Ss=Oe(U),Os=le(U),Es=fe(U),Is=lt(U),Ts=ft(U),Ns=dt(U),As=mt(U),js=ht(U),Cs=_t(U),Rs=gt(U),Ds=xt(U);var Ls=new WeakMap;function ye(e,r,a){let p=Object.getPrototypeOf(e),l=Ls.get(p);if(!l)l=new Set,Ls.set(p,l);if(l.has(r))return;l.add(r);for(let f in a){let m=a[f];Object.defineProperty(p,f,{configurable:!0,enumerable:!1,get(){let h=m.bind(this);return Object.defineProperty(this,f,{configurable:!0,writable:!0,enumerable:!0,value:h}),h},set(h){Object.defineProperty(this,f,{configurable:!0,writable:!0,enumerable:!0,value:h})}})}}var N=z("ZodType",(e,r)=>(I.init(e,r),Object.assign(e["~standard"],{jsonSchema:{input:_e(e,"input"),output:_e(e,"output")}}),e.toJSONSchema=ts(e,{}),e.def=r,e.type=r.type,Object.defineProperty(e,"_def",{value:r}),e.parse=(a,p)=>Ps(e,a,p,{callee:e.parse}),e.safeParse=(a,p)=>Os(e,a,p),e.parseAsync=async(a,p)=>Ss(e,a,p,{callee:e.parseAsync}),e.safeParseAsync=async(a,p)=>Es(e,a,p),e.spa=e.safeParseAsync,e.encode=(a,p)=>Is(e,a,p),e.decode=(a,p)=>Ts(e,a,p),e.encodeAsync=async(a,p)=>Ns(e,a,p),e.decodeAsync=async(a,p)=>As(e,a,p),e.safeEncode=(a,p)=>js(e,a,p),e.safeDecode=(a,p)=>Cs(e,a,p),e.safeEncodeAsync=async(a,p)=>Rs(e,a,p),e.safeDecodeAsync=async(a,p)=>Ds(e,a,p),ye(e,"ZodType",{check(...a){let p=this.def;return this.clone(K(p,{checks:[...p.checks??[],...a.map((l)=>typeof l==="function"?{_zod:{check:l,def:{check:"custom"},onattach:[]}}:l)]}),{parent:!0})},with(...a){return this.check(...a)},clone(a,p){return M(this,a,p)},brand(){return this},register(a,p){return a.add(this,p),this},refine(a,p){return this.check(hc(a,p))},superRefine(a,p){return this.check(_c(a,p))},overwrite(a){return this.check(X(a))},optional(){return Us(this)},exactOptional(){return tc(this)},nullable(){return Ms(this)},nullish(){return Us(Ms(this))},nonoptional(a){return uc(this,a)},array(){return u(this)},or(a){return W([this,a])},and(a){return Xi(this,a)},transform(a){return Js(this,ec(a))},default(a){return sc(this,a)},prefault(a){return cc(this,a)},catch(a){return pc(this,a)},pipe(a){return Js(this,a)},readonly(){return dc(this)},describe(a){let p=this.clone();return oe.add(p,{description:a}),p},meta(...a){if(a.length===0)return oe.get(this);let p=this.clone();return oe.add(p,a[0]),p},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(a){return a(this)}}),Object.defineProperty(e,"description",{get(){return oe.get(e)?.description},configurable:!0}),e)),Bs=z("_ZodString",(e,r)=>{Ae.init(e,r),N.init(e,r),e._zod.processJSONSchema=(p,l,f)=>xr(e,p,l,f);let a=e._zod.bag;e.format=a.format??null,e.minLength=a.minimum??null,e.maxLength=a.maximum??null,ye(e,"_ZodString",{regex(...p){return this.check(cr(...p))},includes(...p){return this.check(pr(...p))},startsWith(...p){return this.check(lr(...p))},endsWith(...p){return this.check(fr(...p))},min(...p){return this.check(ie(...p))},max(...p){return this.check(Le(...p))},length(...p){return this.check(Fe(...p))},nonempty(...p){return this.check(ie(1,...p))},lowercase(p){return this.check(ur(p))},uppercase(p){return this.check(ar(p))},trim(){return this.check(mr())},normalize(...p){return this.check(dr(...p))},toLowerCase(){return this.check(hr())},toUpperCase(){return this.check(_r())},slugify(){return this.check(gr())}})}),wi=z("ZodString",(e,r)=>{Ae.init(e,r),Bs.init(e,r),e.email=(a)=>e.check(bn(ki,a)),e.url=(a)=>e.check(ir(Vs,a)),e.jwt=(a)=>e.check(Un(Fi,a)),e.emoji=(a)=>e.check(Pn(Zi,a)),e.guid=(a)=>e.check(je(Vr,a)),e.uuid=(a)=>e.check(sr(ve,a)),e.uuidv4=(a)=>e.check(wn(ve,a)),e.uuidv6=(a)=>e.check(kn(ve,a)),e.uuidv7=(a)=>e.check(Zn(ve,a)),e.nanoid=(a)=>e.check(Sn(Pi,a)),e.guid=(a)=>e.check(je(Vr,a)),e.cuid=(a)=>e.check(On(Si,a)),e.cuid2=(a)=>e.check(En(Oi,a)),e.ulid=(a)=>e.check(In(Ei,a)),e.base64=(a)=>e.check(Dn(Ri,a)),e.base64url=(a)=>e.check(Ln(Di,a)),e.xid=(a)=>e.check(Tn(Ii,a)),e.ksuid=(a)=>e.check(Nn(Ti,a)),e.ipv4=(a)=>e.check(An(Ni,a)),e.ipv6=(a)=>e.check(jn(Ai,a)),e.cidrv4=(a)=>e.check(Cn(ji,a)),e.cidrv6=(a)=>e.check(Rn(Ci,a)),e.e164=(a)=>e.check(Fn(Li,a)),e.datetime=(a)=>e.check(Ur(a)),e.date=(a)=>e.check(Mr(a)),e.time=(a)=>e.check(Jr(a)),e.duration=(a)=>e.check(Br(a))});function t(e){return $n(wi,e)}var A=z("ZodStringFormat",(e,r)=>{T.init(e,r),Bs.init(e,r)}),ki=z("ZodEmail",(e,r)=>{yo.init(e,r),A.init(e,r)});var Vr=z("ZodGUID",(e,r)=>{zo.init(e,r),A.init(e,r)});function Ct(e){return je(Vr,e)}var ve=z("ZodUUID",(e,r)=>{vo.init(e,r),A.init(e,r)});function k(e){return sr(ve,e)}var Vs=z("ZodURL",(e,r)=>{$o.init(e,r),A.init(e,r)});function At(e){return ir(Vs,e)}var Zi=z("ZodEmoji",(e,r)=>{bo.init(e,r),A.init(e,r)});var Pi=z("ZodNanoID",(e,r)=>{wo.init(e,r),A.init(e,r)});var Si=z("ZodCUID",(e,r)=>{ko.init(e,r),A.init(e,r)});var Oi=z("ZodCUID2",(e,r)=>{Po.init(e,r),A.init(e,r)});var Ei=z("ZodULID",(e,r)=>{So.init(e,r),A.init(e,r)});var Ii=z("ZodXID",(e,r)=>{Oo.init(e,r),A.init(e,r)});var Ti=z("ZodKSUID",(e,r)=>{Eo.init(e,r),A.init(e,r)});var Ni=z("ZodIPv4",(e,r)=>{jo.init(e,r),A.init(e,r)});var Ai=z("ZodIPv6",(e,r)=>{Co.init(e,r),A.init(e,r)});var ji=z("ZodCIDRv4",(e,r)=>{Ro.init(e,r),A.init(e,r)});var Ci=z("ZodCIDRv6",(e,r)=>{Do.init(e,r),A.init(e,r)});var Ri=z("ZodBase64",(e,r)=>{Fo.init(e,r),A.init(e,r)});var Di=z("ZodBase64URL",(e,r)=>{Uo.init(e,r),A.init(e,r)});var Li=z("ZodE164",(e,r)=>{Mo.init(e,r),A.init(e,r)});var Fi=z("ZodJWT",(e,r)=>{Jo.init(e,r),A.init(e,r)});var Ws=z("ZodNumber",(e,r)=>{tr.init(e,r),N.init(e,r),e._zod.processJSONSchema=(p,l,f)=>zr(e,p,l,f),ye(e,"ZodNumber",{gt(p,l){return this.check(Re(p,l))},gte(p,l){return this.check(he(p,l))},min(p,l){return this.check(he(p,l))},lt(p,l){return this.check(Ce(p,l))},lte(p,l){return this.check(me(p,l))},max(p,l){return this.check(me(p,l))},int(p){return this.check(Fs(p))},safe(p){return this.check(Fs(p))},positive(p){return this.check(Re(0,p))},nonnegative(p){return this.check(he(0,p))},negative(p){return this.check(Ce(0,p))},nonpositive(p){return this.check(me(0,p))},multipleOf(p,l){return this.check(De(p,l))},step(p,l){return this.check(De(p,l))},finite(){return this}});let a=e._zod.bag;e.minValue=Math.max(a.minimum??Number.NEGATIVE_INFINITY,a.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(a.maximum??Number.POSITIVE_INFINITY,a.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(a.format??"").includes("int")||Number.isSafeInteger(a.multipleOf??0.5),e.isFinite=!0,e.format=a.format??null});function o(e){return Wn(Ws,e)}var Ui=z("ZodNumberFormat",(e,r)=>{Bo.init(e,r),Ws.init(e,r)});function Fs(e){return Kn(Ui,e)}var Ji=z("ZodBoolean",(e,r)=>{Vo.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>vr(e,a,p,l)});function d(e){return Gn(Ji,e)}var Vi=z("ZodNull",(e,r)=>{Wo.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>yr(e,a,p,l)});function ms(e){return qn(Vi,e)}var Wi=z("ZodUnknown",(e,r)=>{Ko.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>br(e,a,p,l)});function Ie(){return Yn(Wi)}var Ki=z("ZodNever",(e,r)=>{Go.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>$r(e,a,p,l)});function Bi(e){return Xn(Ki,e)}var Gi=z("ZodArray",(e,r)=>{qo.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Sr(e,a,p,l),e.element=r.element,ye(e,"ZodArray",{min(a,p){return this.check(ie(a,p))},nonempty(a){return this.check(ie(1,a))},max(a,p){return this.check(Le(a,p))},length(a,p){return this.check(Fe(a,p))},unwrap(){return this.element}})});function u(e,r){return Hn(Gi,e,r)}var Gr=z("ZodObject",(e,r)=>{en.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Or(e,a,p,l),S(e,"shape",()=>r.shape),ye(e,"ZodObject",{keyof(){return s(Object.keys(this._zod.def.shape))},catchall(a){return this.clone({...this._zod.def,catchall:a})},passthrough(){return this.clone({...this._zod.def,catchall:Ie()})},loose(){return this.clone({...this._zod.def,catchall:Ie()})},strict(){return this.clone({...this._zod.def,catchall:Bi()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(a){return ri(this,a)},safeExtend(a){return ti(this,a)},merge(a){return oi(this,a)},pick(a){return Qs(this,a)},omit(a){return ei(this,a)},partial(...a){return ni(Gs,this,a[0])},required(...a){return si(qs,this,a[0])}})});function n(e,r){let a={type:"object",shape:e??{},...b(r)};return new Gr(a)}function c(e,r){return new Gr({type:"object",shape:e,catchall:Bi(),...b(r)})}function gs(e,r){return new Gr({type:"object",shape:e,catchall:Ie(),...b(r)})}var Ks=z("ZodUnion",(e,r)=>{or.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Er(e,a,p,l),e.options=r.options});function W(e,r){return new Ks({type:"union",options:e,...b(r)})}var qi=z("ZodDiscriminatedUnion",(e,r)=>{Ks.init(e,r),rn.init(e,r)});function g(e,r,a){return new qi({type:"union",options:r,discriminator:e,...b(a)})}var Yi=z("ZodIntersection",(e,r)=>{tn.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Ir(e,a,p,l)});function Xi(e,r){return new Yi({type:"intersection",left:e,right:r})}var Wr=z("ZodRecord",(e,r)=>{on.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Tr(e,a,p,l),e.keyType=r.keyType,e.valueType=r.valueType});function ee(e,r,a){if(!r||!r._zod)return new Wr({type:"record",keyType:t(),valueType:e,...b(r)});return new Wr({type:"record",keyType:e,valueType:r,...b(a)})}function _s(e,r,a){let p=M(e);return p._zod.values=void 0,new Wr({type:"record",keyType:p,valueType:r,...b(a)})}var Kr=z("ZodEnum",(e,r)=>{nn.init(e,r),N.init(e,r),e._zod.processJSONSchema=(p,l,f)=>wr(e,p,l,f),e.enum=r.entries,e.options=Object.values(r.entries);let a=new Set(Object.keys(r.entries));e.extract=(p,l)=>{let f={};for(let m of p)if(a.has(m))f[m]=r.entries[m];else throw Error(`Key ${m} not found in enum`);return new Kr({...r,checks:[],...b(l),entries:f})},e.exclude=(p,l)=>{let f={...r.entries};for(let m of p)if(a.has(m))delete f[m];else throw Error(`Key ${m} not found in enum`);return new Kr({...r,checks:[],...b(l),entries:f})}});function s(e,r){let a=Array.isArray(e)?Object.fromEntries(e.map((p)=>[p,p])):e;return new Kr({type:"enum",entries:a,...b(r)})}var Hi=z("ZodLiteral",(e,r)=>{sn.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>kr(e,a,p,l),e.values=new Set(r.values),Object.defineProperty(e,"value",{get(){if(r.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return r.values[0]}})});function i(e,r){return new Hi({type:"literal",values:Array.isArray(e)?e:[e],...b(r)})}var Qi=z("ZodTransform",(e,r)=>{un.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Pr(e,a,p,l),e._zod.parse=(a,p)=>{if(p.direction==="backward")throw new ue(e.constructor.name);a.addIssue=(f)=>{if(typeof f==="string")a.issues.push(te(f,a.value,r));else{let m=f;if(m.fatal)m.continue=!1;m.code??(m.code="custom"),m.input??(m.input=a.value),m.inst??(m.inst=e),a.issues.push(te(m))}};let l=r.transform(a.value,a);if(l instanceof Promise)return l.then((f)=>(a.value=f,a.fallback=!0,a));return a.value=l,a.fallback=!0,a}});function ec(e){return new Qi({type:"transform",transform:e})}var Gs=z("ZodOptional",(e,r)=>{nr.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Ue(e,a,p,l),e.unwrap=()=>e._zod.def.innerType});function Us(e){return new Gs({type:"optional",innerType:e})}var rc=z("ZodExactOptional",(e,r)=>{pn.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Ue(e,a,p,l),e.unwrap=()=>e._zod.def.innerType});function tc(e){return new rc({type:"optional",innerType:e})}var oc=z("ZodNullable",(e,r)=>{ln.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Nr(e,a,p,l),e.unwrap=()=>e._zod.def.innerType});function Ms(e){return new oc({type:"nullable",innerType:e})}var nc=z("ZodDefault",(e,r)=>{fn.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>jr(e,a,p,l),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function sc(e,r){return new nc({type:"default",innerType:e,get defaultValue(){return typeof r==="function"?r():Ke(r)}})}var ic=z("ZodPrefault",(e,r)=>{dn.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Cr(e,a,p,l),e.unwrap=()=>e._zod.def.innerType});function cc(e,r){return new ic({type:"prefault",innerType:e,get defaultValue(){return typeof r==="function"?r():Ke(r)}})}var qs=z("ZodNonOptional",(e,r)=>{mn.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Ar(e,a,p,l),e.unwrap=()=>e._zod.def.innerType});function uc(e,r){return new qs({type:"nonoptional",innerType:e,...b(r)})}var ac=z("ZodCatch",(e,r)=>{hn.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Rr(e,a,p,l),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function pc(e,r){return new ac({type:"catch",innerType:e,catchValue:typeof r==="function"?r:()=>r})}var lc=z("ZodPipe",(e,r)=>{_n.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Dr(e,a,p,l),e.in=r.in,e.out=r.out});function Js(e,r){return new lc({type:"pipe",in:e,out:r})}var fc=z("ZodReadonly",(e,r)=>{gn.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Lr(e,a,p,l),e.unwrap=()=>e._zod.def.innerType});function dc(e){return new fc({type:"readonly",innerType:e})}var mc=z("ZodLazy",(e,r)=>{xn.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Fr(e,a,p,l),e.unwrap=()=>e._zod.def.getter()});function Zo(e){return new mc({type:"lazy",getter:e})}var Ys=z("ZodCustom",(e,r)=>{zn.init(e,r),N.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Zr(e,a,p,l)});function cn(e,r){return Qn(Ys,e??(()=>!0),r)}function hc(e,r={}){return es(Ys,e,r)}function _c(e,r){return rs(e,r)}export{Xo,L,$i,Mi,Yo,an,y,t,Ct,k,At,o,d,ms,Ie,Bi,u,n,c,gs,W,g,ee,_s,s,i,Zo,cn};
@@ -1,8 +1,8 @@
1
1
  // @bun
2
- import{_,Ho,ke}from"./vm-hands-entry-lite-4anjdcth.js";import{l,Gt,Ke,Lr,Kt,Mr,ht}from"./vm-hands-entry-lite-cgddp0y3.js";import{bt,ar}from"./vm-hands-entry-lite-qc6gxqgs.js";import{fn}from"./vm-hands-entry-lite-pp4a4cnb.js";import{B,m,te,He}from"./vm-hands-entry-lite-k3jm8km9.js";import{F}from"./vm-hands-entry-lite-4j8pm02n.js";import{Bo}from"./vm-hands-entry-lite-qnyrqhac.js";import{xe,Ze,Xn,Vr}from"./vm-hands-entry-lite-nzxfr7dn.js";import{f,v,h}from"./vm-hands-entry-lite-hfx1q0b0.js";import{a}from"./vm-hands-entry-lite-jvszqt0z.js";import{Xo,an,y,t,k,At,o,d,Ie,u,i,c,g,_s,s,n,cn}from"./vm-hands-entry-lite-ztsp4gs8.js";import{closeSync as Uh,existsSync as Fh,mkdirSync as jh,openSync as qh,readdirSync as zh,realpathSync as pe,rmSync as Kh}from"fs";import{dirname as Jh,join as J,resolve as Gh}from"path";import{createHash as It}from"crypto";import{platform as Ot}from"os";import{join as Mt}from"path";var Tt=g("store",[c({version:n(1),store:n("keychain")}),c({version:n(1),store:n("file"),api_key:t().min(1).max(4096)})]),We=(e)=>Mt(e,"api-key.json");function Ne(e){let r=It("sha256").update(`reason-connect-api-key
3
- ${e}`).digest("hex");return new Ke(Gt(),Ot(),r)}function we(e,r=Ne(e)){if(!f(We(e)))return null;let p=Tt.parse(JSON.parse(h(We(e))));if(p.store==="file")return p.api_key;try{let b=r.loadBinding();return b?new TextDecoder().decode(b):null}catch(b){if(!(b instanceof l))throw b;throw Error("worker_api_key_unreadable")}}import{readdirSync as Zt,renameSync as Jo,rmSync as Go}from"fs";import{join as ee}from"path";import{createHash as Wt}from"crypto";import{platform as Nt}from"os";import{join as N}from"path";function w(e){return{state:N(m(e),"device.json"),control:N(m(e),"control.json"),lock:N(m(e),"lifecycle.lock"),socket:N(m(e),"control.sock"),daemon:N(m(e),"daemon.json"),releaseCheck:N(m(e),"release-check.json"),updateDeferral:N(m(e),"update-deferral.json"),firstHeartbeat:N(m(e),"first-heartbeat.json")}}var lo=i({version:n(1),device_id:t().min(1).max(160),offer:Ie().optional(),enrollment_ms:o().int().nonnegative().max(ar).optional()});function z(e,r=!1){v(m(e),r);let p=["local-device.key","local-device.binding","device.json"].filter((b)=>{let R=N(m(e),b);if(!f(R))return!1;return h(R),!0});return e.lifetime==="persistent"&&p.join()==="device.json"?Ht(e):new Lr(m(e))}function Ht(e){return new Ke(Gt(),Nt(),$t(e))}function $t(e){let r=Ft(e);return Wt("sha256").update(`reason-worker
4
- ${r?.directory??m(e)}`).digest("hex")}var Bt="keychain-scope.json";var Ut=c({version:n(1),directory:t().min(1),devicePublicKey:t().min(1)});function Ft(e){let r=N(m(e),Bt);if(!f(r))return null;let p=Ut.safeParse(JSON.parse(h(r))),b=w(e).state;if(!p.success||!f(b))return null;return JSON.parse(h(b))?.devicePublicKey===p.data.devicePublicKey?p.data:null}function M(e){if(!f(m(e)))return null;let r=Mr(w(e).state,{proofStore:z(e),repair:!1}),p=r!==null&&Ho(e.apiOrigin,r.apiOrigin),b=p?[te(e),te({...e,apiOrigin:r.apiOrigin})]:[te(e)];if(r&&(!b.includes(r.worker?.configDigest??"")||r.worker.lifetime!==e.lifetime||r.apiOrigin!==e.apiOrigin&&!p||r.roots.length>32||r.roots[0]?.path!==e.workspaceRoot||r.handsSlots!==e.slots))throw Error("worker_config_binding_mismatch");return r}var jt=c({version:n(1),drained:d(),revoked:d()});function H(e){let r=w(e).control;return f(r)?jt.parse(JSON.parse(h(r))):{version:1,drained:!1,revoked:!1}}var zt=c({read:d(),write:d(),execute:d(),discover_environment:d(),expose_mcp:n(!1)}),Vt=c({version:n(1),organization_id:t().min(1).max(160),enrollment_ticket:t().min(1).max(4096),code_verifier:t().regex(/^[A-Za-z0-9._~-]{43,128}$/),root_fingerprint_key:t().regex(/^[a-f0-9]{64}$/),root:c({path_fingerprint:t().regex(/^[a-f0-9]{64}$/),permissions:zt,execution_mode:s(["confined","host"]).default("confined")}),folders:u(c({path_fingerprint:t().regex(/^[a-f0-9]{64}$/)})).min(1).max(31).optional()}),So=i({device_id:t().min(1).max(160),organization_id:t().min(1).max(160),auth_scheme:n("p256"),protocol_version:n(2),roots:u(i({id:t().min(1),label:t(),path_fingerprint:t()})).min(1).max(32),headless:i({lifecycle:s(["persistent","ephemeral"]),expires_at:y.datetime({offset:!0})}),first_heartbeat:Ie().optional()});var jo=c({version:n(1),install_id:k(),fingerprint_key:t().regex(/^[a-f0-9]{64}$/)}),qo=i({enrollment_ticket:t().min(1).max(4096),expires_at:y.datetime({offset:!0}),device_kind:n("headless"),lifecycle:s(["persistent","ephemeral"]),device_expires_at:y.datetime({offset:!0})});var zo=i({credentialKind:s(["oauth","api_key"]).optional(),apiOrigin:At(),clientId:t(),accessToken:t().min(1).max(32768),refreshToken:t().max(32768),expiresAt:y.datetime({offset:!0}),scopes:u(t().max(128)).max(128),orgId:t().min(1).max(160)});var je=8;var Qt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,_e=(e)=>ee(m(e),"workspaces"),er="account.json",tr=(e)=>f(ee(e,er));function Se(e){let r;try{r=Zt(_e(e))}catch{return[]}return r.filter((p)=>Qt.test(p)).sort().map((p)=>{let b=ee(_e(e),p),R=ee(b,"worker.json"),S=null;try{let P=B.safeParse(JSON.parse(h(R)));if(P.success&&P.data.stateDirectory===b)S=P.data}catch{}return{organizationId:p,directory:b,configPath:R,config:S,account:tr(b)}})}var rr=(e)=>ee(_e(e),"listed.json");function nr(e){try{let r=JSON.parse(h(rr(e))),p=r.names&&typeof r.names==="object"&&!Array.isArray(r.names)?Object.fromEntries(Object.entries(r.names).filter((R)=>typeof R[1]==="string")):{},b=r.refused&&typeof r.refused==="object"?r.refused:null;return{listed:r.listed===!0,reason:r.reason==="sign_in"?"sign_in":null,blocked:Array.isArray(r.blocked)?r.blocked.filter((R)=>typeof R==="string"):[],names:p,...b&&typeof b.device==="string"&&typeof b.roots==="string"&&typeof b.at==="number"&&Number.isFinite(b.at)&&typeof b.count==="number"&&Number.isInteger(b.count)&&b.count>=1?{refused:{device:b.device,roots:b.roots,at:b.at,count:b.count}}:{}}}catch{return null}}function qe(e,r){let p=Se(e),b=p.filter((C)=>C.account),R=p.filter((C)=>!C.account),S=nr(e),P=S&&!S.listed?S.reason:null,E=P||R.length===0&&S&&!S.listed?[]:R;if(b.length===0&&E.length===0&&(P||S&&!S.listed))return{workspaces:null,off:P};return{off:P,workspaces:[...b,...E].map(({organizationId:C,config:T,account:I})=>{let A=!1,D=null,L=!1,he=null;try{A=T?H(T).revoked:!1,D=T&&!A?M(T):null;let Le=T?ht(w(T).daemon):null;L=r&&!!D&&Le?.state==="connected",he=L?Kt(Le,D):null}catch{}return{...he?{permission_recovery:he}:{},organization_id:C,device_id:D?.deviceId??null,name:S?.names?.[C]??null,root:D?.roots[0]?{id:D.roots[0].id,permissions:D.roots[0].permissions}:null,state:A?"removed":L?"connected":"not_running",blocked:!I&&!A&&!L&&(S?.blocked.includes(C)??!1),...I?{account:!0}:{}}})}}import{readFileSync as ir}from"fs";function pr(e){try{let r=JSON.parse(ir(`${e}.keep-awake.json`,"utf8"));return r!==null&&typeof r==="object"&&"version"in r&&r.version===1&&"enabled"in r&&r.enabled===!0?"battery_and_ac":void 0}catch(r){return r.code==="ENOENT"?"battery_and_ac":void 0}}import{chmodSync as ji,lstatSync as Xe,mkdtempSync as qi,realpathSync as sr,rmdirSync as zi,rmSync as Ki,unlinkSync as Vi}from"fs";import{createConnection as cr,createServer as Gi}from"net";import{basename as Je,dirname as Ge,join as ne}from"path";var lr=s(["status","drain","resume","stop","reload_roots"]),dr=c({version:n(1),instanceId:t(),deviceId:t(),phase:s(["starting","running","reconnecting","stopping"]),drained:d(),activeClaims:o().int().nonnegative(),activeSessions:o().int().nonnegative().optional(),executionEligible:d(),supportedOperations:u(s(bt)).max(bt.length).optional(),capabilityReadiness:_s(s(bt),d()).optional(),lastHeartbeat:t().nullable(),expiresAt:t()}),ta=c({nonce:t(),action:lr}),ur=i({nonce:k()}),fr=c({version:n(1),nonce:k(),socketPath:t().max(100)});function mr(e){return ne(w(e).lock,"control.json")}function Qe(e){return v(w(e).lock),ur.parse(JSON.parse(h(ne(w(e).lock,"owner.json"))))}function Ye(e){if(!f(e))return!1;let r=Xe(e);if(!r.isSocket()||r.uid!==process.getuid?.()||(r.mode&63)!==0)throw Error("worker_control_socket_not_private");return!0}function et(e,r){let p=mr(e);if(!f(p)){let S=w(e).socket;if(!f(S)||!Xe(S).isSocket())return null;return Ye(S)?S:null}let b=fr.parse(JSON.parse(h(p)));if(b.nonce!==r)throw Error("worker_instance_changed");if(process.platform==="win32"){if(!hr.test(b.socketPath))throw Error("worker_control_endpoint_invalid");return b.socketPath}let R=Ge(b.socketPath);if(Ge(R)!==sr("/tmp")||!/^(?:reason|ara)-worker-[A-Za-z0-9]{6}$/.test(Je(R))||Je(b.socketPath)!=="control.sock"||Buffer.byteLength(b.socketPath)>100)throw Error("worker_control_endpoint_invalid");if(!f(R))return null;return v(R),Ye(b.socketPath)?b.socketPath:null}var hr=/^\\\\\.\\pipe\\reason-worker-[0-9a-f-]{36}$/;function gr(e,r){try{let p=JSON.parse(h(ne(w(e).lock,"owner.json"))),b=p&&typeof p==="object"?p[r]:void 0;return typeof b==="string"?b:null}catch{return null}}function tt(e){return gr(e,"runtime_version")}function rt(e,r){if(r)return r.message==="worker_control_timeout"?"socket_timeout":"bad_reply";try{if(!f(ne(w(e).lock,"owner.json")))return"no_lock";return et(e,Qe(e).nonce)?"socket_refused":"no_socket"}catch{return"bad_reply"}}var ra=c({instance:t().nullable(),since:o().int().nonnegative()});async function G(e,r){let p=w(e);if(!f(ne(p.lock,"owner.json")))return null;let b=Qe(e),R=et(e,b.nonce);if(!R)return null;return new Promise((S,P)=>{let E=cr(R),C="",T=!1,I=(A,D)=>{if(T)return;if(T=!0,E.destroy(),D)P(D);else S(A)};E.setTimeout(2000,()=>E.destroy(Error("worker_control_timeout"))),E.on("connect",()=>E.write(JSON.stringify({nonce:b.nonce,action:r})+`
5
- `)),E.on("data",(A)=>{if(C+=A.toString(),Buffer.byteLength(C)>16384)E.destroy(Error("worker_control_oversize"))}),E.on("error",(A)=>{if("code"in A&&["ECONNREFUSED","ENOENT"].includes(String(A.code)))I(null);else I(null,A.message==="worker_control_timeout"?A:Error("worker_control_unavailable"))}),E.on("end",()=>{try{let A=dr.parse(JSON.parse(C));if(A.instanceId!==b.nonce)throw Error("worker_instance_changed");I(A)}catch{I(null,Error("worker_control_invalid_response"))}}),E.once("close",()=>I(null,Error("worker_control_unavailable")))})}import{realpathSync as br}from"fs";import{constants as Re}from"fs";import{open as wr}from"fs/promises";var la={platform:process.platform,home:a,async openFile(e){let r=await wr(e,Re.O_RDONLY|Re.O_NOFOLLOW|Re.O_NONBLOCK);return{isFile:async()=>(await r.stat()).isFile(),close:()=>r.close()}}};var qa=Bo(br(process.execPath));var hs=Buffer.from([0,255,3,4]);import{execFile as nn}from"child_process";import{promisify as on}from"util";var Er=/#w=(\d{1,5})&h=(\d{1,5})$/;function at(e){return typeof e==="number"&&Number.isInteger(e)&&e>0&&e<=32768?e:void 0}function st(e){let r=Er.exec(e);if(!r)return;let p=at(Number(r[1])),b=at(Number(r[2]));return p&&b?{width:p,height:b}:void 0}var ct="[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}",Pr=new RegExp(`^/media/pr-screenshots/(${ct})/(${ct})/([a-z0-9][a-z0-9._-]*)\\.(png|jpe?g|gif|webp|webm|mp4)$`,"i");var Cr=new Set(["png","jpg","jpeg","gif","webp"]),Ar=new Set(["webm","mp4"]);function xr(e){if(!e)return null;try{return new URL(e).origin}catch{return null}}function Ir(e){let r=st(e);return Boolean(r&&e===`#w=${r.width}&h=${r.height}`)}function lt(e,r){let p;try{p=new URL(e)}catch{return null}let b=xr(r),R=p.hostname==="ara.so"||p.hostname.endsWith(".ara.so")||p.hostname==="reasonmachines.ai"||p.hostname.endsWith(".reasonmachines.ai")||p.hostname==="reasonmachines.com"||p.hostname.endsWith(".reasonmachines.com");if(p.protocol!=="https:"||!R&&p.origin!==b||p.username||p.password||p.port||p.search||p.hash&&!Ir(p.hash))return null;let S=Pr.exec(p.pathname);if(!S)return null;let P=S[1]?.toLowerCase(),E=S[2]?.toLowerCase(),C=S[3]?.toLowerCase(),T=S[4]?.toLowerCase();if(!P||!E||!C||!T)return null;let I=Cr.has(T)?"image":Ar.has(T)?"video":null;if(!I)return null;let A=/^(before|after)[\s:_-]+/.exec(C),D=p.pathname.replace(/^\/media\//,"");return{url:p.toString(),storagePath:D,runId:P,artifactId:E,fileName:`${C}.${T}`,kind:I,phase:A?.[1]==="before"||A?.[1]==="after"?A[1]:null}}var Or=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,dt=(e)=>Boolean(e&&typeof e==="object"&&!Array.isArray(e)),K=()=>{throw Error("cloud_browser_media_request_invalid")};function Pe(e){if(!dt(e)||Object.keys(e).some((S)=>!["runId","configuredMediaOrigin","media"].includes(S))||typeof e.runId!=="string"||!Or.test(e.runId)||typeof e.configuredMediaOrigin!=="string"||e.configuredMediaOrigin.length>2048||!Array.isArray(e.media)||e.media.length<1||e.media.length>8)return K();let r;try{r=new URL(e.configuredMediaOrigin)}catch{return K()}if(r.protocol!=="https:"||r.username||r.password||r.port||!He(r.origin,{mode:"public_web"}).allowed)return K();let p=e.runId.toLowerCase(),b=new Set,R=e.media.map((S)=>{if(!dt(S)||Object.keys(S).some((E)=>!["url","sourceUrl","kind"].includes(E))||typeof S.url!=="string"||S.url.length>2048||typeof S.sourceUrl!=="string"||S.sourceUrl.length>8192||!["image","video"].includes(String(S.kind)))return K();let P=lt(S.url,r.origin);if(!P||new URL(P.url).origin!==r.origin||P.runId!==p||P.kind!==S.kind||P.url!==S.url||b.has(S.url))return K();if(b.add(S.url),S.sourceUrl!==S.url){let E;try{E=new URL(S.sourceUrl)}catch{return K()}let C=/^\/(?:[a-f0-9]{40}|[a-f0-9]{64})\/([a-f0-9]+)$/.exec(E.pathname)?.[1];if(S.kind!=="image"||E.origin!=="https://camo.githubusercontent.com"||E.username||E.password||E.search||E.hash||!C||C.length%2!==0||Buffer.from(C,"hex").toString("utf8")!==S.url)return K()}return{url:S.url,sourceUrl:S.sourceUrl,kind:S.kind}});return{runId:e.runId,configuredMediaOrigin:r.origin,media:R}}var x=t().uuid(),X=t().regex(/^[a-f0-9]{64}$/),V=y.datetime({precision:3}),Ce=t().regex(/^[a-zA-Z0-9_-]{1,160}$/),mt=t().max(2048).regex(/^https:\/\/github\.com\/[A-Za-z0-9_-]+\/[A-Za-z0-9_.-]+\/pull\/[1-9][0-9]*$/).refine((e)=>![".",".."].includes(e.split("/")[4])),U=i({kind:n("primary_mac"),version:n(1),organizationId:Ce,userId:Ce,sessionId:Ce,runId:x,deviceId:x,rootId:x,rootRevision:t().min(1).max(64),binding:s(["workspace_source","mcp_control"]),targetRevision:o().int().nonnegative(),generation:x,profile:t().regex(/^(Default|Profile [0-9]+)$/),extensionInstanceId:t().min(1).max(1024)}).strict().refine((e)=>e.binding!=="workspace_source"||e.targetRevision===0),Tr=cn().transform((e,r)=>{try{return fn(e)}catch{return r.addIssue({code:"custom",message:"proof_visual_contract_invalid"}),Xo}}),ue=i({version:n(1),owner:U,contextId:x,preparedAt:V,expiresAt:V,prUrl:mt,headSha:t().regex(/^[a-f0-9]{40}$/),skillDigest:X,evidenceKind:s(["image","video"]),visualPlan:Tr.optional(),uploadOrigin:t().url().refine((e)=>{let r=new URL(e);return r.protocol==="https:"&&r.origin===e&&!r.username&&!r.password}).optional()}).strict().refine((e)=>Date.parse(e.expiresAt)>Date.parse(e.preparedAt)&&Date.parse(e.expiresAt)-Date.parse(e.preparedAt)<=300000),Dr=i({version:n(1),producer:n("primary_mac"),context:ue,captureId:x,operationId:x,attemptId:x,tabId:o().int().positive(),startedAt:V,finishedAt:V,sha256:X,media:g("contentType",[i({contentType:n("image/png"),sizeBytes:o().int().min(24).max(8388608),width:o().int().min(1).max(4096),height:o().int().min(1).max(4096)}).strict(),i({contentType:n("video/webm"),sizeBytes:o().int().min(128).max(10485760),durationSeconds:o().min(0.05).max(15),frameCount:o().int().min(1).max(450),receivedFrameCount:o().int().min(1).max(2000)}).strict()])}).strict().superRefine((e,r)=>{let p=Date.parse(e.startedAt),b=Date.parse(e.finishedAt);if(p<Date.parse(e.context.preparedAt)||b<p||b>Date.parse(e.context.expiresAt)||b-p>30000||e.media.contentType==="video/webm"&&(e.media.receivedFrameCount<e.media.frameCount||Math.abs((b-p)/1000-e.media.durationSeconds)>0.1))r.addIssue({code:"custom",message:"mac_pr_proof_capture_chronology_invalid"})}),yc=g("action",[i({action:n("screenshot"),context_id:x,tab_id:o().int().positive()}).strict(),i({action:n("start_video"),context_id:x,tab_id:o().int().positive(),seconds:o().int().min(1).max(15)}).strict(),i({action:n("stop_video"),recording_operation_id:x}).strict()]),fe=i({login:t().regex(/^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,37}[a-zA-Z0-9])?$/),id:t().regex(/^[1-9][0-9]{0,19}$/).nullable()}).strict(),ce=t().regex(/^[1-9][0-9]{0,19}$/),le=i({version:n(1),owner:U,expectedActorId:ce.nullable(),repositoryId:ce,repositoryFullName:t().max(200).regex(/^[A-Za-z0-9_-]+\/[A-Za-z0-9_.-]+$/).refine((e)=>![".",".."].includes(e.split("/")[1]))}).strict(),Wr=["browser_unavailable","github_page_unavailable","identity_check_failed","operation_incomplete","attachment_unavailable"],Nr=g("status",[le.extend({status:n("ready"),observedActor:fe,checkedAt:V}),le.extend({status:n("not_ready"),reason:s(["authentication_required","identity_mismatch","authority_lost","unavailable"]),cause:s(Wr).optional()})]).refine((e)=>e.status!=="ready"||e.expectedActorId===null||e.observedActor.id===e.expectedActorId),Y=i({version:n(1),owner:U,expectedActorId:ce.nullable(),authenticatedActor:fe,attemptId:x,captureId:x,prUrl:mt,repositoryId:ce,headSha:t().regex(/^[a-f0-9]{40}$/),sha256:X,sizeBytes:o().int().min(128).max(10485760),contentType:n("video/webm")}).strict(),pt=t().regex(/^https:\/\/github\.com\/user-attachments\/assets\/[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/),Hr=g("status",[Y.extend({status:n("not_attempted"),reason:s(["authentication_required","attachment_unavailable","identity_mismatch","capture_invalid","authority_lost"])}),Y.extend({status:n("uncertain"),reason:n("upload_outcome_unknown")}),Y.extend({status:n("uploaded"),observedActor:fe,nativeUrl:pt,uploadedAt:V})]).refine((e)=>(e.expectedActorId===null||e.authenticatedActor.id===e.expectedActorId)&&(e.status!=="uploaded"||e.observedActor.id===e.authenticatedActor.id&&e.observedActor.login===e.authenticatedActor.login)),de=Y.extend({nativeUrl:pt,observedActor:fe,bodySha256:X}),$r=g("status",[de.extend({status:n("incomplete"),reason:s(["authentication_required","identity_mismatch","playback_unverified","authority_lost"])}),de.extend({status:n("verified"),sourceSha256:X,width:o().int().min(1).max(4096),height:o().int().min(1).max(4096),durationSeconds:o().positive().max(30),advancedSeconds:o().min(0.05).max(10),advancedFrames:o().int().positive(),playbackRestored:n(!0),verifiedAt:V})]).refine((e)=>(e.expectedActorId===null||e.authenticatedActor.id===e.expectedActorId)&&e.observedActor.id===e.authenticatedActor.id&&e.observedActor.login===e.authenticatedActor.login&&(e.status!=="verified"||e.sourceSha256===e.sha256)),Br=cn().transform((e,r)=>{try{let p=Pe(e);if(p.media.some((b)=>b.kind!=="image"))throw Error();return p}catch{return r.addIssue({code:"custom",message:"proof_media_request_invalid"}),Xo}}),Ur=g("action",[i({action:n("auth_check"),input:le}).strict(),i({action:n("prepare"),context:ue}).strict(),i({action:n("capture_png"),owner:U,contextId:x,tabId:o().int().positive()}).strict(),i({action:n("start_video"),owner:U,contextId:x,tabId:o().int().positive(),seconds:o().int().min(1).max(15)}).strict(),i({action:n("inspect_capture"),owner:U,captureId:x}).strict(),i({action:n("publish_video"),input:Y}).strict(),i({action:n("verify_png_media"),owner:U,media:Br}).strict().refine((e)=>e.media.runId===e.owner.runId),i({action:n("verify_saved_media"),input:de}).strict(),i({action:n("publish_png"),owner:U,attemptId:x,captureId:x,sha256:X,sizeBytes:o().int().min(24).max(8388608),storagePath:t().max(512),uploadUrl:t().url().max(8192)}).strict()]);var Fr=i({requestId:x,command:Ur}).strict();var jr={type:"object",required:["action"],properties:{action:{type:"string",enum:["screenshot","start_video","stop_video"]},context_id:{type:"string",format:"uuid"},tab_id:{type:"integer",minimum:1},seconds:{type:"integer",minimum:1,maximum:15},recording_operation_id:{type:"string",format:"uuid"}},additionalProperties:!1},ut={type:"string",format:"uuid",description:"capture_context_id from tools.pr.prepareProof."},ft={type:"integer",minimum:1,description:"An already-owned tab's id."},_c={...jr,oneOf:[{type:"object",required:["action","context_id","tab_id"],additionalProperties:!1,properties:{action:{type:"string",const:"screenshot"},context_id:ut,tab_id:ft}},{type:"object",required:["action","context_id","tab_id","seconds"],additionalProperties:!1,properties:{action:{type:"string",const:"start_video"},context_id:ut,tab_id:ft,seconds:{type:"integer",minimum:1,maximum:15}}},{type:"object",required:["action","recording_operation_id"],additionalProperties:!1,properties:{action:{type:"string",const:"stop_video"},recording_operation_id:{type:"string",format:"uuid",description:"The recording_operation_id start_video returned."}}}]};var Rc=i({operationId:t().uuid(),attemptId:t().uuid(),contextId:t().uuid(),tabId:o().int().positive()}).strict();var qr=String.raw`async (media) => {
2
+ import{_,Ho,ke}from"./vm-hands-entry-lite-4anjdcth.js";import{l,Gt,Ke,Lr,Kt,Mr,ht}from"./vm-hands-entry-lite-vj0gm694.js";import{bt,ar}from"./vm-hands-entry-lite-nxd394w3.js";import{fn}from"./vm-hands-entry-lite-p4z0dgch.js";import{B,m,te,He}from"./vm-hands-entry-lite-8jcb5jqm.js";import{F}from"./vm-hands-entry-lite-gz65ybc2.js";import{Bo}from"./vm-hands-entry-lite-kng982rg.js";import{xe,Ze,Xn,Vr}from"./vm-hands-entry-lite-ax1rvy38.js";import{f,v,h}from"./vm-hands-entry-lite-hfx1q0b0.js";import{a}from"./vm-hands-entry-lite-jvszqt0z.js";import{Xo,an,y,t,k,At,o,d,Ie,u,n,c,g,_s,s,i,cn}from"./vm-hands-entry-lite-dszmx6yf.js";import{closeSync as Uh,existsSync as Fh,mkdirSync as jh,openSync as qh,readdirSync as zh,realpathSync as pe,rmSync as Kh}from"fs";import{dirname as Jh,join as J,resolve as Gh}from"path";import{createHash as It}from"crypto";import{platform as Ot}from"os";import{join as Mt}from"path";var Tt=g("store",[c({version:i(1),store:i("keychain")}),c({version:i(1),store:i("file"),api_key:t().min(1).max(4096)})]),We=(e)=>Mt(e,"api-key.json");function Ne(e){let r=It("sha256").update(`reason-connect-api-key
3
+ ${e}`).digest("hex");return new Ke(Gt(),Ot(),r)}function we(e,r=Ne(e)){if(!f(We(e)))return null;let p=Tt.parse(JSON.parse(h(We(e))));if(p.store==="file")return p.api_key;try{let b=r.loadBinding();return b?new TextDecoder().decode(b):null}catch(b){if(!(b instanceof l))throw b;throw Error("worker_api_key_unreadable")}}import{readdirSync as Zt,renameSync as Jo,rmSync as Go}from"fs";import{join as ee}from"path";import{createHash as Wt}from"crypto";import{platform as Nt}from"os";import{join as N}from"path";function w(e){return{state:N(m(e),"device.json"),control:N(m(e),"control.json"),lock:N(m(e),"lifecycle.lock"),socket:N(m(e),"control.sock"),daemon:N(m(e),"daemon.json"),releaseCheck:N(m(e),"release-check.json"),updateDeferral:N(m(e),"update-deferral.json"),firstHeartbeat:N(m(e),"first-heartbeat.json")}}var lo=n({version:i(1),device_id:t().min(1).max(160),offer:Ie().optional(),enrollment_ms:o().int().nonnegative().max(ar).optional()});function z(e,r=!1){v(m(e),r);let p=["local-device.key","local-device.binding","device.json"].filter((b)=>{let R=N(m(e),b);if(!f(R))return!1;return h(R),!0});return e.lifetime==="persistent"&&p.join()==="device.json"?Ht(e):new Lr(m(e))}function Ht(e){return new Ke(Gt(),Nt(),$t(e))}function $t(e){let r=Ft(e);return Wt("sha256").update(`reason-worker
4
+ ${r?.directory??m(e)}`).digest("hex")}var Bt="keychain-scope.json";var Ut=c({version:i(1),directory:t().min(1),devicePublicKey:t().min(1)});function Ft(e){let r=N(m(e),Bt);if(!f(r))return null;let p=Ut.safeParse(JSON.parse(h(r))),b=w(e).state;if(!p.success||!f(b))return null;return JSON.parse(h(b))?.devicePublicKey===p.data.devicePublicKey?p.data:null}function M(e){if(!f(m(e)))return null;let r=Mr(w(e).state,{proofStore:z(e),repair:!1}),p=r!==null&&Ho(e.apiOrigin,r.apiOrigin),b=p?[te(e),te({...e,apiOrigin:r.apiOrigin})]:[te(e)];if(r&&(!b.includes(r.worker?.configDigest??"")||r.worker.lifetime!==e.lifetime||r.apiOrigin!==e.apiOrigin&&!p||r.roots.length>32||r.roots[0]?.path!==e.workspaceRoot||r.handsSlots!==e.slots))throw Error("worker_config_binding_mismatch");return r}var jt=c({version:i(1),drained:d(),revoked:d()});function H(e){let r=w(e).control;return f(r)?jt.parse(JSON.parse(h(r))):{version:1,drained:!1,revoked:!1}}var zt=c({read:d(),write:d(),execute:d(),discover_environment:d(),expose_mcp:i(!1)}),Vt=c({version:i(1),organization_id:t().min(1).max(160),enrollment_ticket:t().min(1).max(4096),code_verifier:t().regex(/^[A-Za-z0-9._~-]{43,128}$/),root_fingerprint_key:t().regex(/^[a-f0-9]{64}$/),root:c({path_fingerprint:t().regex(/^[a-f0-9]{64}$/),permissions:zt,execution_mode:s(["confined","host"]).default("confined")}),folders:u(c({path_fingerprint:t().regex(/^[a-f0-9]{64}$/)})).min(1).max(31).optional()}),So=n({device_id:t().min(1).max(160),organization_id:t().min(1).max(160),auth_scheme:i("p256"),protocol_version:i(2),roots:u(n({id:t().min(1),label:t(),path_fingerprint:t()})).min(1).max(32),headless:n({lifecycle:s(["persistent","ephemeral"]),expires_at:y.datetime({offset:!0})}),first_heartbeat:Ie().optional()});var jo=c({version:i(1),install_id:k(),fingerprint_key:t().regex(/^[a-f0-9]{64}$/)}),qo=n({enrollment_ticket:t().min(1).max(4096),expires_at:y.datetime({offset:!0}),device_kind:i("headless"),lifecycle:s(["persistent","ephemeral"]),device_expires_at:y.datetime({offset:!0})});var zo=n({credentialKind:s(["oauth","api_key"]).optional(),apiOrigin:At(),clientId:t(),accessToken:t().min(1).max(32768),refreshToken:t().max(32768),expiresAt:y.datetime({offset:!0}),scopes:u(t().max(128)).max(128),orgId:t().min(1).max(160)});var je=8;var Qt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,_e=(e)=>ee(m(e),"workspaces"),er="account.json",tr=(e)=>f(ee(e,er));function Se(e){let r;try{r=Zt(_e(e))}catch{return[]}return r.filter((p)=>Qt.test(p)).sort().map((p)=>{let b=ee(_e(e),p),R=ee(b,"worker.json"),S=null;try{let P=B.safeParse(JSON.parse(h(R)));if(P.success&&P.data.stateDirectory===b)S=P.data}catch{}return{organizationId:p,directory:b,configPath:R,config:S,account:tr(b)}})}var rr=(e)=>ee(_e(e),"listed.json");function nr(e){try{let r=JSON.parse(h(rr(e))),p=r.names&&typeof r.names==="object"&&!Array.isArray(r.names)?Object.fromEntries(Object.entries(r.names).filter((R)=>typeof R[1]==="string")):{},b=r.refused&&typeof r.refused==="object"?r.refused:null;return{listed:r.listed===!0,reason:r.reason==="sign_in"?"sign_in":null,blocked:Array.isArray(r.blocked)?r.blocked.filter((R)=>typeof R==="string"):[],names:p,...b&&typeof b.device==="string"&&typeof b.roots==="string"&&typeof b.at==="number"&&Number.isFinite(b.at)&&typeof b.count==="number"&&Number.isInteger(b.count)&&b.count>=1?{refused:{device:b.device,roots:b.roots,at:b.at,count:b.count}}:{}}}catch{return null}}function qe(e,r){let p=Se(e),b=p.filter((C)=>C.account),R=p.filter((C)=>!C.account),S=nr(e),P=S&&!S.listed?S.reason:null,E=P||R.length===0&&S&&!S.listed?[]:R;if(b.length===0&&E.length===0&&(P||S&&!S.listed))return{workspaces:null,off:P};return{off:P,workspaces:[...b,...E].map(({organizationId:C,config:T,account:I})=>{let A=!1,D=null,L=!1,he=null;try{A=T?H(T).revoked:!1,D=T&&!A?M(T):null;let Le=T?ht(w(T).daemon):null;L=r&&!!D&&Le?.state==="connected",he=L?Kt(Le,D):null}catch{}return{...he?{permission_recovery:he}:{},organization_id:C,device_id:D?.deviceId??null,name:S?.names?.[C]??null,root:D?.roots[0]?{id:D.roots[0].id,permissions:D.roots[0].permissions}:null,state:A?"removed":L?"connected":"not_running",blocked:!I&&!A&&!L&&(S?.blocked.includes(C)??!1),...I?{account:!0}:{}}})}}import{readFileSync as ir}from"fs";function pr(e){try{let r=JSON.parse(ir(`${e}.keep-awake.json`,"utf8"));return r!==null&&typeof r==="object"&&"version"in r&&r.version===1&&"enabled"in r&&r.enabled===!0?"battery_and_ac":void 0}catch(r){return r.code==="ENOENT"?"battery_and_ac":void 0}}import{chmodSync as ji,lstatSync as Xe,mkdtempSync as qi,realpathSync as sr,rmdirSync as zi,rmSync as Ki,unlinkSync as Vi}from"fs";import{createConnection as cr,createServer as Gi}from"net";import{basename as Je,dirname as Ge,join as ne}from"path";var lr=s(["status","drain","resume","stop","reload_roots"]),dr=c({version:i(1),instanceId:t(),deviceId:t(),phase:s(["starting","running","reconnecting","stopping"]),drained:d(),activeClaims:o().int().nonnegative(),activeSessions:o().int().nonnegative().optional(),executionEligible:d(),supportedOperations:u(s(bt)).max(bt.length).optional(),capabilityReadiness:_s(s(bt),d()).optional(),lastHeartbeat:t().nullable(),expiresAt:t()}),ta=c({nonce:t(),action:lr}),ur=n({nonce:k()}),fr=c({version:i(1),nonce:k(),socketPath:t().max(100)});function mr(e){return ne(w(e).lock,"control.json")}function Qe(e){return v(w(e).lock),ur.parse(JSON.parse(h(ne(w(e).lock,"owner.json"))))}function Ye(e){if(!f(e))return!1;let r=Xe(e);if(!r.isSocket()||r.uid!==process.getuid?.()||(r.mode&63)!==0)throw Error("worker_control_socket_not_private");return!0}function et(e,r){let p=mr(e);if(!f(p)){let S=w(e).socket;if(!f(S)||!Xe(S).isSocket())return null;return Ye(S)?S:null}let b=fr.parse(JSON.parse(h(p)));if(b.nonce!==r)throw Error("worker_instance_changed");if(process.platform==="win32"){if(!hr.test(b.socketPath))throw Error("worker_control_endpoint_invalid");return b.socketPath}let R=Ge(b.socketPath);if(Ge(R)!==sr("/tmp")||!/^(?:reason|ara)-worker-[A-Za-z0-9]{6}$/.test(Je(R))||Je(b.socketPath)!=="control.sock"||Buffer.byteLength(b.socketPath)>100)throw Error("worker_control_endpoint_invalid");if(!f(R))return null;return v(R),Ye(b.socketPath)?b.socketPath:null}var hr=/^\\\\\.\\pipe\\reason-worker-[0-9a-f-]{36}$/;function gr(e,r){try{let p=JSON.parse(h(ne(w(e).lock,"owner.json"))),b=p&&typeof p==="object"?p[r]:void 0;return typeof b==="string"?b:null}catch{return null}}function tt(e){return gr(e,"runtime_version")}function rt(e,r){if(r)return r.message==="worker_control_timeout"?"socket_timeout":"bad_reply";try{if(!f(ne(w(e).lock,"owner.json")))return"no_lock";return et(e,Qe(e).nonce)?"socket_refused":"no_socket"}catch{return"bad_reply"}}var ra=c({instance:t().nullable(),since:o().int().nonnegative()});async function G(e,r){let p=w(e);if(!f(ne(p.lock,"owner.json")))return null;let b=Qe(e),R=et(e,b.nonce);if(!R)return null;return new Promise((S,P)=>{let E=cr(R),C="",T=!1,I=(A,D)=>{if(T)return;if(T=!0,E.destroy(),D)P(D);else S(A)};E.setTimeout(2000,()=>E.destroy(Error("worker_control_timeout"))),E.on("connect",()=>E.write(JSON.stringify({nonce:b.nonce,action:r})+`
5
+ `)),E.on("data",(A)=>{if(C+=A.toString(),Buffer.byteLength(C)>16384)E.destroy(Error("worker_control_oversize"))}),E.on("error",(A)=>{if("code"in A&&["ECONNREFUSED","ENOENT"].includes(String(A.code)))I(null);else I(null,A.message==="worker_control_timeout"?A:Error("worker_control_unavailable"))}),E.on("end",()=>{try{let A=dr.parse(JSON.parse(C));if(A.instanceId!==b.nonce)throw Error("worker_instance_changed");I(A)}catch{I(null,Error("worker_control_invalid_response"))}}),E.once("close",()=>I(null,Error("worker_control_unavailable")))})}import{realpathSync as br}from"fs";import{constants as Re}from"fs";import{open as wr}from"fs/promises";var la={platform:process.platform,home:a,async openFile(e){let r=await wr(e,Re.O_RDONLY|Re.O_NOFOLLOW|Re.O_NONBLOCK);return{isFile:async()=>(await r.stat()).isFile(),close:()=>r.close()}}};var qa=Bo(br(process.execPath));var hs=Buffer.from([0,255,3,4]);import{execFile as nn}from"child_process";import{promisify as on}from"util";var Er=/#w=(\d{1,5})&h=(\d{1,5})$/;function at(e){return typeof e==="number"&&Number.isInteger(e)&&e>0&&e<=32768?e:void 0}function st(e){let r=Er.exec(e);if(!r)return;let p=at(Number(r[1])),b=at(Number(r[2]));return p&&b?{width:p,height:b}:void 0}var ct="[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}",Pr=new RegExp(`^/media/pr-screenshots/(${ct})/(${ct})/([a-z0-9][a-z0-9._-]*)\\.(png|jpe?g|gif|webp|webm|mp4)$`,"i");var Cr=new Set(["png","jpg","jpeg","gif","webp"]),Ar=new Set(["webm","mp4"]);function xr(e){if(!e)return null;try{return new URL(e).origin}catch{return null}}function Ir(e){let r=st(e);return Boolean(r&&e===`#w=${r.width}&h=${r.height}`)}function lt(e,r){let p;try{p=new URL(e)}catch{return null}let b=xr(r),R=p.hostname==="ara.so"||p.hostname.endsWith(".ara.so")||p.hostname==="reasonmachines.ai"||p.hostname.endsWith(".reasonmachines.ai")||p.hostname==="reasonmachines.com"||p.hostname.endsWith(".reasonmachines.com");if(p.protocol!=="https:"||!R&&p.origin!==b||p.username||p.password||p.port||p.search||p.hash&&!Ir(p.hash))return null;let S=Pr.exec(p.pathname);if(!S)return null;let P=S[1]?.toLowerCase(),E=S[2]?.toLowerCase(),C=S[3]?.toLowerCase(),T=S[4]?.toLowerCase();if(!P||!E||!C||!T)return null;let I=Cr.has(T)?"image":Ar.has(T)?"video":null;if(!I)return null;let A=/^(before|after)[\s:_-]+/.exec(C),D=p.pathname.replace(/^\/media\//,"");return{url:p.toString(),storagePath:D,runId:P,artifactId:E,fileName:`${C}.${T}`,kind:I,phase:A?.[1]==="before"||A?.[1]==="after"?A[1]:null}}var Or=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,dt=(e)=>Boolean(e&&typeof e==="object"&&!Array.isArray(e)),K=()=>{throw Error("cloud_browser_media_request_invalid")};function Pe(e){if(!dt(e)||Object.keys(e).some((S)=>!["runId","configuredMediaOrigin","media"].includes(S))||typeof e.runId!=="string"||!Or.test(e.runId)||typeof e.configuredMediaOrigin!=="string"||e.configuredMediaOrigin.length>2048||!Array.isArray(e.media)||e.media.length<1||e.media.length>8)return K();let r;try{r=new URL(e.configuredMediaOrigin)}catch{return K()}if(r.protocol!=="https:"||r.username||r.password||r.port||!He(r.origin,{mode:"public_web"}).allowed)return K();let p=e.runId.toLowerCase(),b=new Set,R=e.media.map((S)=>{if(!dt(S)||Object.keys(S).some((E)=>!["url","sourceUrl","kind"].includes(E))||typeof S.url!=="string"||S.url.length>2048||typeof S.sourceUrl!=="string"||S.sourceUrl.length>8192||!["image","video"].includes(String(S.kind)))return K();let P=lt(S.url,r.origin);if(!P||new URL(P.url).origin!==r.origin||P.runId!==p||P.kind!==S.kind||P.url!==S.url||b.has(S.url))return K();if(b.add(S.url),S.sourceUrl!==S.url){let E;try{E=new URL(S.sourceUrl)}catch{return K()}let C=/^\/(?:[a-f0-9]{40}|[a-f0-9]{64})\/([a-f0-9]+)$/.exec(E.pathname)?.[1];if(S.kind!=="image"||E.origin!=="https://camo.githubusercontent.com"||E.username||E.password||E.search||E.hash||!C||C.length%2!==0||Buffer.from(C,"hex").toString("utf8")!==S.url)return K()}return{url:S.url,sourceUrl:S.sourceUrl,kind:S.kind}});return{runId:e.runId,configuredMediaOrigin:r.origin,media:R}}var x=t().uuid(),X=t().regex(/^[a-f0-9]{64}$/),V=y.datetime({precision:3}),Ce=t().regex(/^[a-zA-Z0-9_-]{1,160}$/),mt=t().max(2048).regex(/^https:\/\/github\.com\/[A-Za-z0-9_-]+\/[A-Za-z0-9_.-]+\/pull\/[1-9][0-9]*$/).refine((e)=>![".",".."].includes(e.split("/")[4])),U=n({kind:i("primary_mac"),version:i(1),organizationId:Ce,userId:Ce,sessionId:Ce,runId:x,deviceId:x,rootId:x,rootRevision:t().min(1).max(64),binding:s(["workspace_source","mcp_control"]),targetRevision:o().int().nonnegative(),generation:x,profile:t().regex(/^(Default|Profile [0-9]+)$/),extensionInstanceId:t().min(1).max(1024)}).strict().refine((e)=>e.binding!=="workspace_source"||e.targetRevision===0),Tr=cn().transform((e,r)=>{try{return fn(e)}catch{return r.addIssue({code:"custom",message:"proof_visual_contract_invalid"}),Xo}}),ue=n({version:i(1),owner:U,contextId:x,preparedAt:V,expiresAt:V,prUrl:mt,headSha:t().regex(/^[a-f0-9]{40}$/),skillDigest:X,evidenceKind:s(["image","video"]),visualPlan:Tr.optional(),uploadOrigin:t().url().refine((e)=>{let r=new URL(e);return r.protocol==="https:"&&r.origin===e&&!r.username&&!r.password}).optional()}).strict().refine((e)=>Date.parse(e.expiresAt)>Date.parse(e.preparedAt)&&Date.parse(e.expiresAt)-Date.parse(e.preparedAt)<=300000),Dr=n({version:i(1),producer:i("primary_mac"),context:ue,captureId:x,operationId:x,attemptId:x,tabId:o().int().positive(),startedAt:V,finishedAt:V,sha256:X,media:g("contentType",[n({contentType:i("image/png"),sizeBytes:o().int().min(24).max(8388608),width:o().int().min(1).max(4096),height:o().int().min(1).max(4096)}).strict(),n({contentType:i("video/webm"),sizeBytes:o().int().min(128).max(10485760),durationSeconds:o().min(0.05).max(15),frameCount:o().int().min(1).max(450),receivedFrameCount:o().int().min(1).max(2000)}).strict()])}).strict().superRefine((e,r)=>{let p=Date.parse(e.startedAt),b=Date.parse(e.finishedAt);if(p<Date.parse(e.context.preparedAt)||b<p||b>Date.parse(e.context.expiresAt)||b-p>30000||e.media.contentType==="video/webm"&&(e.media.receivedFrameCount<e.media.frameCount||Math.abs((b-p)/1000-e.media.durationSeconds)>0.1))r.addIssue({code:"custom",message:"mac_pr_proof_capture_chronology_invalid"})}),yc=g("action",[n({action:i("screenshot"),context_id:x,tab_id:o().int().positive()}).strict(),n({action:i("start_video"),context_id:x,tab_id:o().int().positive(),seconds:o().int().min(1).max(15)}).strict(),n({action:i("stop_video"),recording_operation_id:x}).strict()]),fe=n({login:t().regex(/^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,37}[a-zA-Z0-9])?$/),id:t().regex(/^[1-9][0-9]{0,19}$/).nullable()}).strict(),ce=t().regex(/^[1-9][0-9]{0,19}$/),le=n({version:i(1),owner:U,expectedActorId:ce.nullable(),repositoryId:ce,repositoryFullName:t().max(200).regex(/^[A-Za-z0-9_-]+\/[A-Za-z0-9_.-]+$/).refine((e)=>![".",".."].includes(e.split("/")[1]))}).strict(),Wr=["browser_unavailable","github_page_unavailable","identity_check_failed","operation_incomplete","attachment_unavailable"],Nr=g("status",[le.extend({status:i("ready"),observedActor:fe,checkedAt:V}),le.extend({status:i("not_ready"),reason:s(["authentication_required","identity_mismatch","authority_lost","unavailable"]),cause:s(Wr).optional()})]).refine((e)=>e.status!=="ready"||e.expectedActorId===null||e.observedActor.id===e.expectedActorId),Y=n({version:i(1),owner:U,expectedActorId:ce.nullable(),authenticatedActor:fe,attemptId:x,captureId:x,prUrl:mt,repositoryId:ce,headSha:t().regex(/^[a-f0-9]{40}$/),sha256:X,sizeBytes:o().int().min(128).max(10485760),contentType:i("video/webm")}).strict(),pt=t().regex(/^https:\/\/github\.com\/user-attachments\/assets\/[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/),Hr=g("status",[Y.extend({status:i("not_attempted"),reason:s(["authentication_required","attachment_unavailable","identity_mismatch","capture_invalid","authority_lost"])}),Y.extend({status:i("uncertain"),reason:i("upload_outcome_unknown")}),Y.extend({status:i("uploaded"),observedActor:fe,nativeUrl:pt,uploadedAt:V})]).refine((e)=>(e.expectedActorId===null||e.authenticatedActor.id===e.expectedActorId)&&(e.status!=="uploaded"||e.observedActor.id===e.authenticatedActor.id&&e.observedActor.login===e.authenticatedActor.login)),de=Y.extend({nativeUrl:pt,observedActor:fe,bodySha256:X}),$r=g("status",[de.extend({status:i("incomplete"),reason:s(["authentication_required","identity_mismatch","playback_unverified","authority_lost"])}),de.extend({status:i("verified"),sourceSha256:X,width:o().int().min(1).max(4096),height:o().int().min(1).max(4096),durationSeconds:o().positive().max(30),advancedSeconds:o().min(0.05).max(10),advancedFrames:o().int().positive(),playbackRestored:i(!0),verifiedAt:V})]).refine((e)=>(e.expectedActorId===null||e.authenticatedActor.id===e.expectedActorId)&&e.observedActor.id===e.authenticatedActor.id&&e.observedActor.login===e.authenticatedActor.login&&(e.status!=="verified"||e.sourceSha256===e.sha256)),Br=cn().transform((e,r)=>{try{let p=Pe(e);if(p.media.some((b)=>b.kind!=="image"))throw Error();return p}catch{return r.addIssue({code:"custom",message:"proof_media_request_invalid"}),Xo}}),Ur=g("action",[n({action:i("auth_check"),input:le}).strict(),n({action:i("prepare"),context:ue}).strict(),n({action:i("capture_png"),owner:U,contextId:x,tabId:o().int().positive()}).strict(),n({action:i("start_video"),owner:U,contextId:x,tabId:o().int().positive(),seconds:o().int().min(1).max(15)}).strict(),n({action:i("inspect_capture"),owner:U,captureId:x}).strict(),n({action:i("publish_video"),input:Y}).strict(),n({action:i("verify_png_media"),owner:U,media:Br}).strict().refine((e)=>e.media.runId===e.owner.runId),n({action:i("verify_saved_media"),input:de}).strict(),n({action:i("publish_png"),owner:U,attemptId:x,captureId:x,sha256:X,sizeBytes:o().int().min(24).max(8388608),storagePath:t().max(512),uploadUrl:t().url().max(8192)}).strict()]);var Fr=n({requestId:x,command:Ur}).strict();var jr={type:"object",required:["action"],properties:{action:{type:"string",enum:["screenshot","start_video","stop_video"]},context_id:{type:"string",format:"uuid"},tab_id:{type:"integer",minimum:1},seconds:{type:"integer",minimum:1,maximum:15},recording_operation_id:{type:"string",format:"uuid"}},additionalProperties:!1},ut={type:"string",format:"uuid",description:"capture_context_id from tools.pr.prepareProof."},ft={type:"integer",minimum:1,description:"An already-owned tab's id."},_c={...jr,oneOf:[{type:"object",required:["action","context_id","tab_id"],additionalProperties:!1,properties:{action:{type:"string",const:"screenshot"},context_id:ut,tab_id:ft}},{type:"object",required:["action","context_id","tab_id","seconds"],additionalProperties:!1,properties:{action:{type:"string",const:"start_video"},context_id:ut,tab_id:ft,seconds:{type:"integer",minimum:1,maximum:15}}},{type:"object",required:["action","recording_operation_id"],additionalProperties:!1,properties:{action:{type:"string",const:"stop_video"},recording_operation_id:{type:"string",format:"uuid",description:"The recording_operation_id start_video returned."}}}]};var Rc=n({operationId:t().uuid(),attemptId:t().uuid(),contextId:t().uuid(),tabId:o().int().positive()}).strict();var qr=String.raw`async (media) => {
6
6
  const deadline = (promise) => {
7
7
  let timer;
8
8
  return Promise.race([promise, new Promise((_, reject) => {
@@ -49,4 +49,4 @@ ${r?.directory??m(e)}`).digest("hex")}var Bt="keychain-scope.json";var Ut=c({ver
49
49
  }
50
50
  }));
51
51
  return { verified: true, items };
52
- }`;import{execFile as zr}from"child_process";import{promisify as Kr}from"util";var Ic=Kr(zr);var Vc=g("ok",[i({ok:n(!0),actor:i({login:t(),id:t().nullable()}).strict()}).strict(),i({ok:n(!1),reason:s(["authentication_required","identity_mismatch","attachment_unavailable"])}).strict()]),Jc=i({version:n("0.1.42"),metadata:i({extensionId:t(),extensionInstanceId:t(),nativeHostName:t()})});var Xc=i({version:n(1),recording_operation_id:t().uuid(),proof_ready:n(!1),acknowledged_at:y.datetime()}).strict(),me=i({action:n("start"),request_id:t().uuid(),profile:t().regex(/^(Default|Profile [0-9]+)$/),tab_id:o().int().positive(),seconds:o().int().min(1).max(15)}).strict(),gt=i({action:n("inspect"),recording_operation_id:t().uuid()}).strict(),Zc=g("action",[me,gt]),wt=i({recording_operation_id:t().uuid()}).strict(),Oe={device_id:t().uuid(),root_id:t().uuid()},Gr=g("action",[me.extend(Oe),gt.extend(Oe),wt.extend({...Oe,action:n("stop")})]),Qc=an(Gr),el=i({version:n(1),recordingId:t().uuid(),proofReady:n(!1),capture:i({captureId:t().uuid(),contentType:n("video/webm"),sha256:t().regex(/^[a-f0-9]{64}$/),sizeBytes:o().int().min(128).max(10485760),startedAt:y.datetime(),finishedAt:y.datetime(),durationSeconds:o().min(0.05).max(15),frameCount:o().int().min(1).max(450),receivedFrameCount:o().int().min(1).max(2000),owner:i({runId:t().uuid(),deviceId:t().uuid(),rootId:t().uuid(),rootRevision:t().max(64),profile:t().regex(/^(Default|Profile [0-9]+)$/),extensionInstanceId:t().min(1).max(1024),generation:t().uuid(),browserScope:t().max(128),tabId:o().int().positive()}).strict()}).strict().refine((e)=>e.receivedFrameCount>=e.frameCount&&Math.abs((Date.parse(e.finishedAt)-Date.parse(e.startedAt))/1000-e.durationSeconds)<=0.1)}).strict();var dl=me.extend({action:s(["start","inspect"]),recording_boot_generation:t().uuid(),recording_operation_id:t().uuid().optional(),recording_attempt_id:t().uuid().optional()}).strict();import{execFile as Yr}from"child_process";import{promisify as Xr}from"util";var pl=Xr(Yr);var Zr=s(["recording_failed","authority_lost","browser_timeout","cleanup_failed","no_frames","encoding_invalid","frame_invalid","timestamp_invalid","capture_bound","ack_failed","cancelled","detached","browser_changed","tab_not_owned","encoding_frames_failed","encoding_encode_failed","encoding_output_failed","encoding_probe_failed","encoding_probe_streams_failed","encoding_probe_dimensions_failed","encoding_probe_duration_failed","encoding_probe_frames_failed","encoding_probe_format_failed","encoding_decode_failed","encoding_pin_failed"]);var j=t().min(1).max(1024),yt=i({path:j,sha256:t().regex(/^[a-f0-9]{64}$/)}).strict(),Qr=i({owner:i({runId:j,deviceId:j,rootId:j,rootRevision:j,profile:t().regex(/^(Default|Profile [0-9]+)$/),extensionInstanceId:j,generation:j,browserScope:j,tabId:o().int().positive()}).strict(),socketPath:j,extensionId:t().regex(/^[a-p]{32}$/),nativeHostName:j,seconds:o().int().min(1).max(15),encoder:i({ffmpeg:yt,ffprobe:yt}).strict()}).strict();var Ll=i({version:n("0.1.42"),metadata:i({extensionId:t(),extensionInstanceId:t(),nativeHostName:t()})});var Vl=i({operationId:t().uuid()}).strict();var fd=on(nn);var md=i({version:n("0.1.42"),metadata:i({extensionId:n(F),extensionInstanceId:t().min(1).max(1024)})});var Me=1;var Lf=c({type:n("configure"),protocol:n(Me),version:t(),config:B}),Wf=c({type:n("ticket"),organizationId:t().min(1).max(160),receipt:Ie()}),Nf=c({type:s(["ping","stop"])});var Qf=c({type:n("hello"),protocol:n(Me),version:t(),platform:s(["linux","darwin"]),architecture:s(["arm64","x64"]),enrolled:d()}),em=c({type:n("ticket-request"),request:c({install_id:k(),code_challenge:t().regex(/^[A-Za-z0-9_-]{43}$/),lifecycle:s(["persistent","ephemeral"]),roots:u(c({path_fingerprint:t().regex(/^[a-f0-9]{64}$/),execution_mode:s(["confined","host"]),permissions:c({read:n(!0),write:n(!0),execute:n(!0),discover_environment:n(!0),expose_mcp:n(!1)})})).length(1)})}),tm=g("type",[c({type:n("running"),deviceId:t().min(1).max(160),expiresAt:y.datetime({offset:!0}),lifetime:s(["persistent","ephemeral"]),supervision:n("ssh-foreground")}),c({type:n("pong")}),c({type:n("stopped")})]);var Rn=1;var Z=k(),En=c({kind:n("install_only"),authorityId:Z,organizationId:Z,userId:Z,connectionId:Z,attemptId:Z,purpose:n("install"),generation:o().int().positive(),transport:n("reverse_ssh"),expiresAt:y.datetime({offset:!0}),maxDurationMs:n(300000),maxChannels:n(1),allowTcpForwarding:n(!1),allowPty:n(!1)}),Pn=t().max(2048).superRefine((e,r)=>{let p;try{p=new URL(e)}catch{r.addIssue({code:"custom",message:"invalid relay url"});return}if(p.protocol!=="ws:"&&p.protocol!=="wss:"){r.addIssue({code:"custom",message:"invalid relay protocol"});return}if(p.username||p.password||p.search||p.hash){r.addIssue({code:"custom",message:"relay credentials or modifiers are not allowed"});return}let b=p.pathname.split("/");if(b.length!==4||b[1]!=="device"||!Z.safeParse(b[2]).success||!/^[a-f0-9]{64}$/.test(b[3]??""))r.addIssue({code:"custom",message:"invalid device relay path"});if(p.protocol==="ws:"&&!["127.0.0.1","[::1]"].includes(p.hostname))r.addIssue({code:"custom",message:"plaintext relay must be loopback"})});var om=c({protocol:n(Rn),type:n("ssh_install_relay"),authorityToken:t().regex(/^(?:reason|ara)_ssh_install_[A-Za-z0-9_-]{43}$/),authority:En,relayUrl:Pn,endpoint:c({host:n("127.0.0.1"),port:n(22)})});class Ct extends Error{}function Be(e){if(!f(e))return null;let r=new Ct(`${e} is not a valid worker config. Remove it to start over.`),p;try{p=JSON.parse(h(e))}catch(R){if(R instanceof SyntaxError)throw r;throw R}let b=B.safeParse(p);if(!b.success)throw r;return b.data}var Ln=200;var Zp=c({version:n(1),session_ids:u(t().min(1).max(200)).max(Ln)});function it(e,r,p=!1){let b=Wn(e,r,p);return b.length===1?b[0]:J(ke(J(e,".config")),...xt(r,p))}var xt=(e,r)=>[...e==="production"?[]:[e],r?"connect-once":"connect"];function Wn(e,r,p=!1){let b=e;try{b=pe(e)}catch{}return["ara","reason"].map((R)=>J(b,".config",R,...xt(r,p))).filter(Nn)}function Nn(e){try{if(pe(e)!==e)return!1;return Be(J(e,"worker.json"))?.stateDirectory===e}catch{return!1}}var Hn="disconnected.json";function Ss(e,r){return f(J(it(e,r),Hn))}function $n(e,r){return r==="darwin"&&e.userChrome!==!1}var xg=i({root:i({id:t().min(1).max(160),label:t().max(160),path_fingerprint:t()})});var Ig=Symbol("serve here");async function Es(e={}){let r=pe(e.home??a()),p=Be(J(it(r,e.channel??_()),"worker.json"));if(!p)return null;let b,R=await(e.controlWorker??G)(p,"status").catch((L)=>(b=L instanceof Error?L:Error(String(L)),null)),S=R?tt(p):null,P=e.serviceHost??xe(r),E=Ze(p,P,"connect"),C=H(p).revoked,T=!C&&!R,I=(()=>{try{return M(p)}catch{return null}})(),{workspaces:A,off:D}=C||we(p.stateDirectory)!==null?{workspaces:null,off:null}:qe(p,R?.phase==="running");return{workspaces:A,workspaces_off:D,workspaces_max:je+(A?.filter((L)=>L.account).length??0),name:p.name,device_id:I?.deviceId??null,organization_id:I?.orgId??null,folder:p.workspaceRoot,mode:p.executionMode,sessions_max:null,user_chrome:$n(p,P.platform),cloud_sessions:p.cloudSessions===!0,root:I?.roots[0]?{id:I.roots[0].id,permissions:I.roots[0].permissions}:null,roots:I?.roots.map((L)=>({id:L.id,folder:L.path,permissions:L.permissions}))??[],state:C?"removed":R?R.phase==="running"?"connected":R.phase:"not_running",not_running_reason:T?rt(p,b):null,worker_alive:T&&E?Xn(E,P):null,sessions_running:R?.activeSessions??null,version:S,service:E?{label:E.label,logs:E.logs}:null}}function xs(e={}){let r=pe(e.home??a()),p=Be(J(it(r,e.channel??_()),"worker.json"));if(!p)return null;return Vr(p,e.serviceHost??xe(r),"connect")?.label??null}export{w,M,pr,Be,it,Ss,Es,xs};
52
+ }`;import{execFile as zr}from"child_process";import{promisify as Kr}from"util";var Ic=Kr(zr);var Vc=g("ok",[n({ok:i(!0),actor:n({login:t(),id:t().nullable()}).strict()}).strict(),n({ok:i(!1),reason:s(["authentication_required","identity_mismatch","attachment_unavailable"])}).strict()]),Jc=n({version:i("0.1.42"),metadata:n({extensionId:t(),extensionInstanceId:t(),nativeHostName:t()})});var Xc=n({version:i(1),recording_operation_id:t().uuid(),proof_ready:i(!1),acknowledged_at:y.datetime()}).strict(),me=n({action:i("start"),request_id:t().uuid(),profile:t().regex(/^(Default|Profile [0-9]+)$/),tab_id:o().int().positive(),seconds:o().int().min(1).max(15)}).strict(),gt=n({action:i("inspect"),recording_operation_id:t().uuid()}).strict(),Zc=g("action",[me,gt]),wt=n({recording_operation_id:t().uuid()}).strict(),Oe={device_id:t().uuid(),root_id:t().uuid()},Gr=g("action",[me.extend(Oe),gt.extend(Oe),wt.extend({...Oe,action:i("stop")})]),Qc=an(Gr),el=n({version:i(1),recordingId:t().uuid(),proofReady:i(!1),capture:n({captureId:t().uuid(),contentType:i("video/webm"),sha256:t().regex(/^[a-f0-9]{64}$/),sizeBytes:o().int().min(128).max(10485760),startedAt:y.datetime(),finishedAt:y.datetime(),durationSeconds:o().min(0.05).max(15),frameCount:o().int().min(1).max(450),receivedFrameCount:o().int().min(1).max(2000),owner:n({runId:t().uuid(),deviceId:t().uuid(),rootId:t().uuid(),rootRevision:t().max(64),profile:t().regex(/^(Default|Profile [0-9]+)$/),extensionInstanceId:t().min(1).max(1024),generation:t().uuid(),browserScope:t().max(128),tabId:o().int().positive()}).strict()}).strict().refine((e)=>e.receivedFrameCount>=e.frameCount&&Math.abs((Date.parse(e.finishedAt)-Date.parse(e.startedAt))/1000-e.durationSeconds)<=0.1)}).strict();var dl=me.extend({action:s(["start","inspect"]),recording_boot_generation:t().uuid(),recording_operation_id:t().uuid().optional(),recording_attempt_id:t().uuid().optional()}).strict();import{execFile as Yr}from"child_process";import{promisify as Xr}from"util";var pl=Xr(Yr);var Zr=s(["recording_failed","authority_lost","browser_timeout","cleanup_failed","no_frames","encoding_invalid","frame_invalid","timestamp_invalid","capture_bound","ack_failed","cancelled","detached","browser_changed","tab_not_owned","encoding_frames_failed","encoding_encode_failed","encoding_output_failed","encoding_probe_failed","encoding_probe_streams_failed","encoding_probe_dimensions_failed","encoding_probe_duration_failed","encoding_probe_frames_failed","encoding_probe_format_failed","encoding_decode_failed","encoding_pin_failed"]);var j=t().min(1).max(1024),yt=n({path:j,sha256:t().regex(/^[a-f0-9]{64}$/)}).strict(),Qr=n({owner:n({runId:j,deviceId:j,rootId:j,rootRevision:j,profile:t().regex(/^(Default|Profile [0-9]+)$/),extensionInstanceId:j,generation:j,browserScope:j,tabId:o().int().positive()}).strict(),socketPath:j,extensionId:t().regex(/^[a-p]{32}$/),nativeHostName:j,seconds:o().int().min(1).max(15),encoder:n({ffmpeg:yt,ffprobe:yt}).strict()}).strict();var Ll=n({version:i("0.1.42"),metadata:n({extensionId:t(),extensionInstanceId:t(),nativeHostName:t()})});var Vl=n({operationId:t().uuid()}).strict();var fd=on(nn);var md=n({version:i("0.1.42"),metadata:n({extensionId:i(F),extensionInstanceId:t().min(1).max(1024)})});var Me=1;var Lf=c({type:i("configure"),protocol:i(Me),version:t(),config:B}),Wf=c({type:i("ticket"),organizationId:t().min(1).max(160),receipt:Ie()}),Nf=c({type:s(["ping","stop"])});var Qf=c({type:i("hello"),protocol:i(Me),version:t(),platform:s(["linux","darwin"]),architecture:s(["arm64","x64"]),enrolled:d()}),em=c({type:i("ticket-request"),request:c({install_id:k(),code_challenge:t().regex(/^[A-Za-z0-9_-]{43}$/),lifecycle:s(["persistent","ephemeral"]),roots:u(c({path_fingerprint:t().regex(/^[a-f0-9]{64}$/),execution_mode:s(["confined","host"]),permissions:c({read:i(!0),write:i(!0),execute:i(!0),discover_environment:i(!0),expose_mcp:i(!1)})})).length(1)})}),tm=g("type",[c({type:i("running"),deviceId:t().min(1).max(160),expiresAt:y.datetime({offset:!0}),lifetime:s(["persistent","ephemeral"]),supervision:i("ssh-foreground")}),c({type:i("pong")}),c({type:i("stopped")})]);var Rn=1;var Z=k(),En=c({kind:i("install_only"),authorityId:Z,organizationId:Z,userId:Z,connectionId:Z,attemptId:Z,purpose:i("install"),generation:o().int().positive(),transport:i("reverse_ssh"),expiresAt:y.datetime({offset:!0}),maxDurationMs:i(300000),maxChannels:i(1),allowTcpForwarding:i(!1),allowPty:i(!1)}),Pn=t().max(2048).superRefine((e,r)=>{let p;try{p=new URL(e)}catch{r.addIssue({code:"custom",message:"invalid relay url"});return}if(p.protocol!=="ws:"&&p.protocol!=="wss:"){r.addIssue({code:"custom",message:"invalid relay protocol"});return}if(p.username||p.password||p.search||p.hash){r.addIssue({code:"custom",message:"relay credentials or modifiers are not allowed"});return}let b=p.pathname.split("/");if(b.length!==4||b[1]!=="device"||!Z.safeParse(b[2]).success||!/^[a-f0-9]{64}$/.test(b[3]??""))r.addIssue({code:"custom",message:"invalid device relay path"});if(p.protocol==="ws:"&&!["127.0.0.1","[::1]"].includes(p.hostname))r.addIssue({code:"custom",message:"plaintext relay must be loopback"})});var om=c({protocol:i(Rn),type:i("ssh_install_relay"),authorityToken:t().regex(/^(?:reason|ara)_ssh_install_[A-Za-z0-9_-]{43}$/),authority:En,relayUrl:Pn,endpoint:c({host:i("127.0.0.1"),port:i(22)})});class Ct extends Error{}function Be(e){if(!f(e))return null;let r=new Ct(`${e} is not a valid worker config. Remove it to start over.`),p;try{p=JSON.parse(h(e))}catch(R){if(R instanceof SyntaxError)throw r;throw R}let b=B.safeParse(p);if(!b.success)throw r;return b.data}var Ln=200;var Zp=c({version:i(1),session_ids:u(t().min(1).max(200)).max(Ln)});function it(e,r,p=!1){let b=Wn(e,r,p);return b.length===1?b[0]:J(ke(J(e,".config")),...xt(r,p))}var xt=(e,r)=>[...e==="production"?[]:[e],r?"connect-once":"connect"];function Wn(e,r,p=!1){let b=e;try{b=pe(e)}catch{}return["ara","reason"].map((R)=>J(b,".config",R,...xt(r,p))).filter(Nn)}function Nn(e){try{if(pe(e)!==e)return!1;return Be(J(e,"worker.json"))?.stateDirectory===e}catch{return!1}}var Hn="disconnected.json";function Ss(e,r){return f(J(it(e,r),Hn))}function $n(e,r){return r==="darwin"&&e.userChrome!==!1}var xg=n({root:n({id:t().min(1).max(160),label:t().max(160),path_fingerprint:t()})});var Ig=Symbol("serve here");async function Es(e={}){let r=pe(e.home??a()),p=Be(J(it(r,e.channel??_()),"worker.json"));if(!p)return null;let b,R=await(e.controlWorker??G)(p,"status").catch((L)=>(b=L instanceof Error?L:Error(String(L)),null)),S=R?tt(p):null,P=e.serviceHost??xe(r),E=Ze(p,P,"connect"),C=H(p).revoked,T=!C&&!R,I=(()=>{try{return M(p)}catch{return null}})(),{workspaces:A,off:D}=C||we(p.stateDirectory)!==null?{workspaces:null,off:null}:qe(p,R?.phase==="running");return{workspaces:A,workspaces_off:D,workspaces_max:je+(A?.filter((L)=>L.account).length??0),name:p.name,device_id:I?.deviceId??null,organization_id:I?.orgId??null,folder:p.workspaceRoot,mode:p.executionMode,sessions_max:null,user_chrome:$n(p,P.platform),cloud_sessions:p.cloudSessions===!0,root:I?.roots[0]?{id:I.roots[0].id,permissions:I.roots[0].permissions}:null,roots:I?.roots.map((L)=>({id:L.id,folder:L.path,permissions:L.permissions}))??[],state:C?"removed":R?R.phase==="running"?"connected":R.phase:"not_running",not_running_reason:T?rt(p,b):null,worker_alive:T&&E?Xn(E,P):null,sessions_running:R?.activeSessions??null,version:S,service:E?{label:E.label,logs:E.logs}:null}}function xs(e={}){let r=pe(e.home??a()),p=Be(J(it(r,e.channel??_()),"worker.json"));if(!p)return null;return Vr(p,e.serviceHost??xe(r),"connect")?.label??null}export{w,M,pr,Be,it,Ss,Es,xs};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{S,Wt,Bn,Ge,Fn,jn}from"./vm-hands-entry-lite-k9vk84wa.js";import{Zn}from"./vm-hands-entry-lite-qnyrqhac.js";import{Ln}from"./vm-hands-entry-lite-ct4mtq1m.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{execFile as ys,spawn as qe}from"child_process";import{existsSync as ws}from"fs";import{connect as xs}from"net";function pn(){let e=new Set,t=null,n=(s)=>({holder:t?.viewer??null,you:t===s,same_user:Boolean(t?.viewer&&s.viewer&&t.viewer.user_id===s.viewer.user_id)}),o=()=>{for(let s of e)s.notify(n(s))};return{join(s){return e.add(s),s.notify(n(s)),()=>{if(!e.delete(s))return;if(t!==s)return;t=null,o()}},claim(s){if(t===s||!e.has(s))return;t=s,o()}}}var ut=pn();import{createHash as St}from"crypto";import{once as Sn}from"events";import{createWriteStream as vn,existsSync as mr,mkdirSync as gr,mkdtempSync as hr,readFileSync as le,readdirSync as br,renameSync as yr,realpathSync as En,rmSync as Pn,statSync as Ne,writeFileSync as wr}from"fs";import{delimiter as _r,dirname as vt,join as b}from"path";import{finished as Cn}from"stream/promises";var We="omljlfpmafedpplnpkkahegadhkimdje",go="https://chromewebstore.google.com/detail/reason/omljlfpmafedpplnpkkahegadhkimdje";var O={ocu:{repository:"https://github.com/iFurySt/open-codex-computer-use.git",revision:"386a260d1ab8b690adbbb27f7471595cf0c2b752",version:"0.3.5"},obu:{repository:"https://github.com/iFurySt/open-browser-use.git",revision:"ac015846df75928fbcf0f3a0f3ba3a210ce1a507",version:"0.1.42"}},H={version:"155.0.8059.84",macArm64Sha256:"13b9e98ce56f5ce18e100a009f455c9285f399e7c9dc8a76fdf2f3a9755bb5f2",linux64Sha256:"cf0f049892dea22e6a6db26d47ed0d7776b7158edcbec4634086633df8bafcbc",win64Sha256:"507f2a031441d10c62b5e3d4e863f09ac1198a571c1419976cbd8387f639afde"};var J={ocu:{url:`https://registry.npmjs.org/open-computer-use/-/open-computer-use-${O.ocu.version}.tgz`,sha256:"7c16a87c8cd357787b02c0ebd040dd5f93880c1fb51c1901caa2e0c05d063130",size_bytes:5844280},obu:{url:`https://registry.npmjs.org/open-browser-use/-/open-browser-use-${O.obu.version}.tgz`,sha256:"9386d8ce0a147b3f55e1807b68edf736836378807541c457c9b5f6ca2cabaa4e",size_bytes:21372018},extension:{url:`https://github.com/iFurySt/open-browser-use/releases/download/v${O.obu.version}/open-browser-use-chrome-extension-${O.obu.version}.zip`,sha256:"c9c07bec1175e12ea6985b0e7784a5ef01fd03f014b958224a1e17dcd838a241",size_bytes:31070}},F="pnbmoicbkopffjjgfgfglopechaiemkp";import{spawn as Me}from"child_process";import{createRequire as fn}from"module";import{join as mn}from"path";var gn=30000,hn=1048576;function Te(){return process.env.SystemRoot??"C:\\Windows"}function bn(){return mn(Te(),"System32","WindowsPowerShell","v1.0","powershell.exe")}var yn=String.raw`
2
+ import{S,Wt,Bn,Ge,Fn,jn}from"./vm-hands-entry-lite-k9vk84wa.js";import{Zn}from"./vm-hands-entry-lite-kng982rg.js";import{Ln}from"./vm-hands-entry-lite-ct4mtq1m.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{execFile as ys,spawn as qe}from"child_process";import{existsSync as ws}from"fs";import{connect as xs}from"net";function pn(){let e=new Set,t=null,n=(s)=>({holder:t?.viewer??null,you:t===s,same_user:Boolean(t?.viewer&&s.viewer&&t.viewer.user_id===s.viewer.user_id)}),o=()=>{for(let s of e)s.notify(n(s))};return{join(s){return e.add(s),s.notify(n(s)),()=>{if(!e.delete(s))return;if(t!==s)return;t=null,o()}},claim(s){if(t===s||!e.has(s))return;t=s,o()}}}var ut=pn();import{createHash as St}from"crypto";import{once as Sn}from"events";import{createWriteStream as vn,existsSync as mr,mkdirSync as gr,mkdtempSync as hr,readFileSync as le,readdirSync as br,renameSync as yr,realpathSync as En,rmSync as Pn,statSync as Ne,writeFileSync as wr}from"fs";import{delimiter as _r,dirname as vt,join as b}from"path";import{finished as Cn}from"stream/promises";var We="omljlfpmafedpplnpkkahegadhkimdje",go="https://chromewebstore.google.com/detail/reason/omljlfpmafedpplnpkkahegadhkimdje";var O={ocu:{repository:"https://github.com/iFurySt/open-codex-computer-use.git",revision:"386a260d1ab8b690adbbb27f7471595cf0c2b752",version:"0.3.5"},obu:{repository:"https://github.com/iFurySt/open-browser-use.git",revision:"ac015846df75928fbcf0f3a0f3ba3a210ce1a507",version:"0.1.42"}},H={version:"155.0.8059.84",macArm64Sha256:"13b9e98ce56f5ce18e100a009f455c9285f399e7c9dc8a76fdf2f3a9755bb5f2",linux64Sha256:"cf0f049892dea22e6a6db26d47ed0d7776b7158edcbec4634086633df8bafcbc",win64Sha256:"507f2a031441d10c62b5e3d4e863f09ac1198a571c1419976cbd8387f639afde"};var J={ocu:{url:`https://registry.npmjs.org/open-computer-use/-/open-computer-use-${O.ocu.version}.tgz`,sha256:"7c16a87c8cd357787b02c0ebd040dd5f93880c1fb51c1901caa2e0c05d063130",size_bytes:5844280},obu:{url:`https://registry.npmjs.org/open-browser-use/-/open-browser-use-${O.obu.version}.tgz`,sha256:"9386d8ce0a147b3f55e1807b68edf736836378807541c457c9b5f6ca2cabaa4e",size_bytes:21372018},extension:{url:`https://github.com/iFurySt/open-browser-use/releases/download/v${O.obu.version}/open-browser-use-chrome-extension-${O.obu.version}.zip`,sha256:"c9c07bec1175e12ea6985b0e7784a5ef01fd03f014b958224a1e17dcd838a241",size_bytes:31070}},F="pnbmoicbkopffjjgfgfglopechaiemkp";import{spawn as Me}from"child_process";import{createRequire as fn}from"module";import{join as mn}from"path";var gn=30000,hn=1048576;function Te(){return process.env.SystemRoot??"C:\\Windows"}function bn(){return mn(Te(),"System32","WindowsPowerShell","v1.0","powershell.exe")}var yn=String.raw`
3
3
  $ErrorActionPreference = "Stop"
4
4
  Add-Type -TypeDefinition @"
5
5
  using System;
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{U}from"./vm-hands-entry-lite-a0g6c3wr.js";import{ft}from"./vm-hands-entry-lite-hv3dxd5k.js";import{Xt}from"./vm-hands-entry-lite-y9jarm7q.js";import{j}from"./vm-hands-entry-lite-cgddp0y3.js";import{ie}from"./vm-hands-entry-lite-jvszqt0z.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{Me}from"./vm-hands-entry-lite-3gbf905c.js";import{existsSync as D,realpathSync as z,statSync as K}from"fs";import{platform as h}from"os";import{isAbsolute as I,sep as G}from"path";import{existsSync as X}from"fs";import{createRequire as Y}from"module";var k=Me(Xt)(()=>Y(import.meta.url)("bun:ffi"),X);function C(){return process.platform==="win32"&&typeof globalThis.Bun<"u"&&k.available()}function M(e=process.env){return k.defaultShell(e)}function N(e){return k.shellArgs(e)}function W(e){let n=k.spawn({...e,env:e.environment});return n.exited.then(()=>n.close()),{write:(o)=>n.write(o),resize:(o,t)=>n.resize(o,t),kill:()=>n.close(),exited:n.exited}}var Dr=43200000,Vt=ft,Or=4,Q=/^[A-Za-z0-9._:-]{1,160}$/,V=1000;function F(e){return Boolean(e)&&typeof e==="object"&&!Array.isArray(e)}function P(e,n){if(typeof e!=="number"||!Number.isFinite(e)||e<=0)return n;return Math.min(V,Math.max(1,Math.floor(e)))}function Z(e,n=Date.now()){let o=["relay_url","session_id","expires_at"],t=new Set([...o,"cols","rows","cwd","workspace"]);if(!F(e)||o.some((b)=>!(b in e))||Object.keys(e).some((b)=>!t.has(b)))throw new r("invalid_pty_request","Reason terminal request is malformed.");let{relay_url:c,session_id:m,expires_at:g}=e;if(typeof c!=="string")throw new r("invalid_pty_request","Reason terminal relay URL is missing.");let d;try{d=new URL(c)}catch{throw new r("invalid_pty_request","Reason terminal relay URL is invalid.")}if(d.protocol!=="wss:"&&d.protocol!=="ws:"||d.username||d.password)throw new r("invalid_pty_request","Reason terminal relay URL is invalid.");if(typeof m!=="string"||!Q.test(m))throw new r("invalid_pty_request","Reason terminal session identity is invalid.");let p=typeof g==="string"?Date.parse(g):Number.NaN;if(!Number.isFinite(p)||p<=n)throw new r("invalid_pty_request","Reason terminal session has already expired.");if(e.cwd!==void 0&&typeof e.cwd!=="string")throw new r("invalid_pty_request","Reason terminal working directory is invalid.");let a=e.workspace===void 0?void 0:U(e.workspace);if(a===null||a&&e.cwd!==void 0)throw new r("invalid_pty_request","Reason terminal workspace is invalid.");return{relay_url:c,session_id:m,expires_at:new Date(Math.min(p,n+Dr)).toISOString(),cols:P(e.cols,80),rows:P(e.rows,24),...e.cwd===void 0?{}:{cwd:e.cwd},...a?{workspace:a}:{}}}function ee(e,n){if(h()==="win32")[e,n]=[e.toLowerCase(),n.toLowerCase()];return n===e||n.startsWith(e+G)}function q(e,n){if(n===void 0)return e;if(!I(n))throw new r("pty_cwd_invalid","Reason terminal working directory must be absolute.");let o;try{o=z(n)}catch{throw new r("pty_cwd_invalid","Reason terminal working directory does not exist.")}if(!ee(e,o))throw new r("pty_cwd_outside_root","Reason terminal working directory escapes the granted root.");if(!K(o).isDirectory())throw new r("pty_cwd_invalid","Reason terminal working directory is not a directory.");return o}function ds(e=process.env){if(h()==="win32")return M(e);let n=e.SHELL;if(n&&I(n)&&D(n))return n;for(let o of h()==="darwin"?["/bin/zsh","/bin/bash","/bin/sh"]:["/bin/bash","/bin/sh"])if(D(o))return o;return"/bin/sh"}function ne(){let e=globalThis.Bun;if(!e)throw new r("pty_unavailable","Reason terminals require the Bun runtime.");return e.spawn}function Hn(){if(h()==="win32")return C();return typeof globalThis.Bun<"u"}var re=(e)=>{if(h()==="win32")try{return W({...e,file:e.shell,args:N(e.shell),environment:{...e.environment,TERM:"xterm-256color"}})}catch{throw new r("pty_unavailable","Reason could not allocate a pseudo-terminal.")}let n=ne()({cmd:[e.shell,"-i","-l"],cwd:e.cwd,env:{...e.environment,TERM:"xterm-256color"},terminal:{cols:e.cols,rows:e.rows,data:(t,c)=>{e.onData(c)}}}),o=n.terminal;if(!o){try{n.kill()}catch{}throw new r("pty_unavailable","Reason could not allocate a pseudo-terminal.")}return{write:(t)=>o.write(t),resize:(t,c)=>o.resize(t,c),kill:()=>{try{n.kill()}catch{}},exited:n.exited.then((t)=>typeof t==="number"?t:null,()=>null)}},Nr=(e,n)=>n===void 0?new WebSocket(e):new WebSocket(e,{proxy:n}),v=new Set;function te(e){if(v.size>=Or||v.has(e))return null;v.add(e);let n=!1;return()=>{if(n)return;n=!0,v.delete(e)}}async function Un(e,n={}){let o=n.now??Date.now,t=Z(e.payload,o()),c=te(e.operationId);if(!c)throw new r("pty_slot_busy","This Reason Device already runs the maximum number of terminals.");let m=o(),g,d,p;try{let a=t.workspace?ie(e.root,t.workspace):void 0;g=a?q(D(a.boundary)?z(a.boundary):a.boundary,a.path):q(e.root,t.cwd),d=n.environment??process.env,p=n.shellPath??ds(d)}catch(a){throw c(),a}return await new Promise((a,b)=>{let w=null,i=null,S=!1,x=!1,y=!1,T=null,B=0,O=0,E=[],R=0,A=null,l=(s)=>{if(y)return;if(y=!0,A)clearTimeout(A);e.signal.removeEventListener("abort",L);try{w?.kill()}catch{}try{i?.close(1000,"pty_session_over")}catch{}if(c(),s.kind==="rejected"){b(s.error);return}let u={reason:s.reason,exit_code:T,output_bytes:B,input_bytes:O,duration_ms:Math.max(0,o()-m)};e.emitEvent("pty.stopped",{...u}).catch(()=>{return}),a({...u})},L=()=>{let s=e.signal.reason;l({kind:"rejected",error:s instanceof r?s:new r("cancelled","Reason closed the terminal session.")})};if(e.signal.aborted){L();return}e.signal.addEventListener("abort",L,{once:!0}),A=setTimeout(()=>l({kind:"resolved",reason:"session_expired"}),Math.max(1,Date.parse(t.expires_at)-o()));let H=(s)=>{if(B+=s.byteLength,!S||!i){if(E.push(s),R+=s.byteLength,R>Vt)l({kind:"resolved",reason:"output_backpressure"});return}try{i.send(s)}catch{l({kind:"resolved",reason:"relay_closed"});return}if(i.bufferedAmount>Vt)l({kind:"resolved",reason:"output_backpressure"})};try{w=(n.spawnPty??re)({shell:p,args:["-i","-l"],cwd:g,cols:t.cols,rows:t.rows,environment:d,onData:(s)=>{if(!y)H(s)}})}catch(s){l({kind:"rejected",error:s instanceof r?s:new r("pty_spawn_failed","Reason could not start the terminal shell.")});return}w.exited.then((s)=>{if(y)return;if(T=s,S&&i)try{i.send(JSON.stringify({t:"exit",code:s}))}catch{}l({kind:"resolved",reason:"shell_exited"})});let J=(n.loadProxy??j)()?.url;try{i=(n.connect??Nr)(t.relay_url,J)}catch{l({kind:"rejected",error:new r("pty_relay_unavailable","Reason could not reach the terminal relay.")});return}i.binaryType="arraybuffer",i.onopen=()=>{if(y||!i)return;S=!0;try{i.send(JSON.stringify({t:"open",cols:t.cols,rows:t.rows}));for(let s of E.splice(0))i.send(s);R=0}catch{l({kind:"resolved",reason:"relay_closed"});return}x=!0,e.emitEvent("pty.ready",{session_id:t.session_id,cols:t.cols,rows:t.rows}).catch(()=>{return})},i.onmessage=(s)=>{if(y||!w)return;let u=s.data;if(typeof u==="string"){let f;try{f=JSON.parse(u)}catch{return}if(!F(f))return;if(f.t==="resize"){try{w.resize(P(f.cols,t.cols),P(f.rows,t.rows))}catch{}return}if(f.t==="close")l({kind:"resolved",reason:"client_closed"});return}let _=u instanceof ArrayBuffer?new Uint8Array(u):ArrayBuffer.isView(u)?new Uint8Array(u.buffer,u.byteOffset,u.byteLength):null;if(!_||_.byteLength===0)return;O+=_.byteLength;try{w.write(_)}catch{}},i.onclose=()=>{if(y)return;if(!x){l({kind:"rejected",error:new r("pty_relay_unavailable","Reason could not reach the terminal relay.")});return}l({kind:"resolved",reason:"relay_closed"})},i.onerror=()=>{if(y||x)return;l({kind:"rejected",error:new r("pty_relay_unavailable","Reason could not reach the terminal relay.")})}})}
2
+ import{U}from"./vm-hands-entry-lite-a0g6c3wr.js";import{ft}from"./vm-hands-entry-lite-hv3dxd5k.js";import{Xt}from"./vm-hands-entry-lite-y9jarm7q.js";import{j}from"./vm-hands-entry-lite-vj0gm694.js";import{ie}from"./vm-hands-entry-lite-jvszqt0z.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{Me}from"./vm-hands-entry-lite-3gbf905c.js";import{existsSync as D,realpathSync as z,statSync as K}from"fs";import{platform as h}from"os";import{isAbsolute as I,sep as G}from"path";import{existsSync as X}from"fs";import{createRequire as Y}from"module";var k=Me(Xt)(()=>Y(import.meta.url)("bun:ffi"),X);function C(){return process.platform==="win32"&&typeof globalThis.Bun<"u"&&k.available()}function M(e=process.env){return k.defaultShell(e)}function N(e){return k.shellArgs(e)}function W(e){let n=k.spawn({...e,env:e.environment});return n.exited.then(()=>n.close()),{write:(o)=>n.write(o),resize:(o,t)=>n.resize(o,t),kill:()=>n.close(),exited:n.exited}}var Dr=43200000,Vt=ft,Or=4,Q=/^[A-Za-z0-9._:-]{1,160}$/,V=1000;function F(e){return Boolean(e)&&typeof e==="object"&&!Array.isArray(e)}function P(e,n){if(typeof e!=="number"||!Number.isFinite(e)||e<=0)return n;return Math.min(V,Math.max(1,Math.floor(e)))}function Z(e,n=Date.now()){let o=["relay_url","session_id","expires_at"],t=new Set([...o,"cols","rows","cwd","workspace"]);if(!F(e)||o.some((b)=>!(b in e))||Object.keys(e).some((b)=>!t.has(b)))throw new r("invalid_pty_request","Reason terminal request is malformed.");let{relay_url:c,session_id:m,expires_at:g}=e;if(typeof c!=="string")throw new r("invalid_pty_request","Reason terminal relay URL is missing.");let d;try{d=new URL(c)}catch{throw new r("invalid_pty_request","Reason terminal relay URL is invalid.")}if(d.protocol!=="wss:"&&d.protocol!=="ws:"||d.username||d.password)throw new r("invalid_pty_request","Reason terminal relay URL is invalid.");if(typeof m!=="string"||!Q.test(m))throw new r("invalid_pty_request","Reason terminal session identity is invalid.");let p=typeof g==="string"?Date.parse(g):Number.NaN;if(!Number.isFinite(p)||p<=n)throw new r("invalid_pty_request","Reason terminal session has already expired.");if(e.cwd!==void 0&&typeof e.cwd!=="string")throw new r("invalid_pty_request","Reason terminal working directory is invalid.");let a=e.workspace===void 0?void 0:U(e.workspace);if(a===null||a&&e.cwd!==void 0)throw new r("invalid_pty_request","Reason terminal workspace is invalid.");return{relay_url:c,session_id:m,expires_at:new Date(Math.min(p,n+Dr)).toISOString(),cols:P(e.cols,80),rows:P(e.rows,24),...e.cwd===void 0?{}:{cwd:e.cwd},...a?{workspace:a}:{}}}function ee(e,n){if(h()==="win32")[e,n]=[e.toLowerCase(),n.toLowerCase()];return n===e||n.startsWith(e+G)}function q(e,n){if(n===void 0)return e;if(!I(n))throw new r("pty_cwd_invalid","Reason terminal working directory must be absolute.");let o;try{o=z(n)}catch{throw new r("pty_cwd_invalid","Reason terminal working directory does not exist.")}if(!ee(e,o))throw new r("pty_cwd_outside_root","Reason terminal working directory escapes the granted root.");if(!K(o).isDirectory())throw new r("pty_cwd_invalid","Reason terminal working directory is not a directory.");return o}function ds(e=process.env){if(h()==="win32")return M(e);let n=e.SHELL;if(n&&I(n)&&D(n))return n;for(let o of h()==="darwin"?["/bin/zsh","/bin/bash","/bin/sh"]:["/bin/bash","/bin/sh"])if(D(o))return o;return"/bin/sh"}function ne(){let e=globalThis.Bun;if(!e)throw new r("pty_unavailable","Reason terminals require the Bun runtime.");return e.spawn}function Hn(){if(h()==="win32")return C();return typeof globalThis.Bun<"u"}var re=(e)=>{if(h()==="win32")try{return W({...e,file:e.shell,args:N(e.shell),environment:{...e.environment,TERM:"xterm-256color"}})}catch{throw new r("pty_unavailable","Reason could not allocate a pseudo-terminal.")}let n=ne()({cmd:[e.shell,"-i","-l"],cwd:e.cwd,env:{...e.environment,TERM:"xterm-256color"},terminal:{cols:e.cols,rows:e.rows,data:(t,c)=>{e.onData(c)}}}),o=n.terminal;if(!o){try{n.kill()}catch{}throw new r("pty_unavailable","Reason could not allocate a pseudo-terminal.")}return{write:(t)=>o.write(t),resize:(t,c)=>o.resize(t,c),kill:()=>{try{n.kill()}catch{}},exited:n.exited.then((t)=>typeof t==="number"?t:null,()=>null)}},Nr=(e,n)=>n===void 0?new WebSocket(e):new WebSocket(e,{proxy:n}),v=new Set;function te(e){if(v.size>=Or||v.has(e))return null;v.add(e);let n=!1;return()=>{if(n)return;n=!0,v.delete(e)}}async function Un(e,n={}){let o=n.now??Date.now,t=Z(e.payload,o()),c=te(e.operationId);if(!c)throw new r("pty_slot_busy","This Reason Device already runs the maximum number of terminals.");let m=o(),g,d,p;try{let a=t.workspace?ie(e.root,t.workspace):void 0;g=a?q(D(a.boundary)?z(a.boundary):a.boundary,a.path):q(e.root,t.cwd),d=n.environment??process.env,p=n.shellPath??ds(d)}catch(a){throw c(),a}return await new Promise((a,b)=>{let w=null,i=null,S=!1,x=!1,y=!1,T=null,B=0,O=0,E=[],R=0,A=null,l=(s)=>{if(y)return;if(y=!0,A)clearTimeout(A);e.signal.removeEventListener("abort",L);try{w?.kill()}catch{}try{i?.close(1000,"pty_session_over")}catch{}if(c(),s.kind==="rejected"){b(s.error);return}let u={reason:s.reason,exit_code:T,output_bytes:B,input_bytes:O,duration_ms:Math.max(0,o()-m)};e.emitEvent("pty.stopped",{...u}).catch(()=>{return}),a({...u})},L=()=>{let s=e.signal.reason;l({kind:"rejected",error:s instanceof r?s:new r("cancelled","Reason closed the terminal session.")})};if(e.signal.aborted){L();return}e.signal.addEventListener("abort",L,{once:!0}),A=setTimeout(()=>l({kind:"resolved",reason:"session_expired"}),Math.max(1,Date.parse(t.expires_at)-o()));let H=(s)=>{if(B+=s.byteLength,!S||!i){if(E.push(s),R+=s.byteLength,R>Vt)l({kind:"resolved",reason:"output_backpressure"});return}try{i.send(s)}catch{l({kind:"resolved",reason:"relay_closed"});return}if(i.bufferedAmount>Vt)l({kind:"resolved",reason:"output_backpressure"})};try{w=(n.spawnPty??re)({shell:p,args:["-i","-l"],cwd:g,cols:t.cols,rows:t.rows,environment:d,onData:(s)=>{if(!y)H(s)}})}catch(s){l({kind:"rejected",error:s instanceof r?s:new r("pty_spawn_failed","Reason could not start the terminal shell.")});return}w.exited.then((s)=>{if(y)return;if(T=s,S&&i)try{i.send(JSON.stringify({t:"exit",code:s}))}catch{}l({kind:"resolved",reason:"shell_exited"})});let J=(n.loadProxy??j)()?.url;try{i=(n.connect??Nr)(t.relay_url,J)}catch{l({kind:"rejected",error:new r("pty_relay_unavailable","Reason could not reach the terminal relay.")});return}i.binaryType="arraybuffer",i.onopen=()=>{if(y||!i)return;S=!0;try{i.send(JSON.stringify({t:"open",cols:t.cols,rows:t.rows}));for(let s of E.splice(0))i.send(s);R=0}catch{l({kind:"resolved",reason:"relay_closed"});return}x=!0,e.emitEvent("pty.ready",{session_id:t.session_id,cols:t.cols,rows:t.rows}).catch(()=>{return})},i.onmessage=(s)=>{if(y||!w)return;let u=s.data;if(typeof u==="string"){let f;try{f=JSON.parse(u)}catch{return}if(!F(f))return;if(f.t==="resize"){try{w.resize(P(f.cols,t.cols),P(f.rows,t.rows))}catch{}return}if(f.t==="close")l({kind:"resolved",reason:"client_closed"});return}let _=u instanceof ArrayBuffer?new Uint8Array(u):ArrayBuffer.isView(u)?new Uint8Array(u.buffer,u.byteOffset,u.byteLength):null;if(!_||_.byteLength===0)return;O+=_.byteLength;try{w.write(_)}catch{}},i.onclose=()=>{if(y)return;if(!x){l({kind:"rejected",error:new r("pty_relay_unavailable","Reason could not reach the terminal relay.")});return}l({kind:"resolved",reason:"relay_closed"})},i.onerror=()=>{if(y||x)return;l({kind:"rejected",error:new r("pty_relay_unavailable","Reason could not reach the terminal relay.")})}})}
3
3
  export{Dr,Vt,Or,ds,Hn,Nr,Un};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Qe}from"./vm-hands-entry-lite-107tpag5.js";import{a}from"./vm-hands-entry-lite-jvszqt0z.js";import{randomUUID as L}from"crypto";import{spawnSync as b}from"child_process";import{chmodSync as ee,cpSync as te,existsSync as x,lstatSync as A,mkdirSync as Y,readdirSync as ne,readFileSync as w,readlinkSync as re,realpathSync as T,renameSync as E,rmdirSync as ie,rmSync as g,symlinkSync as M,writeFileSync as oe}from"fs";import{dirname as I,join as u,relative as se,resolve as ce}from"path";var Yn="so.ara.cli",k=[Yn,"com.reasonmachines.cli"],F="5LJFSBRY2F";function Gr(e){return`(${e.map((t)=>`identifier "${t}"`).join(" or ")}) and anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] exists and certificate leaf[field.1.2.840.113635.100.6.1.13] exists and certificate leaf[subject.OU] = "${F}"`}var G="ReasonBackgroundIdentity",$o="Contents/Helpers/ReasonPermissionTile",ae="so.ara.cli.permission-tile",Ne=Gr([ae,"com.reasonmachines.cli.permission-tile"]),v="AraBackgroundIdentity",ue="Reason",Ce=Gr(k),de=`anchor apple generic and (${k.map((e)=>`identifier "${e}"`).join(" or ")}) and certificate leaf[subject.OU] = "${F}"`;class h extends Error{code;constructor(e,t){super(t);this.code=e;this.name="MacOSBackgroundIdentityError"}}var R="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister";function le(e=a()){return u(e,"Library","Application Support","Reason","Background","Reason.app")}function O(e=a()){return u(e,"Library","Application Support","Ara","Background","Ara.app")}function fe(e){try{return A(e).isFile()}catch{return!1}}function D(e){return[G,v].map((t)=>u(e,"Contents","MacOS",t)).find(fe)??null}function d(e){try{if(!A(e).isDirectory())return!1;let t=w(u(e,"Contents","Info.plist"),"utf8");return k.some((n)=>t.includes(`<string>${n}</string>`))&&(t.includes(`<string>${ue}</string>`)||t.includes("<string>Ara</string>"))&&D(e)!==null}catch{return!1}}function Kr(e=a()){let t=le(e);if(!d(t))return null;try{let n=w(u(t,"Contents","Info.plist"),"utf8");return/<key>CFBundleVersion<\/key>\s*<string>(\d+\.\d+\.\d+)<\/string>/.exec(n)?.[1]??null}catch{return null}}function pe(e,t=a()){let n=Kr(t);return n===null||j(N(n.split(".")),N(e.split(/[.-]/).slice(0,3)))}var ge=1e4;function K(e,t){return b(e,[...t],{stdio:"ignore",timeout:ge}).status??1}var W=new Set;function H(e){if(process.env.REASON_TEST_REFUSE_REAL_IDENTITY!=="1")return;let t=(n)=>{try{return T(n)}catch{return ce(n)}};if(e!==void 0&&t(e)!==t(a()))return;throw Error("A test tried to change this computer's real Reason background identity; pass a temporary home. Refused by scripts/test-env.ts.")}var V=/\/(?:runtime|CLI)\/versions\/(\d+)\.(\d+)\.(\d+)[^/]*\/[^/]+$|\/\.(?:ara|reason)(?:-staging)?-worker-(\d+)\.(\d+)\.(\d+)[^/]*\/[^/]+$/,J=new Set(["ara","ara.exe","reason","reason.exe"]);function N(e){return e.map((t)=>Number(t))}function j(e,t){for(let n=0;n<3;n+=1)if(e[n]!==t[n])return e[n]<t[n];return!1}var ye=[0,2,161];function me(e){if(e===null)return!0;let t=ye,n=null;try{n=T(process.execPath)}catch{}return e.some((r)=>{let i=V.exec(r);if(i){let f=i[1]===void 0?i.slice(4,7):i.slice(1,4);return j(N(f),t)}let o=r.slice(r.lastIndexOf("/")+1);return J.has(o)&&r!==n&&r!==process.execPath})}function Ee(){let e=b("/bin/ps",["-xo","pid=,comm="],{encoding:"utf8",timeout:5000});if(e.status!==0)return null;let t=[];for(let n of e.stdout.split(`
2
+ import{Qe}from"./vm-hands-entry-lite-r34f55z4.js";import{a}from"./vm-hands-entry-lite-jvszqt0z.js";import{randomUUID as L}from"crypto";import{spawnSync as b}from"child_process";import{chmodSync as ee,cpSync as te,existsSync as x,lstatSync as A,mkdirSync as Y,readdirSync as ne,readFileSync as w,readlinkSync as re,realpathSync as T,renameSync as E,rmdirSync as ie,rmSync as g,symlinkSync as M,writeFileSync as oe}from"fs";import{dirname as I,join as u,relative as se,resolve as ce}from"path";var Yn="so.ara.cli",k=[Yn,"com.reasonmachines.cli"],F="5LJFSBRY2F";function Gr(e){return`(${e.map((t)=>`identifier "${t}"`).join(" or ")}) and anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] exists and certificate leaf[field.1.2.840.113635.100.6.1.13] exists and certificate leaf[subject.OU] = "${F}"`}var G="ReasonBackgroundIdentity",$o="Contents/Helpers/ReasonPermissionTile",ae="so.ara.cli.permission-tile",Ne=Gr([ae,"com.reasonmachines.cli.permission-tile"]),v="AraBackgroundIdentity",ue="Reason",Ce=Gr(k),de=`anchor apple generic and (${k.map((e)=>`identifier "${e}"`).join(" or ")}) and certificate leaf[subject.OU] = "${F}"`;class h extends Error{code;constructor(e,t){super(t);this.code=e;this.name="MacOSBackgroundIdentityError"}}var R="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister";function le(e=a()){return u(e,"Library","Application Support","Reason","Background","Reason.app")}function O(e=a()){return u(e,"Library","Application Support","Ara","Background","Ara.app")}function fe(e){try{return A(e).isFile()}catch{return!1}}function D(e){return[G,v].map((t)=>u(e,"Contents","MacOS",t)).find(fe)??null}function d(e){try{if(!A(e).isDirectory())return!1;let t=w(u(e,"Contents","Info.plist"),"utf8");return k.some((n)=>t.includes(`<string>${n}</string>`))&&(t.includes(`<string>${ue}</string>`)||t.includes("<string>Ara</string>"))&&D(e)!==null}catch{return!1}}function Kr(e=a()){let t=le(e);if(!d(t))return null;try{let n=w(u(t,"Contents","Info.plist"),"utf8");return/<key>CFBundleVersion<\/key>\s*<string>(\d+\.\d+\.\d+)<\/string>/.exec(n)?.[1]??null}catch{return null}}function pe(e,t=a()){let n=Kr(t);return n===null||j(N(n.split(".")),N(e.split(/[.-]/).slice(0,3)))}var ge=1e4;function K(e,t){return b(e,[...t],{stdio:"ignore",timeout:ge}).status??1}var W=new Set;function H(e){if(process.env.REASON_TEST_REFUSE_REAL_IDENTITY!=="1")return;let t=(n)=>{try{return T(n)}catch{return ce(n)}};if(e!==void 0&&t(e)!==t(a()))return;throw Error("A test tried to change this computer's real Reason background identity; pass a temporary home. Refused by scripts/test-env.ts.")}var V=/\/(?:runtime|CLI)\/versions\/(\d+)\.(\d+)\.(\d+)[^/]*\/[^/]+$|\/\.(?:ara|reason)(?:-staging)?-worker-(\d+)\.(\d+)\.(\d+)[^/]*\/[^/]+$/,J=new Set(["ara","ara.exe","reason","reason.exe"]);function N(e){return e.map((t)=>Number(t))}function j(e,t){for(let n=0;n<3;n+=1)if(e[n]!==t[n])return e[n]<t[n];return!1}var ye=[0,2,161];function me(e){if(e===null)return!0;let t=ye,n=null;try{n=T(process.execPath)}catch{}return e.some((r)=>{let i=V.exec(r);if(i){let f=i[1]===void 0?i.slice(4,7):i.slice(1,4);return j(N(f),t)}let o=r.slice(r.lastIndexOf("/")+1);return J.has(o)&&r!==n&&r!==process.execPath})}function Ee(){let e=b("/bin/ps",["-xo","pid=,comm="],{encoding:"utf8",timeout:5000});if(e.status!==0)return null;let t=[];for(let n of e.stdout.split(`
3
3
  `)){let r=/^\s*(\d+)\s+(\S.*)$/.exec(n);if(!r||Number(r[1])===process.pid)continue;let i=r[2].trimEnd(),o=i.slice(i.lastIndexOf("/")+1);if(!V.test(i)&&J.has(o)){let c=b("/usr/sbin/lsof",["-a","-p",r[1],"-d","txt","-Fn"],{encoding:"utf8",timeout:5000}).stdout?.split(`
4
4
  `).find((l)=>l.startsWith("n/"));if(c)i=c.slice(1)}t.push(i)}return t}function _e(e){if(H(e.home),!d(e.sourceApp))throw new h("identity_invalid","The packaged Reason background identity is missing or invalid.");let t=e.command??K,n=le(e.home),r=I(n);Y(r,{recursive:!0,mode:448}),ee(r,448);let i=T(e.sourceApp),o=null;try{o=T(n)}catch{}if(i!==o){let f=`${process.pid}.${L()}`,c=u(r,`.Reason.app.${f}.tmp`),l=u(r,`.Reason.app.${f}.old`),y=!1;try{if(te(i,c,{recursive:!0,errorOnExist:!0,preserveTimestamps:!0}),!d(c))throw new h("identity_invalid","The copied Reason background identity is invalid.");let _=e.releaseSigned?["--test-requirement",`=${de}`]:[];if(t("/usr/bin/codesign",["--verify","--strict",..._,c])!==0)throw new h("identity_invalid_signature","The installed Reason background identity has an invalid signature.");let S=!1;for(let p=0;p<4;p+=1){let m=!1;try{E(n,l),m=!0,y=!0}catch(s){if(s.code!=="ENOENT")throw s}if(p===0)e.beforePublish?.();try{E(c,n),S=!0}catch(s){let Z=s.code;if(!["EEXIST","ENOTEMPTY"].includes(Z??""))throw s;if(m)g(l,{recursive:!0,force:!0}),y=!1;if(p===3)throw s;continue}if(m)g(l,{recursive:!0,force:!0}),y=!1;break}if(!S)throw Error("Could not publish Reason's background identity.")}catch(_){if(y&&!x(n)&&x(l))E(l,n);throw _}finally{g(c,{recursive:!0,force:!0}),g(l,{recursive:!0,force:!0})}}return z(n,e,{verified:i!==o}),n}function X(e){return u(I(e),".Reason.app.registered")}function q(e){try{let t=A(e);return t.isDirectory()?`${t.ino}:${t.birthtimeMs}`:null}catch{return null}}function C(e){let t=q(e);try{return t!==null&&w(X(e),"utf8")===t}catch{return!1}}function Q(e){if(d(e))return"bundle";try{if(A(u(e,"Contents","Info.plist"),{throwIfNoEntry:!1}))return null;return A(u(e,"Contents","MacOS",v)).isSymbolicLink()?"retired":null}catch{return null}}function z(e,t,n={}){let r=t.command??K;if(!n.verified&&r("/usr/bin/codesign",["--verify","--strict",e])!==0)throw new h("identity_invalid_signature","The installed Reason background identity has an invalid signature.");if(r(R,["-f",e])!==0)throw new h("identity_register_failed","Could not register Reason's macOS background identity.");let i=q(e);try{if(i)oe(X(e),i,{mode:384})}catch{}try{Se(e,t.home,r,t.runningExecutables??Ee)}catch(o){let f=o.code??"unknown";process.stderr.write(`Reason background identity: legacy_identity_retire_failed (${f})
5
5
  `)}}function Se(e,t,n,r){let i=D(e);if(!i)return;let o=O(t),f=I(o),c=(s)=>u(s,"Contents","MacOS",v),l=se(I(c(o)),i),y=`${process.pid}.${L()}`,_=Q(o);if(_===null)return;let S=_==="bundle";if(S)n(R,["-u",o]);let p=u(f,`.Ara.app.${y}.old`);if(!W.has(o)&&!me(r())){if(!S)n(R,["-u",o]);try{E(o,p)}catch(s){if(s.code==="ENOENT")return;throw s}g(p,{recursive:!0,force:!0}),Ie(f);return}if(!S){if(re(c(o))===l)return;let s=`${c(o)}.${y}`;M(l,s);try{E(s,c(o))}finally{g(s,{force:!0})}return}let m=u(f,`.Ara.app.${y}.shim`);Y(I(c(m)),{recursive:!0}),M(l,c(m));try{try{E(o,p)}catch(s){if(s.code==="ENOENT")return;throw s}try{E(m,o)}catch(s){if(x(o))return;throw E(p,o),s}}finally{g(m,{recursive:!0,force:!0}),g(p,{recursive:!0,force:!0})}}function Ie(e){try{if(ne(e).some((n)=>n!==".DS_Store"))return;g(u(e,".DS_Store"),{force:!0}),ie(e)}catch{}}var B=new Map;function Zn(e=a()){let t=B.get(e);if(t)return t;if(process.platform!=="darwin")return[];let n=U(e);if(n===null&&x(I(le(e))))Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,100),n=U(e);if(n===null)return[];return B.set(e,n),n}function U(e){let t=le(e),n=O(e);if(!d(t)||!C(t))try{he({home:e,skipWhenSettled:!0})}catch{}let r=d(t)&&(C(t)||!d(n))?t:d(n)?n:null,i=r?D(r):null;if(!i)return null;if(r===n)W.add(n);let o=b(i,["--can-spawn"],{env:{},timeout:2000,encoding:"utf8"});return o.status===0&&o.stdout===`spawn
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{$n,Mn,To,Wt}from"./vm-hands-entry-lite-k9vk84wa.js";import{Tn,Ve,_o,In,Dn,On,Rr,x}from"./vm-hands-entry-lite-4j8pm02n.js";import{Pt}from"./vm-hands-entry-lite-xe0benev.js";import{Nr}from"./vm-hands-entry-lite-j5t2pj4v.js";import{j}from"./vm-hands-entry-lite-cgddp0y3.js";import{a}from"./vm-hands-entry-lite-jvszqt0z.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{execFile as ce,spawn as ne}from"child_process";import{randomBytes as Oe}from"crypto";import{chmodSync as he,existsSync as ae,lstatSync as Je,mkdirSync as Qe,readFileSync as oe,rmSync as ie,writeFileSync as u}from"fs";import{connect as Se}from"net";import{join as I}from"path";var B=32,Y=76;var m="./desktop-wallpaper-fd8f2wb2.jpg";var v="./dock-browser-y53t41cx.png";var Z="./dock-files-cp52htdw.png";var V="./dock-terminal-1es514yq.png";var z="./grok-wallpaper-71zwn2pj.jpg";var W="./grok-dock-browser-pzw59wnd.png";var U="./grok-dock-files-eckq444x.png";var ee="./grok-dock-terminal-hcpz3e43.png";var re=`# Sets the X root window background and _XROOTPMAP_ID, as feh --bg-fill does.
2
+ import{$n,Mn,To,Wt}from"./vm-hands-entry-lite-k9vk84wa.js";import{Tn,Ve,_o,In,Dn,On,Rr,x}from"./vm-hands-entry-lite-gz65ybc2.js";import{Pt}from"./vm-hands-entry-lite-xe0benev.js";import{Nr}from"./vm-hands-entry-lite-hhk4h552.js";import{j}from"./vm-hands-entry-lite-vj0gm694.js";import{a}from"./vm-hands-entry-lite-jvszqt0z.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{execFile as ce,spawn as ne}from"child_process";import{randomBytes as Oe}from"crypto";import{chmodSync as he,existsSync as ae,lstatSync as Je,mkdirSync as Qe,readFileSync as oe,rmSync as ie,writeFileSync as u}from"fs";import{connect as Se}from"net";import{join as I}from"path";var B=32,Y=76;var m="./desktop-wallpaper-fd8f2wb2.jpg";var v="./dock-browser-y53t41cx.png";var Z="./dock-files-cp52htdw.png";var V="./dock-terminal-1es514yq.png";var z="./grok-wallpaper-71zwn2pj.jpg";var W="./grok-dock-browser-pzw59wnd.png";var U="./grok-dock-files-eckq444x.png";var ee="./grok-dock-terminal-hcpz3e43.png";var re=`# Sets the X root window background and _XROOTPMAP_ID, as feh --bg-fill does.
3
3
  # The native Blaxel image ships no feh, hsetroot or compositor, but it does ship
4
4
  # python3-gi and libX11. tint2 reads _XROOTPMAP_ID to draw its transparent panel.
5
5
  # Usage: DISPLAY=:99 python3 set-root-wallpaper.py IMAGE