@reason-machines/cli-linux-x64 0.2.407 → 0.2.410

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 (146) hide show
  1. package/THIRD_PARTY_NOTICES.txt +8 -7
  2. package/bin/reason +2 -2
  3. package/bin/runtime/srt/sandbox-runtime.mjs +52 -52
  4. package/bin/vm-hands/api-cjv8m2zy.js +2 -0
  5. package/bin/vm-hands/api-credentials-m5akr9fv.js +2 -0
  6. package/bin/vm-hands/connect-cli-nydbj6ae.js +2 -0
  7. package/bin/vm-hands/custom-endpoint-device-dkqb4rqy.js +2 -0
  8. package/bin/vm-hands/desktop-account-5v7x0ajx.js +2 -0
  9. package/bin/vm-hands/device-workspace-p9q9dckg.js +2 -0
  10. package/bin/vm-hands/fsevents-ekt70rcc.js +2 -0
  11. package/bin/vm-hands/hands-worker-source-cgrpm21b.js +2 -0
  12. package/bin/vm-hands/index-k8kcz8a3.js +12818 -0
  13. package/bin/vm-hands/install-receipt-7vt2y2vh.js +2 -0
  14. package/bin/vm-hands/local-automation-y9kx76wa.js +2 -0
  15. package/bin/vm-hands/local-capabilities-j6h63m79.js +2 -0
  16. package/bin/vm-hands/local-desktop-users-q886k0mm.js +2 -0
  17. package/bin/vm-hands/local-display-mac-w85956f1.js +2 -0
  18. package/bin/vm-hands/local-display-session-ftt74eb3.js +2 -0
  19. package/bin/vm-hands/local-pty-session-5f50sqq0.js +2 -0
  20. package/bin/vm-hands/managed-runtime-tjwpypgf.js +2 -0
  21. package/bin/vm-hands/network-contract-9x9kc5vv.js +2 -0
  22. package/bin/vm-hands/package-78fkast4.js +2 -0
  23. package/bin/vm-hands/permissions-byngw8v0.js +2 -0
  24. package/bin/vm-hands/reason-hands-protocol-2tnghj3b.js +2 -0
  25. package/bin/vm-hands/serve-service-j5wnq4bg.js +2 -0
  26. package/bin/vm-hands/status-8tjada6n.js +10 -0
  27. package/bin/vm-hands/version-5hrs2hvb.js +2 -0
  28. package/bin/vm-hands/vm-hands-entry-lite-05rrh8yg.js +250 -0
  29. package/bin/vm-hands/vm-hands-entry-lite-09m2cdkw.js +4 -0
  30. package/bin/vm-hands/vm-hands-entry-lite-0g9xvgdy.js +2 -0
  31. package/bin/vm-hands/vm-hands-entry-lite-0xrsph3r.js +3 -0
  32. package/bin/vm-hands/vm-hands-entry-lite-10sbjfzx.js +9 -0
  33. package/bin/vm-hands/vm-hands-entry-lite-1cwqa4jr.js +3 -0
  34. package/bin/vm-hands/vm-hands-entry-lite-1rrb66r9.js +3 -0
  35. package/bin/vm-hands/vm-hands-entry-lite-1rtkf2xm.js +3 -0
  36. package/bin/vm-hands/vm-hands-entry-lite-1sg8sdw5.js +5 -0
  37. package/bin/vm-hands/vm-hands-entry-lite-22kfyvnk.js +2 -0
  38. package/bin/vm-hands/vm-hands-entry-lite-46fkv5sp.js +105 -0
  39. package/bin/vm-hands/vm-hands-entry-lite-66ctbcym.js +3 -0
  40. package/bin/vm-hands/vm-hands-entry-lite-6aeea05q.js +3 -0
  41. package/bin/vm-hands/vm-hands-entry-lite-70ba2bqj.js +458 -0
  42. package/bin/vm-hands/{vm-hands-entry-lite-vr4sva78.js → vm-hands-entry-lite-80y72d0e.js} +5 -9
  43. package/bin/vm-hands/vm-hands-entry-lite-88swf2qr.js +6 -0
  44. package/bin/vm-hands/vm-hands-entry-lite-89z488gz.js +3 -0
  45. package/bin/vm-hands/vm-hands-entry-lite-8ns59paz.js +3 -0
  46. package/bin/vm-hands/vm-hands-entry-lite-8t9xssf9.js +3 -0
  47. package/bin/vm-hands/vm-hands-entry-lite-907pa7f9.js +65 -0
  48. package/bin/vm-hands/vm-hands-entry-lite-9ay6f56v.js +3 -0
  49. package/bin/vm-hands/{vm-hands-entry-lite-jcd21jpm.js → vm-hands-entry-lite-9c95p6n9.js} +54 -54
  50. package/bin/vm-hands/vm-hands-entry-lite-ab2m9erf.js +2 -0
  51. package/bin/vm-hands/vm-hands-entry-lite-b885gwfh.js +7 -0
  52. package/bin/vm-hands/{vm-hands-entry-lite-xqve205b.js → vm-hands-entry-lite-bdhjpv7g.js} +2 -2
  53. package/bin/vm-hands/vm-hands-entry-lite-bk6akkdt.js +540 -0
  54. package/bin/vm-hands/vm-hands-entry-lite-ckv17tn8.js +3 -0
  55. package/bin/vm-hands/vm-hands-entry-lite-eqgj4acy.js +112 -0
  56. package/bin/vm-hands/vm-hands-entry-lite-f5e3dbgk.js +4 -0
  57. package/bin/vm-hands/vm-hands-entry-lite-grm1tqs7.js +3 -0
  58. package/bin/vm-hands/vm-hands-entry-lite-gvwdy3rf.js +4 -0
  59. package/bin/vm-hands/vm-hands-entry-lite-hj8n59y9.js +3 -0
  60. package/bin/vm-hands/vm-hands-entry-lite-k278g9kj.js +42 -0
  61. package/bin/vm-hands/{vm-hands-entry-lite-wer0qzxg.js → vm-hands-entry-lite-m11j0f9q.js} +2 -2
  62. package/bin/vm-hands/vm-hands-entry-lite-pgb514h0.js +3 -0
  63. package/bin/vm-hands/vm-hands-entry-lite-pmcz7j7t.js +3 -0
  64. package/bin/vm-hands/vm-hands-entry-lite-q0k6kx6d.js +5 -0
  65. package/bin/vm-hands/vm-hands-entry-lite-qy9xg6em.js +3 -0
  66. package/bin/vm-hands/vm-hands-entry-lite-qysyf65v.js +2 -0
  67. package/bin/vm-hands/vm-hands-entry-lite-r29k28kb.js +14 -0
  68. package/bin/vm-hands/{vm-hands-entry-lite-fbpxs065.js → vm-hands-entry-lite-t7an5zg2.js} +2 -2
  69. package/bin/vm-hands/vm-hands-entry-lite-vrqzr15t.js +3 -0
  70. package/bin/vm-hands/vm-hands-entry-lite-w59z67hf.js +52 -0
  71. package/bin/vm-hands/vm-hands-entry-lite-zg36myyf.js +5 -0
  72. package/bin/vm-hands/vm-hands-entry-lite.js +3 -1
  73. package/bin/vm-hands/vm-hands-executor-rdmj1wv4.js +11 -0
  74. package/bin/vm-hands/vm-hands-op-runner-f2bjvb7v.js +2 -0
  75. package/bin/vm-hands/vm-hands-runtime-aa4p4pqz.js +4 -0
  76. package/bin/vm-hands/worker-sandbox-smqj3mbe.js +2 -0
  77. package/package.json +1 -1
  78. package/bin/vm-hands/api-credentials-4e2gypqj.js +0 -2
  79. package/bin/vm-hands/api-f48wa4ym.js +0 -2
  80. package/bin/vm-hands/ask-relay-jatz6zdz.js +0 -8
  81. package/bin/vm-hands/connect-cli-7jc6q164.js +0 -2
  82. package/bin/vm-hands/custom-endpoint-device-8h95wy87.js +0 -2
  83. package/bin/vm-hands/desktop-account-2kkxwv1y.js +0 -2
  84. package/bin/vm-hands/device-workspace-nzz3kd5t.js +0 -2
  85. package/bin/vm-hands/hands-worker-source-as5wepvk.js +0 -2
  86. package/bin/vm-hands/index-2kk983b8.js +0 -12818
  87. package/bin/vm-hands/install-receipt-e6s355j1.js +0 -2
  88. package/bin/vm-hands/local-automation-c7sk21zn.js +0 -2
  89. package/bin/vm-hands/local-capabilities-dgaqqaw9.js +0 -2
  90. package/bin/vm-hands/local-desktop-users-sevkfkye.js +0 -2
  91. package/bin/vm-hands/local-display-mac-jzc0g5ge.js +0 -2
  92. package/bin/vm-hands/local-display-session-gcndscvj.js +0 -2
  93. package/bin/vm-hands/local-pty-session-fe6jz2zy.js +0 -2
  94. package/bin/vm-hands/managed-runtime-pveke48y.js +0 -2
  95. package/bin/vm-hands/network-contract-9smga6kn.js +0 -2
  96. package/bin/vm-hands/package-qjr5q0bp.js +0 -2
  97. package/bin/vm-hands/permissions-92a6yh7t.js +0 -2
  98. package/bin/vm-hands/reason-hands-protocol-5fhd49en.js +0 -2
  99. package/bin/vm-hands/serve-service-rjbca0dj.js +0 -2
  100. package/bin/vm-hands/status-1tqes7gw.js +0 -96
  101. package/bin/vm-hands/version-8qryvrwt.js +0 -2
  102. package/bin/vm-hands/vm-hands-entry-lite-05qq23fw.js +0 -3
  103. package/bin/vm-hands/vm-hands-entry-lite-1sc3wc94.js +0 -3
  104. package/bin/vm-hands/vm-hands-entry-lite-2nec0vk1.js +0 -3
  105. package/bin/vm-hands/vm-hands-entry-lite-2s9the7x.js +0 -3
  106. package/bin/vm-hands/vm-hands-entry-lite-32ch1nr1.js +0 -346
  107. package/bin/vm-hands/vm-hands-entry-lite-40nkzw38.js +0 -3
  108. package/bin/vm-hands/vm-hands-entry-lite-4bgxq9ps.js +0 -9
  109. package/bin/vm-hands/vm-hands-entry-lite-5rkakg10.js +0 -4
  110. package/bin/vm-hands/vm-hands-entry-lite-69ray4x8.js +0 -6
  111. package/bin/vm-hands/vm-hands-entry-lite-6berk108.js +0 -3
  112. package/bin/vm-hands/vm-hands-entry-lite-72nn2b4n.js +0 -3
  113. package/bin/vm-hands/vm-hands-entry-lite-7k3vp3fe.js +0 -52
  114. package/bin/vm-hands/vm-hands-entry-lite-8f3px72v.js +0 -3
  115. package/bin/vm-hands/vm-hands-entry-lite-8gjrr6hg.js +0 -3
  116. package/bin/vm-hands/vm-hands-entry-lite-8tcnbfnm.js +0 -5
  117. package/bin/vm-hands/vm-hands-entry-lite-9vf97byd.js +0 -4
  118. package/bin/vm-hands/vm-hands-entry-lite-er3nrbb9.js +0 -3
  119. package/bin/vm-hands/vm-hands-entry-lite-f6714myc.js +0 -3
  120. package/bin/vm-hands/vm-hands-entry-lite-g5c9ec33.js +0 -5
  121. package/bin/vm-hands/vm-hands-entry-lite-h0y0xv5f.js +0 -3
  122. package/bin/vm-hands/vm-hands-entry-lite-h9t84ekh.js +0 -3
  123. package/bin/vm-hands/vm-hands-entry-lite-hd4a0a6f.js +0 -112
  124. package/bin/vm-hands/vm-hands-entry-lite-hepppjp0.js +0 -3
  125. package/bin/vm-hands/vm-hands-entry-lite-hye6r7dy.js +0 -3
  126. package/bin/vm-hands/vm-hands-entry-lite-jw5y1aa5.js +0 -3
  127. package/bin/vm-hands/vm-hands-entry-lite-ky0w7t09.js +0 -42
  128. package/bin/vm-hands/vm-hands-entry-lite-mapxp682.js +0 -4
  129. package/bin/vm-hands/vm-hands-entry-lite-mxdztdmq.js +0 -11
  130. package/bin/vm-hands/vm-hands-entry-lite-np1fcr2t.js +0 -5
  131. package/bin/vm-hands/vm-hands-entry-lite-nqvb7a2m.js +0 -3
  132. package/bin/vm-hands/vm-hands-entry-lite-q4tcfj61.js +0 -3
  133. package/bin/vm-hands/vm-hands-entry-lite-q590arx5.js +0 -251
  134. package/bin/vm-hands/vm-hands-entry-lite-r2xmr627.js +0 -4
  135. package/bin/vm-hands/vm-hands-entry-lite-r6f6qkw6.js +0 -105
  136. package/bin/vm-hands/vm-hands-entry-lite-swwb5mp2.js +0 -3
  137. package/bin/vm-hands/vm-hands-entry-lite-tkb2b6x8.js +0 -540
  138. package/bin/vm-hands/vm-hands-entry-lite-va3vbvsk.js +0 -458
  139. package/bin/vm-hands/vm-hands-entry-lite-vr38bh6k.js +0 -66
  140. package/bin/vm-hands/vm-hands-entry-lite-wa261sf8.js +0 -3
  141. package/bin/vm-hands/vm-hands-entry-lite-yg5h9mhm.js +0 -7
  142. package/bin/vm-hands/vm-hands-entry-lite-yqrmr2c8.js +0 -5
  143. package/bin/vm-hands/vm-hands-executor-etthkykm.js +0 -11
  144. package/bin/vm-hands/vm-hands-op-runner-bbp6fzn2.js +0 -2
  145. package/bin/vm-hands/vm-hands-runtime-2x1ryrxr.js +0 -4
  146. package/bin/vm-hands/worker-sandbox-p242st5d.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ud as ae,Wd as ne}from"./vm-hands-entry-lite-r6f6qkw6.js";import{Gf as be}from"./vm-hands-entry-lite-ky0w7t09.js";import{cg as C,dg as ie,fg as M,gg as Oe,jg as Y,kg as z,lg as v,ug as O,vg as Be}from"./vm-hands-entry-lite-q590arx5.js";import{ah as Se}from"./vm-hands-entry-lite-9vf97byd.js";import{Ri as se}from"./vm-hands-entry-lite-7k3vp3fe.js";import{rj as J}from"./vm-hands-entry-lite-4bgxq9ps.js";import{xj as x}from"./vm-hands-entry-lite-hye6r7dy.js";import{ok as Ne,pk as oe}from"./vm-hands-entry-lite-hd4a0a6f.js";import{Bk as Ie,vk as ye}from"./vm-hands-entry-lite-r2xmr627.js";import{Ik as xe}from"./vm-hands-entry-lite-8gjrr6hg.js";import{Rk as p}from"./vm-hands-entry-lite-40nkzw38.js";import{spawn as S,spawnSync as pt}from"child_process";import{createHash as ft,randomUUID as Te}from"crypto";import{closeSync as mt,copyFileSync as de,existsSync as q,fstatSync as _t,mkdirSync as pe,openSync as ht,readdirSync as D,readFileSync as j,readlinkSync as wt,renameSync as ve,rmSync as gt,statSync as bt,writeFileSync as xt}from"fs";import{connect as St}from"net";import{tmpdir as F,userInfo as Re}from"os";import{basename as fe,delimiter as yt,dirname as B,join as f}from"path";var Z=`import { spawn, execFileSync } from "node:child_process";
2
+ import{$e,Fi,F,Qe,Ct,yr,P,V,Be}from"./vm-hands-entry-lite-05rrh8yg.js";import{G}from"./vm-hands-entry-lite-f5e3dbgk.js";import{st}from"./vm-hands-entry-lite-eqgj4acy.js";import{at}from"./vm-hands-entry-lite-10sbjfzx.js";import{Br}from"./vm-hands-entry-lite-r29k28kb.js";import{gt,_i}from"./vm-hands-entry-lite-gvwdy3rf.js";import{be,Cn}from"./vm-hands-entry-lite-46fkv5sp.js";import{ht}from"./vm-hands-entry-lite-k278g9kj.js";import{a}from"./vm-hands-entry-lite-89z488gz.js";import{x}from"./vm-hands-entry-lite-9ay6f56v.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{spawn as R,spawnSync as tt}from"child_process";import{createHash as ot,randomUUID as me}from"crypto";import{closeSync as rt,copyFileSync as se,existsSync as M,fstatSync as nt,mkdirSync as ie,openSync as it,readdirSync as U,readFileSync as K,readlinkSync as ct,renameSync as fe,rmSync as lt,statSync as ut,writeFileSync as dt}from"fs";import{connect as pt}from"net";import{tmpdir as L,userInfo as ge}from"os";import{basename as ae,delimiter as mt,dirname as B,join as f}from"path";var Y=`import { spawn, execFileSync } from "node:child_process";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  import { readFileSync, readlinkSync, lstatSync, realpathSync, statSync, mkdtempSync, mkdirSync, chmodSync, writeFileSync, readdirSync, rmSync, openSync, readSync, closeSync, renameSync } from "node:fs";
5
5
  import { tmpdir } from "node:os";
@@ -849,11 +849,7 @@ if(process.env.REASON_CLOUD_GATEWAY_EXEC === "1") {
849
849
  process.stdout.write(JSON.stringify(cloudAutomationFailure(error))+"\\n");process.exitCode=1;
850
850
  }
851
851
  }
852
- `;import{spawn as Ge}from"child_process";import{basename as Me}from"path";var Ke="__desktop-call",ze="/usr/bin/setpriv",Je=27262976,je=8192,Ye=2000;function U(e){return Boolean(e)&&typeof e==="object"&&!Array.isArray(e)}function Xe(e){try{return JSON.parse(e)}catch{return null}}function Ve(){return[process.execPath,...Me(process.execPath).startsWith("bun")&&process.argv[1]?[process.argv[1]]:[],Ke]}function Ze(e,r,t,i={}){t.throwIfAborted();let o=i.command??Ve();return new Promise((s,c)=>{let a=(i.spawnProcess??Ge)(ze,[`--reuid=${e.uid}`,`--regid=${e.gid}`,"--clear-groups","--no-new-privs","--",...o],{cwd:e.home,detached:!0,stdio:["pipe","pipe","pipe"],env:{HOME:e.home,USER:e.username,LOGNAME:e.username,PATH:"/usr/local/bin:/usr/bin:/bin"}}),l=[],d=0,n="",u=null,m=!1,_,g=(w)=>{try{process.kill(-a.pid,w)}catch{a.kill(w)}},N=(w)=>{u??=w,g("SIGTERM"),_??=setTimeout(()=>g("SIGKILL"),Ye)},y=()=>N(new p("cancelled","Reason cancelled the desktop operation."));t.addEventListener("abort",y,{once:!0});let h=(w)=>{if(m)return;m=!0,clearTimeout(_),t.removeEventListener("abort",y),w()};if(a.stdout.on("data",(w)=>{if(d+=w.byteLength,d>Je)N(new p("desktop_delegate_failed","Reason's desktop reply is too large."));else l.push(w)}),a.stderr.setEncoding("utf8").on("data",(w)=>{n=(n+w).slice(-je)}),a.stdin.on("error",()=>{}),a.once("error",()=>h(()=>c(u??new p("desktop_delegate_unavailable","Reason could not start its desktop as the desktop account.")))),a.once("close",(w,Ue)=>h(()=>{if(u)return c(u);let b=Xe(Buffer.concat(l).toString("utf8"));if(U(b)&&b.ok===!0&&U(b.result))return s(b.result);let R=U(b)&&b.ok===!1&&typeof b.code==="string"&&typeof b.message==="string"?new p(b.code.slice(0,120),b.message.slice(0,2000)):null,X=`exited ${w??Ue}${R?"":" with no reply"}`,V=n.trim().split(`
853
- `).at(-1)?.slice(-300)??"";if(!R||R.code==="desktop_delegate_failed")process.stderr.write(`Reason worker: desktop call ${X}${n?`: ${n.trim().slice(-500)}`:""}
854
- `);if(R)return c(R);c(new p("desktop_delegate_failed",`Reason's desktop operation failed (${X}${V?`: ${V}`:""}).`))})),t.aborted)y();a.stdin.end(JSON.stringify(r))})}async function H(e,r,t,i={}){let o=await Ze(e,{op:"automation",call:r},t,i);if(!Number.isSafeInteger(o.code)||typeof o.stdout!=="string"||typeof o.stderr!=="string")throw new p("desktop_delegate_failed","Reason's desktop reply is malformed.");return{code:o.code,stdout:Buffer.from(o.stdout,"base64"),stderr:o.stderr}}import{execFile as He,spawn as Qe}from"child_process";import{closeSync as et,mkdirSync as tt,openSync as rt}from"fs";import{dirname as A,join as it}from"path";import{promisify as ot}from"util";var st=ot(He),Q="x-apple.systempreferences:com.apple.preference.security",at={accessibility:`${Q}?Privacy_Accessibility`,screen:`${Q}?Privacy_ScreenCapture`},nt=64,$=new Map;function k(e,r){let t=$.get(e);if(t?.has(r))return!1;if(!t){if($.size>=nt)$.delete($.keys().next().value);t=new Set,$.set(e,t)}return t.add(r),!0}function ct(){let e=x(),r=ne(ae(e),process.env),t=it(e,".local","share","reason","desktop-install.log");tt(A(t),{recursive:!0,mode:448});let i=rt(t,"a",384);try{let o=Qe(r,["desktop","install"],{detached:!0,stdio:["ignore",i,i],env:{...process.env,REASON_DESKTOP_BACKGROUND:"1"}});o.on("error",()=>{return}),o.unref()}finally{et(i)}}var P={open:async(e,r)=>{await st("/usr/bin/open",e,{signal:r,timeout:1e4,maxBuffer:8192})},request:(e,r)=>oe(e,r),tile:se,installDesktop:ct},ee=!1;async function te(e,r,t){try{await r.open(["-a","Google Chrome",e],t)}catch{t.throwIfAborted(),await r.open([e],t)}}async function ce(e,r,t,i){if(await t.open([at[r]],i).catch(()=>{}),e[0]&&!i.aborted)t.tile(A(A(A(e[0]))),r)}async function lt(e,r,t,i,o){for(let s of t){if(!k(e,`grant:${s}`))continue;o.throwIfAborted(),await i.request(r,s).catch(()=>null),await ce(r,s,i,o)}}var ut={name:"open_tab",description:"Open a web page in the user's own Chrome on this Mac. Reason cannot read, screenshot or click in that tab, and no tab_id is returned: browser control needs Reason's Chrome extension. An actual browser call opens its setup page.",inputSchema:{type:"object",properties:{url:{type:"string",description:"An http or https URL."}},required:["url"],additionalProperties:!1}};function re(e){return{code:0,stderr:"",stdout:Buffer.from(JSON.stringify({ok:!0,...e}))}}function dt(e){if(typeof e!=="string")return null;try{let r=new URL(e);return r.protocol==="https:"||r.protocol==="http:"?r.href:null}catch{return null}}async function le(e,r=P){let{call:t,runId:i,signal:o}=e;if(t.kind==="browser"){if(t.operation==="discover")return re({result:{tools:[ut]}});if(t.operation!=="call")throw new p("automation_browser_setup_required","Browser control is not set up on this Mac yet. Request a browser operation or connect Chrome from Reason to set it up.")}if(e.desktopMissing&&!ee){ee=!0;try{r.installDesktop()}catch{}}if(t.kind==="computer"){if(e.identity.length>0&&k(i,"grant:probe")){let a=await r.request(e.identity).catch(()=>null),l=a?[...a.accessibility?[]:["accessibility"],...a.screen?[]:["screen"]]:[];for(let d of l)k(i,`grant:${d}`);for(let d of l)await ce(e.identity,d,r,o)}throw new p("automation_computer_setup_required","Computer use is not set up on this Mac yet; Reason asked macOS for any missing permission.")}if(k(i,"page:chrome-extension"))await te(ie,r,o).catch(()=>{});let s=t.arguments,c=t.operation==="call"&&t.tool==="open_tab"&&s&&typeof s==="object"&&!Array.isArray(s)?dt(s.url):null;if(!c)throw new p("automation_browser_setup_required","Browser control is not set up on this Mac yet; Reason opened its Chrome Web Store page. open_tab still opens pages.");return await te(c,r,o),re({result:{content:[{type:"text",text:JSON.stringify({opened:c,browser:"the user's Chrome",controllable:!1,note:"Opened for the user to see. Reason cannot read or act in this tab until Reason's Chrome extension is added (its Chrome Web Store page is open)."})}]}})}async function ue(e,r=P){if(e.call.kind!=="computer"||e.call.operation!=="permission_status"||e.output.code!==0||e.identity.length===0)return e.output;let t;try{t=JSON.parse(e.output.stdout.toString("utf8"))}catch{return e.output}if(!t||typeof t!=="object"||Array.isArray(t))return e.output;let i=t.permissions;if(!i||typeof i!=="object")return e.output;let o=i,s=[...o.accessibility==="missing"?["accessibility"]:[],...o.screenRecording==="missing"?["screen"]:[]];if(s.length===0)return e.output;return await lt(e.runId,e.identity,s,r,e.signal),{...e.output,stdout:Buffer.from(JSON.stringify({...t,requested:s}))}}var K=172032,It=18874368,Nt=8192,Ot=65536,Tt=55000,vt=60000,Rt=4,$t=40000,At=/^[0-9a-f-]{36}$/,me=Z,kt=Te();function W(e){return Boolean(e)&&typeof e==="object"&&!Array.isArray(e)}function E(){throw new p("invalid_automation_request","Reason automation request is malformed.")}function $e(e){let r=Object.keys(e).sort().join(",");if(r==="call"||r==="browser,call"){let t=e.call,i=r==="browser,call";if(!W(t)||t.version!==1||t.kind!=="computer"&&t.kind!=="browser"||i&&(e.browser!==be||t.kind!=="browser")||JSON.stringify(t).length>Ot)E();return{call:t,userChrome:i}}if(r==="offset,output_id"){if(typeof e.output_id!=="string"||!At.test(e.output_id)||!Number.isSafeInteger(e.offset)||e.offset<0)E();return{output_id:e.output_id,offset:e.offset}}return E()}function Wr(e=process.platform,r=v){if(e==="darwin")return!0;return(e==="linux"||e==="win32")&&r()?.features.computer===!0}var Pt="__computer-use";function Ct(e){let r=(t)=>t?"granted":"missing";return`Permissions: accessibility=${r(e.accessibility)}, screenRecording=${r(e.screen)}
855
- `}function Wt(e,r,t,i={stdin:process.stdin,stdout:process.stdout}){return new Promise((o)=>{let s=S(e,r,{env:t,stdio:["pipe","pipe","inherit"]}),c=(n)=>{s.kill(n)},a=["SIGTERM","SIGINT","SIGHUP"];for(let n of a)process.on(n,c);i.stdin.pipe(s.stdin),s.stdin.on("error",()=>{return}),s.stdout.pipe(i.stdout,{end:!1});let l=!1,d=(n)=>{if(l)return;l=!0;for(let u of a)process.off(u,c);i.stdin.unpipe(s.stdin),i.stdout.write("",()=>o(n))};s.once("error",()=>d(127)),s.once("close",(n)=>d(n??1))})}async function Er(e,r={}){let t=r.stderr??process.stderr,i=(r.identity??J)(),o=(r.components??v)();if(i.length===0||o?.platform!=="darwin-arm64")return t.write(`Reason computer use: Reason's background identity cannot run Open Computer Use here (computer_use_identity_unavailable)
856
- `),1;if(e.length===1&&e[0]==="doctor"){let a=await(r.grants??Ne)(i);if(!a)return t.write(`Reason computer use: Reason's permissions could not be read (computer_use_permission_status_unavailable)
857
- `),1;return(r.stdout??process.stdout).write(Ct(a)),0}if(e.length!==1||e[0]!=="mcp")return t.write(`Usage: reason __computer-use mcp|doctor
858
- `),2;let[s,...c]=i;return(r.run??Wt)(s,[...c,o.ocu,"mcp"],{...process.env,OPEN_COMPUTER_USE_DISABLE_APP_AGENT_PROXY:"1"})}function qr(e=v){return e()?.userChrome??{code:"user_chrome_browser_use_missing"}}function Ae(e,r,t,i){return new Promise((o)=>{let s=S(e,r,{env:t,stdio:"ignore",windowsHide:!0}),c=setTimeout(()=>{s.kill("SIGKILL"),o(-1)},i);s.once("error",()=>{clearTimeout(c),o(-1)}),s.once("exit",(a)=>{clearTimeout(c),o(a??-1)})})}function Et(e,r,t,i){return new Promise((o)=>{let s=S(e,r,{env:t,stdio:["ignore","pipe","ignore"],windowsHide:!0}),c="";s.stdout.setEncoding("utf8").on("data",(l)=>{c+=l});let a=setTimeout(()=>{s.kill("SIGKILL"),o(null)},i);s.once("error",()=>{clearTimeout(a),o(null)}),s.once("close",(l)=>{clearTimeout(a),o(l===0?c:null)})})}function qt(e){return T(e)?f(F(),"open-browser-use"):"/tmp/open-browser-use"}function T(e){return e.platform==="win32-x64"||e.platform==="win32-arm64"}var Dt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,Ft=33554432;function Bt(e,r){let t;try{t=e===null?null:JSON.parse(e)}catch{return null}let i=W(t)&&W(t.result)?t.result.metadata:null;if(!W(i)||i.extensionId!==r)return null;return typeof i.extensionInstanceId==="string"&&Dt.test(i.extensionInstanceId)?i.extensionInstanceId:null}async function ke(e,r,t){let i=t.storages.map((a)=>{try{return D(a).filter((l)=>l.endsWith(".log")||l.endsWith(".ldb")).map((l)=>f(a,l))}catch{return[]}}),o;try{o=i.some((a)=>a.length>0)?D(t.socketDir).filter((a)=>a.endsWith(".sock")):[]}catch{return[]}let s=[];for(let a of o){let l=f(t.socketDir,a),d=Bt(await Et(e,["info","--socket",l,"--timeout","2s"],r,5000),t.extensionId);if(d)s.push({instance:d,socket:l})}let c=[];for(let[a,l]of(s.length>0?i:[]).entries())for(let d of l)try{if(bt(d).size>Ft)continue;let n=j(d),u=s.find((m)=>n.includes(m.instance));if(u){c.push({storage:t.storages[a],...u});break}}catch{}return c}async function Ut(e,r,t){return(await ke(e,r,t))[0]?.instance??null}function Pe(e,r,t){return Ut(e.nativeHost,r,{socketDir:qt(e),extensionId:M,storages:[f(t,"browser-profile","Default","Local Extension Settings",M)]})}var _e=/^(Default|Profile ([0-9]+))$/;async function Lt(e,r,t=x(),i=Y){let o=f(t,"Library","Application Support","Google","Chrome"),s=[];try{s=D(o)}catch(n){if(n.code==="EPERM")throw new p("browser_use_chrome_access_denied","macOS blocked Reason from reading Chrome's profiles. Allow Full Disk Access for Reason on this Mac and try again.")}let c=(n)=>Number(_e.exec(n)?.[2]??-1),a=s.filter((n)=>_e.test(n)&&q(f(o,n,"Extensions",C))).sort((n,u)=>c(n)-c(u)),l=(n)=>f(o,n,"Local Extension Settings",C);return(await ke(e,r,{socketDir:i,extensionId:C,storages:a.map(l)})).map(({storage:n,instance:u,socket:m})=>({profile:a.find((_)=>l(_)===n),instance:u,socket:m}))}async function Gt(e,r,t=x(),i=Y){let o=(await Lt(e,r,t,i))[0]?.instance;if(!o)throw new p("automation_user_chrome_not_connected","No Chrome profile on this Mac is connected to Reason. Open Chrome with the Reason extension, then try again.");return o}function he(e){return new Promise((r)=>{let t=St({path:e}),i=(o)=>{t.destroy(),r(o)};t.setTimeout(1000,()=>i(!1)),t.once("error",()=>i(!1)),t.once("connect",()=>i(!0))})}async function Ce(e,r){let t=Date.now()+r;while(Date.now()<t){if(await e())return!0;await new Promise((i)=>setTimeout(i,200))}return!1}var L=new Map;function G(e,r){let t=L.get(e);if(!t)t=r().finally(()=>L.delete(e)),L.set(e,t);return t}async function Mt(e,r){if(await he(e))return;if(gt(e,{force:!0}),await Ae("dbus-daemon",["--session",`--address=unix:path=${e}`,"--fork"],r,1e4)!==0||!await Ce(()=>he(e),5000))throw new p("automation_unavailable","Reason could not start the desktop session bus.")}async function we(e,r,t){let i=e.platform==="darwin-arm64"||T(e)?async()=>await Pe(e,r,t)!==null:async()=>await Ae(e.nativeHost,["info"],r,5000)===0;if(await i())return;let o=["--profile-directory=Default",`--load-extension=${e.extensionDir}`,"--no-first-run","--no-default-browser-check","--window-size=1280,800","about:blank"],s,c=null,a=0;if(e.platform==="darwin-arm64"){let n=f(t,"browser-profile");O(n);let u=f(n,"NativeMessagingHosts");pe(u,{recursive:!0,mode:448});let m=z(e.platform).nativeHostManifests[0];de(m,f(u,fe(m)));let _=e.browser.slice(0,e.browser.indexOf(".app/")+4),g=o.filter((N)=>N!=="about:blank").concat("--no-startup-window","--use-mock-keychain");s=S("/usr/bin/open",["-g","-n","-a",_,"--args",`--user-data-dir=${n}`,...g],{env:r,stdio:"ignore"})}else if(T(e)){let n=f(t,"browser-profile");O(n),pt(xe("icacls"),[B(e.browser),"/grant","*S-1-15-2-1:(OI)(CI)(RX)","*S-1-15-2-2:(OI)(CI)(RX)"],{stdio:"ignore",windowsHide:!0,timeout:60000});let u=o.filter((m)=>m!=="about:blank").concat("--no-startup-window","--keep-alive-for-test");s=S(e.browser,[`--user-data-dir=${n}`,...u],{detached:!0,stdio:"ignore",env:r})}else{let n=f(r.HOME,".config","google-chrome"),u=f(n,"NativeMessagingHosts");pe(u,{recursive:!0,mode:448});let m=z(e.platform).nativeHostManifests[0];de(m,f(u,fe(m)));let _=process.geteuid?.()===0?["--no-sandbox"]:[];c=f(t,"browser.log");let g=ht(c,"a",384);a=_t(g).size,s=S(e.browser,[`--user-data-dir=${n}`,...o,..._,"--force-renderer-accessibility"],{detached:!0,stdio:["ignore",g,g],env:{...r,ACCESSIBILITY_ENABLED:"1"}}),mt(g)}let l=!1;s.once("error",()=>{l=!0}),s.once("exit",(n)=>{l||=n!==0}),s.unref();let d=!1;if(await Ce(async()=>l||(d=await i()),$t),!d){if(c&&j(c).subarray(a).toString("utf8").includes("No usable sandbox"))throw new p("automation_browser_sandbox_unavailable","Chromium found no usable sandbox on this machine. Run the worker as a non-root user with unprivileged user namespaces enabled, or in a container with seccomp unconfined.");throw new p("automation_browser_unavailable","Reason could not connect the desktop browser.")}}async function Dr(e){await qe(e,!0)}function Fr(e){return We(e,Ee(e))}function We(e,r){return e.platform==="darwin-arm64"||T(e)?f(r,"browser-profile"):f(r,"home",".config","google-chrome")}function Ee(e){let r=f(e.root,"automation");if(!q(r)||!Kt(e.automation))return e.automation;if(!zt(We(e,r)))try{ve(r,e.automation)}catch{}return q(r)?r:e.automation}function Kt(e){try{return D(e).length===0}catch(r){return r.code==="ENOENT"}}function zt(e){let r;try{r=wt(f(e,"SingletonLock"))}catch{return!1}let t=Number(r.slice(r.lastIndexOf("-")+1));if(!Number.isSafeInteger(t)||t<=0)return!0;try{return process.kill(t,0),!0}catch(i){return i.code==="EPERM"}}async function qe(e,r){ye({root:e.root,automation:e.automation,extensionDir:e.extensionDir});let t=Ee(e);O(t);let i=Re().username,o={USER:i,LOGNAME:i,REASON_AUTOMATION_OCU:e.ocu,REASON_AUTOMATION_OBU:e.nativeHost};if(e.platform==="darwin-arm64"||T(e)){let n=T(e)?{...o,...Jt(),HOME:x()}:{...o,HOME:x(),PATH:`${B(e.node)}:/usr/bin:/bin:/usr/sbin:/sbin`,REASON_AUTOMATION_OCU:process.execPath,REASON_AUTOMATION_OCU_SUBCOMMAND:Pt};if(!r)return n;await G("browser",()=>we(e,n,t));let u=await Pe(e,n,t);if(!u)throw new p("automation_browser_unavailable","Reason could not connect the desktop browser.");return{...n,REASON_AUTOMATION_OBU_INSTANCE:u,REASON_AUTOMATION_BACKGROUND_TABS:"1"}}let s=await Be(),c=f(t,"home"),a=f(t,"runtime");O(c),O(a);let l=f(t,"bus"),d={...o,HOME:c,PATH:`${B(e.node)}:/usr/bin:/bin`,DISPLAY:s.display,XAUTHORITY:s.xauthority,XDG_RUNTIME_DIR:a,DBUS_SESSION_BUS_ADDRESS:`unix:path=${l}`,...s.sound?{PULSE_SERVER:Oe(s.sound)}:{}};if(await G("bus",()=>Mt(l,d)),r)await G("browser",()=>we(e,d,t));return d}function Jt(){let e=process.env.SystemRoot??"C:\\Windows",r=Object.fromEntries(["SystemDrive","USERPROFILE","LOCALAPPDATA","APPDATA","ProgramData","ProgramFiles","PATHEXT","ComSpec","USERNAME","USERDOMAIN","COMPUTERNAME","NUMBER_OF_PROCESSORS","PROCESSOR_ARCHITECTURE","PSModuleAnalysisCachePath"].flatMap((i)=>process.env[i]?[[i,process.env[i]]]:[])),t=f(e,"System32");return{...r,SystemRoot:e,windir:e,TEMP:F(),TMP:F(),PATH:[t,f(t,"WindowsPowerShell","v1.0"),e].join(yt)}}async function jt(e,r,t){let i=Re().username,o={USER:i,LOGNAME:i,HOME:x(),PATH:`${B(e.node)}:/usr/bin:/bin:/usr/sbin:/sbin`,REASON_AUTOMATION_OBU:r,REASON_AUTOMATION_BACKGROUND_TABS:"1"},s=await Gt(r,o);return t.throwIfAborted(),{...o,REASON_AUTOMATION_OBU_INSTANCE:s}}function Yt(e){if(process.platform!=="win32")return["--input-type=module","--eval",e];let r=f(F(),`reason-automation-${ft("sha256").update(e).digest("hex").slice(0,16)}.mjs`);if(!q(r)||j(r,"utf8")!==e){let t=`${r}.${process.pid}.tmp`;xt(t,e,{mode:384}),ve(t,r)}return[r]}function De(e,r,t,i){if(typeof me!=="string")return Promise.reject(new p("automation_unavailable","This Reason build has no automation runtime."));let o=me;return new Promise((s,c)=>{let a=S(e,Yt(o),{env:{...r,REASON_CLOUD_GATEWAY_EXEC:"1",REASON_AUTOMATION_INLINE_RESULT:"1"},stdio:["pipe","pipe","pipe"],detached:process.platform!=="win32",windowsHide:!0}),l=[],d=0,n="",u=null,m=!1,_=(h)=>{if(u??=h,process.platform==="win32"&&a.pid){S(f(process.env.SystemRoot??"C:\\Windows","System32","taskkill.exe"),["/pid",String(a.pid),"/t","/f"],{stdio:"ignore",windowsHide:!0}).once("error",()=>a.kill("SIGKILL"));return}try{process.kill(-a.pid,"SIGKILL")}catch{a.kill("SIGKILL")}},g=(h)=>{if(m)return;m=!0,clearTimeout(N),i.removeEventListener("abort",y),h()},N=setTimeout(()=>_(new p("automation_timed_out","Reason automation did not finish in time.")),Tt),y=()=>_(new p("cancelled","Reason cancelled the automation call."));if(i.addEventListener("abort",y,{once:!0}),a.stdout.on("data",(h)=>{if(d+=h.byteLength,d>It)_(new p("automation_output_too_large","Reason automation output is too large."));else l.push(h)}),a.stderr.setEncoding("utf8").on("data",(h)=>{n=(n+h).slice(-Nt)}),a.stdin.on("error",()=>{}),a.once("error",()=>g(()=>c(u??new p("automation_unavailable","Reason could not start the automation runtime.")))),a.once("close",(h)=>g(()=>{if(u)c(u);else s({code:h??1,stdout:Buffer.concat(l),stderr:n})})),i.aborted)y();a.stdin.end(t)})}var I=new Map;function Xt(e,r,t){for(let[o,s]of I)if(s.expiresAt<=t)I.delete(o);while(I.size>=Rt)I.delete(I.keys().next().value);let i=Te();return I.set(i,{runId:e,bytes:r,expiresAt:t+vt}),i}async function Fe(e,r,t,i={}){let o=await(i.environment??qe)(e,r.kind==="browser");return t.throwIfAborted(),await(i.runtime??De)(e.node,o,JSON.stringify(r),t)}async function Br(e,r){let t=$e({call:e});if(!("call"in t))E();let i=v();if(!i?.features.computer||t.call.kind==="browser"&&!i.features.browser)throw new p("automation_unavailable","Run `reason desktop install` on this machine to enable computer and browser use.");return await Fe(i,t.call,r)}function ge(e,r,t){let i=e.stdout.byteLength>K?Xt(r,e.stdout,t):void 0;return{code:e.code,stderr:e.stderr,instance_id:kt,output_bytes:e.stdout.byteLength,chunk:e.stdout.subarray(0,K).toString("base64"),...i?{output_id:i}:{}}}async function Ur(e,r={}){let t=$e(e.payload),i=(r.now??Date.now)();if("output_id"in t){let _=I.get(t.output_id);if(!_||_.runId!==e.runId||_.expiresAt<=i||t.offset>_.bytes.byteLength)throw new p("automation_output_unavailable","Reason automation output expired.");return{chunk:_.bytes.subarray(t.offset,t.offset+K).toString("base64")}}let o=(r.components??v)(),s=(r.platform??process.platform)==="darwin",c=s?(r.macIdentity??J)():[],a=r.macSetup??P,l=!o?.features.computer||t.call.kind==="browser"&&!t.userChrome&&!o.features.browser;if(s&&(l||c.length===0||t.call.kind==="browser"&&t.userChrome&&!e.userChrome))return ge(await le({runId:e.runId,call:t.call,identity:c,desktopMissing:l,signal:e.signal},a),e.runId,i);if(!o?.features.computer)throw new p("automation_unavailable","Run `reason desktop install` on this machine to enable computer and browser use.");let d=t.userChrome?e.userChrome:void 0;if(t.userChrome&&!d)throw new p("automation_user_chrome_unavailable","Your own Chrome is not enabled on this computer: run `reason desktop install` on this Mac (and `reason connect --user-chrome on` if you turned it off).");if(t.call.kind==="browser"&&!d&&!o.features.browser)throw new p("automation_browser_not_installed",!o.platform.startsWith("linux")?"Browser use is unavailable on this machine: re-run `reason desktop install`.":"Browser use is unavailable on this machine: install a non-snap Chromium at /usr/bin/chromium, then re-run `reason desktop install`.");e.signal.throwIfAborted();let n=await Ie(e.runId,e.signal,r.now),u="account"in r?r.account??null:Se(),m;try{if(d){let _=await(r.userChromeEnvironment??jt)(o,d,e.signal);e.signal.throwIfAborted(),m=await(r.runtime??De)(o.node,_,JSON.stringify(t.call),e.signal)}else if(u)m=await(r.delegate??H)(u,t.call,e.signal);else m=await Fe(o,t.call,e.signal,r)}finally{n()}if(s)m=await ue({runId:e.runId,call:t.call,identity:c,output:m,signal:e.signal},a);return ge(m,e.runId,i)}
859
- export{Ze as Ed,K as Fd,$e as Gd,Wr as Hd,Wt as Id,Er as Jd,qr as Kd,Lt as Ld,Gt as Md,Dr as Nd,Fr as Od,Br as Pd,Ur as Qd};
852
+ `;import{spawn as Ee}from"child_process";import{basename as Ce}from"path";var Te="__desktop-call",Ne="/usr/bin/setpriv",Pe=27262976,De=8192,Me=2000;function q(e){return Boolean(e)&&typeof e==="object"&&!Array.isArray(e)}function Ue(e){try{return JSON.parse(e)}catch{return null}}function Le(){return[process.execPath,...Ce(process.execPath).startsWith("bun")&&process.argv[1]?[process.argv[1]]:[],Te]}function kt(e,o,t,n={}){t.throwIfAborted();let s=n.command??Le();return new Promise((i,u)=>{let c=(n.spawnProcess??Ee)(Ne,[`--reuid=${e.uid}`,`--regid=${e.gid}`,"--clear-groups","--no-new-privs","--",...s],{cwd:e.home,detached:!0,stdio:["pipe","pipe","pipe"],env:{HOME:e.home,USER:e.username,LOGNAME:e.username,PATH:"/usr/local/bin:/usr/bin:/bin"}}),d=[],m=0,l="",p=null,g=!1,h,y=(_)=>{try{process.kill(-c.pid,_)}catch{c.kill(_)}},I=(_)=>{p??=_,y("SIGTERM"),h??=setTimeout(()=>y("SIGKILL"),Me)},S=()=>I(new r("cancelled","Reason cancelled the desktop operation."));t.addEventListener("abort",S,{once:!0});let w=(_)=>{if(g)return;g=!0,clearTimeout(h),t.removeEventListener("abort",S),_()};if(c.stdout.on("data",(_)=>{if(m+=_.byteLength,m>Pe)I(new r("desktop_delegate_failed","Reason's desktop reply is too large."));else d.push(_)}),c.stderr.setEncoding("utf8").on("data",(_)=>{l=(l+_).slice(-De)}),c.stdin.on("error",()=>{}),c.once("error",()=>w(()=>u(p??new r("desktop_delegate_unavailable","Reason could not start its desktop as the desktop account.")))),c.once("close",(_,Oe)=>w(()=>{if(p)return u(p);let b=Ue(Buffer.concat(d).toString("utf8"));if(q(b)&&b.ok===!0&&q(b.result))return i(b.result);let O=q(b)&&b.ok===!1&&typeof b.code==="string"&&typeof b.message==="string"?new r(b.code.slice(0,120),b.message.slice(0,2000)):null,X=`exited ${_??Oe}${O?"":" with no reply"}`,J=l.trim().split(`
853
+ `).at(-1)?.slice(-300)??"";if(!O||O.code==="desktop_delegate_failed")process.stderr.write(`Reason worker: desktop call ${X}${l?`: ${l.trim().slice(-500)}`:""}
854
+ `);if(O)return u(O);u(new r("desktop_delegate_failed",`Reason's desktop operation failed (${X}${J?`: ${J}`:""}).`))})),t.aborted)S();c.stdin.end(JSON.stringify(o))})}async function z(e,o,t,n={}){let s=await kt(e,{op:"automation",call:o},t,n);if(!Number.isSafeInteger(s.code)||typeof s.stdout!=="string"||typeof s.stderr!=="string")throw new r("desktop_delegate_failed","Reason's desktop reply is malformed.");return{code:s.code,stdout:Buffer.from(s.stdout,"base64"),stderr:s.stderr}}import{execFile as qe,spawn as We}from"child_process";import{closeSync as Fe,mkdirSync as Ge,openSync as He}from"fs";import{dirname as E,join as je}from"path";import{promisify as Ke}from"util";var Xe=Ke(qe),Z="x-apple.systempreferences:com.apple.preference.security",Je={accessibility:`${Z}?Privacy_Accessibility`,screen:`${Z}?Privacy_ScreenCapture`},Ye=64,A=new Map;function C(e,o){let t=A.get(e);if(t?.has(o))return!1;if(!t){if(A.size>=Ye)A.delete(A.keys().next().value);t=new Set,A.set(e,t)}return t.add(o),!0}function ze(){let e=a(),o=Cn(be(e),process.env),t=je(e,".local","share","reason","desktop-install.log");Ge(E(t),{recursive:!0,mode:448});let n=He(t,"a",384);try{let s=We(o,["desktop","install"],{detached:!0,stdio:["ignore",n,n],env:{...process.env,REASON_DESKTOP_BACKGROUND:"1"}});s.on("error",()=>{return}),s.unref()}finally{Fe(n)}}var T={open:async(e,o)=>{await Xe("/usr/bin/open",e,{signal:o,timeout:1e4,maxBuffer:8192})},request:(e,o)=>st(e,o),tile:Br,installDesktop:ze},Q=!1;async function ee(e,o,t){try{await o.open(["-a","Google Chrome",e],t)}catch{t.throwIfAborted(),await o.open([e],t)}}async function oe(e,o,t,n){if(await t.open([Je[o]],n).catch(()=>{}),e[0]&&!n.aborted)t.tile(E(E(E(e[0]))),o)}async function Ve(e,o,t,n,s){for(let i of t){if(!C(e,`grant:${i}`))continue;s.throwIfAborted(),await n.request(o,i).catch(()=>null),await oe(o,i,n,s)}}var Ze={name:"open_tab",description:"Open a web page in the user's own Chrome on this Mac. Reason cannot read, screenshot or click in that tab, and no tab_id is returned: browser control needs Reason's Chrome extension. An actual browser call opens its setup page.",inputSchema:{type:"object",properties:{url:{type:"string",description:"An http or https URL."}},required:["url"],additionalProperties:!1}};function te(e){return{code:0,stderr:"",stdout:Buffer.from(JSON.stringify({ok:!0,...e}))}}function et(e){if(typeof e!=="string")return null;try{let o=new URL(e);return o.protocol==="https:"||o.protocol==="http:"?o.href:null}catch{return null}}async function re(e,o=T){let{call:t,runId:n,signal:s}=e;if(t.kind==="browser"){if(t.operation==="discover")return te({result:{tools:[Ze]}});if(t.operation!=="call")throw new r("automation_browser_setup_required","Browser control is not set up on this Mac yet. Request a browser operation or connect Chrome from Reason to set it up.")}if(e.desktopMissing&&!Q){Q=!0;try{o.installDesktop()}catch{}}if(t.kind==="computer"){if(e.identity.length>0&&C(n,"grant:probe")){let c=await o.request(e.identity).catch(()=>null),d=c?[...c.accessibility?[]:["accessibility"],...c.screen?[]:["screen"]]:[];for(let m of d)C(n,`grant:${m}`);for(let m of d)await oe(e.identity,m,o,s)}throw new r("automation_computer_setup_required","Computer use is not set up on this Mac yet; Reason asked macOS for any missing permission.")}if(C(n,"page:chrome-extension"))await ee(Fi,o,s).catch(()=>{});let i=t.arguments,u=t.operation==="call"&&t.tool==="open_tab"&&i&&typeof i==="object"&&!Array.isArray(i)?et(i.url):null;if(!u)throw new r("automation_browser_setup_required","Browser control is not set up on this Mac yet; Reason opened its Chrome Web Store page. open_tab still opens pages.");return await ee(u,o,s),te({result:{content:[{type:"text",text:JSON.stringify({opened:u,browser:"the user's Chrome",controllable:!1,note:"Opened for the user to see. Reason cannot read or act in this tab until Reason's Chrome extension is added (its Chrome Web Store page is open)."})}]}})}async function ne(e,o=T){if(e.call.kind!=="computer"||e.call.operation!=="permission_status"||e.output.code!==0||e.identity.length===0)return e.output;let t;try{t=JSON.parse(e.output.stdout.toString("utf8"))}catch{return e.output}if(!t||typeof t!=="object"||Array.isArray(t))return e.output;let n=t.permissions;if(!n||typeof n!=="object")return e.output;let s=n,i=[...s.accessibility==="missing"?["accessibility"]:[],...s.screenRecording==="missing"?["screen"]:[]];if(i.length===0)return e.output;return await Ve(e.runId,e.identity,i,o,e.signal),{...e.output,stdout:Buffer.from(JSON.stringify({...t,requested:i}))}}var j=172032,ft=18874368,wt=8192,_t=65536,yt=55000,bt=60000,St=4,xt=40000,Rt=/^[0-9a-f-]{36}$/,ce=Y,It=me();function N(e){return Boolean(e)&&typeof e==="object"&&!Array.isArray(e)}function D(){throw new r("invalid_automation_request","Reason automation request is malformed.")}function he(e){let o=Object.keys(e).sort().join(",");if(o==="call"||o==="browser,call"){let t=e.call,n=o==="browser,call";if(!N(t)||t.version!==1||t.kind!=="computer"&&t.kind!=="browser"||n&&(e.browser!==ht||t.kind!=="browser")||JSON.stringify(t).length>_t)D();return{call:t,userChrome:n}}if(o==="offset,output_id"){if(typeof e.output_id!=="string"||!Rt.test(e.output_id)||!Number.isSafeInteger(e.offset)||e.offset<0)D();return{output_id:e.output_id,offset:e.offset}}return D()}function mn(e=process.platform,o=P){if(e==="darwin")return!0;return(e==="linux"||e==="win32")&&o()?.features.computer===!0}var vt="__computer-use";function ss(e=P){return e()?.userChrome??{code:"user_chrome_browser_use_missing"}}function we(e,o,t,n){return new Promise((s)=>{let i=R(e,o,{env:t,stdio:"ignore",windowsHide:!0}),u=setTimeout(()=>{i.kill("SIGKILL"),s(-1)},n);i.once("error",()=>{clearTimeout(u),s(-1)}),i.once("exit",(c)=>{clearTimeout(u),s(c??-1)})})}function Ot(e,o,t,n){return new Promise((s)=>{let i=R(e,o,{env:t,stdio:["ignore","pipe","ignore"],windowsHide:!0}),u="";i.stdout.setEncoding("utf8").on("data",(d)=>{u+=d});let c=setTimeout(()=>{i.kill("SIGKILL"),s(null)},n);i.once("error",()=>{clearTimeout(c),s(null)}),i.once("close",(d)=>{clearTimeout(c),s(d===0?u:null)})})}function At(e){return v(e)?f(L(),"open-browser-use"):"/tmp/open-browser-use"}function v(e){return e.platform==="win32-x64"||e.platform==="win32-arm64"}var Et=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,Tt=33554432;function Nt(e,o){let t;try{t=e===null?null:JSON.parse(e)}catch{return null}let n=N(t)&&N(t.result)?t.result.metadata:null;if(!N(n)||n.extensionId!==o)return null;return typeof n.extensionInstanceId==="string"&&Et.test(n.extensionInstanceId)?n.extensionInstanceId:null}async function _e(e,o,t){let n=t.storages.map((c)=>{try{return U(c).filter((d)=>d.endsWith(".log")||d.endsWith(".ldb")).map((d)=>f(c,d))}catch{return[]}}),s;try{s=n.some((c)=>c.length>0)?U(t.socketDir).filter((c)=>c.endsWith(".sock")):[]}catch{return[]}let i=[];for(let c of s){let d=f(t.socketDir,c),m=Nt(await Ot(e,["info","--socket",d,"--timeout","2s"],o,5000),t.extensionId);if(m)i.push({instance:m,socket:d})}let u=[];for(let[c,d]of(i.length>0?n:[]).entries())for(let m of d)try{if(ut(m).size>Tt)continue;let l=K(m),p=i.find((g)=>l.includes(g.instance));if(p){u.push({storage:t.storages[c],...p});break}}catch{}return u}async function Pt(e,o,t){return(await _e(e,o,t))[0]?.instance??null}function ye(e,o,t){return Pt(e.nativeHost,o,{socketDir:At(e),extensionId:F,storages:[f(t,"browser-profile","Default","Local Extension Settings",F)]})}var le=/^(Default|Profile ([0-9]+))$/;async function Dt(e,o,t=a(),n=Ct){let s=f(t,"Library","Application Support","Google","Chrome"),i=[];try{i=U(s)}catch(l){if(l.code==="EPERM")throw new r("browser_use_chrome_access_denied","macOS blocked Reason from reading Chrome's profiles. Allow Full Disk Access for Reason on this Mac and try again.")}let u=(l)=>Number(le.exec(l)?.[2]??-1),c=i.filter((l)=>le.test(l)&&M(f(s,l,"Extensions",$e))).sort((l,p)=>u(l)-u(p)),d=(l)=>f(s,l,"Local Extension Settings",$e);return(await _e(e,o,{socketDir:n,extensionId:$e,storages:c.map(d)})).map(({storage:l,instance:p,socket:g})=>({profile:c.find((h)=>d(h)===l),instance:p,socket:g}))}async function Mt(e,o,t=a(),n=Ct){let s=(await Dt(e,o,t,n))[0]?.instance;if(!s)throw new r("automation_user_chrome_not_connected","No Chrome profile on this Mac is connected to Reason. Open Chrome with the Reason extension, then try again.");return s}function ue(e){return new Promise((o)=>{let t=pt({path:e}),n=(s)=>{t.destroy(),o(s)};t.setTimeout(1000,()=>n(!1)),t.once("error",()=>n(!1)),t.once("connect",()=>n(!0))})}async function Se(e,o){let t=Date.now()+o;while(Date.now()<t){if(await e())return!0;await new Promise((n)=>setTimeout(n,200))}return!1}var W=new Map;function H(e,o){let t=W.get(e);if(!t)t=o().finally(()=>W.delete(e)),W.set(e,t);return t}async function Ut(e,o){if(await ue(e))return;if(lt(e,{force:!0}),await we("dbus-daemon",["--session",`--address=unix:path=${e}`,"--fork"],o,1e4)!==0||!await Se(()=>ue(e),5000))throw new r("automation_unavailable","Reason could not start the desktop session bus.")}async function de(e,o,t){let n=e.platform==="darwin-arm64"||v(e)?async()=>await ye(e,o,t)!==null:async()=>await we(e.nativeHost,["info"],o,5000)===0;if(await n())return;let s=["--profile-directory=Default",`--load-extension=${e.extensionDir}`,"--no-first-run","--no-default-browser-check","--window-size=1280,800","about:blank"],i,u=null,c=0;if(e.platform==="darwin-arm64"){let l=f(t,"browser-profile");V(l);let p=f(l,"NativeMessagingHosts");ie(p,{recursive:!0,mode:448});let g=yr(e.platform).nativeHostManifests[0];se(g,f(p,ae(g)));let h=e.browser.slice(0,e.browser.indexOf(".app/")+4),y=s.filter((I)=>I!=="about:blank").concat("--no-startup-window","--use-mock-keychain");i=R("/usr/bin/open",["-g","-n","-a",h,"--args",`--user-data-dir=${l}`,...y],{env:o,stdio:"ignore"})}else if(v(e)){let l=f(t,"browser-profile");V(l),tt(x("icacls"),[B(e.browser),"/grant","*S-1-15-2-1:(OI)(CI)(RX)","*S-1-15-2-2:(OI)(CI)(RX)"],{stdio:"ignore",windowsHide:!0,timeout:60000});let p=s.filter((g)=>g!=="about:blank").concat("--no-startup-window","--keep-alive-for-test");i=R(e.browser,[`--user-data-dir=${l}`,...p],{detached:!0,stdio:"ignore",env:o})}else{let l=f(o.HOME,".config","google-chrome"),p=f(l,"NativeMessagingHosts");ie(p,{recursive:!0,mode:448});let g=yr(e.platform).nativeHostManifests[0];se(g,f(p,ae(g)));let h=process.geteuid?.()===0?["--no-sandbox"]:[];u=f(t,"browser.log");let y=it(u,"a",384);c=nt(y).size,i=R(e.browser,[`--user-data-dir=${l}`,...s,...h,"--force-renderer-accessibility"],{detached:!0,stdio:["ignore",y,y],env:{...o,ACCESSIBILITY_ENABLED:"1"}}),rt(y)}let d=!1;i.once("error",()=>{d=!0}),i.once("exit",(l)=>{d||=l!==0}),i.unref();let m=!1;if(await Se(async()=>d||(m=await n()),xt),!m){if(u&&K(u).subarray(c).toString("utf8").includes("No usable sandbox"))throw new r("automation_browser_sandbox_unavailable","Chromium found no usable sandbox on this machine. Run the worker as a non-root user with unprivileged user namespaces enabled, or in a container with seccomp unconfined.");throw new r("automation_browser_unavailable","Reason could not connect the desktop browser.")}}async function as(e){await Re(e,!0)}function cs(e){return xe(e,ke(e))}function xe(e,o){return e.platform==="darwin-arm64"||v(e)?f(o,"browser-profile"):f(o,"home",".config","google-chrome")}function ke(e){let o=f(e.root,"automation");if(!M(o)||!Lt(e.automation))return e.automation;if(!$t(xe(e,o)))try{fe(o,e.automation)}catch{}return M(o)?o:e.automation}function Lt(e){try{return U(e).length===0}catch(o){return o.code==="ENOENT"}}function $t(e){let o;try{o=ct(f(e,"SingletonLock"))}catch{return!1}let t=Number(o.slice(o.lastIndexOf("-")+1));if(!Number.isSafeInteger(t)||t<=0)return!0;try{return process.kill(t,0),!0}catch(n){return n.code==="EPERM"}}async function Re(e,o){gt({root:e.root,automation:e.automation,extensionDir:e.extensionDir});let t=ke(e);V(t);let n=ge().username,s={USER:n,LOGNAME:n,REASON_AUTOMATION_OCU:e.ocu,REASON_AUTOMATION_OBU:e.nativeHost};if(e.platform==="darwin-arm64"||v(e)){let l=v(e)?{...s,...Bt(),HOME:a()}:{...s,HOME:a(),PATH:`${B(e.node)}:/usr/bin:/bin:/usr/sbin:/sbin`,REASON_AUTOMATION_OCU:process.execPath,REASON_AUTOMATION_OCU_SUBCOMMAND:vt};if(!o)return l;await H("browser",()=>de(e,l,t));let p=await ye(e,l,t);if(!p)throw new r("automation_browser_unavailable","Reason could not connect the desktop browser.");return{...l,REASON_AUTOMATION_OBU_INSTANCE:p,REASON_AUTOMATION_BACKGROUND_TABS:"1"}}let i=await Be(),u=f(t,"home"),c=f(t,"runtime");V(u),V(c);let d=f(t,"bus"),m={...s,HOME:u,PATH:`${B(e.node)}:/usr/bin:/bin`,DISPLAY:i.display,XAUTHORITY:i.xauthority,XDG_RUNTIME_DIR:c,DBUS_SESSION_BUS_ADDRESS:`unix:path=${d}`,...i.sound?{PULSE_SERVER:Qe(i.sound)}:{}};if(await H("bus",()=>Ut(d,m)),o)await H("browser",()=>de(e,m,t));return m}function Bt(){let e=process.env.SystemRoot??"C:\\Windows",o=Object.fromEntries(["SystemDrive","USERPROFILE","LOCALAPPDATA","APPDATA","ProgramData","ProgramFiles","PATHEXT","ComSpec","USERNAME","USERDOMAIN","COMPUTERNAME","NUMBER_OF_PROCESSORS","PROCESSOR_ARCHITECTURE","PSModuleAnalysisCachePath"].flatMap((n)=>process.env[n]?[[n,process.env[n]]]:[])),t=f(e,"System32");return{...o,SystemRoot:e,windir:e,TEMP:L(),TMP:L(),PATH:[t,f(t,"WindowsPowerShell","v1.0"),e].join(mt)}}async function qt(e,o,t){let n=ge().username,s={USER:n,LOGNAME:n,HOME:a(),PATH:`${B(e.node)}:/usr/bin:/bin:/usr/sbin:/sbin`,REASON_AUTOMATION_OBU:o,REASON_AUTOMATION_BACKGROUND_TABS:"1"},i=await Mt(o,s);return t.throwIfAborted(),{...s,REASON_AUTOMATION_OBU_INSTANCE:i}}function Wt(e){if(process.platform!=="win32")return["--input-type=module","--eval",e];let o=f(L(),`reason-automation-${ot("sha256").update(e).digest("hex").slice(0,16)}.mjs`);if(!M(o)||K(o,"utf8")!==e){let t=`${o}.${process.pid}.tmp`;dt(t,e,{mode:384}),fe(t,o)}return[o]}function Ie(e,o,t,n){if(typeof ce!=="string")return Promise.reject(new r("automation_unavailable","This Reason build has no automation runtime."));let s=ce;return new Promise((i,u)=>{let c=R(e,Wt(s),{env:{...o,REASON_CLOUD_GATEWAY_EXEC:"1",REASON_AUTOMATION_INLINE_RESULT:"1"},stdio:["pipe","pipe","pipe"],detached:process.platform!=="win32",windowsHide:!0}),d=[],m=0,l="",p=null,g=!1,h=(w)=>{if(p??=w,process.platform==="win32"&&c.pid){R(f(process.env.SystemRoot??"C:\\Windows","System32","taskkill.exe"),["/pid",String(c.pid),"/t","/f"],{stdio:"ignore",windowsHide:!0}).once("error",()=>c.kill("SIGKILL"));return}try{process.kill(-c.pid,"SIGKILL")}catch{c.kill("SIGKILL")}},y=(w)=>{if(g)return;g=!0,clearTimeout(I),n.removeEventListener("abort",S),w()},I=setTimeout(()=>h(new r("automation_timed_out","Reason automation did not finish in time.")),yt),S=()=>h(new r("cancelled","Reason cancelled the automation call."));if(n.addEventListener("abort",S,{once:!0}),c.stdout.on("data",(w)=>{if(m+=w.byteLength,m>ft)h(new r("automation_output_too_large","Reason automation output is too large."));else d.push(w)}),c.stderr.setEncoding("utf8").on("data",(w)=>{l=(l+w).slice(-wt)}),c.stdin.on("error",()=>{}),c.once("error",()=>y(()=>u(p??new r("automation_unavailable","Reason could not start the automation runtime.")))),c.once("close",(w)=>y(()=>{if(p)u(p);else i({code:w??1,stdout:Buffer.concat(d),stderr:l})})),n.aborted)S();c.stdin.end(t)})}var k=new Map;function Ft(e,o,t){for(let[s,i]of k)if(i.expiresAt<=t)k.delete(s);while(k.size>=St)k.delete(k.keys().next().value);let n=me();return k.set(n,{runId:e,bytes:o,expiresAt:t+bt}),n}async function ve(e,o,t,n={}){let s=await(n.environment??Re)(e,o.kind==="browser");return t.throwIfAborted(),await(n.runtime??Ie)(e.node,s,JSON.stringify(o),t)}async function ls(e,o){let t=he({call:e});if(!("call"in t))D();let n=P();if(!n?.features.computer||t.call.kind==="browser"&&!n.features.browser)throw new r("automation_unavailable","Run `reason desktop install` on this machine to enable computer and browser use.");return await ve(n,t.call,o)}function pe(e,o,t){let n=e.stdout.byteLength>j?Ft(o,e.stdout,t):void 0;return{code:e.code,stderr:e.stderr,instance_id:It,output_bytes:e.stdout.byteLength,chunk:e.stdout.subarray(0,j).toString("base64"),...n?{output_id:n}:{}}}async function gn(e,o={}){let t=he(e.payload),n=(o.now??Date.now)();if("output_id"in t){let h=k.get(t.output_id);if(!h||h.runId!==e.runId||h.expiresAt<=n||t.offset>h.bytes.byteLength)throw new r("automation_output_unavailable","Reason automation output expired.");return{chunk:h.bytes.subarray(t.offset,t.offset+j).toString("base64")}}let s=(o.components??P)(),i=(o.platform??process.platform)==="darwin",u=i?(o.macIdentity??at)():[],c=o.macSetup??T,d=!s?.features.computer||t.call.kind==="browser"&&!t.userChrome&&!s.features.browser;if(i&&(d||u.length===0||t.call.kind==="browser"&&t.userChrome&&!e.userChrome))return pe(await re({runId:e.runId,call:t.call,identity:u,desktopMissing:d,signal:e.signal},c),e.runId,n);if(!s?.features.computer)throw new r("automation_unavailable","Run `reason desktop install` on this machine to enable computer and browser use.");let m=t.userChrome?e.userChrome:void 0;if(t.userChrome&&!m)throw new r("automation_user_chrome_unavailable","Your own Chrome is not enabled on this computer: run `reason desktop install` on this Mac (and `reason connect --user-chrome on` if you turned it off).");if(t.call.kind==="browser"&&!m&&!s.features.browser)throw new r("automation_browser_not_installed",!s.platform.startsWith("linux")?"Browser use is unavailable on this machine: re-run `reason desktop install`.":"Browser use is unavailable on this machine: install a non-snap Chromium at /usr/bin/chromium, then re-run `reason desktop install`.");e.signal.throwIfAborted();let l=await _i(e.runId,e.signal,o.now),p="account"in o?o.account??null:G(),g;try{if(m){let h=await(o.userChromeEnvironment??qt)(s,m,e.signal);e.signal.throwIfAborted(),g=await(o.runtime??Ie)(s.node,h,JSON.stringify(t.call),e.signal)}else if(p)g=await(o.delegate??z)(p,t.call,e.signal);else g=await ve(s,t.call,e.signal,o)}finally{l()}if(i)g=await ne({runId:e.runId,call:t.call,identity:u,output:g,signal:e.signal},c);return pe(g,e.runId,n)}
855
+ export{kt,mn,ss,as,cs,ls,gn};
@@ -0,0 +1,6 @@
1
+ // @bun
2
+ import{E}from"./vm-hands-entry-lite-pgb514h0.js";import{fe,Re,Kt,Jt,Oe}from"./vm-hands-entry-lite-9ay6f56v.js";import{spawn as y}from"child_process";import{existsSync as p,mkdirSync as T,readFileSync as _,writeFileSync as A}from"fs";import{homedir as m}from"os";import{basename as H,delimiter as g,join as f,win32 as u}from"path";var fr=process.platform==="win32"?Re("win32"):"/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",P=fr.split(g),R=5000,S=65536,O=new Set(["zsh","bash"]),b=[[".local","bin"],[".bun","bin"],[".cargo","bin"],["go","bin"]],x=(t,e)=>new Promise((n,r)=>{let o;try{o=y(t,[...e],{...Kt(),stdio:["ignore","pipe","ignore"]}),Jt(o)}catch(c){r(c);return}let i=[],s=0,a=null,L=(c)=>{a??=Error(c);try{if(o.pid!==void 0)Oe(o.pid,"SIGKILL")}catch{}},d=setTimeout(()=>L("login_shell_timeout"),R);o.stdout?.on("data",(c)=>{if(s+=c.length,s>S)L("login_shell_output_too_large");else i.push(c)}),o.once("error",(c)=>{clearTimeout(d),r(c)}),o.once("close",(c)=>{if(clearTimeout(d),a)r(a);else if(c!==0)r(Error("login_shell_exit_nonzero"));else n(Buffer.concat(i).toString("utf8"))})});function w(t){return typeof t==="string"&&t.startsWith("/")&&!t.includes("\x00")&&O.has(H(t))}function h(t){let e=new Set,n=[];for(let r of t){if(e.has(r))continue;e.add(r),n.push(r)}return n}function mr(t,e=process.platform){let n=e==="win32",r=t.split(`
3
+ `).at(-1)??"",o=[];for(let i of r.split(n?";":":")){let s=i.trim();if(n?!u.isAbsolute(s):!s.startsWith("/"))continue;if(s.includes("\x00"))continue;if(E(s))continue;o.push(s)}return h(o)}function ln(t){let e=t?.home??m(),n=t?.directoryExists??p,r=b.map((o)=>f(e,...o)).filter((o)=>{try{return n(o)}catch{return!1}});return h([...r,...process.platform==="win32"?mr(process.env.PATH??process.env.Path??""):[],...P]).join(g)}async function C(t){let e=t?.shell??process.env.SHELL,n=()=>({path:ln({home:t?.home,directoryExists:t?.directoryExists}),source:"fallback"});if(process.platform==="win32"||!w(e))return n();let r;try{r=await(t?.runLoginShell??x)(e,["-lic",'printf %s "$PATH"'])}catch{return n()}if(Buffer.byteLength(r,"utf8")>S)return n();let o=mr(r);if(o.length===0)return n();return{path:h([...o,...P]).join(":"),source:"login_shell"}}function $i(t){let e=null;return()=>(e??=C(t),e)}function l(t){if(t===void 0||t.includes("\x00")||Buffer.byteLength(t,"utf8")>32768)return;return t}function Me(t){let e=t.source??process.env,n={HOME:t.home,PATH:t.path??fr,TMPDIR:t.temporaryDirectory,SHELL:l(e.SHELL)??"/bin/zsh",LANG:l(e.LANG)??"C.UTF-8",LC_ALL:l(e.LC_ALL)??l(e.LANG)??"C.UTF-8"},r=l(e.LC_CTYPE),o=l(e.TERM),i=l(e.COLORTERM);if(r)n.LC_CTYPE=r;if(o)n.TERM=o;if(i)n.COLORTERM=i;if(process.platform==="win32"){for(let s of I){let a=l(e[s]);if(a)n[s]=a}n.TEMP=n.TMP=t.temporaryDirectory,n.SHELL=fe()??n.SHELL,n.PATH=un(n.PATH)}return n}function un(t,e=f(m(),".reason","python3")){let n=(i)=>t.split(u.delimiter).filter((s)=>s&&!/[\\/]WindowsApps[\\/]?$/i.test(s)).map((s)=>u.join(s,i)).find((s)=>p(s)),r=n("python.exe");if(n("python3.exe")||!r)return t;let o=`#!/bin/sh
4
+ exec "${r.replaceAll("\\","/")}" "$@"
5
+ `;try{let i=f(e,"python3");if(!p(i)||_(i,"utf8")!==o)T(e,{recursive:!0}),A(i,o)}catch{return t}return[e,t].join(u.delimiter)}var I=["SystemRoot","SystemDrive","windir","ComSpec","PATHEXT","USERPROFILE","USERNAME","USERDOMAIN","APPDATA","LOCALAPPDATA","ProgramData","ProgramFiles","ProgramFiles(x86)","ProgramW6432","CommonProgramFiles","NUMBER_OF_PROCESSORS","PROCESSOR_ARCHITECTURE","OS"];
6
+ export{fr,mr,ln,$i,Me,un};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{de,We,T}from"./vm-hands-entry-lite-8t9xssf9.js";import{execFileSync as p}from"child_process";import{existsSync as s,realpathSync as c}from"fs";import{userInfo as l}from"os";import{isAbsolute as u,join as t,normalize as f,parse as d}from"path";function a(){let r=f(l().homedir);if(!u(r)||r===d(r).root)throw Error("Could not resolve the canonical user home.");return r}function ne(r,n,e=a()){let i=T(n);if(n.kind==="managed"&&n.base){let o=c(e);return{anchor:o,boundary:t(o,n.base),path:t(o,i)}}if(n.kind==="root"&&We(n.path)){let o=c(e);return{anchor:o,boundary:t(o,de),path:t(o,i)}}return{anchor:r,boundary:r,path:t(r,i)}}function qt(r=a()){return t(r,".config")}function uo(){if(process.platform!=="darwin")return null;try{let r=p("/usr/bin/getconf",["DARWIN_USER_DIR"],{encoding:"utf8",timeout:5000}).trim();return u(r)?c(r):null}catch{return null}}function po(r=a()){let n=t(r,"Library","Application Support","Ara"),e=t(r,"Library","Application Support","Reason");return s(n)&&!s(e)?n:e}
3
+ export{a,ne,qt,uo,po};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ function Ie(n){return Function("return ("+n+")")()}
3
+ export{Ie};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ var ue=".reason/workspace",Ee="workspace_base",J="sessions",xe="workspace_layout",de=".reason/workspace/sessions",zt=/^[0-9a-f]{8}$/;function We(t){if(!Z(t))return!1;let e=".reason/workspace/sessions/";if(!t.startsWith(e))return!1;let n=t.slice(e.length).split("/");return n.length===2&&zt.test(n[0])}var i=4096,S="workspaces/pi";function Z(t){if(typeof t!=="string"||!t||t.length>i)return!1;if(t.startsWith("/")||t.includes("\x00")||t.includes("\\"))return!1;return t.split("/").every((e)=>e!==""&&e!=="."&&e!=="..")}function T(t){if(t.kind==="root"){if(t.path===void 0)return".";if(!Z(t.path))throw Error("invalid_device_workspace_identity");return t.path}if(!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$/.test(t.workspaceId)||t.workspaceId==="."||t.workspaceId==="..")throw Error("invalid_device_workspace_identity");let e=t.layout==="sessions"?"sessions":S;return`${t.base?`${t.base}/`:""}${e}/${t.workspaceId}/repo`}function H(t){if(!t||typeof t!=="object"||Array.isArray(t))return null;let e=t;if(e.kind==="root"&&Object.keys(e).length===1)return{kind:"root"};if(e.kind==="root"&&Object.keys(e).length===2&&Z(e.path))return{kind:"root",path:e.path};if(e.kind!=="managed"||typeof e.workspaceId!=="string"||Object.keys(e).length!==2+(e.base===void 0?0:1)+(e.layout===void 0?0:1)||e.base!==void 0&&e.base!==".reason/workspace"||e.layout!==void 0&&e.layout!=="sessions")return null;let n={kind:"managed",workspaceId:e.workspaceId,...e.base===".reason/workspace"?{base:".reason/workspace"}:{},...e.layout==="sessions"?{layout:"sessions"}:{}};try{return T(n),n}catch{return null}}var c="/home/runner";var Hr="/run/reason/sessions",O=/^(?:\/[A-Za-z0-9._-]+)+$/,qr=/-sidechat-([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/,zr=/^(.+)-repository-[a-z0-9][a-z0-9._-]*-[0-9a-f]{12}$/;function a(t){return qr.exec(t)?.[1]??zr.exec(t)?.[1]??t}var Wt=/^((?:\/[A-Za-z0-9._-]+)+)\/\.reason\/workspace\/(workspaces\/pi|sessions)\/([^/]+)$/;function _(t,e=c,n="sessions"){if(!O.test(e)||e.split("/").some((s)=>s==="."||s===".."))throw Error("invalid_cloud_payload_home");let r=`${e}/${T({kind:"managed",workspaceId:t,base:".reason/workspace",...n?{layout:n}:{}})}`,o=`${Hr}/${a(t)}`;return{home:e,root:r.slice(0,-5),checkout:r,control:o,jobEnv:`${o}/job.env`,cloudAccess:`${o}/cloud-access`,logs:`${o}/logs`,pin:`${o}/ws`}}function E(t){return Wt.exec(t.replace(/\/+$/,""))?.[2]==="sessions"?"sessions":null}function Wr(t){let e=Wt.exec(t.replace(/\/+$/,""));if(!e)return null;try{let n=_(e[3],e[1],E(t));return n.root===t.replace(/\/+$/,"")?n:null}catch{return null}}
3
+ export{ue,Ee,J,xe,de,zt,We,Z,T,H,Hr,qr,zr,Wt,Wr};
@@ -0,0 +1,65 @@
1
+ // @bun
2
+ import{Bo}from"./vm-hands-entry-lite-0xrsph3r.js";var Qr,go=Object.freeze({status:"aborted"});function z(e,r,a){function p(h,g){if(!h._zod)Object.defineProperty(h,"_zod",{value:{def:g,constr:m,traits:new Set},enumerable:!1});if(h._zod.traits.has(e))return;h._zod.traits.add(e),r(h,g);let x=m.prototype,v=Object.keys(x);for(let w=0;w<v.length;w++){let Z=v[w];if(!(Z in h))h[Z]=x[Z].bind(h)}}let l=a?.Parent??Object;class f extends l{}Object.defineProperty(f,"name",{value:e});function m(h){var g;let x=a?.Parent?new f:this;p(x,h),(g=x._zod).deferred??(g.deferred=[]);for(let v of x._zod.deferred)v();return x}return Object.defineProperty(m,"init",{value:p}),Object.defineProperty(m,Symbol.hasInstance,{value:(h)=>{if(a?.Parent&&h instanceof a.Parent)return!0;return h?._zod?.traits?.has(e)}}),Object.defineProperty(m,"name",{value:e}),m}var gc=Symbol("zod_brand");class V extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ue extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Qr=globalThis).__zod_globalConfig??(Qr.__zod_globalConfig={});var ne=globalThis.__zod_globalConfig;function L(e){if(e)Object.assign(ne,e);return ne}function be(e){let r=Object.values(e).filter((p)=>typeof p==="number");return Object.entries(e).filter(([p,l])=>r.indexOf(+p)===-1).map(([p,l])=>l)}function pi(e,r="|"){return e.map((a)=>hi(a)).join(r)}function ae(e,r){if(typeof r==="bigint")return r.toString();return r}function pe(e){return{get value(){{let a=e();return Object.defineProperty(this,"value",{value:a}),a}throw Error("cached value already set")}}}function we(e){return e===null||e===void 0}function ke(e){let r=e.startsWith("^")?1:0,a=e.endsWith("$")?e.length-1:e.length;return e.slice(r,a)}function rt(e,r){let a=e/r,p=Math.round(a),l=Number.EPSILON*Math.max(Math.abs(a),1);if(Math.abs(a-p)<l)return 0;return a-p}var et=Symbol("evaluating");function P(e,r,a){let p=void 0;Object.defineProperty(e,r,{get(){if(p===et)return;if(p===void 0)p=et,p=a();return p},set(l){Object.defineProperty(e,r,{value:l})},configurable:!0})}function X(e,r,a){Object.defineProperty(e,r,{value:a,writable:!0,enumerable:!0,configurable:!0})}function W(...e){let r={};for(let a of e){let p=Object.getOwnPropertyDescriptors(a);Object.assign(r,p)}return Object.defineProperties({},r)}function Ve(e){return JSON.stringify(e)}function tt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var We="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function se(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var ot=pe(()=>{if(ne.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function H(e){if(se(e)===!1)return!1;let r=e.constructor;if(r===void 0)return!0;if(typeof r!=="function")return!0;let a=r.prototype;if(se(a)===!1)return!1;if(Object.prototype.hasOwnProperty.call(a,"isPrototypeOf")===!1)return!1;return!0}function Ke(e){if(H(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var nt=new Set(["string","number","symbol"]);function K(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function M(e,r,a){let p=new e._zod.constr(r??e._zod.def);if(!r||a?.parent)p._zod.parent=e;return p}function b(e){let r=e;if(!r)return{};if(typeof r==="string")return{error:()=>r};if(r?.message!==void 0){if(r?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");r.error=r.message}if(delete r.message,typeof r.error==="string")return{...r,error:()=>r.error};return r}function hi(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function st(e){return Object.keys(e).filter((r)=>e[r]._zod.optin==="optional"&&e[r]._zod.optout==="optional")}var it={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Qs(e,r){let a=e._zod.def,p=a.checks;if(p&&p.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let f=W(e._zod.def,{get shape(){let m={};for(let h in r){if(!(h in a.shape))throw Error(`Unrecognized key: "${h}"`);if(!r[h])continue;m[h]=a.shape[h]}return X(this,"shape",m),m},checks:[]});return M(e,f)}function ei(e,r){let a=e._zod.def,p=a.checks;if(p&&p.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let f=W(e._zod.def,{get shape(){let m={...e._zod.def.shape};for(let h in r){if(!(h in a.shape))throw Error(`Unrecognized key: "${h}"`);if(!r[h])continue;delete m[h]}return X(this,"shape",m),m},checks:[]});return M(e,f)}function ri(e,r){if(!H(r))throw Error("Invalid input to extend: expected a plain object");let a=e._zod.def.checks;if(a&&a.length>0){let f=e._zod.def.shape;for(let m in r)if(Object.getOwnPropertyDescriptor(f,m)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let l=W(e._zod.def,{get shape(){let f={...e._zod.def.shape,...r};return X(this,"shape",f),f}});return M(e,l)}function ti(e,r){if(!H(r))throw Error("Invalid input to safeExtend: expected a plain object");let a=W(e._zod.def,{get shape(){let p={...e._zod.def.shape,...r};return X(this,"shape",p),p}});return M(e,a)}function oi(e,r){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let a=W(e._zod.def,{get shape(){let p={...e._zod.def.shape,...r._zod.def.shape};return X(this,"shape",p),p},get catchall(){return r._zod.def.catchall},checks:r._zod.def.checks??[]});return M(e,a)}function ni(e,r,a){let l=r._zod.def.checks;if(l&&l.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let m=W(r._zod.def,{get shape(){let h=r._zod.def.shape,g={...h};if(a)for(let x in a){if(!(x in h))throw Error(`Unrecognized key: "${x}"`);if(!a[x])continue;g[x]=e?new e({type:"optional",innerType:h[x]}):h[x]}else for(let x in h)g[x]=e?new e({type:"optional",innerType:h[x]}):h[x];return X(this,"shape",g),g},checks:[]});return M(r,m)}function si(e,r,a){let p=W(r._zod.def,{get shape(){let l=r._zod.def.shape,f={...l};if(a)for(let m in a){if(!(m in f))throw Error(`Unrecognized key: "${m}"`);if(!a[m])continue;f[m]=new e({type:"nonoptional",innerType:l[m]})}else for(let m in l)f[m]=new e({type:"nonoptional",innerType:l[m]});return X(this,"shape",f),f}});return M(r,p)}function ee(e,r=0){if(e.aborted===!0)return!0;for(let a=r;a<e.issues.length;a++)if(e.issues[a]?.continue!==!0)return!0;return!1}function ct(e,r=0){if(e.aborted===!0)return!0;for(let a=r;a<e.issues.length;a++)if(e.issues[a]?.continue===!1)return!0;return!1}function G(e,r){return r.map((a)=>{var p;return(p=a).path??(p.path=[]),a.path.unshift(e),a})}function $e(e){return typeof e==="string"?e:e?.message}function J(e,r,a){let p=e.message?e.message:$e(e.inst?._zod.def?.error?.(e))??$e(r?.error?.(e))??$e(a.customError?.(e))??$e(a.localeError?.(e))??"Invalid input",{inst:l,continue:f,input:m,...h}=e;if(h.path??(h.path=[]),h.message=p,r?.reportInput)h.input=m;return h}function Ze(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function _o(e){let r=typeof e;switch(r){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let a=e;if(a&&Object.getPrototypeOf(a)!==Object.prototype&&"constructor"in a&&a.constructor)return a.constructor.name}}return r}function re(...e){let[r,a,p]=e;if(typeof r==="string")return{message:r,code:"custom",input:a,inst:p};return{...r}}var ut=(e,r)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:r,enumerable:!1}),e.message=JSON.stringify(r,ae,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Pe=z("$ZodError",ut),Ge=z("$ZodError",ut,{Parent:Error});function at(e,r=(a)=>a.message){let a={},p=[];for(let l of e.issues)if(l.path.length>0)a[l.path[0]]=a[l.path[0]]||[],a[l.path[0]].push(r(l));else p.push(r(l));return{formErrors:p,fieldErrors:a}}function pt(e,r=(a)=>a.message){let a={_errors:[]},p=(l,f=[])=>{for(let m of l.issues)if(m.code==="invalid_union"&&m.errors.length)m.errors.map((h)=>p({issues:h},[...f,...m.path]));else if(m.code==="invalid_key")p({issues:m.issues},[...f,...m.path]);else if(m.code==="invalid_element")p({issues:m.issues},[...f,...m.path]);else{let h=[...f,...m.path];if(h.length===0)a._errors.push(r(m));else{let g=a,x=0;while(x<h.length){let v=h[x];if(x!==h.length-1)g[v]=g[v]||{_errors:[]};else g[v]=g[v]||{_errors:[]},g[v]._errors.push(r(m));g=g[v],x++}}}};return p(e),a}var Se=(e)=>(r,a,p,l)=>{let f=p?{...p,async:!1}:{async:!1},m=r._zod.run({value:a,issues:[]},f);if(m instanceof Promise)throw new V;if(m.issues.length){let h=new(l?.Err??e)(m.issues.map((g)=>J(g,f,L())));throw We(h,l?.callee),h}return m.value};var Oe=(e)=>async(r,a,p,l)=>{let f=p?{...p,async:!0}:{async:!0},m=r._zod.run({value:a,issues:[]},f);if(m instanceof Promise)m=await m;if(m.issues.length){let h=new(l?.Err??e)(m.issues.map((g)=>J(g,f,L())));throw We(h,l?.callee),h}return m.value};var le=(e)=>(r,a,p)=>{let l=p?{...p,async:!1}:{async:!1},f=r._zod.run({value:a,issues:[]},l);if(f instanceof Promise)throw new V;return f.issues.length?{success:!1,error:new(e??Pe)(f.issues.map((m)=>J(m,l,L())))}:{success:!0,data:f.value}},lt=le(Ge),fe=(e)=>async(r,a,p)=>{let l=p?{...p,async:!0}:{async:!0},f=r._zod.run({value:a,issues:[]},l);if(f instanceof Promise)f=await f;return f.issues.length?{success:!1,error:new e(f.issues.map((m)=>J(m,l,L())))}:{success:!0,data:f.value}},dt=fe(Ge),ht=(e)=>(r,a,p)=>{let l=p?{...p,direction:"backward"}:{direction:"backward"};return Se(e)(r,a,l)};var _t=(e)=>(r,a,p)=>Se(e)(r,a,p);var gt=(e)=>async(r,a,p)=>{let l=p?{...p,direction:"backward"}:{direction:"backward"};return Oe(e)(r,a,l)};var xt=(e)=>async(r,a,p)=>Oe(e)(r,a,p);var zt=(e)=>(r,a,p)=>{let l=p?{...p,direction:"backward"}:{direction:"backward"};return le(e)(r,a,l)};var vt=(e)=>(r,a,p)=>le(e)(r,a,p);var yt=(e)=>async(r,a,p)=>{let l=p?{...p,direction:"backward"}:{direction:"backward"};return fe(e)(r,a,l)};var $t=(e)=>async(r,a,p)=>fe(e)(r,a,p);var bt=/^[cC][0-9a-z]{6,}$/,wt=/^[0-9a-z]+$/,kt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Zt=/^[0-9a-vA-V]{20}$/,Pt=/^[A-Za-z0-9]{27}$/,St=/^[a-zA-Z0-9_-]{21}$/,Ot=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Et=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,qe=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var It=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var ci="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Tt(){return new RegExp(ci,"u")}var Nt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,At=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var jt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ct=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Rt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ye=/^[A-Za-z0-9_-]*$/;var Dt=/^https?$/,Lt=/^\+[1-9]\d{6,14}$/,Ft="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Ut=new RegExp(`^${Ft}$`);function Mt(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Jt(e){return new RegExp(`^${Mt(e)}$`)}function Bt(e){let r=Mt({precision:e.precision}),a=["Z"];if(e.local)a.push("");if(e.offset)a.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let p=`${r}(?:${a.join("|")})`;return new RegExp(`^${Ft}T(?:${p})$`)}var Vt=(e)=>{let r=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${r}$`)};var Wt=/^-?\d+$/,Xe=/^-?\d+(?:\.\d+)?$/,Kt=/^(?:true|false)$/i,Gt=/^null$/i;var qt=/^[^A-Z]*$/,Yt=/^[^a-z]*$/;var D=z("$ZodCheck",(e,r)=>{var a;e._zod??(e._zod={}),e._zod.def=r,(a=e._zod).onattach??(a.onattach=[])}),Xt={number:"number",bigint:"bigint",object:"date"},He=z("$ZodCheckLessThan",(e,r)=>{D.init(e,r);let a=Xt[typeof r.value];e._zod.onattach.push((p)=>{let l=p._zod.bag,f=(r.inclusive?l.maximum:l.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(r.value<f)if(r.inclusive)l.maximum=r.value;else l.exclusiveMaximum=r.value}),e._zod.check=(p)=>{if(r.inclusive?p.value<=r.value:p.value<r.value)return;p.issues.push({origin:a,code:"too_big",maximum:typeof r.value==="object"?r.value.getTime():r.value,input:p.value,inclusive:r.inclusive,inst:e,continue:!r.abort})}}),Qe=z("$ZodCheckGreaterThan",(e,r)=>{D.init(e,r);let a=Xt[typeof r.value];e._zod.onattach.push((p)=>{let l=p._zod.bag,f=(r.inclusive?l.minimum:l.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(r.value>f)if(r.inclusive)l.minimum=r.value;else l.exclusiveMinimum=r.value}),e._zod.check=(p)=>{if(r.inclusive?p.value>=r.value:p.value>r.value)return;p.issues.push({origin:a,code:"too_small",minimum:typeof r.value==="object"?r.value.getTime():r.value,input:p.value,inclusive:r.inclusive,inst:e,continue:!r.abort})}}),Ht=z("$ZodCheckMultipleOf",(e,r)=>{D.init(e,r),e._zod.onattach.push((a)=>{var p;(p=a._zod.bag).multipleOf??(p.multipleOf=r.value)}),e._zod.check=(a)=>{if(typeof a.value!==typeof r.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof a.value==="bigint"?a.value%r.value===BigInt(0):rt(a.value,r.value)===0)return;a.issues.push({origin:typeof a.value,code:"not_multiple_of",divisor:r.value,input:a.value,inst:e,continue:!r.abort})}}),Qt=z("$ZodCheckNumberFormat",(e,r)=>{D.init(e,r),r.format=r.format||"float64";let a=r.format?.includes("int"),p=a?"int":"number",[l,f]=it[r.format];e._zod.onattach.push((m)=>{let h=m._zod.bag;if(h.format=r.format,h.minimum=l,h.maximum=f,a)h.pattern=Wt}),e._zod.check=(m)=>{let h=m.value;if(a){if(!Number.isInteger(h)){m.issues.push({expected:p,format:r.format,code:"invalid_type",continue:!1,input:h,inst:e});return}if(!Number.isSafeInteger(h)){if(h>0)m.issues.push({input:h,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:p,inclusive:!0,continue:!r.abort});else m.issues.push({input:h,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:p,inclusive:!0,continue:!r.abort});return}}if(h<l)m.issues.push({origin:"number",input:h,code:"too_small",minimum:l,inclusive:!0,inst:e,continue:!r.abort});if(h>f)m.issues.push({origin:"number",input:h,code:"too_big",maximum:f,inclusive:!0,inst:e,continue:!r.abort})}});var eo=z("$ZodCheckMaxLength",(e,r)=>{var a;D.init(e,r),(a=e._zod.def).when??(a.when=(p)=>{let l=p.value;return!we(l)&&l.length!==void 0}),e._zod.onattach.push((p)=>{let l=p._zod.bag.maximum??Number.POSITIVE_INFINITY;if(r.maximum<l)p._zod.bag.maximum=r.maximum}),e._zod.check=(p)=>{let l=p.value;if(l.length<=r.maximum)return;let m=Ze(l);p.issues.push({origin:m,code:"too_big",maximum:r.maximum,inclusive:!0,input:l,inst:e,continue:!r.abort})}}),ro=z("$ZodCheckMinLength",(e,r)=>{var a;D.init(e,r),(a=e._zod.def).when??(a.when=(p)=>{let l=p.value;return!we(l)&&l.length!==void 0}),e._zod.onattach.push((p)=>{let l=p._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(r.minimum>l)p._zod.bag.minimum=r.minimum}),e._zod.check=(p)=>{let l=p.value;if(l.length>=r.minimum)return;let m=Ze(l);p.issues.push({origin:m,code:"too_small",minimum:r.minimum,inclusive:!0,input:l,inst:e,continue:!r.abort})}}),to=z("$ZodCheckLengthEquals",(e,r)=>{var a;D.init(e,r),(a=e._zod.def).when??(a.when=(p)=>{let l=p.value;return!we(l)&&l.length!==void 0}),e._zod.onattach.push((p)=>{let l=p._zod.bag;l.minimum=r.length,l.maximum=r.length,l.length=r.length}),e._zod.check=(p)=>{let l=p.value,f=l.length;if(f===r.length)return;let m=Ze(l),h=f>r.length;p.issues.push({origin:m,...h?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length},inclusive:!0,exact:!0,input:p.value,inst:e,continue:!r.abort})}}),de=z("$ZodCheckStringFormat",(e,r)=>{var a,p;if(D.init(e,r),e._zod.onattach.push((l)=>{let f=l._zod.bag;if(f.format=r.format,r.pattern)f.patterns??(f.patterns=new Set),f.patterns.add(r.pattern)}),r.pattern)(a=e._zod).check??(a.check=(l)=>{if(r.pattern.lastIndex=0,r.pattern.test(l.value))return;l.issues.push({origin:"string",code:"invalid_format",format:r.format,input:l.value,...r.pattern?{pattern:r.pattern.toString()}:{},inst:e,continue:!r.abort})});else(p=e._zod).check??(p.check=()=>{})}),oo=z("$ZodCheckRegex",(e,r)=>{de.init(e,r),e._zod.check=(a)=>{if(r.pattern.lastIndex=0,r.pattern.test(a.value))return;a.issues.push({origin:"string",code:"invalid_format",format:"regex",input:a.value,pattern:r.pattern.toString(),inst:e,continue:!r.abort})}}),no=z("$ZodCheckLowerCase",(e,r)=>{r.pattern??(r.pattern=qt),de.init(e,r)}),so=z("$ZodCheckUpperCase",(e,r)=>{r.pattern??(r.pattern=Yt),de.init(e,r)}),io=z("$ZodCheckIncludes",(e,r)=>{D.init(e,r);let a=K(r.includes),p=new RegExp(typeof r.position==="number"?`^.{${r.position}}${a}`:a);r.pattern=p,e._zod.onattach.push((l)=>{let f=l._zod.bag;f.patterns??(f.patterns=new Set),f.patterns.add(p)}),e._zod.check=(l)=>{if(l.value.includes(r.includes,r.position))return;l.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:r.includes,input:l.value,inst:e,continue:!r.abort})}}),co=z("$ZodCheckStartsWith",(e,r)=>{D.init(e,r);let a=new RegExp(`^${K(r.prefix)}.*`);r.pattern??(r.pattern=a),e._zod.onattach.push((p)=>{let l=p._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(a)}),e._zod.check=(p)=>{if(p.value.startsWith(r.prefix))return;p.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:r.prefix,input:p.value,inst:e,continue:!r.abort})}}),uo=z("$ZodCheckEndsWith",(e,r)=>{D.init(e,r);let a=new RegExp(`.*${K(r.suffix)}$`);r.pattern??(r.pattern=a),e._zod.onattach.push((p)=>{let l=p._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(a)}),e._zod.check=(p)=>{if(p.value.endsWith(r.suffix))return;p.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:r.suffix,input:p.value,inst:e,continue:!r.abort})}});var ao=z("$ZodCheckOverwrite",(e,r)=>{D.init(e,r),e._zod.check=(a)=>{a.value=r.tx(a.value)}});class er{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let a=e.split(`
3
+ `).filter((f)=>f),p=Math.min(...a.map((f)=>f.length-f.trimStart().length)),l=a.map((f)=>f.slice(p)).map((f)=>" ".repeat(this.indent*2)+f);for(let f of l)this.content.push(f)}compile(){let e=Function,r=this?.args,p=[...(this?.content??[""]).map((l)=>` ${l}`)];return new e(...r,p.join(`
4
+ `))}}var lo={major:4,minor:4,patch:3};var E=z("$ZodType",(e,r)=>{var a;e??(e={}),e._zod.def=r,e._zod.bag=e._zod.bag||{},e._zod.version=lo;let p=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))p.unshift(e);for(let l of p)for(let f of l._zod.onattach)f(e);if(p.length===0)(a=e._zod).deferred??(a.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let l=(m,h,g)=>{let x=ee(m),v;for(let w of h){if(w._zod.def.when){if(ct(m))continue;if(!w._zod.def.when(m))continue}else if(x)continue;let Z=m.issues.length,k=w._zod.check(m);if(k instanceof Promise&&g?.async===!1)throw new V;if(v||k instanceof Promise)v=(v??Promise.resolve()).then(async()=>{if(await k,m.issues.length===Z)return;if(!x)x=ee(m,Z)});else{if(m.issues.length===Z)continue;if(!x)x=ee(m,Z)}}if(v)return v.then(()=>m);return m},f=(m,h,g)=>{if(ee(m))return m.aborted=!0,m;let x=l(h,p,g);if(x instanceof Promise){if(g.async===!1)throw new V;return x.then((v)=>e._zod.parse(v,g))}return e._zod.parse(x,g)};e._zod.run=(m,h)=>{if(h.skipChecks)return e._zod.parse(m,h);if(h.direction==="backward"){let x=e._zod.parse({value:m.value,issues:[]},{...h,skipChecks:!0});if(x instanceof Promise)return x.then((v)=>f(v,m,h));return f(x,m,h)}let g=e._zod.parse(m,h);if(g instanceof Promise){if(h.async===!1)throw new V;return g.then((x)=>l(x,p,h))}return l(g,p,h)}}P(e,"~standard",()=>({validate:(l)=>{try{let f=lt(e,l);return f.success?{value:f.data}:{issues:f.error?.issues}}catch(f){return dt(e,l).then((m)=>m.success?{value:m.data}:{issues:m.error?.issues})}},vendor:"zod",version:1}))}),Ae=z("$ZodString",(e,r)=>{E.init(e,r),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Vt(e._zod.bag),e._zod.parse=(a,p)=>{if(r.coerce)try{a.value=String(a.value)}catch(l){}if(typeof a.value==="string")return a;return a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:e}),a}}),I=z("$ZodStringFormat",(e,r)=>{de.init(e,r),Ae.init(e,r)}),ko=z("$ZodGUID",(e,r)=>{r.pattern??(r.pattern=Et),I.init(e,r)}),Zo=z("$ZodUUID",(e,r)=>{if(r.version){let p={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[r.version];if(p===void 0)throw Error(`Invalid UUID version: "${r.version}"`);r.pattern??(r.pattern=qe(p))}else r.pattern??(r.pattern=qe());I.init(e,r)}),Po=z("$ZodEmail",(e,r)=>{r.pattern??(r.pattern=It),I.init(e,r)}),So=z("$ZodURL",(e,r)=>{I.init(e,r),e._zod.check=(a)=>{try{let p=a.value.trim();if(!r.normalize&&r.protocol?.source===Dt.source){if(!/^https?:\/\//i.test(p)){a.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:a.value,inst:e,continue:!r.abort});return}}let l=new URL(p);if(r.hostname){if(r.hostname.lastIndex=0,!r.hostname.test(l.hostname))a.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:r.hostname.source,input:a.value,inst:e,continue:!r.abort})}if(r.protocol){if(r.protocol.lastIndex=0,!r.protocol.test(l.protocol.endsWith(":")?l.protocol.slice(0,-1):l.protocol))a.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:r.protocol.source,input:a.value,inst:e,continue:!r.abort})}if(r.normalize)a.value=l.href;else a.value=p;return}catch(p){a.issues.push({code:"invalid_format",format:"url",input:a.value,inst:e,continue:!r.abort})}}}),Oo=z("$ZodEmoji",(e,r)=>{r.pattern??(r.pattern=Tt()),I.init(e,r)}),Eo=z("$ZodNanoID",(e,r)=>{r.pattern??(r.pattern=St),I.init(e,r)}),Io=z("$ZodCUID",(e,r)=>{r.pattern??(r.pattern=bt),I.init(e,r)}),To=z("$ZodCUID2",(e,r)=>{r.pattern??(r.pattern=wt),I.init(e,r)}),No=z("$ZodULID",(e,r)=>{r.pattern??(r.pattern=kt),I.init(e,r)}),Ao=z("$ZodXID",(e,r)=>{r.pattern??(r.pattern=Zt),I.init(e,r)}),jo=z("$ZodKSUID",(e,r)=>{r.pattern??(r.pattern=Pt),I.init(e,r)}),Co=z("$ZodISODateTime",(e,r)=>{r.pattern??(r.pattern=Bt(r)),I.init(e,r)}),Ro=z("$ZodISODate",(e,r)=>{r.pattern??(r.pattern=Ut),I.init(e,r)}),Do=z("$ZodISOTime",(e,r)=>{r.pattern??(r.pattern=Jt(r)),I.init(e,r)}),Fo=z("$ZodISODuration",(e,r)=>{r.pattern??(r.pattern=Ot),I.init(e,r)}),Uo=z("$ZodIPv4",(e,r)=>{r.pattern??(r.pattern=Nt),I.init(e,r),e._zod.bag.format="ipv4"}),Jo=z("$ZodIPv6",(e,r)=>{r.pattern??(r.pattern=At),I.init(e,r),e._zod.bag.format="ipv6",e._zod.check=(a)=>{try{new URL(`http://[${a.value}]`)}catch{a.issues.push({code:"invalid_format",format:"ipv6",input:a.value,inst:e,continue:!r.abort})}}});var Vo=z("$ZodCIDRv4",(e,r)=>{r.pattern??(r.pattern=jt),I.init(e,r)}),Wo=z("$ZodCIDRv6",(e,r)=>{r.pattern??(r.pattern=Ct),I.init(e,r),e._zod.check=(a)=>{let p=a.value.split("/");try{if(p.length!==2)throw Error();let[l,f]=p;if(!f)throw Error();let m=Number(f);if(`${m}`!==f)throw Error();if(m<0||m>128)throw Error();new URL(`http://[${l}]`)}catch{a.issues.push({code:"invalid_format",format:"cidrv6",input:a.value,inst:e,continue:!r.abort})}}});function Ko(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Go=z("$ZodBase64",(e,r)=>{r.pattern??(r.pattern=Rt),I.init(e,r),e._zod.bag.contentEncoding="base64",e._zod.check=(a)=>{if(Ko(a.value))return;a.issues.push({code:"invalid_format",format:"base64",input:a.value,inst:e,continue:!r.abort})}});function ui(e){if(!Ye.test(e))return!1;let r=e.replace(/[-_]/g,(p)=>p==="-"?"+":"/"),a=r.padEnd(Math.ceil(r.length/4)*4,"=");return Ko(a)}var qo=z("$ZodBase64URL",(e,r)=>{r.pattern??(r.pattern=Ye),I.init(e,r),e._zod.bag.contentEncoding="base64url",e._zod.check=(a)=>{if(ui(a.value))return;a.issues.push({code:"invalid_format",format:"base64url",input:a.value,inst:e,continue:!r.abort})}}),Yo=z("$ZodE164",(e,r)=>{r.pattern??(r.pattern=Lt),I.init(e,r)});function ai(e,r=null){try{let a=e.split(".");if(a.length!==3)return!1;let[p]=a;if(!p)return!1;let l=JSON.parse(atob(p));if("typ"in l&&l?.typ!=="JWT")return!1;if(!l.alg)return!1;if(r&&(!("alg"in l)||l.alg!==r))return!1;return!0}catch{return!1}}var Xo=z("$ZodJWT",(e,r)=>{I.init(e,r),e._zod.check=(a)=>{if(ai(a.value,r.alg))return;a.issues.push({code:"invalid_format",format:"jwt",input:a.value,inst:e,continue:!r.abort})}});var tr=z("$ZodNumber",(e,r)=>{E.init(e,r),e._zod.pattern=e._zod.bag.pattern??Xe,e._zod.parse=(a,p)=>{if(r.coerce)try{a.value=Number(a.value)}catch(m){}let l=a.value;if(typeof l==="number"&&!Number.isNaN(l)&&Number.isFinite(l))return a;let f=typeof l==="number"?Number.isNaN(l)?"NaN":!Number.isFinite(l)?"Infinity":void 0:void 0;return a.issues.push({expected:"number",code:"invalid_type",input:l,inst:e,...f?{received:f}:{}}),a}}),Ho=z("$ZodNumberFormat",(e,r)=>{Qt.init(e,r),tr.init(e,r)}),Qo=z("$ZodBoolean",(e,r)=>{E.init(e,r),e._zod.pattern=Kt,e._zod.parse=(a,p)=>{if(r.coerce)try{a.value=Boolean(a.value)}catch(f){}let l=a.value;if(typeof l==="boolean")return a;return a.issues.push({expected:"boolean",code:"invalid_type",input:l,inst:e}),a}});var en=z("$ZodNull",(e,r)=>{E.init(e,r),e._zod.pattern=Gt,e._zod.values=new Set([null]),e._zod.parse=(a,p)=>{let l=a.value;if(l===null)return a;return a.issues.push({expected:"null",code:"invalid_type",input:l,inst:e}),a}});var rn=z("$ZodUnknown",(e,r)=>{E.init(e,r),e._zod.parse=(a)=>a}),tn=z("$ZodNever",(e,r)=>{E.init(e,r),e._zod.parse=(a,p)=>(a.issues.push({expected:"never",code:"invalid_type",input:a.value,inst:e}),a)});function fo(e,r,a){if(e.issues.length)r.issues.push(...G(a,e.issues));r.value[a]=e.value}var on=z("$ZodArray",(e,r)=>{E.init(e,r),e._zod.parse=(a,p)=>{let l=a.value;if(!Array.isArray(l))return a.issues.push({expected:"array",code:"invalid_type",input:l,inst:e}),a;a.value=Array(l.length);let f=[];for(let m=0;m<l.length;m++){let h=l[m],g=r.element._zod.run({value:h,issues:[]},p);if(g instanceof Promise)f.push(g.then((x)=>fo(x,a,m)));else fo(g,a,m)}if(f.length)return Promise.all(f).then(()=>a);return a}});function Ne(e,r,a,p,l,f){let m=a in p;if(e.issues.length){if(l&&f&&!m)return;r.issues.push(...G(a,e.issues))}if(!m&&!l){if(!e.issues.length)r.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[a]});return}if(e.value===void 0){if(m)r.value[a]=void 0}else r.value[a]=e.value}function nn(e){let r=Object.keys(e.shape);for(let p of r)if(!e.shape?.[p]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${p}": expected a Zod schema`);let a=st(e.shape);return{...e,keys:r,keySet:new Set(r),numKeys:r.length,optionalKeys:new Set(a)}}function sn(e,r,a,p,l,f){let m=[],h=l.keySet,g=l.catchall._zod,x=g.def.type,v=g.optin==="optional",w=g.optout==="optional";for(let Z in r){if(Z==="__proto__")continue;if(h.has(Z))continue;if(x==="never"){m.push(Z);continue}let k=g.run({value:r[Z],issues:[]},p);if(k instanceof Promise)e.push(k.then((S)=>Ne(S,a,Z,r,v,w)));else Ne(k,a,Z,r,v,w)}if(m.length)a.issues.push({code:"unrecognized_keys",keys:m,input:r,inst:f});if(!e.length)return a;return Promise.all(e).then(()=>a)}var li=z("$ZodObject",(e,r)=>{if(E.init(e,r),!Object.getOwnPropertyDescriptor(r,"shape")?.get){let h=r.shape;Object.defineProperty(r,"shape",{get:()=>{let g={...h};return Object.defineProperty(r,"shape",{value:g}),g}})}let p=pe(()=>nn(r));P(e._zod,"propValues",()=>{let h=r.shape,g={};for(let x in h){let v=h[x]._zod;if(v.values){g[x]??(g[x]=new Set);for(let w of v.values)g[x].add(w)}}return g});let l=se,f=r.catchall,m;e._zod.parse=(h,g)=>{m??(m=p.value);let x=h.value;if(!l(x))return h.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),h;h.value={};let v=[],w=m.shape;for(let Z of m.keys){let k=w[Z],S=k._zod.optin==="optional",ce=k._zod.optout==="optional",C=k._zod.run({value:x[Z],issues:[]},g);if(C instanceof Promise)v.push(C.then((Je)=>Ne(Je,h,Z,x,S,ce)));else Ne(C,h,Z,x,S,ce)}if(!f)return v.length?Promise.all(v).then(()=>h):h;return sn(v,x,h,g,p.value,e)}}),cn=z("$ZodObjectJIT",(e,r)=>{li.init(e,r);let a=e._zod.parse,p=pe(()=>nn(r)),l=(Z)=>{let k=new er(["shape","payload","ctx"]),S=p.value,ce=(B)=>{let j=Ve(B);return`shape[${j}]._zod.run({ value: input[${j}], issues: [] }, ctx)`};k.write("const input = payload.value;");let C=Object.create(null),Je=0;for(let B of S.keys)C[B]=`key_${Je++}`;k.write("const newResult = {};");for(let B of S.keys){let j=C[B],R=Ve(B),Xr=Z[B],Hr=Xr?._zod?.optin==="optional",Hs=Xr?._zod?.optout==="optional";if(k.write(`const ${j} = ${ce(B)};`),Hr&&Hs)k.write(`
5
+ if (${j}.issues.length) {
6
+ if (${R} in input) {
7
+ payload.issues = payload.issues.concat(${j}.issues.map(iss => ({
8
+ ...iss,
9
+ path: iss.path ? [${R}, ...iss.path] : [${R}]
10
+ })));
11
+ }
12
+ }
13
+
14
+ if (${j}.value === undefined) {
15
+ if (${R} in input) {
16
+ newResult[${R}] = undefined;
17
+ }
18
+ } else {
19
+ newResult[${R}] = ${j}.value;
20
+ }
21
+
22
+ `);else if(!Hr)k.write(`
23
+ const ${j}_present = ${R} in input;
24
+ if (${j}.issues.length) {
25
+ payload.issues = payload.issues.concat(${j}.issues.map(iss => ({
26
+ ...iss,
27
+ path: iss.path ? [${R}, ...iss.path] : [${R}]
28
+ })));
29
+ }
30
+ if (!${j}_present && !${j}.issues.length) {
31
+ payload.issues.push({
32
+ code: "invalid_type",
33
+ expected: "nonoptional",
34
+ input: undefined,
35
+ path: [${R}]
36
+ });
37
+ }
38
+
39
+ if (${j}_present) {
40
+ if (${j}.value === undefined) {
41
+ newResult[${R}] = undefined;
42
+ } else {
43
+ newResult[${R}] = ${j}.value;
44
+ }
45
+ }
46
+
47
+ `);else k.write(`
48
+ if (${j}.issues.length) {
49
+ payload.issues = payload.issues.concat(${j}.issues.map(iss => ({
50
+ ...iss,
51
+ path: iss.path ? [${R}, ...iss.path] : [${R}]
52
+ })));
53
+ }
54
+
55
+ if (${j}.value === undefined) {
56
+ if (${R} in input) {
57
+ newResult[${R}] = undefined;
58
+ }
59
+ } else {
60
+ newResult[${R}] = ${j}.value;
61
+ }
62
+
63
+ `)}k.write("payload.value = newResult;"),k.write("return payload;");let Xs=k.compile();return(B,j)=>Xs(Z,B,j)},f,m=se,h=!ne.jitless,x=h&&ot.value,v=r.catchall,w;e._zod.parse=(Z,k)=>{w??(w=p.value);let S=Z.value;if(!m(S))return Z.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),Z;if(h&&x&&k?.async===!1&&k.jitless!==!0){if(!f)f=l(r.shape);if(Z=f(Z,k),!v)return Z;return sn([],S,Z,k,w,e)}return a(Z,k)}});function mo(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)=>!ee(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)=>{E.init(e,r),P(e._zod,"optin",()=>r.options.some((p)=>p._zod.optin==="optional")?"optional":void 0),P(e._zod,"optout",()=>r.options.some((p)=>p._zod.optout==="optional")?"optional":void 0),P(e._zod,"values",()=>{if(r.options.every((p)=>p._zod.values))return new Set(r.options.flatMap((p)=>Array.from(p._zod.values)));return}),P(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 g=h._zod.run({value:p.value,issues:[]},l);if(g instanceof Promise)m.push(g),f=!0;else{if(g.issues.length===0)return g;m.push(g)}}if(!f)return mo(m,p,e,l);return Promise.all(m).then((h)=>mo(h,p,e,l))}});var un=z("$ZodDiscriminatedUnion",(e,r)=>{r.inclusive=!1,or.init(e,r);let a=e._zod.parse;P(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,g]of Object.entries(m)){if(!l[h])l[h]=new Set;for(let x of g)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 g of h){if(f.has(g))throw Error(`Duplicate discriminator value "${String(g)}"`);f.set(g,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}}),an=z("$ZodIntersection",(e,r)=>{E.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(([g,x])=>ho(a,g,x));return ho(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(H(e)&&H(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 ho(e,r,a){let p=new Map,l;for(let h of r.issues)if(h.code==="unrecognized_keys"){l??(l=h);for(let g of h.keys){if(!p.has(g))p.set(g,{});p.get(g).l=!0}}else e.issues.push(h);for(let h of a.issues)if(h.code==="unrecognized_keys")for(let g of h.keys){if(!p.has(g))p.set(g,{});p.get(g).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(ee(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 pn=z("$ZodRecord",(e,r)=>{E.init(e,r),e._zod.parse=(a,p)=>{let l=a.value;if(!H(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((k)=>J(k,p,L())),input:x,path:[x],inst:e});continue}let w=v.value,Z=r.valueType._zod.run({value:l[x],issues:[]},p);if(Z instanceof Promise)f.push(Z.then((k)=>{if(k.issues.length)a.issues.push(...G(x,k.issues));a.value[w]=k.value}));else{if(Z.issues.length)a.issues.push(...G(x,Z.issues));a.value[w]=Z.value}}let g;for(let x in l)if(!h.has(x))g=g??[],g.push(x);if(g&&g.length>0)a.issues.push({code:"unrecognized_keys",input:l,inst:e,keys:g})}else{a.value={};for(let h of Reflect.ownKeys(l)){if(h==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(l,h))continue;let g=r.keyType._zod.run({value:h,issues:[]},p);if(g instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof h==="string"&&Xe.test(h)&&g.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)g=w}if(g.issues.length){if(r.mode==="loose")a.value[h]=l[h];else a.issues.push({code:"invalid_key",origin:"record",issues:g.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(...G(h,w.issues));a.value[g.value]=w.value}));else{if(v.issues.length)a.issues.push(...G(h,v.issues));a.value[g.value]=v.value}}}if(f.length)return Promise.all(f).then(()=>a);return a}});var ln=z("$ZodEnum",(e,r)=>{E.init(e,r);let a=be(r.entries),p=new Set(a);e._zod.values=p,e._zod.pattern=new RegExp(`^(${a.filter((l)=>nt.has(typeof l)).map((l)=>typeof l==="string"?K(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}}),fn=z("$ZodLiteral",(e,r)=>{if(E.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"?K(p):p?K(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 dn=z("$ZodTransform",(e,r)=>{E.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 xo(e,r){if(r===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}var nr=z("$ZodOptional",(e,r)=>{E.init(e,r),e._zod.optin="optional",e._zod.optout="optional",P(e._zod,"values",()=>r.innerType._zod.values?new Set([...r.innerType._zod.values,void 0]):void 0),P(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)=>xo(m,l));return xo(f,l)}if(a.value===void 0)return a;return r.innerType._zod.run(a,p)}}),mn=z("$ZodExactOptional",(e,r)=>{nr.init(e,r),P(e._zod,"values",()=>r.innerType._zod.values),P(e._zod,"pattern",()=>r.innerType._zod.pattern),e._zod.parse=(a,p)=>r.innerType._zod.run(a,p)}),hn=z("$ZodNullable",(e,r)=>{E.init(e,r),P(e._zod,"optin",()=>r.innerType._zod.optin),P(e._zod,"optout",()=>r.innerType._zod.optout),P(e._zod,"pattern",()=>{let a=r.innerType._zod.pattern;return a?new RegExp(`^(${ke(a.source)}|null)$`):void 0}),P(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)}}),_n=z("$ZodDefault",(e,r)=>{E.init(e,r),e._zod.optin="optional",P(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)=>zo(f,r));return zo(l,r)}});function zo(e,r){if(e.value===void 0)e.value=r.defaultValue;return e}var gn=z("$ZodPrefault",(e,r)=>{E.init(e,r),e._zod.optin="optional",P(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)}}),xn=z("$ZodNonOptional",(e,r)=>{E.init(e,r),P(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)=>vo(f,e));return vo(l,e)}});function vo(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 zn=z("$ZodCatch",(e,r)=>{E.init(e,r),e._zod.optin="optional",P(e._zod,"optout",()=>r.innerType._zod.optout),P(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 vn=z("$ZodPipe",(e,r)=>{E.init(e,r),P(e._zod,"values",()=>r.in._zod.values),P(e._zod,"optin",()=>r.in._zod.optin),P(e._zod,"optout",()=>r.out._zod.optout),P(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)=>Ie(m,r.in,p));return Ie(f,r.in,p)}let l=r.in._zod.run(a,p);if(l instanceof Promise)return l.then((f)=>Ie(f,r.out,p));return Ie(l,r.out,p)}});function Ie(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 yn=z("$ZodReadonly",(e,r)=>{E.init(e,r),P(e._zod,"propValues",()=>r.innerType._zod.propValues),P(e._zod,"values",()=>r.innerType._zod.values),P(e._zod,"optin",()=>r.innerType?._zod?.optin),P(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(bo);return bo(l)}});function bo(e){return e.value=Object.freeze(e.value),e}var $n=z("$ZodLazy",(e,r)=>{E.init(e,r),P(e._zod,"innerType",()=>{let a=r;if(!a._cachedInner)a._cachedInner=r.getter();return a._cachedInner}),P(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),P(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),P(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),P(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(a,p)=>e._zod.innerType._zod.run(a,p)}),bn=z("$ZodCustom",(e,r)=>{D.init(e,r),E.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)=>wo(f,a,p,e));wo(l,a,p,e);return}});function wo(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(re(l))}}var wn,Rc=Symbol("ZodOutput"),Dc=Symbol("ZodInput");class kn{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 di(){return new kn}(wn=globalThis).__zod_globalRegistry??(wn.__zod_globalRegistry=di());var te=globalThis.__zod_globalRegistry;function Zn(e,r){return new e({type:"string",...b(r)})}function Pn(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 Sn(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...b(r)})}function On(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...b(r)})}function En(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 In(e,r){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...b(r)})}function Tn(e,r){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...b(r)})}function Nn(e,r){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...b(r)})}function An(e,r){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...b(r)})}function jn(e,r){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...b(r)})}function Cn(e,r){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...b(r)})}function Rn(e,r){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...b(r)})}function Dn(e,r){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...b(r)})}function Ln(e,r){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...b(r)})}function Fn(e,r){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...b(r)})}function Un(e,r){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...b(r)})}function Mn(e,r){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...b(r)})}function Jn(e,r){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...b(r)})}function Bn(e,r){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...b(r)})}function Vn(e,r){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...b(r)})}function Wn(e,r){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...b(r)})}function Kn(e,r){return new e({type:"string",format:"date",check:"string_format",...b(r)})}function Gn(e,r){return new e({type:"string",format:"time",check:"string_format",precision:null,...b(r)})}function qn(e,r){return new e({type:"string",format:"duration",check:"string_format",...b(r)})}function Yn(e,r){return new e({type:"number",checks:[],...b(r)})}function Xn(e,r){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...b(r)})}function Hn(e,r){return new e({type:"boolean",...b(r)})}function Qn(e,r){return new e({type:"null",...b(r)})}function es(e){return new e({type:"unknown"})}function rs(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 Ht({check:"multiple_of",...b(r),value:e})}function Le(e,r){return new eo({check:"max_length",...b(r),maximum:e})}function ie(e,r){return new ro({check:"min_length",...b(r),minimum:e})}function Fe(e,r){return new to({check:"length_equals",...b(r),length:e})}function cr(e,r){return new oo({check:"string_format",format:"regex",...b(r),pattern:e})}function ur(e){return new no({check:"string_format",format:"lowercase",...b(e)})}function ar(e){return new so({check:"string_format",format:"uppercase",...b(e)})}function pr(e,r){return new io({check:"string_format",format:"includes",...b(r),includes:e})}function lr(e,r){return new co({check:"string_format",format:"starts_with",...b(r),prefix:e})}function fr(e,r){return new uo({check:"string_format",format:"ends_with",...b(r),suffix:e})}function Y(e){return new ao({check:"overwrite",tx:e})}function dr(e){return Y((r)=>r.normalize(e))}function mr(){return Y((e)=>e.trim())}function hr(){return Y((e)=>e.toLowerCase())}function _r(){return Y((e)=>e.toUpperCase())}function gr(){return Y((e)=>tt(e))}function ts(e,r,a){return new e({type:"array",element:r,...b(a)})}function os(e,r,a){let p=b(a);return p.abort??(p.abort=!0),new e({type:"custom",check:"custom",fn:r,...p})}function ns(e,r,a){return new e({type:"custom",check:"custom",fn:r,...b(a)})}function ss(e,r){let a=mi((p)=>(p.addIssue=(l)=>{if(typeof l==="string")p.issues.push(re(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(re(f))}},e(p.value,p)),r);return a}function mi(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??te,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 O(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 Z=m.schema,k=r.processors[l.type];if(!k)throw Error(`[toJSONSchema]: Non-representable type encountered: ${l.type}`);k(e,r,Z,v)}let w=e._zod.parent;if(w){if(!m.ref)m.ref=w;O(w,r,v),r.seen.get(w).isParent=!0}}let g=r.metadataRegistry.get(e);if(g)Object.assign(m.schema,g);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 g=p.get(h);if(g&&g!==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,Z=e.external.uri??((S)=>S);if(w)return{ref:Z(w)};let k=m[1].defId??m[1].schema.id??`schema${e.counter++}`;return m[1].defId=k,{defId:k,ref:`${Z("__shared")}#/${h}/${k}`}}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:g,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=g};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
+
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 g=e.seen.get(h);if(g.ref===null)return;let x=g.def??g.schema,v={...x},w=g.ref;if(g.ref=null,w){p(w);let k=e.seen.get(w),S=k.schema;if(S.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))x.allOf=x.allOf??[],x.allOf.push(S);else Object.assign(x,S);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(S.$ref&&k.def)for(let C in x){if(C==="$ref"||C==="allOf")continue;if(C in k.def&&JSON.stringify(x[C])===JSON.stringify(k.def[C]))delete x[C]}}let Z=h._zod.parent;if(Z&&Z!==w){p(Z);let k=e.seen.get(Z);if(k?.schema.$ref){if(x.$ref=k.schema.$ref,k.def)for(let S in x){if(S==="$ref"||S==="allOf")continue;if(S in k.def&&JSON.stringify(x[S])===JSON.stringify(k.def[S]))delete x[S]}}}e.override({zodSchema:h,jsonSchema:x,path:g.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 g=h[1];if(g.def&&g.defId){if(g.def.id===g.defId)delete g.def.id;m[g.defId]=g.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 is=(e,r={})=>(a)=>{let p=ge({...a,processors:r});return O(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 O(e,m),xe(m,e),ze(m,e)};var _i={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:g,contentEncoding:x}=e._zod.bag;if(typeof f==="number")l.minLength=f;if(typeof m==="number")l.maxLength=m;if(h){if(l.format=_i[h]??h,l.format==="")delete l.format;if(h==="time")delete l.format}if(x)l.contentEncoding=x;if(g&&g.size>0){let v=[...g];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:g,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),Z=typeof x==="number"&&x<=(m??Number.POSITIVE_INFINITY),k=r.target==="draft-04"||r.target==="openapi-3.0";if(w)if(k)l.minimum=v,l.exclusiveMinimum=!0;else l.exclusiveMinimum=v;else if(typeof f==="number")l.minimum=f;if(Z)if(k)l.maximum=x,l.exclusiveMaximum=!0;else l.exclusiveMaximum=x;else if(typeof m==="number")l.maximum=m;if(typeof g==="number")l.multipleOf=g},vr=(e,r,a,p)=>{a.type="boolean"},us=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},as=(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"},ps=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},ls=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},$r=(e,r,a,p)=>{a.not={}},fs=(e,r,a,p)=>{},br=(e,r,a,p)=>{},ds=(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}},ms=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},hs=(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},_s=(e,r,a,p)=>{let l=a,f={type:"string",format:"binary",contentEncoding:"binary"},{minimum:m,maximum:h,mime:g}=e._zod.bag;if(m!==void 0)f.minLength=m;if(h!==void 0)f.maxLength=h;if(g)if(g.length===1)f.contentMediaType=g[0],Object.assign(l,f);else Object.assign(l,f),l.anyOf=g.map((x)=>({contentMediaType:x}));else Object.assign(l,f)},gs=(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")},xs=(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")},zs=(e,r,a,p)=>{if(r.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},vs=(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=O(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]=O(m[x],r,{...p,path:[...p.path,"properties",x]});let h=new Set(Object.keys(m)),g=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(g.size>0)l.required=Array.from(g);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=O(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,g)=>O(h,r,{...p,path:[...p.path,f?"oneOf":"anyOf",g]}));if(f)a.oneOf=m;else a.anyOf=m},Ir=(e,r,a,p)=>{let l=e._zod.def,f=O(l.left,r,{...p,path:[...p.path,"allOf",0]}),m=O(l.right,r,{...p,path:[...p.path,"allOf",1]}),h=(x)=>("allOf"in x)&&Object.keys(x).length===1,g=[...h(f)?f.allOf:[f],...h(m)?m.allOf:[m]];a.allOf=g},ys=(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",g=f.items.map((Z,k)=>O(Z,r,{...p,path:[...p.path,m,k]})),x=f.rest?O(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=g,x)l.items=x}else if(r.target==="openapi-3.0"){if(l.items={anyOf:g},x)l.items.anyOf.push(x);if(l.minItems=g.length,!x)l.maxItems=g.length}else if(l.items=g,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,g=m._zod.bag?.patterns;if(f.mode==="loose"&&g&&g.size>0){let v=O(f.valueType,r,{...p,path:[...p.path,"patternProperties","*"]});l.patternProperties={};for(let w of g)l.patternProperties[w.source]=v}else{if(r.target==="draft-07"||r.target==="draft-2020-12")l.propertyNames=O(f.keyType,r,{...p,path:[...p.path,"propertyNames"]});l.additionalProperties=O(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=O(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;O(l.innerType,r,p);let f=r.seen.get(e);f.ref=l.innerType},jr=(e,r,a,p)=>{let l=e._zod.def;O(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;O(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;O(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;O(m,r,p);let h=r.seen.get(e);h.ref=m},Lr=(e,r,a,p)=>{let l=e._zod.def;O(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;O(l.innerType,r,p);let f=r.seen.get(e);f.ref=l.innerType},Ue=(e,r,a,p)=>{let l=e._zod.def;O(l.innerType,r,p);let f=r.seen.get(e);f.ref=l.innerType},Fr=(e,r,a,p)=>{let l=e._zod.innerType;O(l,r,p);let f=r.seen.get(e);f.ref=l},cs={string:xr,number:zr,boolean:vr,bigint:us,symbol:as,null:yr,undefined:ps,void:ls,never:$r,any:fs,unknown:br,date:ds,enum:wr,literal:kr,nan:ms,template_literal:hs,file:_s,success:gs,custom:Zr,function:xs,transform:Pr,map:zs,set:vs,array:Sr,object:Or,union:Er,intersection:Ir,tuple:ys,record:Tr,nullable:Nr,nonoptional:Ar,default:jr,prefault:Cr,catch:Rr,pipe:Dr,readonly:Lr,promise:$s,optional:Ue,lazy:Fr};function Gr(e,r){if("_idmap"in e){let p=e,l=ge({...r,processors:cs}),f={};for(let g of p._idmap.entries()){let[x,v]=g;O(v,l)}let m={},h={registry:p,uri:r?.uri,defs:f};l.external=h;for(let g of p._idmap.entries()){let[x,v]=g;xe(l,v),m[x]=ze(l,v)}if(Object.keys(f).length>0){let g=l.target==="draft-2020-12"?"$defs":"definitions";m.__shared={[g]:f}}return{schemas:m}}let a=ge({...r,processors:cs});return O(e,a),xe(a,e),ze(a,e)}var y={};Bo(y,{ZodISODate:()=>ws,ZodISODateTime:()=>bs,ZodISODuration:()=>Zs,ZodISOTime:()=>ks,date:()=>Mr,datetime:()=>Ur,duration:()=>Br,time:()=>Jr});var bs=z("ZodISODateTime",(e,r)=>{Co.init(e,r),N.init(e,r)});function Ur(e){return Wn(bs,e)}var ws=z("ZodISODate",(e,r)=>{Ro.init(e,r),N.init(e,r)});function Mr(e){return Kn(ws,e)}var ks=z("ZodISOTime",(e,r)=>{Do.init(e,r),N.init(e,r)});function Jr(e){return Gn(ks,e)}var Zs=z("ZodISODuration",(e,r)=>{Fo.init(e,r),N.init(e,r)});function Br(e){return qn(Zs,e)}var wi=(e,r)=>{Pe.init(e,r),e.name="ZodError",Object.defineProperties(e,{format:{value:(a)=>pt(e,a)},flatten:{value:(a)=>at(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",wi,{Parent:Error});var Ps=Se(U),Ss=Oe(U),Os=le(U),Es=fe(U),Is=ht(U),Ts=_t(U),Ns=gt(U),As=xt(U),js=zt(U),Cs=vt(U),Rs=yt(U),Ds=$t(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 T=z("ZodType",(e,r)=>(E.init(e,r),Object.assign(e["~standard"],{jsonSchema:{input:_e(e,"input"),output:_e(e,"output")}}),e.toJSONSchema=is(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(W(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(Y(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 Q([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 te.add(p,{description:a}),p},meta(...a){if(a.length===0)return te.get(this);let p=this.clone();return te.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 te.get(e)?.description},configurable:!0}),e)),Bs=z("_ZodString",(e,r)=>{Ae.init(e,r),T.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())}})}),Zi=z("ZodString",(e,r)=>{Ae.init(e,r),Bs.init(e,r),e.email=(a)=>e.check(Pn(Pi,a)),e.url=(a)=>e.check(ir(Vs,a)),e.jwt=(a)=>e.check(Vn(Mi,a)),e.emoji=(a)=>e.check(In(Si,a)),e.guid=(a)=>e.check(je(Vr,a)),e.uuid=(a)=>e.check(sr(ve,a)),e.uuidv4=(a)=>e.check(Sn(ve,a)),e.uuidv6=(a)=>e.check(On(ve,a)),e.uuidv7=(a)=>e.check(En(ve,a)),e.nanoid=(a)=>e.check(Tn(Oi,a)),e.guid=(a)=>e.check(je(Vr,a)),e.cuid=(a)=>e.check(Nn(Ei,a)),e.cuid2=(a)=>e.check(An(Ii,a)),e.ulid=(a)=>e.check(jn(Ti,a)),e.base64=(a)=>e.check(Mn(Li,a)),e.base64url=(a)=>e.check(Jn(Fi,a)),e.xid=(a)=>e.check(Cn(Ni,a)),e.ksuid=(a)=>e.check(Rn(Ai,a)),e.ipv4=(a)=>e.check(Dn(ji,a)),e.ipv6=(a)=>e.check(Ln(Ci,a)),e.cidrv4=(a)=>e.check(Fn(Ri,a)),e.cidrv6=(a)=>e.check(Un(Di,a)),e.e164=(a)=>e.check(Bn(Ui,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 Zn(Zi,e)}var N=z("ZodStringFormat",(e,r)=>{I.init(e,r),Bs.init(e,r)}),Pi=z("ZodEmail",(e,r)=>{Po.init(e,r),N.init(e,r)});var Vr=z("ZodGUID",(e,r)=>{ko.init(e,r),N.init(e,r)});function ft(e){return je(Vr,e)}var ve=z("ZodUUID",(e,r)=>{Zo.init(e,r),N.init(e,r)});function A(e){return sr(ve,e)}var Vs=z("ZodURL",(e,r)=>{So.init(e,r),N.init(e,r)});function mt(e){return ir(Vs,e)}var Si=z("ZodEmoji",(e,r)=>{Oo.init(e,r),N.init(e,r)});var Oi=z("ZodNanoID",(e,r)=>{Eo.init(e,r),N.init(e,r)});var Ei=z("ZodCUID",(e,r)=>{Io.init(e,r),N.init(e,r)});var Ii=z("ZodCUID2",(e,r)=>{To.init(e,r),N.init(e,r)});var Ti=z("ZodULID",(e,r)=>{No.init(e,r),N.init(e,r)});var Ni=z("ZodXID",(e,r)=>{Ao.init(e,r),N.init(e,r)});var Ai=z("ZodKSUID",(e,r)=>{jo.init(e,r),N.init(e,r)});var ji=z("ZodIPv4",(e,r)=>{Uo.init(e,r),N.init(e,r)});var Ci=z("ZodIPv6",(e,r)=>{Jo.init(e,r),N.init(e,r)});var Ri=z("ZodCIDRv4",(e,r)=>{Vo.init(e,r),N.init(e,r)});var Di=z("ZodCIDRv6",(e,r)=>{Wo.init(e,r),N.init(e,r)});var Li=z("ZodBase64",(e,r)=>{Go.init(e,r),N.init(e,r)});var Fi=z("ZodBase64URL",(e,r)=>{qo.init(e,r),N.init(e,r)});var Ui=z("ZodE164",(e,r)=>{Yo.init(e,r),N.init(e,r)});var Mi=z("ZodJWT",(e,r)=>{Xo.init(e,r),N.init(e,r)});var Ws=z("ZodNumber",(e,r)=>{tr.init(e,r),T.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 Yn(Ws,e)}var Ji=z("ZodNumberFormat",(e,r)=>{Ho.init(e,r),Ws.init(e,r)});function Fs(e){return Xn(Ji,e)}var Bi=z("ZodBoolean",(e,r)=>{Qo.init(e,r),T.init(e,r),e._zod.processJSONSchema=(a,p,l)=>vr(e,a,p,l)});function d(e){return Hn(Bi,e)}var Vi=z("ZodNull",(e,r)=>{en.init(e,r),T.init(e,r),e._zod.processJSONSchema=(a,p,l)=>yr(e,a,p,l)});function Lo(e){return Qn(Vi,e)}var Wi=z("ZodUnknown",(e,r)=>{rn.init(e,r),T.init(e,r),e._zod.processJSONSchema=(a,p,l)=>br(e,a,p,l)});function Te(){return es(Wi)}var Ki=z("ZodNever",(e,r)=>{tn.init(e,r),T.init(e,r),e._zod.processJSONSchema=(a,p,l)=>$r(e,a,p,l)});function fi(e){return rs(Ki,e)}var Gi=z("ZodArray",(e,r)=>{on.init(e,r),T.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 ts(Gi,e,r)}var Yr=z("ZodObject",(e,r)=>{cn.init(e,r),T.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Or(e,a,p,l),P(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:Te()})},loose(){return this.clone({...this._zod.def,catchall:Te()})},strict(){return this.clone({...this._zod.def,catchall:fi()})},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 Yr(a)}function c(e,r){return new Yr({type:"object",shape:e,catchall:fi(),...b(r)})}function Mo(e,r){return new Yr({type:"object",shape:e,catchall:Te(),...b(r)})}var Ks=z("ZodUnion",(e,r)=>{or.init(e,r),T.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Er(e,a,p,l),e.options=r.options});function Q(e,r){return new Ks({type:"union",options:e,...b(r)})}var qi=z("ZodDiscriminatedUnion",(e,r)=>{Ks.init(e,r),un.init(e,r)});function _(e,r,a){return new qi({type:"union",options:r,discriminator:e,...b(a)})}var Yi=z("ZodIntersection",(e,r)=>{an.init(e,r),T.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)=>{pn.init(e,r),T.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Tr(e,a,p,l),e.keyType=r.keyType,e.valueType=r.valueType});function oe(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 $o(e,r,a){let p=M(e);return p._zod.values=void 0,new Wr({type:"record",keyType:p,valueType:r,...b(a)})}var qr=z("ZodEnum",(e,r)=>{ln.init(e,r),T.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 qr({...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 qr({...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 qr({type:"enum",entries:a,...b(r)})}var Hi=z("ZodLiteral",(e,r)=>{fn.init(e,r),T.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)=>{dn.init(e,r),T.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(re(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(re(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),T.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)=>{mn.init(e,r),T.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)=>{hn.init(e,r),T.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)=>{_n.init(e,r),T.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)=>{gn.init(e,r),T.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)=>{xn.init(e,r),T.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)=>{zn.init(e,r),T.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)=>{vn.init(e,r),T.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)=>{yn.init(e,r),T.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)=>{$n.init(e,r),T.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Fr(e,a,p,l),e.unwrap=()=>e._zod.def.getter()});function yo(e){return new mc({type:"lazy",getter:e})}var Ys=z("ZodCustom",(e,r)=>{bn.init(e,r),T.init(e,r),e._zod.processJSONSchema=(a,p,l)=>Zr(e,a,p,l)});function Kr(e,r){return os(Ys,e??(()=>!0),r)}function hc(e,r={}){return ns(Ys,e,r)}function _c(e,r){return ss(e,r)}export{go,L,pi,hi,_o,Gr,y,t,ft,A,mt,o,d,Lo,Te,fi,u,i,c,Mo,Q,_,oe,$o,s,n,yo,Kr};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{Zt}from"./vm-hands-entry-lite-m11j0f9q.js";import{Ie}from"./vm-hands-entry-lite-8ns59paz.js";import{execFileSync as p}from"child_process";import{realpathSync as S,statSync as w}from"fs";import{tmpdir as P}from"os";import{createRequire as b}from"module";import{win32 as r}from"path";var h=["/bin/bash","/usr/bin/bash"],g="Git Bash was not found. Install Git for Windows (https://git-scm.com/download/win), then run `reason connect`.";function c(o){try{return w(o).isFile()}catch{return!1}}var i=(o)=>[r.join(o,"bin","bash.exe"),r.join(o,"usr","bin","bash.exe")];function J(o,e){let t=r.normalize(o).toLowerCase(),s=(e.SystemRoot??e.SYSTEMROOT??"C:\\Windows").toLowerCase();return t.startsWith(r.join(s,"system32").toLowerCase()+"\\")||t.startsWith(r.join(s,"sysnative").toLowerCase()+"\\")||t.includes("\\windowsapps\\")}function f(o=process.env,e=c){let t=[];for(let s of(o.PATH??o.Path??"").split(";"))if(s&&r.isAbsolute(s))t.push(r.join(s,"git.exe"));for(let s of[o.ProgramW6432,o.ProgramFiles,o["ProgramFiles(x86)"]])if(s)t.push(r.join(s,"Git","cmd","git.exe"));if(o.LOCALAPPDATA)t.push(r.join(o.LOCALAPPDATA,"Programs","Git","cmd","git.exe"));return t.find(e)??null}var a;function wo(o=process.platform){if(o!=="win32")return"git";return a??=f(),a}function y(o){let e=process.platform==="win32"?f(o):"git";if(!e)return null;try{return p(e,["--exec-path"],{encoding:"utf8",timeout:5000,windowsHide:!0,stdio:["ignore","pipe","ignore"],env:o}).trim()||null}catch{return null}}function N(o=process.env,e=y,t=c){let s=[],l=e(o);if(l)s.push(...i(r.resolve(l,"..","..","..")));for(let n of[o.ProgramW6432,o.ProgramFiles,o["ProgramFiles(x86)"]])if(n)s.push(...i(r.join(n,"Git")));if(o.LOCALAPPDATA)s.push(...i(r.join(o.LOCALAPPDATA,"Programs","Git")));for(let n of(o.PATH??o.Path??"").split(";"))if(n&&r.isAbsolute(n))s.push(r.join(n,"bash.exe"));return s.find((n)=>!J(n,o)&&t(n))??null}var d;function fe(o=process.platform){if(o!=="win32")return h.find(c)??null;return d??=N(),d}function se(o=process.platform){let e=fe(o);if(!e)throw Error(o==="win32"?g:"bash_unavailable");return e}function bo(o=process.platform){return S(o==="win32"?P():"/tmp")}function Re(o=process.platform,e=process.env){if(o!=="win32")return"/usr/bin:/bin";let t=e.SystemRoot??e.SYSTEMROOT??"C:\\Windows";return[r.join(t,"System32"),t,r.join(t,"System32","Wbem"),r.join(t,"System32","WindowsPowerShell","v1.0")].join(";")}function x(o,e=process.platform){if(e!=="win32"||/[\\/]/.test(o))return o;let t=/\.exe$/i.test(o)?o:`${o}.exe`,s=Re(e).split(";");return r.join(t.toLowerCase()==="powershell.exe"?s[3]:s[0],t)}function Jr(o=process.platform,e=process.env){if(o!=="win32")return{PATH:Re(o)};let t=e.SystemRoot??e.SYSTEMROOT??"C:\\Windows";return{PATH:Re(o,e),SystemRoot:t,WINDIR:t}}function Kt(o=process.platform){return o==="win32"?{windowsHide:!0}:{detached:!0}}var u;function m(){if(u===void 0)u=Ie(Zt)(b(import.meta.url));return u}function Jt(o,e=process.platform){let t=o.pid;if(e!=="win32"||t===void 0)return;let s=m();if(s?.track(t))o.once("close",()=>s.release(t))}function Oe(o,e="SIGTERM",t=process.platform){if(t!=="win32"){process.kill(-o,e);return}if(e===0){process.kill(o,0);return}if(m()?.terminate(o))return;p(x("taskkill",t),["/PID",String(o),"/T","/F"],{stdio:"ignore",timeout:1e4,windowsHide:!0})}function I(o,e=63,t=process.platform){return t==="win32"||o.uid===process.getuid?.()&&(o.mode&e)===0}var A=/^(?:con|prn|aux|nul|com[0-9\u00b9\u00b2\u00b3]|lpt[0-9\u00b9\u00b2\u00b3]|conin\$|conout\$)(?:\..*)?$|:|[. ]$/i;function Zr(o){return o!=="."&&o!==".."&&A.test(o)}
3
+ export{wo,fe,se,bo,Re,x,Jr,Kt,Jt,Oe,I,Zr};