just-bash 2.12.8 → 2.13.1

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 (163) hide show
  1. package/README.md +332 -260
  2. package/dist/AGENTS.md +1 -1
  3. package/dist/Bash.d.ts +17 -0
  4. package/dist/bin/chunks/{awk2-J2PNSA7C.js → awk2-VTJMI54B.js} +1 -1
  5. package/dist/bin/chunks/{chunk-O5B6WWQQ.js → chunk-A3HQTYHR.js} +1 -1
  6. package/dist/bin/chunks/chunk-AAW7UMPO.js +9 -0
  7. package/dist/bin/chunks/{chunk-2V53PP6G.js → chunk-B3RU2PUI.js} +27 -27
  8. package/dist/bin/chunks/chunk-CQG2HEAL.js +5 -0
  9. package/dist/bin/chunks/chunk-DOXYBGNA.js +12 -0
  10. package/dist/bin/chunks/chunk-FBJJY4ZV.js +14 -0
  11. package/dist/bin/{shell/chunks/chunk-YAEF6X2N.js → chunks/chunk-GR23MPTT.js} +1 -1
  12. package/dist/bin/{shell/chunks/chunk-35JD7YEM.js → chunks/chunk-HJEHIH4P.js} +13 -13
  13. package/dist/bin/chunks/{chunk-UG4GMDQL.js → chunk-LGF54XJQ.js} +1 -1
  14. package/dist/bin/chunks/chunk-LIYVQA3X.js +2 -0
  15. package/dist/bin/chunks/{chunk-2BC3N3L2.js → chunk-ORUYSLP4.js} +4 -4
  16. package/dist/bin/chunks/{chunk-REGSV3X5.js → chunk-SDLWFYVT.js} +1 -1
  17. package/dist/bin/chunks/{chunk-STOAUD75.js → chunk-THNL3XFF.js} +8 -8
  18. package/dist/bin/chunks/chunk-TKTKRRAL.js +11 -0
  19. package/dist/bin/chunks/{chunk-ZJGIBTWD.js → chunk-V7ZOPVQS.js} +1 -1
  20. package/dist/bin/chunks/{chunk-ZYQQ6B7B.js → chunk-ZO5PSLKR.js} +2 -2
  21. package/dist/bin/chunks/curl-SRTMGOVV.js +26 -0
  22. package/dist/bin/chunks/env-NTPN5QYM.js +2 -0
  23. package/dist/bin/{shell/chunks/expansion-JBCP2CHQ.js → chunks/expansion-2RO5M3QC.js} +1 -1
  24. package/dist/bin/{shell/chunks/find-MTLF23HX.js → chunks/find-GAYRV4IF.js} +1 -1
  25. package/dist/bin/{shell/chunks/flag-coverage-CFWN3JJN.js → chunks/flag-coverage-A4G6STMS.js} +1 -1
  26. package/dist/bin/chunks/{help-4H52JYYC.js → help-DVG4AAGE.js} +1 -1
  27. package/dist/bin/{shell/chunks/jq-JFXEKNLN.js → chunks/jq-V7FYGIKO.js} +1 -1
  28. package/dist/bin/chunks/js-exec-JORCTVUT.js +97 -0
  29. package/dist/bin/chunks/js-exec-worker.js +4369 -0
  30. package/dist/bin/chunks/python3-PF7AHNQM.js +12 -0
  31. package/dist/bin/chunks/rg-C6KMBFNG.js +2 -0
  32. package/dist/bin/chunks/time-DDS6JJ23.js +2 -0
  33. package/dist/bin/chunks/{timeout-JJWIFL7W.js → timeout-Z24MNWOP.js} +1 -1
  34. package/dist/bin/chunks/worker.js +88 -33
  35. package/dist/bin/chunks/{xan-M6MLWZCU.js → xan-MOZFJGMY.js} +1 -1
  36. package/dist/bin/chunks/xargs-SCYIFXOW.js +2 -0
  37. package/dist/bin/chunks/{yq-YWUQUXJJ.js → yq-JJLSDDST.js} +1 -1
  38. package/dist/bin/just-bash.js +212 -211
  39. package/dist/bin/shell/chunks/{awk2-J2PNSA7C.js → awk2-VTJMI54B.js} +1 -1
  40. package/dist/bin/shell/chunks/{chunk-O5B6WWQQ.js → chunk-A3HQTYHR.js} +1 -1
  41. package/dist/bin/shell/chunks/chunk-AAW7UMPO.js +9 -0
  42. package/dist/bin/shell/chunks/{chunk-2V53PP6G.js → chunk-B3RU2PUI.js} +27 -27
  43. package/dist/bin/shell/chunks/chunk-CQG2HEAL.js +5 -0
  44. package/dist/bin/shell/chunks/chunk-DOXYBGNA.js +12 -0
  45. package/dist/bin/shell/chunks/chunk-FBJJY4ZV.js +14 -0
  46. package/dist/bin/{chunks/chunk-YAEF6X2N.js → shell/chunks/chunk-GR23MPTT.js} +1 -1
  47. package/dist/bin/{chunks/chunk-35JD7YEM.js → shell/chunks/chunk-HJEHIH4P.js} +13 -13
  48. package/dist/bin/shell/chunks/{chunk-UG4GMDQL.js → chunk-LGF54XJQ.js} +1 -1
  49. package/dist/bin/shell/chunks/chunk-LIYVQA3X.js +2 -0
  50. package/dist/bin/shell/chunks/{chunk-2BC3N3L2.js → chunk-ORUYSLP4.js} +4 -4
  51. package/dist/bin/shell/chunks/{chunk-REGSV3X5.js → chunk-SDLWFYVT.js} +1 -1
  52. package/dist/bin/shell/chunks/{chunk-STOAUD75.js → chunk-THNL3XFF.js} +8 -8
  53. package/dist/bin/shell/chunks/chunk-TKTKRRAL.js +11 -0
  54. package/dist/bin/shell/chunks/{chunk-ZJGIBTWD.js → chunk-V7ZOPVQS.js} +1 -1
  55. package/dist/bin/shell/chunks/{chunk-ZYQQ6B7B.js → chunk-ZO5PSLKR.js} +2 -2
  56. package/dist/bin/shell/chunks/curl-SRTMGOVV.js +26 -0
  57. package/dist/bin/shell/chunks/env-NTPN5QYM.js +2 -0
  58. package/dist/bin/{chunks/expansion-JBCP2CHQ.js → shell/chunks/expansion-2RO5M3QC.js} +1 -1
  59. package/dist/bin/{chunks/find-MTLF23HX.js → shell/chunks/find-GAYRV4IF.js} +1 -1
  60. package/dist/bin/{chunks/flag-coverage-CFWN3JJN.js → shell/chunks/flag-coverage-A4G6STMS.js} +1 -1
  61. package/dist/bin/shell/chunks/{help-4H52JYYC.js → help-DVG4AAGE.js} +1 -1
  62. package/dist/bin/{chunks/jq-JFXEKNLN.js → shell/chunks/jq-V7FYGIKO.js} +1 -1
  63. package/dist/bin/shell/chunks/js-exec-B6QNYHUL.js +97 -0
  64. package/dist/bin/shell/chunks/python3-J7DP4JBQ.js +12 -0
  65. package/dist/bin/shell/chunks/rg-C6KMBFNG.js +2 -0
  66. package/dist/bin/shell/chunks/time-DDS6JJ23.js +2 -0
  67. package/dist/bin/shell/chunks/{timeout-JJWIFL7W.js → timeout-Z24MNWOP.js} +1 -1
  68. package/dist/bin/shell/chunks/{xan-M6MLWZCU.js → xan-MOZFJGMY.js} +1 -1
  69. package/dist/bin/shell/chunks/xargs-SCYIFXOW.js +2 -0
  70. package/dist/bin/shell/chunks/{yq-YWUQUXJJ.js → yq-JJLSDDST.js} +1 -1
  71. package/dist/bin/shell/shell.js +212 -212
  72. package/dist/bundle/browser.js +600 -600
  73. package/dist/bundle/chunks/{awk2-FUVZGMX2.js → awk2-POPGKRAI.js} +1 -1
  74. package/dist/bundle/chunks/{chunk-DZZS6SJP.js → chunk-7TSDKFEO.js} +1 -1
  75. package/dist/bundle/chunks/{chunk-D4QDMGEB.js → chunk-BBXLRYSX.js} +2 -2
  76. package/dist/bundle/chunks/chunk-CWQS3NFK.js +1 -0
  77. package/dist/bundle/chunks/chunk-F5CMUULS.js +13 -0
  78. package/dist/bundle/chunks/{chunk-TRD56HID.js → chunk-FEIOJCZD.js} +1 -1
  79. package/dist/bundle/chunks/chunk-H2WXJGD7.js +10 -0
  80. package/dist/bundle/chunks/{chunk-D2FZX7A2.js → chunk-LPQPILI2.js} +8 -8
  81. package/dist/bundle/chunks/{chunk-2GOYXRRP.js → chunk-MLXIYONF.js} +4 -4
  82. package/dist/bundle/chunks/chunk-NAERJDUW.js +8 -0
  83. package/dist/bundle/chunks/{chunk-OKEHYWBE.js → chunk-NYQYO467.js} +13 -13
  84. package/dist/bundle/chunks/{chunk-JKLUDNMU.js → chunk-O2DBFL6Z.js} +1 -1
  85. package/dist/bundle/chunks/{chunk-JDMQDJYE.js → chunk-OARHFVLG.js} +1 -1
  86. package/dist/bundle/chunks/{chunk-AKVMAONP.js → chunk-RUF7WQ7U.js} +1 -1
  87. package/dist/bundle/chunks/chunk-TOMNU26N.js +4 -0
  88. package/dist/bundle/chunks/{chunk-ZLJ5TCLC.js → chunk-UNYNJIFU.js} +27 -27
  89. package/dist/bundle/chunks/chunk-YTNYSM6T.js +11 -0
  90. package/dist/bundle/chunks/curl-COE4TZE6.js +25 -0
  91. package/dist/bundle/chunks/env-5EPCWSXR.js +1 -0
  92. package/dist/bundle/chunks/{expansion-XG7G47TX.js → expansion-ENLSRCXJ.js} +1 -1
  93. package/dist/bundle/chunks/{find-DOIVMX6X.js → find-TPUOAIUQ.js} +1 -1
  94. package/dist/bundle/chunks/{flag-coverage-VML3BMJT.js → flag-coverage-G2R7PMYU.js} +1 -1
  95. package/dist/bundle/chunks/{help-IA5CMGR4.js → help-VVWX7SA5.js} +1 -1
  96. package/dist/bundle/chunks/{jq-SSCW4AAA.js → jq-DIRZBOTX.js} +1 -1
  97. package/dist/bundle/chunks/js-exec-YJSMH5AG.js +96 -0
  98. package/dist/bundle/chunks/js-exec-worker.js +4369 -0
  99. package/dist/bundle/chunks/python3-6HF56IYI.js +11 -0
  100. package/dist/bundle/chunks/rg-FOQSCCX3.js +1 -0
  101. package/dist/bundle/chunks/{time-XL42Z4U5.js → time-YG5BMRIQ.js} +1 -1
  102. package/dist/bundle/chunks/{timeout-QCU4INQT.js → timeout-VRKMCG72.js} +1 -1
  103. package/dist/bundle/chunks/worker.js +88 -33
  104. package/dist/bundle/chunks/{xan-K7XYDHFV.js → xan-BXDXYEIB.js} +1 -1
  105. package/dist/bundle/chunks/xargs-I6EZUCYF.js +1 -0
  106. package/dist/bundle/chunks/{yq-WTK3HUOR.js → yq-XMVSIL6Z.js} +1 -1
  107. package/dist/bundle/index.cjs +969 -870
  108. package/dist/bundle/index.js +151 -151
  109. package/dist/commands/curl/types.d.ts +1 -1
  110. package/dist/commands/js-exec/fetch-polyfill.d.ts +6 -0
  111. package/dist/commands/js-exec/js-exec.d.ts +11 -0
  112. package/dist/commands/js-exec/module-shims.d.ts +29 -0
  113. package/dist/commands/js-exec/path-polyfill.d.ts +6 -0
  114. package/dist/commands/js-exec/worker.d.ts +30 -0
  115. package/dist/commands/python3/worker.d.ts +1 -0
  116. package/dist/commands/query-engine/safe-object.d.ts +11 -0
  117. package/dist/commands/registry.d.ts +13 -2
  118. package/dist/commands/{python3/fs-bridge-handler.d.ts → worker-bridge/bridge-handler.d.ts} +25 -8
  119. package/dist/commands/{python3 → worker-bridge}/protocol.d.ts +6 -3
  120. package/dist/commands/{python3/sync-fs-backend.d.ts → worker-bridge/sync-backend.d.ts} +25 -4
  121. package/dist/index.d.cts +4 -4
  122. package/dist/index.d.ts +4 -4
  123. package/dist/interpreter/interpreter.d.ts +3 -0
  124. package/dist/interpreter/types.d.ts +8 -0
  125. package/dist/limits.d.ts +3 -1
  126. package/dist/network/allow-list.d.ts +5 -3
  127. package/dist/network/fetch.d.ts +1 -1
  128. package/dist/network/index.d.ts +1 -1
  129. package/dist/network/types.d.ts +32 -1
  130. package/dist/types.d.ts +12 -0
  131. package/package.json +13 -12
  132. package/dist/bin/chunks/chunk-47HZU3SY.js +0 -5
  133. package/dist/bin/chunks/chunk-CZFRRDQC.js +0 -12
  134. package/dist/bin/chunks/chunk-N4EU64Y4.js +0 -9
  135. package/dist/bin/chunks/chunk-QZNF3Y3J.js +0 -2
  136. package/dist/bin/chunks/chunk-VIYJJTN2.js +0 -14
  137. package/dist/bin/chunks/curl-3GMIPMCI.js +0 -26
  138. package/dist/bin/chunks/env-HOVBNLUR.js +0 -2
  139. package/dist/bin/chunks/python3-KI2FQWSN.js +0 -17
  140. package/dist/bin/chunks/rg-34GE6REQ.js +0 -2
  141. package/dist/bin/chunks/time-GZSHCM77.js +0 -2
  142. package/dist/bin/chunks/xargs-GBL6PZ2K.js +0 -2
  143. package/dist/bin/shell/chunks/chunk-47HZU3SY.js +0 -5
  144. package/dist/bin/shell/chunks/chunk-CZFRRDQC.js +0 -12
  145. package/dist/bin/shell/chunks/chunk-N4EU64Y4.js +0 -9
  146. package/dist/bin/shell/chunks/chunk-QZNF3Y3J.js +0 -2
  147. package/dist/bin/shell/chunks/chunk-VIYJJTN2.js +0 -14
  148. package/dist/bin/shell/chunks/curl-3GMIPMCI.js +0 -26
  149. package/dist/bin/shell/chunks/env-HOVBNLUR.js +0 -2
  150. package/dist/bin/shell/chunks/python3-E5X6WBBU.js +0 -17
  151. package/dist/bin/shell/chunks/rg-34GE6REQ.js +0 -2
  152. package/dist/bin/shell/chunks/time-GZSHCM77.js +0 -2
  153. package/dist/bin/shell/chunks/xargs-GBL6PZ2K.js +0 -2
  154. package/dist/bundle/chunks/chunk-3RA5L262.js +0 -8
  155. package/dist/bundle/chunks/chunk-EX62JIX3.js +0 -13
  156. package/dist/bundle/chunks/chunk-RH6GWZAJ.js +0 -1
  157. package/dist/bundle/chunks/chunk-WECLUBEQ.js +0 -11
  158. package/dist/bundle/chunks/chunk-ZSJYNBAF.js +0 -4
  159. package/dist/bundle/chunks/curl-KM2ZAUR6.js +0 -25
  160. package/dist/bundle/chunks/env-XZY4LKEO.js +0 -1
  161. package/dist/bundle/chunks/python3-2OHR6PZU.js +0 -16
  162. package/dist/bundle/chunks/rg-RAICUFGG.js +0 -1
  163. package/dist/bundle/chunks/xargs-2BBAQDTC.js +0 -1
@@ -1,4 +1,4 @@
1
- import{a as C,b as L}from"./chunk-D4QDMGEB.js";import{d as b}from"./chunk-DZZS6SJP.js";import{a as F,b as z}from"./chunk-24IMIIXA.js";import{a as J}from"./chunk-5QMZ5MUS.js";import{a as D}from"./chunk-7L36YK2X.js";import{k as $}from"./chunk-GFQRA5P5.js";import{a as E}from"./chunk-CCNMISUL.js";import{a as I,b as k,c as O}from"./chunk-74CEPOFO.js";function A(s){let r=[],t=0,l=s.length;for(;t<l;){for(;t<l&&/\s/.test(s[t]);)t++;if(t>=l)break;let u=t,n=s[t];if(n==="{"||n==="["){let i=n,a=n==="{"?"}":"]",c=1,p=!1,d=!1;for(t++;t<l&&c>0;){let h=s[t];d?d=!1:h==="\\"?d=!0:h==='"'?p=!p:p||(h===i?c++:h===a&&c--),t++}if(c!==0)throw new Error(`Unexpected end of JSON input at position ${t} (unclosed ${i})`);r.push(b(JSON.parse(s.slice(u,t))))}else if(n==='"'){let i=!1;for(t++;t<l;){let a=s[t];if(i)i=!1;else if(a==="\\")i=!0;else if(a==='"'){t++;break}t++}r.push(b(JSON.parse(s.slice(u,t))))}else if(n==="-"||n>="0"&&n<="9"){for(;t<l&&/[\d.eE+-]/.test(s[t]);)t++;r.push(b(JSON.parse(s.slice(u,t))))}else if(s.slice(t,t+4)==="true")r.push(!0),t+=4;else if(s.slice(t,t+5)==="false")r.push(!1),t+=5;else if(s.slice(t,t+4)==="null")r.push(null),t+=4;else{let i=s.slice(t,t+10);throw new Error(`Invalid JSON at position ${u}: unexpected '${i.split(/\s/)[0]}'`)}}return r}var W={name:"jq",summary:"command-line JSON processor",usage:"jq [OPTIONS] FILTER [FILE]",options:["-r, --raw-output output strings without quotes","-c, --compact compact output (no pretty printing)","-e, --exit-status set exit status based on output","-s, --slurp read entire input into array","-n, --null-input don't read any input","-j, --join-output don't print newlines after each output","-a, --ascii force ASCII output","-S, --sort-keys sort object keys","-C, --color colorize output (ignored)","-M, --monochrome monochrome output (ignored)"," --tab use tabs for indentation"," --help display this help and exit"]};function j(s,r,t,l,u,n=0){if(s===null||s===void 0)return"null";if(typeof s=="boolean")return String(s);if(typeof s=="number")return Number.isFinite(s)?String(s):"null";if(typeof s=="string")return t?s:JSON.stringify(s);let i=u?" ":" ";if(Array.isArray(s))return s.length===0?"[]":r?`[${s.map(c=>j(c,!0,!1,l,u)).join(",")}]`:`[
1
+ import{a as C,b as L}from"./chunk-BBXLRYSX.js";import{d as b}from"./chunk-7TSDKFEO.js";import{a as F,b as z}from"./chunk-24IMIIXA.js";import{a as J}from"./chunk-5QMZ5MUS.js";import{a as D}from"./chunk-7L36YK2X.js";import{k as $}from"./chunk-GFQRA5P5.js";import{a as E}from"./chunk-CCNMISUL.js";import{a as I,b as k,c as O}from"./chunk-74CEPOFO.js";function A(s){let r=[],t=0,l=s.length;for(;t<l;){for(;t<l&&/\s/.test(s[t]);)t++;if(t>=l)break;let u=t,n=s[t];if(n==="{"||n==="["){let i=n,a=n==="{"?"}":"]",c=1,p=!1,d=!1;for(t++;t<l&&c>0;){let h=s[t];d?d=!1:h==="\\"?d=!0:h==='"'?p=!p:p||(h===i?c++:h===a&&c--),t++}if(c!==0)throw new Error(`Unexpected end of JSON input at position ${t} (unclosed ${i})`);r.push(b(JSON.parse(s.slice(u,t))))}else if(n==='"'){let i=!1;for(t++;t<l;){let a=s[t];if(i)i=!1;else if(a==="\\")i=!0;else if(a==='"'){t++;break}t++}r.push(b(JSON.parse(s.slice(u,t))))}else if(n==="-"||n>="0"&&n<="9"){for(;t<l&&/[\d.eE+-]/.test(s[t]);)t++;r.push(b(JSON.parse(s.slice(u,t))))}else if(s.slice(t,t+4)==="true")r.push(!0),t+=4;else if(s.slice(t,t+5)==="false")r.push(!1),t+=5;else if(s.slice(t,t+4)==="null")r.push(null),t+=4;else{let i=s.slice(t,t+10);throw new Error(`Invalid JSON at position ${u}: unexpected '${i.split(/\s/)[0]}'`)}}return r}var W={name:"jq",summary:"command-line JSON processor",usage:"jq [OPTIONS] FILTER [FILE]",options:["-r, --raw-output output strings without quotes","-c, --compact compact output (no pretty printing)","-e, --exit-status set exit status based on output","-s, --slurp read entire input into array","-n, --null-input don't read any input","-j, --join-output don't print newlines after each output","-a, --ascii force ASCII output","-S, --sort-keys sort object keys","-C, --color colorize output (ignored)","-M, --monochrome monochrome output (ignored)"," --tab use tabs for indentation"," --help display this help and exit"]};function j(s,r,t,l,u,n=0){if(s===null||s===void 0)return"null";if(typeof s=="boolean")return String(s);if(typeof s=="number")return Number.isFinite(s)?String(s):"null";if(typeof s=="string")return t?s:JSON.stringify(s);let i=u?" ":" ";if(Array.isArray(s))return s.length===0?"[]":r?`[${s.map(c=>j(c,!0,!1,l,u)).join(",")}]`:`[
2
2
  ${s.map(c=>i.repeat(n+1)+j(c,!1,!1,l,u,n+1)).join(`,
3
3
  `)}
4
4
  ${i.repeat(n)}]`;if(typeof s=="object"){let a=Object.keys(s);return l&&(a=a.sort()),a.length===0?"{}":r?`{${a.map(p=>`${JSON.stringify(p)}:${j(s[p],!0,!1,l,u)}`).join(",")}}`:`{
@@ -0,0 +1,4 @@
1
+ import{a as L}from"./chunk-IPJHKYVM.js";import{a as A,b as v,c as b}from"./chunk-74CEPOFO.js";var $={name:"xargs",summary:"build and execute command lines from standard input",usage:"xargs [OPTION]... [COMMAND [INITIAL-ARGS]]",options:["-I REPLACE replace occurrences of REPLACE with input","-d DELIM use DELIM as input delimiter (e.g., -d '\\n' for newline)","-n NUM use at most NUM arguments per command line","-P NUM run at most NUM processes at a time","-0, --null items are separated by null, not whitespace","-t, --verbose print commands before executing","-r, --no-run-if-empty do not run command if input is empty"," --help display this help and exit"]},P={name:"xargs",async execute(l,r){if(v(l))return A($);let m=null,g=null,c=null,o=null,h=!1,x=!1,y=!1,s=0;for(let e=0;e<l.length;e++){let t=l[e];if(t==="-I"&&e+1<l.length)m=l[++e],s=e+1;else if(t==="-d"&&e+1<l.length)g=l[++e].replace(/\\n/g,`
2
+ `).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\0/g,"\0").replace(/\\\\/g,"\\"),s=e+1;else if(t==="-n"&&e+1<l.length)c=parseInt(l[++e],10),s=e+1;else if(t==="-P"&&e+1<l.length)o=parseInt(l[++e],10),s=e+1;else if(t==="-0"||t==="--null")h=!0,s=e+1;else if(t==="-t"||t==="--verbose")x=!0,s=e+1;else if(t==="-r"||t==="--no-run-if-empty")y=!0,s=e+1;else{if(t.startsWith("--"))return b("xargs",t);if(t.startsWith("-")&&t.length>1){for(let n of t.slice(1))if(!"0tr".includes(n))return b("xargs",`-${n}`);t.includes("0")&&(h=!0),t.includes("t")&&(x=!0),t.includes("r")&&(y=!0),s=e+1}else if(!t.startsWith("-")){s=e;break}}}let a=l.slice(s);a.length===0&&a.push("echo");let i;if(h?i=r.stdin.split("\0").filter(e=>e.length>0):g!==null?i=r.stdin.replace(/\n$/,"").split(g).filter(t=>t.length>0):i=r.stdin.split(/\s+/).map(e=>e.trim()).filter(e=>e.length>0),i.length===0)return y?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:"",exitCode:0};let d="",u="",f=0,w=e=>/[\s"'\\$`!*?[\]{}();&|<>#]/.test(e)?`"${e.replace(/([\\"`$])/g,"\\$1")}"`:e,C=async e=>{if(x){let n=e.map(w).join(" ");u+=`${n}
3
+ `}return r.exec?r.exec(L([e[0]]),{cwd:r.cwd,signal:r.signal,args:e.slice(1)}):{stdout:`${e.map(w).join(" ")}
4
+ `,stderr:"",exitCode:0}},I=async e=>{if(o!==null&&o>1)for(let t=0;t<e.length;t+=o){let n=e.slice(t,t+o),M=await Promise.all(n.map(C));for(let p of M)d+=p.stdout,u+=p.stderr,p.exitCode!==0&&(f=p.exitCode)}else for(let t of e){let n=await C(t);d+=n.stdout,u+=n.stderr,n.exitCode!==0&&(f=n.exitCode)}};if(m!==null){let e=i.map(t=>a.map(n=>n.replaceAll(m,t)));await I(e)}else if(c!==null){let e=[];for(let t=0;t<i.length;t+=c){let n=i.slice(t,t+c);e.push([...a,...n])}await I(e)}else{let e=[...a,...i],t=await C(e);d+=t.stdout,u+=t.stderr,f=t.exitCode}return{stdout:d,stderr:u,exitCode:f}}},H={name:"xargs",flags:[{flag:"-I",type:"value",valueHint:"string"},{flag:"-d",type:"value",valueHint:"delimiter"},{flag:"-n",type:"value",valueHint:"number"},{flag:"-0",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-r",type:"boolean"}],stdinType:"text"};export{P as a,H as b};
@@ -1,17 +1,17 @@
1
- import{a as F,b,c as M,d as qe,e as w,f as v,g as X,h as Y}from"./chunk-F55TLFGB.js";import{a as et}from"./chunk-SYMJJMQ4.js";import{a as $}from"./chunk-D4QDMGEB.js";import{f as G}from"./chunk-DZZS6SJP.js";import{a as H}from"./chunk-YNYSPYQ5.js";import{a as We}from"./chunk-7L36YK2X.js";import{a as D,b as K}from"./chunk-74CEPOFO.js";import{b as Ue,d as Be,e as Ze,f as Qe}from"./chunk-DXB73IDG.js";var q,_e=Ue(()=>{"use strict";q=class{input;pos=0;tokens=[];constructor(n){this.input=n}tokenize(){for(;this.pos<this.input.length&&(this.skipWhitespace(),!(this.pos>=this.input.length));){let n=this.nextToken();n&&this.tokens.push(n)}return this.tokens.push({type:"eof",value:"",pos:this.pos}),this.tokens}skipWhitespace(){for(;this.pos<this.input.length;){let n=this.input[this.pos];if(n===" "||n===" "||n===`
1
+ import{a as O,b,c as M,d as _e,e as w,f as v,g as Y,h as B}from"./chunk-F55TLFGB.js";import{a as tt}from"./chunk-SYMJJMQ4.js";import{a as $}from"./chunk-BBXLRYSX.js";import{f as qe,g as X}from"./chunk-7TSDKFEO.js";import{a as H}from"./chunk-YNYSPYQ5.js";import{a as We}from"./chunk-7L36YK2X.js";import{a as D,b as G}from"./chunk-74CEPOFO.js";import{b as Ue,d as Ze,e as Qe,f as et}from"./chunk-DXB73IDG.js";var q,He=Ue(()=>{"use strict";q=class{input;pos=0;tokens=[];constructor(n){this.input=n}tokenize(){for(;this.pos<this.input.length&&(this.skipWhitespace(),!(this.pos>=this.input.length));){let n=this.nextToken();n&&this.tokens.push(n)}return this.tokens.push({type:"eof",value:"",pos:this.pos}),this.tokens}skipWhitespace(){for(;this.pos<this.input.length;){let n=this.input[this.pos];if(n===" "||n===" "||n===`
2
2
  `||n==="\r")this.pos++;else if(n==="#")for(;this.pos<this.input.length&&this.input[this.pos]!==`
3
3
  `;)this.pos++;else break}}nextToken(){let n=this.pos,t=this.input[this.pos];if(t>="0"&&t<="9")return this.readNumber();if(t==='"'||t==="'"||t==="`")return this.readString(t);if(t==="b"&&this.pos+1<this.input.length){let o=this.input[this.pos+1];if(o==='"'||o==="'"||o==="`")return this.pos++,this.readString(o)}if(t==="/"){let o=this.tokens[this.tokens.length-1];return o&&(o.type==="int"||o.type==="float"||o.type==="string"||o.type==="ident"||o.type===")"||o.type==="]")?this.input[this.pos+1]==="/"?(this.pos+=2,{type:"//",value:"//",pos:n}):(this.pos++,{type:"/",value:"/",pos:n}):this.readRegex()}if(this.match("not in"))return{type:"not in",value:"not in",pos:n};if(this.match("=>"))return{type:"=>",value:"=>",pos:n};if(this.match("**"))return{type:"**",value:"**",pos:n};if(this.match("++"))return{type:"++",value:"++",pos:n};if(this.match("//"))return{type:"//",value:"//",pos:n};if(this.match("=="))return{type:"==",value:"==",pos:n};if(this.match("!="))return{type:"!=",value:"!=",pos:n};if(this.match("<="))return{type:"<=",value:"<=",pos:n};if(this.match(">="))return{type:">=",value:">=",pos:n};if(this.match("&&"))return{type:"&&",value:"&&",pos:n};if(this.match("||"))return{type:"||",value:"||",pos:n};let r=new Map([["(","("],[")",")"],["[","["],["]","]"],["{","{"],["}","}"],[",",","],[":",":"],[";",";"],["+","+"],["-","-"],["*","*"],["%","%"],["<","<"],[">",">"],["!","!"],[".","."],["|","|"],["=","="]]).get(t);if(r!==void 0)return this.pos++,{type:r,value:t,pos:n};if(this.isIdentStart(t))return this.readIdentifier();throw new Error(`Unexpected character '${t}' at position ${this.pos}`)}match(n){if(this.input.slice(this.pos,this.pos+n.length)===n){if(/^[a-zA-Z]/.test(n)){let t=this.input[this.pos+n.length];if(t&&this.isIdentChar(t))return!1}return this.pos+=n.length,!0}return!1}isIdentStart(n){return n>="a"&&n<="z"||n>="A"&&n<="Z"||n==="_"}isIdentChar(n){return this.isIdentStart(n)||n>="0"&&n<="9"}readNumber(){let n=this.pos,t=!1,s=!1;for(;this.pos<this.input.length;){let o=this.input[this.pos];if(o>="0"&&o<="9")this.pos++;else if(o==="_")this.pos++;else if(o==="."&&!t&&!s)t=!0,this.pos++;else if((o==="e"||o==="E")&&!s)s=!0,t=!0,this.pos++,this.pos<this.input.length&&(this.input[this.pos]==="+"||this.input[this.pos]==="-")&&this.pos++;else break}let r=this.input.slice(n,this.pos).replace(/_/g,"");return{type:t?"float":"int",value:r,pos:n}}readString(n){let t=this.pos;this.pos++;let s="";for(;this.pos<this.input.length;){let r=this.input[this.pos];if(r===n)return this.pos++,{type:"string",value:s,pos:t};if(r==="\\"){if(this.pos++,this.pos<this.input.length){let o=this.input[this.pos];switch(o){case"n":s+=`
4
- `;break;case"r":s+="\r";break;case"t":s+=" ";break;case"\\":s+="\\";break;case'"':s+='"';break;case"'":s+="'";break;case"`":s+="`";break;case"0":s+="\0";break;default:s+=o}this.pos++}}else s+=r,this.pos++}throw new Error(`Unterminated string starting at position ${t}`)}readRegex(){let n=this.pos;this.pos++;let t="",s="";for(;this.pos<this.input.length;){let r=this.input[this.pos];if(r==="/"){for(this.pos++;this.pos<this.input.length&&this.input[this.pos]==="i";)s+=this.input[this.pos],this.pos++;return{type:"regex",value:t+(s?`/${s}`:""),pos:n}}r==="\\"?(t+=r,this.pos++,this.pos<this.input.length&&(t+=this.input[this.pos],this.pos++)):(t+=r,this.pos++)}throw new Error(`Unterminated regex starting at position ${n}`)}readIdentifier(){let n=this.pos;for(;this.pos<this.input.length&&this.isIdentChar(this.input[this.pos]);)this.pos++;let t=!1;this.pos<this.input.length&&this.input[this.pos]==="?"&&(t=!0,this.pos++);let s=this.input.slice(n,t?this.pos-1:this.pos);t&&(s+="?");let r=new Map([["true","true"],["false","false"],["null","null"],["and","and"],["or","or"],["eq","eq"],["ne","ne"],["lt","lt"],["le","le"],["gt","gt"],["ge","ge"],["in","in"],["as","as"],["_","_"]]),o=s.replace(/\?$/,""),i=r.get(o);return i!==void 0&&!t?{type:i,value:o,pos:n}:{type:"ident",value:s,pos:n}}}});var He={};Be(He,{parseMoonblade:()=>_,parseNamedExpressions:()=>V});function V(e){let n=[],s=new q(e).tokenize(),r=0,o=()=>s[r]||{type:"eof",value:"",pos:0},i=()=>s[r++];for(;o().type!=="eof";){if(o().type===","&&n.length>0){i();continue}let h=[],u=0,p=r;for(;o().type!=="eof";){let a=o();if((a.type===","||a.type==="as")&&u===0)break;(a.type==="("||a.type==="["||a.type==="{")&&u++,(a.type===")"||a.type==="]"||a.type==="}")&&u--,h.push(i())}h.push({type:"eof",value:"",pos:0});let f=new J(h).parse(),c;if(o().type==="as")if(i(),o().type==="("){i();let a=[];for(;o().type!==")"&&o().type!=="eof";)(o().type==="ident"||o().type==="string")&&(a.push(o().value),i()),o().type===","&&i();o().type===")"&&i(),c=a}else if(o().type==="ident"||o().type==="string")c=o().value,i();else throw new Error(`Expected name after 'as', got ${o().type}`);else c=e.slice(s[p].pos,s[r-1]?.pos||e.length).trim(),f.type==="identifier"&&(c=f.name);n.push({expr:f,name:c})}return n}function _(e){let t=new q(e).tokenize();return new J(t).parse()}var R,J,U=Ue(()=>{"use strict";_e();R={PIPE:1,OR:2,AND:3,EQUALITY:4,COMPARISON:5,ADDITIVE:6,MULTIPLICATIVE:7,POWER:8,UNARY:9,POSTFIX:10},J=class{pos=0;tokens;constructor(n){this.tokens=n}parse(){let n=this.parseExpr(0);if(this.peek().type!=="eof")throw new Error(`Unexpected token: ${this.peek().value}`);return n}parseExpr(n){let t=this.parsePrefix();for(;;){let s=this.peek(),r=this.getInfixPrec(s.type);if(r<n)break;t=this.parseInfix(t,r)}return t}parsePrefix(){let n=this.peek();switch(n.type){case"int":return this.advance(),{type:"int",value:Number.parseInt(n.value,10)};case"float":return this.advance(),{type:"float",value:Number.parseFloat(n.value)};case"string":return this.advance(),{type:"string",value:n.value};case"regex":{this.advance();let t=n.value.split("/"),s=t.length>1?t[t.length-1]:"";return{type:"regex",pattern:t.slice(0,-1).join("/")||n.value,caseInsensitive:s.includes("i")}}case"true":return this.advance(),{type:"bool",value:!0};case"false":return this.advance(),{type:"bool",value:!1};case"null":return this.advance(),{type:"null"};case"_":return this.advance(),{type:"underscore"};case"ident":{let t=n.value,s=t.endsWith("?"),r=s?t.slice(0,-1):t;if(this.advance(),this.peek().type==="(")return this.parseFunctionCall(r);if(this.peek().type==="=>"){this.advance();let o=this.parseExpr(0);return this.bindLambdaArgs({type:"lambda",params:[r],body:o},[r])}return{type:"identifier",name:r,unsure:s}}case"(":{this.advance();let t=[];if(this.peek().type===")"){if(this.advance(),this.peek().type==="=>"){this.advance();let r=this.parseExpr(0);return{type:"lambda",params:[],body:r}}throw new Error("Empty parentheses not allowed")}if(this.peek().type==="ident"){let r=this.peek().value;if(this.advance(),this.peek().type===","||this.peek().type===")"){for(t.push(r);this.peek().type===","&&(this.advance(),this.peek().type==="ident");)t.push(this.peek().value),this.advance();if(this.peek().type===")"&&(this.advance(),this.peek().type==="=>")){this.advance();let o=this.parseExpr(0);return this.bindLambdaArgs({type:"lambda",params:t,body:o},t)}this.pos-=t.length*2,t.length>1&&(this.pos=this.pos)}this.pos--}let s=this.parseExpr(0);return this.expect(")"),this.peek().type,s}case"[":return this.parseList();case"{":return this.parseMap();case"-":{this.advance();let t=this.parseExpr(R.UNARY);return t.type==="int"?{type:"int",value:-t.value}:t.type==="float"?{type:"float",value:-t.value}:{type:"func",name:"neg",args:[{expr:t}]}}case"!":return this.advance(),{type:"func",name:"not",args:[{expr:this.parseExpr(R.UNARY)}]};default:throw new Error(`Unexpected token: ${n.type} (${n.value})`)}}parseFunctionCall(n){this.expect("(");let t=[];if(this.peek().type!==")")do{t.length>0&&this.peek().type===","&&this.advance();let s;if(this.peek().type==="ident"){let o=this.peek().value,i=this.pos+1;i<this.tokens.length&&this.tokens[i].type==="="&&(s=o,this.advance(),this.advance())}let r=this.parseExpr(0);t.push({name:s,expr:r})}while(this.peek().type===",");return this.expect(")"),{type:"func",name:n.toLowerCase(),args:t}}parseList(){this.expect("[");let n=[];if(this.peek().type!=="]")do n.length>0&&this.peek().type===","&&this.advance(),n.push(this.parseExpr(0));while(this.peek().type===",");return this.expect("]"),{type:"list",elements:n}}parseMap(){this.expect("{");let n=[];if(this.peek().type!=="}")do{n.length>0&&this.peek().type===","&&this.advance();let t;if(this.peek().type==="ident")t=this.peek().value,this.advance();else if(this.peek().type==="string")t=this.peek().value,this.advance();else throw new Error(`Expected map key, got ${this.peek().type}`);this.expect(":");let s=this.parseExpr(0);n.push({key:t,value:s})}while(this.peek().type===",");return this.expect("}"),{type:"map",entries:n}}parseInfix(n,t){let s=this.peek(),o=new Map([["+","add"],["-","sub"],["*","mul"],["/","div"],["//","idiv"],["%","mod"],["**","pow"],["++","concat"],["==","=="],["!=","!="],["<","<"],["<=","<="],[">",">"],[">=",">="],["eq","eq"],["ne","ne"],["lt","lt"],["le","le"],["gt","gt"],["ge","ge"],["&&","and"],["and","and"],["||","or"],["or","or"]]).get(s.type);if(o!==void 0){this.advance();let i=this.parseExpr(t+(this.isRightAssoc(s.type)?0:1));return{type:"func",name:o,args:[{expr:n},{expr:i}]}}if(s.type==="|"){this.advance();let i=this.parseExpr(t);return this.handlePipe(n,i)}if(s.type===".")return this.advance(),this.handleDot(n);if(s.type==="[")return this.advance(),this.handleIndexing(n);if(s.type==="in")return this.advance(),{type:"func",name:"contains",args:[{expr:this.parseExpr(t+1)},{expr:n}]};if(s.type==="not in")return this.advance(),{type:"func",name:"not",args:[{expr:{type:"func",name:"contains",args:[{expr:this.parseExpr(t+1)},{expr:n}]}}]};throw new Error(`Unexpected infix token: ${s.type}`)}handlePipe(n,t){if(t.type==="identifier")return{type:"func",name:t.name,args:[{expr:n}]};if(t.type==="func"){let s=this.countUnderscores(t);return s===0?t:s===1?this.fillUnderscore(t,n):{type:"pipeline",exprs:[n,t]}}return this.countUnderscores(t)===1?this.fillUnderscore(t,n):t}handleDot(n){let t=this.peek();if(t.type==="ident"){let s=t.value;if(this.advance(),this.peek().type==="("){let r=this.parseFunctionCall(s);return r.type==="func"&&r.args.unshift({expr:n}),r}return{type:"func",name:"get",args:[{expr:n},{expr:{type:"string",value:s}}]}}if(t.type==="int"){let s=Number.parseInt(t.value,10);return this.advance(),{type:"func",name:"get",args:[{expr:n},{expr:{type:"int",value:s}}]}}if(t.type==="string"){let s=t.value;return this.advance(),{type:"func",name:"get",args:[{expr:n},{expr:{type:"string",value:s}}]}}throw new Error(`Expected identifier, number, or string after dot, got ${t.type}`)}handleIndexing(n){if(this.peek().type===":"){if(this.advance(),this.peek().type==="]")return this.advance(),{type:"func",name:"slice",args:[{expr:n}]};let s=this.parseExpr(0);return this.expect("]"),{type:"func",name:"slice",args:[{expr:n},{expr:{type:"int",value:0}},{expr:s}]}}let t=this.parseExpr(0);if(this.peek().type===":"){if(this.advance(),this.peek().type==="]")return this.advance(),{type:"func",name:"slice",args:[{expr:n},{expr:t}]};let s=this.parseExpr(0);return this.expect("]"),{type:"func",name:"slice",args:[{expr:n},{expr:t},{expr:s}]}}return this.expect("]"),{type:"func",name:"get",args:[{expr:n},{expr:t}]}}countUnderscores(n){return n.type==="underscore"?1:n.type==="func"?n.args.reduce((t,s)=>t+this.countUnderscores(s.expr),0):n.type==="list"?n.elements.reduce((t,s)=>t+this.countUnderscores(s),0):n.type==="map"?n.entries.reduce((t,s)=>t+this.countUnderscores(s.value),0):0}fillUnderscore(n,t){return n.type==="underscore"?t:n.type==="func"?{...n,args:n.args.map(s=>({...s,expr:this.fillUnderscore(s.expr,t)}))}:n.type==="list"?{...n,elements:n.elements.map(s=>this.fillUnderscore(s,t))}:n.type==="map"?{...n,entries:n.entries.map(s=>({...s,value:this.fillUnderscore(s.value,t)}))}:n}bindLambdaArgs(n,t){return{...n,body:this.bindLambdaArgsInExpr(n.body,t)}}bindLambdaArgsInExpr(n,t){return n.type==="identifier"&&t.includes(n.name)?{type:"lambdaBinding",name:n.name}:n.type==="func"?{...n,args:n.args.map(s=>({...s,expr:this.bindLambdaArgsInExpr(s.expr,t)}))}:n.type==="list"?{...n,elements:n.elements.map(s=>this.bindLambdaArgsInExpr(s,t))}:n.type==="map"?{...n,entries:n.entries.map(s=>({...s,value:this.bindLambdaArgsInExpr(s.value,t)}))}:n}getInfixPrec(n){switch(n){case"|":return R.PIPE;case"||":case"or":return R.OR;case"&&":case"and":return R.AND;case"==":case"!=":case"eq":case"ne":return R.EQUALITY;case"<":case"<=":case">":case">=":case"lt":case"le":case"gt":case"ge":case"in":case"not in":return R.COMPARISON;case"+":case"-":case"++":return R.ADDITIVE;case"*":case"/":case"//":case"%":return R.MULTIPLICATIVE;case"**":return R.POWER;case".":case"[":return R.POSTFIX;default:return-1}}isRightAssoc(n){return n==="**"}peek(){return this.tokens[this.pos]||{type:"eof",value:"",pos:0}}advance(){return this.tokens[this.pos++]}expect(n){let t=this.peek();if(t.type!==n)throw new Error(`Expected ${n}, got ${t.type}`);return this.advance()}}});U();function E(e,n){return n.length===0?k(e,[]):n.length===1?{type:"Pipe",left:n[0],right:k(e,[])}:{type:"Pipe",left:n[0],right:k(e,n.slice(1))}}var B={add:e=>S("+",e[0],e[1]),sub:e=>S("-",e[0],e[1]),mul:e=>S("*",e[0],e[1]),div:e=>S("/",e[0],e[1]),mod:e=>S("%",e[0],e[1]),idiv:e=>k("floor",[S("/",e[0],e[1])]),pow:e=>E("pow",e),neg:e=>({type:"UnaryOp",op:"-",operand:e[0]}),"==":e=>S("==",e[0],e[1]),"!=":e=>S("!=",e[0],e[1]),"<":e=>S("<",e[0],e[1]),"<=":e=>S("<=",e[0],e[1]),">":e=>S(">",e[0],e[1]),">=":e=>S(">=",e[0],e[1]),eq:e=>S("==",P(e[0]),P(e[1])),ne:e=>S("!=",P(e[0]),P(e[1])),lt:e=>S("<",P(e[0]),P(e[1])),le:e=>S("<=",P(e[0]),P(e[1])),gt:e=>S(">",P(e[0]),P(e[1])),ge:e=>S(">=",P(e[0]),P(e[1])),and:e=>S("and",e[0],e[1]),or:e=>S("or",e[0],e[1]),not:e=>({type:"UnaryOp",op:"not",operand:e[0]}),len:e=>E("length",e),length:e=>E("length",e),upper:e=>E("ascii_upcase",e),lower:e=>E("ascii_downcase",e),trim:e=>E("trim",e),ltrim:e=>e.length===0?k("ltrimstr",[{type:"Literal",value:" "}]):{type:"Pipe",left:e[0],right:k("ltrimstr",[{type:"Literal",value:" "}])},rtrim:e=>e.length===0?k("rtrimstr",[{type:"Literal",value:" "}]):{type:"Pipe",left:e[0],right:k("rtrimstr",[{type:"Literal",value:" "}])},split:e=>E("split",e),join:e=>e.length===1?k("join",[{type:"Literal",value:""}]):E("join",e),concat:e=>S("+",e[0],e[1]),startswith:e=>E("startswith",e),endswith:e=>E("endswith",e),contains:e=>E("contains",e),replace:e=>E("gsub",e),substr:e=>e.length===2?{type:"Slice",base:e[0],start:e[1]}:{type:"Slice",base:e[0],start:e[1],end:S("+",e[1],e[2])},abs:e=>E("fabs",e),floor:e=>E("floor",e),ceil:e=>E("ceil",e),round:e=>E("round",e),sqrt:e=>E("sqrt",e),log:e=>E("log",e),log10:e=>E("log10",e),log2:e=>E("log2",e),exp:e=>E("exp",e),sin:e=>E("sin",e),cos:e=>E("cos",e),tan:e=>E("tan",e),asin:e=>E("asin",e),acos:e=>E("acos",e),atan:e=>E("atan",e),min:e=>E("min",e),max:e=>E("max",e),first:e=>e.length===0?{type:"Index",index:{type:"Literal",value:0}}:{type:"Index",index:{type:"Literal",value:0},base:e[0]},last:e=>e.length===0?{type:"Index",index:{type:"Literal",value:-1}}:{type:"Index",index:{type:"Literal",value:-1},base:e[0]},get:e=>e.length===1?{type:"Index",index:e[0]}:{type:"Index",index:e[1],base:e[0]},slice:e=>e.length===1?{type:"Slice",base:e[0]}:e.length===2?{type:"Slice",base:e[0],start:e[1]}:{type:"Slice",base:e[0],start:e[1],end:e[2]},keys:"keys",values:"values",entries:e=>k("to_entries",e),from_entries:"from_entries",reverse:"reverse",sort:"sort",sort_by:"sort_by",group_by:"group_by",unique:"unique",unique_by:"unique_by",flatten:"flatten",map:e=>({type:"Pipe",left:e[0],right:{type:"Array",elements:e[1]}}),select:e=>k("select",e),empty:()=>k("empty",[]),count:()=>k("length",[]),sum:e=>e.length===0?k("add",[]):{type:"Pipe",left:{type:"Array",elements:e[0]},right:k("add",[])},mean:e=>e.length===0?{type:"Pipe",left:{type:"Identity"},right:S("/",k("add",[]),k("length",[]))}:{type:"Pipe",left:{type:"Array",elements:e[0]},right:S("/",k("add",[]),k("length",[]))},avg:e=>e.length===0?{type:"Pipe",left:{type:"Identity"},right:S("/",k("add",[]),k("length",[]))}:{type:"Pipe",left:{type:"Array",elements:e[0]},right:S("/",k("add",[]),k("length",[]))},type:"type",isnull:e=>e.length===0?S("==",{type:"Identity"},{type:"Literal",value:null}):S("==",e[0],{type:"Literal",value:null}),isempty:e=>e.length===0?S("==",{type:"Identity"},{type:"Literal",value:""}):S("==",e[0],{type:"Literal",value:""}),tonumber:e=>e.length===0?k("tonumber",[]):k("tonumber",e),tostring:e=>e.length===0?k("tostring",[]):k("tostring",e),if:e=>Je(e[0],e[1],e[2]),coalesce:e=>{if(e.length===0)return{type:"Literal",value:null};if(e.length===1)return e[0];let[n,...t]=e,s=S("and",S("!=",n,{type:"Literal",value:null}),S("!=",n,{type:"Literal",value:""}));return Je(s,n,t.length===1?t[0]:B.coalesce(t))},index:()=>({type:"Field",name:"_row_index"}),now:()=>k("now",[]),fmt:e=>k("tostring",e),format:e=>k("tostring",e)};function S(e,n,t){return{type:"BinaryOp",op:e,left:n,right:t}}function k(e,n){return{type:"Call",name:e,args:n}}var tt="then";function Je(e,n,t){let s={type:"Cond",cond:e,elifs:[],else:t||{type:"Literal",value:null}};return s[tt]=n,s}function P(e){return{type:"Pipe",left:e,right:{type:"Call",name:"tostring",args:[]}}}function O(e,n=!0){switch(e.type){case"int":case"float":return{type:"Literal",value:e.value};case"string":return{type:"Literal",value:e.value};case"bool":return{type:"Literal",value:e.value};case"null":return{type:"Literal",value:null};case"underscore":return{type:"Index",base:{type:"Identity"},index:{type:"Literal",value:"_"}};case"identifier":return n?{type:"Field",name:e.name}:{type:"VarRef",name:e.name};case"lambdaBinding":return{type:"VarRef",name:e.name};case"func":{let t=e.args.map(r=>O(r.expr,n)),s=Object.hasOwn(B,e.name)?B[e.name]:void 0;return typeof s=="function"?s(t):k(typeof s=="string"?s:e.name,t)}case"list":return e.elements.length===0?{type:"Array"}:{type:"Array",elements:e.elements.reduce((t,s,r)=>{let o=O(s,n);return r===0?o:{type:"Comma",left:t,right:o}},null)};case"map":return{type:"Object",entries:e.entries.map(t=>({key:t.key,value:O(t.value,n)}))};case"regex":return{type:"Literal",value:e.pattern};case"slice":return{type:"Slice",start:e.start?O(e.start,n):void 0,end:e.end?O(e.end,n):void 0};case"lambda":return O(e.body,n);case"pipeline":return{type:"Identity"};default:throw new Error(`Unknown moonblade expression type: ${e.type}`)}}function Q(e){let n=[],t=0;for(;t<e.length;){for(;t<e.length&&(e[t]===" "||e[t]===",");)t++;if(t>=e.length)break;let s=t;for(;t<e.length&&/\w/.test(e[t]);)t++;let r=e.slice(s,t);for(;t<e.length&&e[t]===" ";)t++;if(e[t]!=="(")break;t++;let o=1,i=t;for(;t<e.length&&o>0;)e[t]==="("?o++:e[t]===")"&&o--,o>0&&t++;let h=e.slice(i,t).trim();for(t++;t<e.length&&e[t]===" ";)t++;let u="";if(e.slice(t,t+3).toLowerCase()==="as "){for(t+=3;t<e.length&&e[t]===" ";)t++;let p=t;for(;t<e.length&&/\w/.test(e[t]);)t++;u=e.slice(p,t)}u||(u=h?`${r}(${h})`:`${r}()`),n.push({func:r,expr:h,alias:u})}return n}function ze(e){return/^\w+$/.test(e)}function Z(e,n,t){let s=O(_(n)),r=$(e,s,t);return r.length>0?r[0]:null}function ee(e,n,t={}){let{func:s,expr:r}=n;if(s==="count"&&!r)return e.length;let o;switch(ze(r)?o=e.map(i=>i[r]).filter(i=>i!=null):o=e.map(i=>Z(i,r,t)).filter(i=>i!=null),s){case"count":return ze(r)?o.length:o.filter(i=>!!i).length;case"sum":return o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h))).reduce((h,u)=>h+u,0);case"mean":case"avg":{let i=o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h)));return i.length>0?i.reduce((h,u)=>h+u,0)/i.length:0}case"min":{let i=o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h)));return i.length>0?Math.min(...i):null}case"max":{let i=o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h)));return i.length>0?Math.max(...i):null}case"first":return o.length>0?o[0]:null;case"last":return o.length>0?o[o.length-1]:null;case"median":{let i=o.map(u=>typeof u=="number"?u:Number.parseFloat(String(u))).filter(u=>!Number.isNaN(u)).sort((u,p)=>u-p);if(i.length===0)return null;let h=Math.floor(i.length/2);return i.length%2===0?(i[h-1]+i[h])/2:i[h]}case"mode":{let i=new Map;for(let p of o){let l=String(p);i.set(l,(i.get(l)||0)+1)}let h=0,u=null;for(let[p,l]of i)l>h&&(h=l,u=p);return u}case"cardinality":return new Set(o.map(h=>String(h))).size;case"values":return o.map(i=>String(i)).join("|");case"distinct_values":return[...new Set(o.map(h=>String(h)))].sort().join("|");case"all":{if(e.length===0)return!0;for(let i of e)if(!Z(i,r,t))return!1;return!0}case"any":{for(let i of e)if(Z(i,r,t))return!0;return!1}default:return null}}function Ke(e,n,t={}){let s=F();for(let r of n)b(s,r.alias,ee(e,r,t));return s}async function te(e,n){let t="",s=[];for(let l of e)l.startsWith("-")||(t?s.push(l):t=l);if(!t)return{stdout:"",stderr:`xan agg: no aggregation expression
5
- `,exitCode:1};let{data:r,error:o}=await v(s,n);if(o)return o;let i={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},h=Q(t),u=h.map(l=>l.alias),p=Ke(r,h,i);return{stdout:w(u,[p]),stderr:"",exitCode:0}}async function ne(e,n){let t="",s="",r=[];for(let d=0;d<e.length;d++){let m=e[d];m==="--sorted"||m.startsWith("-")||(t?s?r.push(m):s=m:t=m)}if(!t||!s)return{stdout:"",stderr:`xan groupby: usage: xan groupby COLS EXPR [FILE]
6
- `,exitCode:1};let{data:o,error:i}=await v(r,n);if(i)return i;let h={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},u=t.split(","),p=Q(s),l=[],f=new Map;for(let d of o){let m=u.map(g=>String(d[g])).join("\0");f.has(m)||(f.set(m,[]),l.push(m)),f.get(m)?.push(d)}let c=[...u,...p.map(d=>d.alias)],a=[];for(let d of l){let m=f.get(d);if(!m)continue;let g=F();for(let y of u)b(g,y,m[0][y]);for(let y of p)b(g,y.alias,ee(m,y,h));a.push(g)}return{stdout:w(c,a),stderr:"",exitCode:0}}async function se(e,n){let t=[],s="",r=10,o=!1,i=[];for(let a=0;a<e.length;a++){let d=e[a];(d==="-s"||d==="--select")&&a+1<e.length?t=e[++a].split(","):(d==="-g"||d==="--groupby")&&a+1<e.length?s=e[++a]:(d==="-l"||d==="--limit")&&a+1<e.length?r=Number.parseInt(e[++a],10):d==="--no-extra"?o=!0:d==="-A"||d==="--all"?r=0:d.startsWith("-")||i.push(d)}let{headers:h,data:u,error:p}=await v(i,n);if(p)return p;let l=t.length>0?t:h.filter(a=>a!==s);s&&t.length===0&&(l=h.filter(a=>a!==s));let f=[],c=s?["field",s,"value","count"]:["field","value","count"];if(s){let a=new Map;for(let d of u){let m=String(d[s]??"");a.has(m)||a.set(m,[]),a.get(m)?.push(d)}for(let d of l)for(let[m,g]of a){let y=new Map;for(let I of g){let N=I[d],C=N===""||N===null||N===void 0?"":String(N);y.set(C,(y.get(C)||0)+1)}let x=[...y.entries()].sort((I,N)=>N[1]!==I[1]?N[1]-I[1]:I[0].localeCompare(N[0]));o&&(x=x.filter(([I])=>I!=="")),r>0&&(x=x.slice(0,r));for(let[I,N]of x)f.push({field:d,[s]:m,value:I===""?"<empty>":I,count:N})}}else for(let a of l){let d=new Map;for(let g of u){let y=g[a],x=y===""||y===null||y===void 0?"":String(y);d.set(x,(d.get(x)||0)+1)}let m=[...d.entries()].sort((g,y)=>y[1]!==g[1]?y[1]-g[1]:g[0].localeCompare(y[0]));o&&(m=m.filter(([g])=>g!=="")),r>0&&(m=m.slice(0,r));for(let[g,y]of m)f.push({field:a,value:g===""?"<empty>":g,count:y})}return{stdout:w(c,f),stderr:"",exitCode:0}}async function re(e,n){let t=[],s=[];for(let l=0;l<e.length;l++){let f=e[l];f==="-s"&&l+1<e.length?t=e[++l].split(","):f.startsWith("-")||s.push(f)}let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=t.length>0?t:r,u=["field","type","count","min","max","mean"],p=[];for(let l of h){let f=o.map(d=>d[l]).filter(d=>d!=null),c=f.map(d=>typeof d=="number"?d:Number.parseFloat(String(d))).filter(d=>!Number.isNaN(d)),a=c.length===f.length&&c.length>0;p.push({field:l,type:a?"Number":"String",count:f.length,min:a?Math.min(...c):"",max:a?Math.max(...c):"",mean:a?Math.round(c.reduce((d,m)=>d+m,0)/c.length*1e10)/1e10:""})}return{stdout:w(u,p),stderr:"",exitCode:0}}U();function Ge(e){let n=_(e);return O(n)}function nt(e){let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return H(`^${t}$`)}function z(e,n){let t=[],s=new Set;for(let r of e.split(",")){let o=r.trim();if(o.startsWith("!")){let p=o.slice(1),l=z(p,n);for(let f of l)s.add(f);continue}if(o==="*"){for(let p of n)t.includes(p)||t.push(p);continue}if(o.includes("*")){let p=nt(o);for(let l of n)p.test(l)&&!t.includes(l)&&t.push(l);continue}let i=o.match(/^([^:]*):([^:]*)$/);if(i&&(i[1]||i[2])){let p=i[1],l=i[2],f=p?n.indexOf(p):0,c=l?n.indexOf(l):n.length-1;if(f!==-1&&c!==-1){let a=f<=c?1:-1;for(let d=f;a>0?d<=c:d>=c;d+=a)t.includes(n[d])||t.push(n[d])}continue}let h=o.match(/^(\d+)-(\d+)$/);if(h){let p=Number.parseInt(h[1],10),l=Number.parseInt(h[2],10);for(let f=p;f<=l&&f<n.length;f++)t.push(n[f]);continue}let u=Number.parseInt(o,10);if(!Number.isNaN(u)&&u>=0&&u<n.length){t.push(n[u]);continue}n.includes(o)&&t.push(o)}return s.size>0?t.filter(r=>!s.has(r)):t}async function oe(e,n){let t="",s=[];for(let p of e)p.startsWith("-")||(t?s.push(p):t=p);if(!t)return{stdout:"",stderr:`xan select: no columns specified
7
- `,exitCode:1};let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=z(t,r),u=o.map(p=>{let l=F();for(let f of h)b(l,f,p[f]);return l});return{stdout:w(h,u),stderr:"",exitCode:0}}async function ie(e,n){let t="",s=[];for(let l of e)l.startsWith("-")||(t?s.push(l):t=l);if(!t)return{stdout:"",stderr:`xan drop: no columns specified
8
- `,exitCode:1};let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=new Set(z(t,r)),u=r.filter(l=>!h.has(l)),p=o.map(l=>{let f=F();for(let c of u)b(f,c,l[c]);return f});return{stdout:w(u,p),stderr:"",exitCode:0}}async function ae(e,n){let t="",s="",r=[];for(let l=0;l<e.length;l++){let f=e[l];f==="-s"&&l+1<e.length?s=e[++l]:f.startsWith("-")||(t?r.push(f):t=f)}if(!t)return{stdout:"",stderr:`xan rename: no new name(s) specified
9
- `,exitCode:1};let{headers:o,data:i,error:h}=await v(r,n);if(h)return h;let u;if(s){let l=s.split(","),f=t.split(","),c=new Map;for(let a=0;a<l.length&&a<f.length;a++)c.set(l[a],f[a]);u=o.map(a=>c.get(a)||a)}else{let l=t.split(",");u=o.map((f,c)=>c<l.length?l[c]:f)}let p=i.map(l=>{let f=F();for(let c=0;c<o.length;c++)b(f,u[c],l[o[c]]);return f});return{stdout:w(u,p),stderr:"",exitCode:0}}async function le(e,n){let t="index",s=[];for(let p=0;p<e.length;p++)e[p]==="-c"&&p+1<e.length?t=e[++p]:s.push(e[p]);let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=[t,...r],u=o.map((p,l)=>{let f=F();b(f,t,l);for(let c of r)b(f,c,p[c]);return f});return{stdout:w(h,u),stderr:"",exitCode:0}}async function ue(e,n){let t=e.includes("-j")||e.includes("--just-names"),{headers:s,error:r}=await v(e.filter(i=>i!=="-j"&&i!=="--just-names"),n);return r||{stdout:t?`${s.map(i=>i).join(`
4
+ `;break;case"r":s+="\r";break;case"t":s+=" ";break;case"\\":s+="\\";break;case'"':s+='"';break;case"'":s+="'";break;case"`":s+="`";break;case"0":s+="\0";break;default:s+=o}this.pos++}}else s+=r,this.pos++}throw new Error(`Unterminated string starting at position ${t}`)}readRegex(){let n=this.pos;this.pos++;let t="",s="";for(;this.pos<this.input.length;){let r=this.input[this.pos];if(r==="/"){for(this.pos++;this.pos<this.input.length&&this.input[this.pos]==="i";)s+=this.input[this.pos],this.pos++;return{type:"regex",value:t+(s?`/${s}`:""),pos:n}}r==="\\"?(t+=r,this.pos++,this.pos<this.input.length&&(t+=this.input[this.pos],this.pos++)):(t+=r,this.pos++)}throw new Error(`Unterminated regex starting at position ${n}`)}readIdentifier(){let n=this.pos;for(;this.pos<this.input.length&&this.isIdentChar(this.input[this.pos]);)this.pos++;let t=!1;this.pos<this.input.length&&this.input[this.pos]==="?"&&(t=!0,this.pos++);let s=this.input.slice(n,t?this.pos-1:this.pos);t&&(s+="?");let r=new Map([["true","true"],["false","false"],["null","null"],["and","and"],["or","or"],["eq","eq"],["ne","ne"],["lt","lt"],["le","le"],["gt","gt"],["ge","ge"],["in","in"],["as","as"],["_","_"]]),o=s.replace(/\?$/,""),i=r.get(o);return i!==void 0&&!t?{type:i,value:o,pos:n}:{type:"ident",value:s,pos:n}}}});var Je={};Ze(Je,{parseMoonblade:()=>_,parseNamedExpressions:()=>V});function V(e){let n=[],s=new q(e).tokenize(),r=0,o=()=>s[r]||{type:"eof",value:"",pos:0},i=()=>s[r++];for(;o().type!=="eof";){if(o().type===","&&n.length>0){i();continue}let h=[],u=0,p=r;for(;o().type!=="eof";){let a=o();if((a.type===","||a.type==="as")&&u===0)break;(a.type==="("||a.type==="["||a.type==="{")&&u++,(a.type===")"||a.type==="]"||a.type==="}")&&u--,h.push(i())}h.push({type:"eof",value:"",pos:0});let f=new J(h).parse(),c;if(o().type==="as")if(i(),o().type==="("){i();let a=[];for(;o().type!==")"&&o().type!=="eof";)(o().type==="ident"||o().type==="string")&&(a.push(o().value),i()),o().type===","&&i();o().type===")"&&i(),c=a}else if(o().type==="ident"||o().type==="string")c=o().value,i();else throw new Error(`Expected name after 'as', got ${o().type}`);else c=e.slice(s[p].pos,s[r-1]?.pos||e.length).trim(),f.type==="identifier"&&(c=f.name);n.push({expr:f,name:c})}return n}function _(e){let t=new q(e).tokenize();return new J(t).parse()}var R,J,U=Ue(()=>{"use strict";He();R={PIPE:1,OR:2,AND:3,EQUALITY:4,COMPARISON:5,ADDITIVE:6,MULTIPLICATIVE:7,POWER:8,UNARY:9,POSTFIX:10},J=class{pos=0;tokens;constructor(n){this.tokens=n}parse(){let n=this.parseExpr(0);if(this.peek().type!=="eof")throw new Error(`Unexpected token: ${this.peek().value}`);return n}parseExpr(n){let t=this.parsePrefix();for(;;){let s=this.peek(),r=this.getInfixPrec(s.type);if(r<n)break;t=this.parseInfix(t,r)}return t}parsePrefix(){let n=this.peek();switch(n.type){case"int":return this.advance(),{type:"int",value:Number.parseInt(n.value,10)};case"float":return this.advance(),{type:"float",value:Number.parseFloat(n.value)};case"string":return this.advance(),{type:"string",value:n.value};case"regex":{this.advance();let t=n.value.split("/"),s=t.length>1?t[t.length-1]:"";return{type:"regex",pattern:t.slice(0,-1).join("/")||n.value,caseInsensitive:s.includes("i")}}case"true":return this.advance(),{type:"bool",value:!0};case"false":return this.advance(),{type:"bool",value:!1};case"null":return this.advance(),{type:"null"};case"_":return this.advance(),{type:"underscore"};case"ident":{let t=n.value,s=t.endsWith("?"),r=s?t.slice(0,-1):t;if(this.advance(),this.peek().type==="(")return this.parseFunctionCall(r);if(this.peek().type==="=>"){this.advance();let o=this.parseExpr(0);return this.bindLambdaArgs({type:"lambda",params:[r],body:o},[r])}return{type:"identifier",name:r,unsure:s}}case"(":{this.advance();let t=[];if(this.peek().type===")"){if(this.advance(),this.peek().type==="=>"){this.advance();let r=this.parseExpr(0);return{type:"lambda",params:[],body:r}}throw new Error("Empty parentheses not allowed")}if(this.peek().type==="ident"){let r=this.peek().value;if(this.advance(),this.peek().type===","||this.peek().type===")"){for(t.push(r);this.peek().type===","&&(this.advance(),this.peek().type==="ident");)t.push(this.peek().value),this.advance();if(this.peek().type===")"&&(this.advance(),this.peek().type==="=>")){this.advance();let o=this.parseExpr(0);return this.bindLambdaArgs({type:"lambda",params:t,body:o},t)}this.pos-=t.length*2,t.length>1&&(this.pos=this.pos)}this.pos--}let s=this.parseExpr(0);return this.expect(")"),this.peek().type,s}case"[":return this.parseList();case"{":return this.parseMap();case"-":{this.advance();let t=this.parseExpr(R.UNARY);return t.type==="int"?{type:"int",value:-t.value}:t.type==="float"?{type:"float",value:-t.value}:{type:"func",name:"neg",args:[{expr:t}]}}case"!":return this.advance(),{type:"func",name:"not",args:[{expr:this.parseExpr(R.UNARY)}]};default:throw new Error(`Unexpected token: ${n.type} (${n.value})`)}}parseFunctionCall(n){this.expect("(");let t=[];if(this.peek().type!==")")do{t.length>0&&this.peek().type===","&&this.advance();let s;if(this.peek().type==="ident"){let o=this.peek().value,i=this.pos+1;i<this.tokens.length&&this.tokens[i].type==="="&&(s=o,this.advance(),this.advance())}let r=this.parseExpr(0);t.push({name:s,expr:r})}while(this.peek().type===",");return this.expect(")"),{type:"func",name:n.toLowerCase(),args:t}}parseList(){this.expect("[");let n=[];if(this.peek().type!=="]")do n.length>0&&this.peek().type===","&&this.advance(),n.push(this.parseExpr(0));while(this.peek().type===",");return this.expect("]"),{type:"list",elements:n}}parseMap(){this.expect("{");let n=[];if(this.peek().type!=="}")do{n.length>0&&this.peek().type===","&&this.advance();let t;if(this.peek().type==="ident")t=this.peek().value,this.advance();else if(this.peek().type==="string")t=this.peek().value,this.advance();else throw new Error(`Expected map key, got ${this.peek().type}`);this.expect(":");let s=this.parseExpr(0);n.push({key:t,value:s})}while(this.peek().type===",");return this.expect("}"),{type:"map",entries:n}}parseInfix(n,t){let s=this.peek(),o=new Map([["+","add"],["-","sub"],["*","mul"],["/","div"],["//","idiv"],["%","mod"],["**","pow"],["++","concat"],["==","=="],["!=","!="],["<","<"],["<=","<="],[">",">"],[">=",">="],["eq","eq"],["ne","ne"],["lt","lt"],["le","le"],["gt","gt"],["ge","ge"],["&&","and"],["and","and"],["||","or"],["or","or"]]).get(s.type);if(o!==void 0){this.advance();let i=this.parseExpr(t+(this.isRightAssoc(s.type)?0:1));return{type:"func",name:o,args:[{expr:n},{expr:i}]}}if(s.type==="|"){this.advance();let i=this.parseExpr(t);return this.handlePipe(n,i)}if(s.type===".")return this.advance(),this.handleDot(n);if(s.type==="[")return this.advance(),this.handleIndexing(n);if(s.type==="in")return this.advance(),{type:"func",name:"contains",args:[{expr:this.parseExpr(t+1)},{expr:n}]};if(s.type==="not in")return this.advance(),{type:"func",name:"not",args:[{expr:{type:"func",name:"contains",args:[{expr:this.parseExpr(t+1)},{expr:n}]}}]};throw new Error(`Unexpected infix token: ${s.type}`)}handlePipe(n,t){if(t.type==="identifier")return{type:"func",name:t.name,args:[{expr:n}]};if(t.type==="func"){let s=this.countUnderscores(t);return s===0?t:s===1?this.fillUnderscore(t,n):{type:"pipeline",exprs:[n,t]}}return this.countUnderscores(t)===1?this.fillUnderscore(t,n):t}handleDot(n){let t=this.peek();if(t.type==="ident"){let s=t.value;if(this.advance(),this.peek().type==="("){let r=this.parseFunctionCall(s);return r.type==="func"&&r.args.unshift({expr:n}),r}return{type:"func",name:"get",args:[{expr:n},{expr:{type:"string",value:s}}]}}if(t.type==="int"){let s=Number.parseInt(t.value,10);return this.advance(),{type:"func",name:"get",args:[{expr:n},{expr:{type:"int",value:s}}]}}if(t.type==="string"){let s=t.value;return this.advance(),{type:"func",name:"get",args:[{expr:n},{expr:{type:"string",value:s}}]}}throw new Error(`Expected identifier, number, or string after dot, got ${t.type}`)}handleIndexing(n){if(this.peek().type===":"){if(this.advance(),this.peek().type==="]")return this.advance(),{type:"func",name:"slice",args:[{expr:n}]};let s=this.parseExpr(0);return this.expect("]"),{type:"func",name:"slice",args:[{expr:n},{expr:{type:"int",value:0}},{expr:s}]}}let t=this.parseExpr(0);if(this.peek().type===":"){if(this.advance(),this.peek().type==="]")return this.advance(),{type:"func",name:"slice",args:[{expr:n},{expr:t}]};let s=this.parseExpr(0);return this.expect("]"),{type:"func",name:"slice",args:[{expr:n},{expr:t},{expr:s}]}}return this.expect("]"),{type:"func",name:"get",args:[{expr:n},{expr:t}]}}countUnderscores(n){return n.type==="underscore"?1:n.type==="func"?n.args.reduce((t,s)=>t+this.countUnderscores(s.expr),0):n.type==="list"?n.elements.reduce((t,s)=>t+this.countUnderscores(s),0):n.type==="map"?n.entries.reduce((t,s)=>t+this.countUnderscores(s.value),0):0}fillUnderscore(n,t){return n.type==="underscore"?t:n.type==="func"?{...n,args:n.args.map(s=>({...s,expr:this.fillUnderscore(s.expr,t)}))}:n.type==="list"?{...n,elements:n.elements.map(s=>this.fillUnderscore(s,t))}:n.type==="map"?{...n,entries:n.entries.map(s=>({...s,value:this.fillUnderscore(s.value,t)}))}:n}bindLambdaArgs(n,t){return{...n,body:this.bindLambdaArgsInExpr(n.body,t)}}bindLambdaArgsInExpr(n,t){return n.type==="identifier"&&t.includes(n.name)?{type:"lambdaBinding",name:n.name}:n.type==="func"?{...n,args:n.args.map(s=>({...s,expr:this.bindLambdaArgsInExpr(s.expr,t)}))}:n.type==="list"?{...n,elements:n.elements.map(s=>this.bindLambdaArgsInExpr(s,t))}:n.type==="map"?{...n,entries:n.entries.map(s=>({...s,value:this.bindLambdaArgsInExpr(s.value,t)}))}:n}getInfixPrec(n){switch(n){case"|":return R.PIPE;case"||":case"or":return R.OR;case"&&":case"and":return R.AND;case"==":case"!=":case"eq":case"ne":return R.EQUALITY;case"<":case"<=":case">":case">=":case"lt":case"le":case"gt":case"ge":case"in":case"not in":return R.COMPARISON;case"+":case"-":case"++":return R.ADDITIVE;case"*":case"/":case"//":case"%":return R.MULTIPLICATIVE;case"**":return R.POWER;case".":case"[":return R.POSTFIX;default:return-1}}isRightAssoc(n){return n==="**"}peek(){return this.tokens[this.pos]||{type:"eof",value:"",pos:0}}advance(){return this.tokens[this.pos++]}expect(n){let t=this.peek();if(t.type!==n)throw new Error(`Expected ${n}, got ${t.type}`);return this.advance()}}});U();function E(e,n){return n.length===0?k(e,[]):n.length===1?{type:"Pipe",left:n[0],right:k(e,[])}:{type:"Pipe",left:n[0],right:k(e,n.slice(1))}}var z={add:e=>S("+",e[0],e[1]),sub:e=>S("-",e[0],e[1]),mul:e=>S("*",e[0],e[1]),div:e=>S("/",e[0],e[1]),mod:e=>S("%",e[0],e[1]),idiv:e=>k("floor",[S("/",e[0],e[1])]),pow:e=>E("pow",e),neg:e=>({type:"UnaryOp",op:"-",operand:e[0]}),"==":e=>S("==",e[0],e[1]),"!=":e=>S("!=",e[0],e[1]),"<":e=>S("<",e[0],e[1]),"<=":e=>S("<=",e[0],e[1]),">":e=>S(">",e[0],e[1]),">=":e=>S(">=",e[0],e[1]),eq:e=>S("==",P(e[0]),P(e[1])),ne:e=>S("!=",P(e[0]),P(e[1])),lt:e=>S("<",P(e[0]),P(e[1])),le:e=>S("<=",P(e[0]),P(e[1])),gt:e=>S(">",P(e[0]),P(e[1])),ge:e=>S(">=",P(e[0]),P(e[1])),and:e=>S("and",e[0],e[1]),or:e=>S("or",e[0],e[1]),not:e=>({type:"UnaryOp",op:"not",operand:e[0]}),len:e=>E("length",e),length:e=>E("length",e),upper:e=>E("ascii_upcase",e),lower:e=>E("ascii_downcase",e),trim:e=>E("trim",e),ltrim:e=>e.length===0?k("ltrimstr",[{type:"Literal",value:" "}]):{type:"Pipe",left:e[0],right:k("ltrimstr",[{type:"Literal",value:" "}])},rtrim:e=>e.length===0?k("rtrimstr",[{type:"Literal",value:" "}]):{type:"Pipe",left:e[0],right:k("rtrimstr",[{type:"Literal",value:" "}])},split:e=>E("split",e),join:e=>e.length===1?k("join",[{type:"Literal",value:""}]):E("join",e),concat:e=>S("+",e[0],e[1]),startswith:e=>E("startswith",e),endswith:e=>E("endswith",e),contains:e=>E("contains",e),replace:e=>E("gsub",e),substr:e=>e.length===2?{type:"Slice",base:e[0],start:e[1]}:{type:"Slice",base:e[0],start:e[1],end:S("+",e[1],e[2])},abs:e=>E("fabs",e),floor:e=>E("floor",e),ceil:e=>E("ceil",e),round:e=>E("round",e),sqrt:e=>E("sqrt",e),log:e=>E("log",e),log10:e=>E("log10",e),log2:e=>E("log2",e),exp:e=>E("exp",e),sin:e=>E("sin",e),cos:e=>E("cos",e),tan:e=>E("tan",e),asin:e=>E("asin",e),acos:e=>E("acos",e),atan:e=>E("atan",e),min:e=>E("min",e),max:e=>E("max",e),first:e=>e.length===0?{type:"Index",index:{type:"Literal",value:0}}:{type:"Index",index:{type:"Literal",value:0},base:e[0]},last:e=>e.length===0?{type:"Index",index:{type:"Literal",value:-1}}:{type:"Index",index:{type:"Literal",value:-1},base:e[0]},get:e=>e.length===1?{type:"Index",index:e[0]}:{type:"Index",index:e[1],base:e[0]},slice:e=>e.length===1?{type:"Slice",base:e[0]}:e.length===2?{type:"Slice",base:e[0],start:e[1]}:{type:"Slice",base:e[0],start:e[1],end:e[2]},keys:"keys",values:"values",entries:e=>k("to_entries",e),from_entries:"from_entries",reverse:"reverse",sort:"sort",sort_by:"sort_by",group_by:"group_by",unique:"unique",unique_by:"unique_by",flatten:"flatten",map:e=>({type:"Pipe",left:e[0],right:{type:"Array",elements:e[1]}}),select:e=>k("select",e),empty:()=>k("empty",[]),count:()=>k("length",[]),sum:e=>e.length===0?k("add",[]):{type:"Pipe",left:{type:"Array",elements:e[0]},right:k("add",[])},mean:e=>e.length===0?{type:"Pipe",left:{type:"Identity"},right:S("/",k("add",[]),k("length",[]))}:{type:"Pipe",left:{type:"Array",elements:e[0]},right:S("/",k("add",[]),k("length",[]))},avg:e=>e.length===0?{type:"Pipe",left:{type:"Identity"},right:S("/",k("add",[]),k("length",[]))}:{type:"Pipe",left:{type:"Array",elements:e[0]},right:S("/",k("add",[]),k("length",[]))},type:"type",isnull:e=>e.length===0?S("==",{type:"Identity"},{type:"Literal",value:null}):S("==",e[0],{type:"Literal",value:null}),isempty:e=>e.length===0?S("==",{type:"Identity"},{type:"Literal",value:""}):S("==",e[0],{type:"Literal",value:""}),tonumber:e=>e.length===0?k("tonumber",[]):k("tonumber",e),tostring:e=>e.length===0?k("tostring",[]):k("tostring",e),if:e=>ze(e[0],e[1],e[2]),coalesce:e=>{if(e.length===0)return{type:"Literal",value:null};if(e.length===1)return e[0];let[n,...t]=e,s=S("and",S("!=",n,{type:"Literal",value:null}),S("!=",n,{type:"Literal",value:""}));return ze(s,n,t.length===1?t[0]:z.coalesce(t))},index:()=>({type:"Field",name:"_row_index"}),now:()=>k("now",[]),fmt:e=>k("tostring",e),format:e=>k("tostring",e)};Object.setPrototypeOf(z,null);function S(e,n,t){return{type:"BinaryOp",op:e,left:n,right:t}}function k(e,n){return{type:"Call",name:e,args:n}}var nt="then";function ze(e,n,t){let s=qe({type:"Cond",cond:e,elifs:[],else:t||{type:"Literal",value:null}});return s[nt]=n,s}function P(e){return{type:"Pipe",left:e,right:{type:"Call",name:"tostring",args:[]}}}function F(e,n=!0){switch(e.type){case"int":case"float":return{type:"Literal",value:e.value};case"string":return{type:"Literal",value:e.value};case"bool":return{type:"Literal",value:e.value};case"null":return{type:"Literal",value:null};case"underscore":return{type:"Index",base:{type:"Identity"},index:{type:"Literal",value:"_"}};case"identifier":return n?{type:"Field",name:e.name}:{type:"VarRef",name:e.name};case"lambdaBinding":return{type:"VarRef",name:e.name};case"func":{let t=e.args.map(r=>F(r.expr,n)),s=Object.hasOwn(z,e.name)?z[e.name]:void 0;return typeof s=="function"?s(t):k(typeof s=="string"?s:e.name,t)}case"list":return e.elements.length===0?{type:"Array"}:{type:"Array",elements:e.elements.reduce((t,s,r)=>{let o=F(s,n);return r===0?o:{type:"Comma",left:t,right:o}},null)};case"map":return{type:"Object",entries:e.entries.map(t=>({key:t.key,value:F(t.value,n)}))};case"regex":return{type:"Literal",value:e.pattern};case"slice":return{type:"Slice",start:e.start?F(e.start,n):void 0,end:e.end?F(e.end,n):void 0};case"lambda":return F(e.body,n);case"pipeline":return{type:"Identity"};default:throw new Error(`Unknown moonblade expression type: ${e.type}`)}}function Q(e){let n=[],t=0;for(;t<e.length;){for(;t<e.length&&(e[t]===" "||e[t]===",");)t++;if(t>=e.length)break;let s=t;for(;t<e.length&&/\w/.test(e[t]);)t++;let r=e.slice(s,t);for(;t<e.length&&e[t]===" ";)t++;if(e[t]!=="(")break;t++;let o=1,i=t;for(;t<e.length&&o>0;)e[t]==="("?o++:e[t]===")"&&o--,o>0&&t++;let h=e.slice(i,t).trim();for(t++;t<e.length&&e[t]===" ";)t++;let u="";if(e.slice(t,t+3).toLowerCase()==="as "){for(t+=3;t<e.length&&e[t]===" ";)t++;let p=t;for(;t<e.length&&/\w/.test(e[t]);)t++;u=e.slice(p,t)}u||(u=h?`${r}(${h})`:`${r}()`),n.push({func:r,expr:h,alias:u})}return n}function Ke(e){return/^\w+$/.test(e)}function Z(e,n,t){let s=F(_(n)),r=$(e,s,t);return r.length>0?r[0]:null}function ee(e,n,t={}){let{func:s,expr:r}=n;if(s==="count"&&!r)return e.length;let o;switch(Ke(r)?o=e.map(i=>i[r]).filter(i=>i!=null):o=e.map(i=>Z(i,r,t)).filter(i=>i!=null),s){case"count":return Ke(r)?o.length:o.filter(i=>!!i).length;case"sum":return o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h))).reduce((h,u)=>h+u,0);case"mean":case"avg":{let i=o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h)));return i.length>0?i.reduce((h,u)=>h+u,0)/i.length:0}case"min":{let i=o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h)));return i.length>0?Math.min(...i):null}case"max":{let i=o.map(h=>typeof h=="number"?h:Number.parseFloat(String(h)));return i.length>0?Math.max(...i):null}case"first":return o.length>0?o[0]:null;case"last":return o.length>0?o[o.length-1]:null;case"median":{let i=o.map(u=>typeof u=="number"?u:Number.parseFloat(String(u))).filter(u=>!Number.isNaN(u)).sort((u,p)=>u-p);if(i.length===0)return null;let h=Math.floor(i.length/2);return i.length%2===0?(i[h-1]+i[h])/2:i[h]}case"mode":{let i=new Map;for(let p of o){let l=String(p);i.set(l,(i.get(l)||0)+1)}let h=0,u=null;for(let[p,l]of i)l>h&&(h=l,u=p);return u}case"cardinality":return new Set(o.map(h=>String(h))).size;case"values":return o.map(i=>String(i)).join("|");case"distinct_values":return[...new Set(o.map(h=>String(h)))].sort().join("|");case"all":{if(e.length===0)return!0;for(let i of e)if(!Z(i,r,t))return!1;return!0}case"any":{for(let i of e)if(Z(i,r,t))return!0;return!1}default:return null}}function Ge(e,n,t={}){let s=O();for(let r of n)b(s,r.alias,ee(e,r,t));return s}async function te(e,n){let t="",s=[];for(let l of e)l.startsWith("-")||(t?s.push(l):t=l);if(!t)return{stdout:"",stderr:`xan agg: no aggregation expression
5
+ `,exitCode:1};let{data:r,error:o}=await v(s,n);if(o)return o;let i={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},h=Q(t),u=h.map(l=>l.alias),p=Ge(r,h,i);return{stdout:w(u,[p]),stderr:"",exitCode:0}}async function ne(e,n){let t="",s="",r=[];for(let d=0;d<e.length;d++){let m=e[d];m==="--sorted"||m.startsWith("-")||(t?s?r.push(m):s=m:t=m)}if(!t||!s)return{stdout:"",stderr:`xan groupby: usage: xan groupby COLS EXPR [FILE]
6
+ `,exitCode:1};let{data:o,error:i}=await v(r,n);if(i)return i;let h={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},u=t.split(","),p=Q(s),l=[],f=new Map;for(let d of o){let m=u.map(g=>String(d[g])).join("\0");f.has(m)||(f.set(m,[]),l.push(m)),f.get(m)?.push(d)}let c=[...u,...p.map(d=>d.alias)],a=[];for(let d of l){let m=f.get(d);if(!m)continue;let g=O();for(let y of u)b(g,y,m[0][y]);for(let y of p)b(g,y.alias,ee(m,y,h));a.push(g)}return{stdout:w(c,a),stderr:"",exitCode:0}}async function se(e,n){let t=[],s="",r=10,o=!1,i=[];for(let a=0;a<e.length;a++){let d=e[a];(d==="-s"||d==="--select")&&a+1<e.length?t=e[++a].split(","):(d==="-g"||d==="--groupby")&&a+1<e.length?s=e[++a]:(d==="-l"||d==="--limit")&&a+1<e.length?r=Number.parseInt(e[++a],10):d==="--no-extra"?o=!0:d==="-A"||d==="--all"?r=0:d.startsWith("-")||i.push(d)}let{headers:h,data:u,error:p}=await v(i,n);if(p)return p;let l=t.length>0?t:h.filter(a=>a!==s);s&&t.length===0&&(l=h.filter(a=>a!==s));let f=[],c=s?["field",s,"value","count"]:["field","value","count"];if(s){let a=new Map;for(let d of u){let m=String(d[s]??"");a.has(m)||a.set(m,[]),a.get(m)?.push(d)}for(let d of l)for(let[m,g]of a){let y=new Map;for(let I of g){let N=I[d],C=N===""||N===null||N===void 0?"":String(N);y.set(C,(y.get(C)||0)+1)}let x=[...y.entries()].sort((I,N)=>N[1]!==I[1]?N[1]-I[1]:I[0].localeCompare(N[0]));o&&(x=x.filter(([I])=>I!=="")),r>0&&(x=x.slice(0,r));for(let[I,N]of x)f.push({field:d,[s]:m,value:I===""?"<empty>":I,count:N})}}else for(let a of l){let d=new Map;for(let g of u){let y=g[a],x=y===""||y===null||y===void 0?"":String(y);d.set(x,(d.get(x)||0)+1)}let m=[...d.entries()].sort((g,y)=>y[1]!==g[1]?y[1]-g[1]:g[0].localeCompare(y[0]));o&&(m=m.filter(([g])=>g!=="")),r>0&&(m=m.slice(0,r));for(let[g,y]of m)f.push({field:a,value:g===""?"<empty>":g,count:y})}return{stdout:w(c,f),stderr:"",exitCode:0}}async function re(e,n){let t=[],s=[];for(let l=0;l<e.length;l++){let f=e[l];f==="-s"&&l+1<e.length?t=e[++l].split(","):f.startsWith("-")||s.push(f)}let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=t.length>0?t:r,u=["field","type","count","min","max","mean"],p=[];for(let l of h){let f=o.map(d=>d[l]).filter(d=>d!=null),c=f.map(d=>typeof d=="number"?d:Number.parseFloat(String(d))).filter(d=>!Number.isNaN(d)),a=c.length===f.length&&c.length>0;p.push({field:l,type:a?"Number":"String",count:f.length,min:a?Math.min(...c):"",max:a?Math.max(...c):"",mean:a?Math.round(c.reduce((d,m)=>d+m,0)/c.length*1e10)/1e10:""})}return{stdout:w(u,p),stderr:"",exitCode:0}}U();function Xe(e){let n=_(e);return F(n)}function st(e){let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return H(`^${t}$`)}function K(e,n){let t=[],s=new Set;for(let r of e.split(",")){let o=r.trim();if(o.startsWith("!")){let p=o.slice(1),l=K(p,n);for(let f of l)s.add(f);continue}if(o==="*"){for(let p of n)t.includes(p)||t.push(p);continue}if(o.includes("*")){let p=st(o);for(let l of n)p.test(l)&&!t.includes(l)&&t.push(l);continue}let i=o.match(/^([^:]*):([^:]*)$/);if(i&&(i[1]||i[2])){let p=i[1],l=i[2],f=p?n.indexOf(p):0,c=l?n.indexOf(l):n.length-1;if(f!==-1&&c!==-1){let a=f<=c?1:-1;for(let d=f;a>0?d<=c:d>=c;d+=a)t.includes(n[d])||t.push(n[d])}continue}let h=o.match(/^(\d+)-(\d+)$/);if(h){let p=Number.parseInt(h[1],10),l=Number.parseInt(h[2],10);for(let f=p;f<=l&&f<n.length;f++)t.push(n[f]);continue}let u=Number.parseInt(o,10);if(!Number.isNaN(u)&&u>=0&&u<n.length){t.push(n[u]);continue}n.includes(o)&&t.push(o)}return s.size>0?t.filter(r=>!s.has(r)):t}async function oe(e,n){let t="",s=[];for(let p of e)p.startsWith("-")||(t?s.push(p):t=p);if(!t)return{stdout:"",stderr:`xan select: no columns specified
7
+ `,exitCode:1};let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=K(t,r),u=o.map(p=>{let l=O();for(let f of h)b(l,f,p[f]);return l});return{stdout:w(h,u),stderr:"",exitCode:0}}async function ie(e,n){let t="",s=[];for(let l of e)l.startsWith("-")||(t?s.push(l):t=l);if(!t)return{stdout:"",stderr:`xan drop: no columns specified
8
+ `,exitCode:1};let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=new Set(K(t,r)),u=r.filter(l=>!h.has(l)),p=o.map(l=>{let f=O();for(let c of u)b(f,c,l[c]);return f});return{stdout:w(u,p),stderr:"",exitCode:0}}async function ae(e,n){let t="",s="",r=[];for(let l=0;l<e.length;l++){let f=e[l];f==="-s"&&l+1<e.length?s=e[++l]:f.startsWith("-")||(t?r.push(f):t=f)}if(!t)return{stdout:"",stderr:`xan rename: no new name(s) specified
9
+ `,exitCode:1};let{headers:o,data:i,error:h}=await v(r,n);if(h)return h;let u;if(s){let l=s.split(","),f=t.split(","),c=new Map;for(let a=0;a<l.length&&a<f.length;a++)c.set(l[a],f[a]);u=o.map(a=>c.get(a)||a)}else{let l=t.split(",");u=o.map((f,c)=>c<l.length?l[c]:f)}let p=i.map(l=>{let f=O();for(let c=0;c<o.length;c++)b(f,u[c],l[o[c]]);return f});return{stdout:w(u,p),stderr:"",exitCode:0}}async function le(e,n){let t="index",s=[];for(let p=0;p<e.length;p++)e[p]==="-c"&&p+1<e.length?t=e[++p]:s.push(e[p]);let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=[t,...r],u=o.map((p,l)=>{let f=O();b(f,t,l);for(let c of r)b(f,c,p[c]);return f});return{stdout:w(h,u),stderr:"",exitCode:0}}async function ue(e,n){let t=e.includes("-j")||e.includes("--just-names"),{headers:s,error:r}=await v(e.filter(i=>i!=="-j"&&i!=="--just-names"),n);return r||{stdout:t?`${s.map(i=>i).join(`
10
10
  `)}
11
11
  `:`${s.map((i,h)=>`${h} ${i}`).join(`
12
12
  `)}
13
13
  `,stderr:"",exitCode:0}}async function ce(e,n){let{data:t,error:s}=await v(e,n);return s||{stdout:`${t.length}
14
- `,stderr:"",exitCode:0}}async function pe(e,n){let t=10,s=[];for(let u=0;u<e.length;u++)(e[u]==="-l"||e[u]==="-n")&&u+1<e.length?t=Number.parseInt(e[++u],10):s.push(e[u]);let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=o.slice(0,t);return{stdout:w(r,h),stderr:"",exitCode:0}}async function fe(e,n){let t=10,s=[];for(let u=0;u<e.length;u++)(e[u]==="-l"||e[u]==="-n")&&u+1<e.length?t=Number.parseInt(e[++u],10):s.push(e[u]);let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=o.slice(-t);return{stdout:w(r,h),stderr:"",exitCode:0}}async function de(e,n){let t,s,r,o=[];for(let c=0;c<e.length;c++){let a=e[c];(a==="-s"||a==="--start")&&c+1<e.length?t=Number.parseInt(e[++c],10):(a==="-e"||a==="--end")&&c+1<e.length?s=Number.parseInt(e[++c],10):(a==="-l"||a==="--len")&&c+1<e.length?r=Number.parseInt(e[++c],10):a.startsWith("-")||o.push(a)}let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;let p=t??0,l;r!==void 0?l=p+r:s!==void 0?l=s:l=h.length;let f=h.slice(p,l);return{stdout:w(i,f),stderr:"",exitCode:0}}async function he(e,n){let{headers:t,data:s,error:r}=await v(e,n);if(r)return r;let o=[...s].reverse();return{stdout:w(t,o),stderr:"",exitCode:0}}var me=Ze(et(),1);async function ge(e,n){let t=e.filter(p=>!p.startsWith("-")),{headers:s,data:r,error:o}=await v(t,n);if(o)return o;if(r.length===0){let p=["column"],l=s.map(f=>({column:f}));return{stdout:w(p,l),stderr:"",exitCode:0}}let i=s[0],h=[i,...r.map((p,l)=>String(p[i]??`row_${l}`))],u=[];for(let p=1;p<s.length;p++){let l=s[p],f=F();b(f,i,l);for(let c=0;c<r.length;c++)b(f,h[c+1],r[c][l]);u.push(f)}return{stdout:w(h,u),stderr:"",exitCode:0}}async function ye(e,n){let t=null,s=[];for(let l=0;l<e.length;l++){let f=e[l];f==="--seed"&&l+1<e.length?t=Number.parseInt(e[++l],10):f.startsWith("-")||s.push(f)}let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=t!==null?t:Date.now(),u=()=>(h=h*1103515245+12345&2147483647,h/2147483647),p=[...o];for(let l=p.length-1;l>0;l--){let f=Math.floor(u()*(l+1));[p[l],p[f]]=[p[f],p[l]]}return{stdout:w(r,p),stderr:"",exitCode:0}}async function xe(e,n){let t=null,s="",r=[];for(let a=0;a<e.length;a++){let d=e[a];(d==="-l"||d==="--length")&&a+1<e.length?t=Number.parseInt(e[++a],10):(d==="-d"||d==="--default")&&a+1<e.length?s=e[++a]:d.startsWith("-")||r.push(d)}let o=r[0],i;if(!o||o==="-")i=n.stdin;else try{let a=n.fs.resolvePath(n.cwd,o);i=await n.fs.readFile(a)}catch{return{stdout:"",stderr:`xan fixlengths: ${o}: No such file or directory
14
+ `,stderr:"",exitCode:0}}async function pe(e,n){let t=10,s=[];for(let u=0;u<e.length;u++)(e[u]==="-l"||e[u]==="-n")&&u+1<e.length?t=Number.parseInt(e[++u],10):s.push(e[u]);let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=o.slice(0,t);return{stdout:w(r,h),stderr:"",exitCode:0}}async function fe(e,n){let t=10,s=[];for(let u=0;u<e.length;u++)(e[u]==="-l"||e[u]==="-n")&&u+1<e.length?t=Number.parseInt(e[++u],10):s.push(e[u]);let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=o.slice(-t);return{stdout:w(r,h),stderr:"",exitCode:0}}async function de(e,n){let t,s,r,o=[];for(let c=0;c<e.length;c++){let a=e[c];(a==="-s"||a==="--start")&&c+1<e.length?t=Number.parseInt(e[++c],10):(a==="-e"||a==="--end")&&c+1<e.length?s=Number.parseInt(e[++c],10):(a==="-l"||a==="--len")&&c+1<e.length?r=Number.parseInt(e[++c],10):a.startsWith("-")||o.push(a)}let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;let p=t??0,l;r!==void 0?l=p+r:s!==void 0?l=s:l=h.length;let f=h.slice(p,l);return{stdout:w(i,f),stderr:"",exitCode:0}}async function he(e,n){let{headers:t,data:s,error:r}=await v(e,n);if(r)return r;let o=[...s].reverse();return{stdout:w(t,o),stderr:"",exitCode:0}}var me=Qe(tt(),1);async function ge(e,n){let t=e.filter(p=>!p.startsWith("-")),{headers:s,data:r,error:o}=await v(t,n);if(o)return o;if(r.length===0){let p=["column"],l=s.map(f=>({column:f}));return{stdout:w(p,l),stderr:"",exitCode:0}}let i=s[0],h=[i,...r.map((p,l)=>String(p[i]??`row_${l}`))],u=[];for(let p=1;p<s.length;p++){let l=s[p],f=O();b(f,i,l);for(let c=0;c<r.length;c++)b(f,h[c+1],r[c][l]);u.push(f)}return{stdout:w(h,u),stderr:"",exitCode:0}}async function ye(e,n){let t=null,s=[];for(let l=0;l<e.length;l++){let f=e[l];f==="--seed"&&l+1<e.length?t=Number.parseInt(e[++l],10):f.startsWith("-")||s.push(f)}let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=t!==null?t:Date.now(),u=()=>(h=h*1103515245+12345&2147483647,h/2147483647),p=[...o];for(let l=p.length-1;l>0;l--){let f=Math.floor(u()*(l+1));[p[l],p[f]]=[p[f],p[l]]}return{stdout:w(r,p),stderr:"",exitCode:0}}async function xe(e,n){let t=null,s="",r=[];for(let a=0;a<e.length;a++){let d=e[a];(d==="-l"||d==="--length")&&a+1<e.length?t=Number.parseInt(e[++a],10):(d==="-d"||d==="--default")&&a+1<e.length?s=e[++a]:d.startsWith("-")||r.push(d)}let o=r[0],i;if(!o||o==="-")i=n.stdin;else try{let a=n.fs.resolvePath(n.cwd,o);i=await n.fs.readFile(a)}catch{return{stdout:"",stderr:`xan fixlengths: ${o}: No such file or directory
15
15
  `,exitCode:1}}let u=me.default.parse(i.trim(),{header:!1,skipEmptyLines:!0}).data;if(u.length===0)return{stdout:"",stderr:"",exitCode:0};let p=Math.max(...u.map(a=>a.length)),l=t??p,f=u.map(a=>a.length===l?a:a.length<l?[...a,...Array(l-a.length).fill(s)]:a.slice(0,l));return{stdout:`${me.default.unparse(f).replace(/\r\n/g,`
16
16
  `)}
17
17
  `,stderr:"",exitCode:0}}async function we(e,n){let t=null,s=null,r=".",o=[];for(let c=0;c<e.length;c++){let a=e[c];(a==="-c"||a==="--chunks")&&c+1<e.length?t=Number.parseInt(e[++c],10):(a==="-S"||a==="--size")&&c+1<e.length?s=Number.parseInt(e[++c],10):(a==="-o"||a==="--output")&&c+1<e.length?r=e[++c]:a.startsWith("-")||o.push(a)}if(!t&&!s)return{stdout:"",stderr:`xan split: must specify -c or -S
@@ -24,41 +24,41 @@ import{a as F,b,c as M,d as qe,e as w,f as v,g as X,h as Y}from"./chunk-F55TLFGB
24
24
  `,stderr:"",exitCode:0}}catch{return{stdout:`${Array.from(u.entries()).map(([l,f])=>`${l}: ${f.length} rows`).join(`
25
25
  `)}
26
26
  `,stderr:"",exitCode:0}}}async function Ce(e,n){if(e.length===0)return{stdout:"",stderr:`xan to: usage: xan to <format> [FILE]
27
- `,exitCode:1};let t=e[0],s=e.slice(1);return t==="json"?st(s,n):{stdout:"",stderr:`xan to: unsupported format '${t}'
28
- `,exitCode:1}}async function st(e,n){let t=e.filter(i=>!i.startsWith("-")),{data:s,error:r}=await v(t,n);return r||{stdout:`${JSON.stringify(s,null,2)}
29
- `,stderr:"",exitCode:0}}async function be(e,n){let t="",s=[];for(let r=0;r<e.length;r++){let o=e[r];(o==="-f"||o==="--format")&&r+1<e.length?t=e[++r]:o.startsWith("-")||s.push(o)}return t?t==="json"?rt(s,n):{stdout:"",stderr:`xan from: unsupported format '${t}'
27
+ `,exitCode:1};let t=e[0],s=e.slice(1);return t==="json"?rt(s,n):{stdout:"",stderr:`xan to: unsupported format '${t}'
28
+ `,exitCode:1}}async function rt(e,n){let t=e.filter(i=>!i.startsWith("-")),{data:s,error:r}=await v(t,n);return r||{stdout:`${JSON.stringify(s,null,2)}
29
+ `,stderr:"",exitCode:0}}async function be(e,n){let t="",s=[];for(let r=0;r<e.length;r++){let o=e[r];(o==="-f"||o==="--format")&&r+1<e.length?t=e[++r]:o.startsWith("-")||s.push(o)}return t?t==="json"?ot(s,n):{stdout:"",stderr:`xan from: unsupported format '${t}'
30
30
  `,exitCode:1}:{stdout:"",stderr:`xan from: usage: xan from -f <format> [FILE]
31
- `,exitCode:1}}async function rt(e,n){let t=e[0],s;if(!t||t==="-")s=n.stdin;else try{let r=n.fs.resolvePath(n.cwd,t);s=await n.fs.readFile(r)}catch{return{stdout:"",stderr:`xan from: ${t}: No such file or directory
31
+ `,exitCode:1}}async function ot(e,n){let t=e[0],s;if(!t||t==="-")s=n.stdin;else try{let r=n.fs.resolvePath(n.cwd,t);s=await n.fs.readFile(r)}catch{return{stdout:"",stderr:`xan from: ${t}: No such file or directory
32
32
  `,exitCode:1}}try{let r=JSON.parse(s.trim());if(!Array.isArray(r))return{stdout:"",stderr:`xan from: JSON input must be an array
33
33
  `,exitCode:1};if(r.length===0)return{stdout:`
34
- `,stderr:"",exitCode:0};if(Array.isArray(r[0])){let[i,...h]=r,u=h.map(p=>{let l=F();for(let f=0;f<i.length;f++)b(l,i[f],p[f]);return l});return{stdout:w(i,u),stderr:"",exitCode:0}}let o=Object.keys(r[0]).sort();return{stdout:w(o,r),stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`xan from: invalid JSON input
34
+ `,stderr:"",exitCode:0};if(Array.isArray(r[0])){let[i,...h]=r,u=h.map(p=>{let l=O();for(let f=0;f<i.length;f++)b(l,i[f],p[f]);return l});return{stdout:w(i,u),stderr:"",exitCode:0}}let o=Object.keys(r[0]).sort();return{stdout:w(o,r),stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`xan from: invalid JSON input
35
35
  `,exitCode:1}}}async function Se(e,n){let t=!1,s=0,r="",o=[];for(let c=0;c<e.length;c++){let a=e[c];if(a==="-v"||a==="--invert")t=!0;else if((a==="-l"||a==="--limit")&&c+1<e.length)s=Number.parseInt(e[++c],10);else{if(a==="--help")return D({name:"xan filter",summary:"Filter rows by expression",usage:"xan filter [OPTIONS] EXPR [FILE]",description:"Filter CSV rows using moonblade expressions.",options:["-v, --invert invert match","-l, --limit N limit output to N rows"," --help display help"]});a.startsWith("-")||(r?o.push(a):r=a)}}if(!r)return{stdout:"",stderr:`xan filter: no expression specified
36
- `,exitCode:1};let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;let p={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},l=Ge(r),f=[];for(let c of h){if(s>0&&f.length>=s)break;let a=$(c,l,p),d=a.length>0&&a.some(m=>!!m);(t?!d:d)&&f.push(c)}return{stdout:w(i,f),stderr:"",exitCode:0}}async function Ie(e,n){let t="",s=!1,r=!1,o=[];for(let l=0;l<e.length;l++){let f=e[l];f==="-N"||f==="--numeric"?s=!0:f==="-R"||f==="-r"||f==="--reverse"?r=!0:f==="-s"&&l+1<e.length?t=e[++l]:f.startsWith("-")||o.push(f)}let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;!t&&i.length>0&&(t=i[0]);let p=[...h].sort((l,f)=>{let c=l[t],a=f[t],d;if(s){let m=typeof c=="number"?c:Number.parseFloat(String(c)),g=typeof a=="number"?a:Number.parseFloat(String(a));d=m-g}else d=String(c).localeCompare(String(a));return r?-d:d});return{stdout:w(i,p),stderr:"",exitCode:0}}async function ke(e,n){let t="",s=[];for(let p=0;p<e.length;p++){let l=e[p];l==="-s"&&p+1<e.length?t=e[++p]:l.startsWith("-")||s.push(l)}let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=new Set,u=o.filter(p=>{let l=t?String(p[t]):JSON.stringify(p);return h.has(l)?!1:(h.add(l),!0)});return{stdout:w(r,u),stderr:"",exitCode:0}}async function Ne(e,n){let t=10,s="",r=!1,o=[];for(let f=0;f<e.length;f++){let c=e[f];(c==="-l"||c==="-n")&&f+1<e.length?t=Number.parseInt(e[++f],10):c==="-R"||c==="-r"||c==="--reverse"?r=!0:c.startsWith("-")||(s?o.push(c):s=c)}let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;!s&&i.length>0&&(s=i[0]);let l=[...h].sort((f,c)=>{let a=f[s],d=c[s],m=typeof a=="number"?a:Number.parseFloat(String(a)),g=typeof d=="number"?d:Number.parseFloat(String(d));return r?m-g:g-m}).slice(0,t);return{stdout:w(i,l),stderr:"",exitCode:0}}U();async function Ee(e,n){let t="",s=!1,r=!1,o=[];for(let d=0;d<e.length;d++){let m=e[d];m==="-O"||m==="--overwrite"?s=!0:m==="--filter"?r=!0:m.startsWith("-")||(t?o.push(m):t=m)}if(!t)return{stdout:"",stderr:`xan map: no expression specified
37
- `,exitCode:1};let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;let l=V(t).map(({expr:d,name:m})=>({alias:typeof m=="string"?m:m[0],ast:O(d)})),f={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},c;if(s){c=[...i];for(let d of l)i.includes(d.alias)||c.push(d.alias)}else c=[...i,...l.map(d=>d.alias)];let a=[];for(let d=0;d<h.length;d++){let m=h[d],g=M(m),y=!1,x=Object.assign(G(m),{_row_index:d});for(let I of l){let N=$(x,I.ast,f),C=N.length>0?N[0]:null;if(r&&C==null){y=!0;break}b(g,I.alias,C)}y||a.push(g)}return{stdout:w(c,a),stderr:"",exitCode:0}}async function Ae(e,n){let t="",s="",r="",o=[];for(let m=0;m<e.length;m++){let g=e[m];(g==="-r"||g==="--rename")&&m+1<e.length?r=e[++m]:g.startsWith("-")||(t?s?o.push(g):s=g:t=g)}if(!t||!s)return{stdout:"",stderr:`xan transform: usage: xan transform COLUMN EXPR [FILE]
36
+ `,exitCode:1};let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;let p={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},l=Xe(r),f=[];for(let c of h){if(s>0&&f.length>=s)break;let a=$(c,l,p),d=a.length>0&&a.some(m=>!!m);(t?!d:d)&&f.push(c)}return{stdout:w(i,f),stderr:"",exitCode:0}}async function Ie(e,n){let t="",s=!1,r=!1,o=[];for(let l=0;l<e.length;l++){let f=e[l];f==="-N"||f==="--numeric"?s=!0:f==="-R"||f==="-r"||f==="--reverse"?r=!0:f==="-s"&&l+1<e.length?t=e[++l]:f.startsWith("-")||o.push(f)}let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;!t&&i.length>0&&(t=i[0]);let p=[...h].sort((l,f)=>{let c=l[t],a=f[t],d;if(s){let m=typeof c=="number"?c:Number.parseFloat(String(c)),g=typeof a=="number"?a:Number.parseFloat(String(a));d=m-g}else d=String(c).localeCompare(String(a));return r?-d:d});return{stdout:w(i,p),stderr:"",exitCode:0}}async function ke(e,n){let t="",s=[];for(let p=0;p<e.length;p++){let l=e[p];l==="-s"&&p+1<e.length?t=e[++p]:l.startsWith("-")||s.push(l)}let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let h=new Set,u=o.filter(p=>{let l=t?String(p[t]):JSON.stringify(p);return h.has(l)?!1:(h.add(l),!0)});return{stdout:w(r,u),stderr:"",exitCode:0}}async function Ne(e,n){let t=10,s="",r=!1,o=[];for(let f=0;f<e.length;f++){let c=e[f];(c==="-l"||c==="-n")&&f+1<e.length?t=Number.parseInt(e[++f],10):c==="-R"||c==="-r"||c==="--reverse"?r=!0:c.startsWith("-")||(s?o.push(c):s=c)}let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;!s&&i.length>0&&(s=i[0]);let l=[...h].sort((f,c)=>{let a=f[s],d=c[s],m=typeof a=="number"?a:Number.parseFloat(String(a)),g=typeof d=="number"?d:Number.parseFloat(String(d));return r?m-g:g-m}).slice(0,t);return{stdout:w(i,l),stderr:"",exitCode:0}}U();async function Ee(e,n){let t="",s=!1,r=!1,o=[];for(let d=0;d<e.length;d++){let m=e[d];m==="-O"||m==="--overwrite"?s=!0:m==="--filter"?r=!0:m.startsWith("-")||(t?o.push(m):t=m)}if(!t)return{stdout:"",stderr:`xan map: no expression specified
37
+ `,exitCode:1};let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;let l=V(t).map(({expr:d,name:m})=>({alias:typeof m=="string"?m:m[0],ast:F(d)})),f={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},c;if(s){c=[...i];for(let d of l)i.includes(d.alias)||c.push(d.alias)}else c=[...i,...l.map(d=>d.alias)];let a=[];for(let d=0;d<h.length;d++){let m=h[d],g=M(m),y=!1,x=Object.assign(X(m),{_row_index:d});for(let I of l){let N=$(x,I.ast,f),C=N.length>0?N[0]:null;if(r&&C==null){y=!0;break}b(g,I.alias,C)}y||a.push(g)}return{stdout:w(c,a),stderr:"",exitCode:0}}async function Ae(e,n){let t="",s="",r="",o=[];for(let m=0;m<e.length;m++){let g=e[m];(g==="-r"||g==="--rename")&&m+1<e.length?r=e[++m]:g.startsWith("-")||(t?s?o.push(g):s=g:t=g)}if(!t||!s)return{stdout:"",stderr:`xan transform: usage: xan transform COLUMN EXPR [FILE]
38
38
  `,exitCode:1};let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;let p=t.split(",").map(m=>m.trim()),l=r?r.split(",").map(m=>m.trim()):[];for(let m of p)if(!i.includes(m))return{stdout:"",stderr:`xan transform: column '${m}' not found
39
- `,exitCode:1};let f=O(V(s)[0]?.expr||(U(),Qe(He)).parseMoonblade(s)),c={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},a=i.map(m=>{let g=p.indexOf(m);return g!==-1&&l[g]?l[g]:m}),d=[];for(let m of h){let g=M(m);for(let y=0;y<p.length;y++){let x=p[y],I=Object.assign(G(m),{_:m[x]}),N=$(I,f,c),C=N.length>0?N[0]:null,A=l[y]||x;A!==x&&delete g[x],b(g,A,C)}d.push(g)}return{stdout:w(a,d),stderr:"",exitCode:0}}async function Fe(e,n){let t="",s="|",r=!1,o="",i=[];for(let a=0;a<e.length;a++){let d=e[a];(d==="-s"||d==="--separator")&&a+1<e.length?s=e[++a]:d==="--drop-empty"?r=!0:(d==="-r"||d==="--rename")&&a+1<e.length?o=e[++a]:d.startsWith("-")||(t?i.push(d):t=d)}if(!t)return{stdout:"",stderr:`xan explode: usage: xan explode COLUMN [FILE]
39
+ `,exitCode:1};let f=F(V(s)[0]?.expr||(U(),et(Je)).parseMoonblade(s)),c={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},a=i.map(m=>{let g=p.indexOf(m);return g!==-1&&l[g]?l[g]:m}),d=[];for(let m of h){let g=M(m);for(let y=0;y<p.length;y++){let x=p[y],I=Object.assign(X(m),{_:m[x]}),N=$(I,f,c),C=N.length>0?N[0]:null,A=l[y]||x;A!==x&&delete g[x],b(g,A,C)}d.push(g)}return{stdout:w(a,d),stderr:"",exitCode:0}}async function Oe(e,n){let t="",s="|",r=!1,o="",i=[];for(let a=0;a<e.length;a++){let d=e[a];(d==="-s"||d==="--separator")&&a+1<e.length?s=e[++a]:d==="--drop-empty"?r=!0:(d==="-r"||d==="--rename")&&a+1<e.length?o=e[++a]:d.startsWith("-")||(t?i.push(d):t=d)}if(!t)return{stdout:"",stderr:`xan explode: usage: xan explode COLUMN [FILE]
40
40
  `,exitCode:1};let{headers:h,data:u,error:p}=await v(i,n);if(p)return p;if(!h.includes(t))return{stdout:"",stderr:`xan explode: column '${t}' not found
41
- `,exitCode:1};let l=o?h.map(a=>a===t?o:a):h,f=o||t,c=[];for(let a of u){let d=a[t],m=d==null?"":String(d);if(m===""){if(!r){let g=M(a);o&&(delete g[t],b(g,f,"")),c.push(g)}}else{let g=m.split(s);for(let y of g){let x=M(a);o&&delete x[t],b(x,f,y),c.push(x)}}}return{stdout:w(l,c),stderr:"",exitCode:0}}async function Oe(e,n){let t="",s="|",r="",o=[];for(let g=0;g<e.length;g++){let y=e[g];(y==="-s"||y==="--sep")&&g+1<e.length?s=e[++g]:(y==="-r"||y==="--rename")&&g+1<e.length?r=e[++g]:y.startsWith("-")||(t?o.push(y):t=y)}if(!t)return{stdout:"",stderr:`xan implode: usage: xan implode COLUMN [FILE]
41
+ `,exitCode:1};let l=o?h.map(a=>a===t?o:a):h,f=o||t,c=[];for(let a of u){let d=a[t],m=d==null?"":String(d);if(m===""){if(!r){let g=M(a);o&&(delete g[t],b(g,f,"")),c.push(g)}}else{let g=m.split(s);for(let y of g){let x=M(a);o&&delete x[t],b(x,f,y),c.push(x)}}}return{stdout:w(l,c),stderr:"",exitCode:0}}async function Fe(e,n){let t="",s="|",r="",o=[];for(let g=0;g<e.length;g++){let y=e[g];(y==="-s"||y==="--sep")&&g+1<e.length?s=e[++g]:(y==="-r"||y==="--rename")&&g+1<e.length?r=e[++g]:y.startsWith("-")||(t?o.push(y):t=y)}if(!t)return{stdout:"",stderr:`xan implode: usage: xan implode COLUMN [FILE]
42
42
  `,exitCode:1};let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;if(!i.includes(t))return{stdout:"",stderr:`xan implode: column '${t}' not found
43
43
  `,exitCode:1};let p=i.filter(g=>g!==t),l=r?i.map(g=>g===t?r:g):i,f=r||t,c=[],a=null,d=[],m=null;for(let g of h){let y=p.map(N=>String(g[N]??"")).join("\0"),x=g[t],I=x==null?"":String(x);if(y!==a){if(m!==null){let N=M(m);r&&delete N[t],b(N,f,d.join(s)),c.push(N)}a=y,d=[I],m=g}else d.push(I)}if(m!==null){let g=M(m);r&&delete g[t],b(g,f,d.join(s)),c.push(g)}return{stdout:w(l,c),stderr:"",exitCode:0}}async function Le(e,n){let t="",s="",r="",o="",i="inner",h="",u=0;for(let C=0;C<e.length;C++){let A=e[C];A==="--left"?i="left":A==="--right"?i="right":A==="--full"?i="full":(A==="-D"||A==="--default")&&C+1<e.length?h=e[++C]:A.startsWith("-")||(u++,u===1?t=A:u===2?s=A:u===3?r=A:u===4&&(o=A))}if(!t||!s||!r||!o)return{stdout:"",stderr:`xan join: usage: xan join KEY1 FILE1 KEY2 FILE2 [OPTIONS]
44
44
  `,exitCode:1};let p=await v([s],n);if(p.error)return p.error;let l=await v([o],n);if(l.error)return l.error;let{headers:f,data:c}=p,{headers:a,data:d}=l;if(!f.includes(t))return{stdout:"",stderr:`xan join: column '${t}' not found in first file
45
45
  `,exitCode:1};if(!a.includes(r))return{stdout:"",stderr:`xan join: column '${r}' not found in second file
46
- `,exitCode:1};let m=new Map;for(let C of d){let A=String(C[r]??"");m.has(A)||m.set(A,[]),m.get(A)?.push(C)}let g=new Set(f),y=a.filter(C=>!g.has(C)),x=[...f,...y],I=[],N=new Set;for(let C of c){let A=String(C[t]??""),j=m.get(A);if(j&&j.length>0){N.add(A);for(let L of j){let T=F();for(let W of f)b(T,W,C[W]);for(let W of y)b(T,W,L[W]);I.push(T)}}else if(i==="left"||i==="full"){let L=F();for(let T of f)b(L,T,C[T]);for(let T of y)b(L,T,h);I.push(L)}}if(i==="right"||i==="full")for(let C of d){let A=String(C[r]??"");if(!N.has(A)){let j=F();for(let L of f)b(j,L,a.includes(L)?C[L]:h);for(let L of y)b(j,L,C[L]);I.push(j)}}return{stdout:w(x,I),stderr:"",exitCode:0}}async function Pe(e,n){let t="",s="",r=[],o=[];for(let y=0;y<e.length;y++){let x=e[y];(x==="-g"||x==="--groupby")&&y+1<e.length?r=e[++y].split(",").map(I=>I.trim()):x.startsWith("-")||(t?s?o.push(x):s=x:t=x)}if(!t||!s)return{stdout:"",stderr:`xan pivot: usage: xan pivot COLUMN AGG_EXPR [OPTIONS] [FILE]
46
+ `,exitCode:1};let m=new Map;for(let C of d){let A=String(C[r]??"");m.has(A)||m.set(A,[]),m.get(A)?.push(C)}let g=new Set(f),y=a.filter(C=>!g.has(C)),x=[...f,...y],I=[],N=new Set;for(let C of c){let A=String(C[t]??""),j=m.get(A);if(j&&j.length>0){N.add(A);for(let L of j){let T=O();for(let W of f)b(T,W,C[W]);for(let W of y)b(T,W,L[W]);I.push(T)}}else if(i==="left"||i==="full"){let L=O();for(let T of f)b(L,T,C[T]);for(let T of y)b(L,T,h);I.push(L)}}if(i==="right"||i==="full")for(let C of d){let A=String(C[r]??"");if(!N.has(A)){let j=O();for(let L of f)b(j,L,a.includes(L)?C[L]:h);for(let L of y)b(j,L,C[L]);I.push(j)}}return{stdout:w(x,I),stderr:"",exitCode:0}}async function Pe(e,n){let t="",s="",r=[],o=[];for(let y=0;y<e.length;y++){let x=e[y];(x==="-g"||x==="--groupby")&&y+1<e.length?r=e[++y].split(",").map(I=>I.trim()):x.startsWith("-")||(t?s?o.push(x):s=x:t=x)}if(!t||!s)return{stdout:"",stderr:`xan pivot: usage: xan pivot COLUMN AGG_EXPR [OPTIONS] [FILE]
47
47
  `,exitCode:1};let{headers:i,data:h,error:u}=await v(o,n);if(u)return u;if(!i.includes(t))return{stdout:"",stderr:`xan pivot: column '${t}' not found
48
48
  `,exitCode:1};let p=s.match(/^(\w+)\((\w+)\)$/);if(!p)return{stdout:"",stderr:`xan pivot: invalid aggregation expression '${s}'
49
- `,exitCode:1};let[,l,f]=p;r.length===0&&(r=i.filter(y=>y!==t&&y!==f));let c=[];for(let y of h){let x=String(y[t]??"");c.includes(x)||c.push(x)}let a=new Map,d=[];for(let y of h){let x=r.map(A=>String(y[A]??"")).join("\0"),I=String(y[t]??""),N=y[f];a.has(x)||(a.set(x,new Map),d.push(x));let C=a.get(x);C&&(C.has(I)||C.set(I,[]),C.get(I)?.push(N))}let m=[...r,...c],g=[];for(let y of d){let x=y.split("\0"),I=a.get(y);if(!I)continue;let N=F();for(let C=0;C<r.length;C++)b(N,r[C],x[C]);for(let C of c){let A=I.get(C)||[];b(N,C,ot(l,A))}g.push(N)}return{stdout:w(m,g),stderr:"",exitCode:0}}function ot(e,n){let t=n.filter(s=>s!=null).map(s=>typeof s=="number"?s:Number.parseFloat(String(s))).filter(s=>!Number.isNaN(s));switch(e){case"count":return n.length;case"sum":return t.reduce((s,r)=>s+r,0);case"mean":case"avg":return t.length>0?t.reduce((s,r)=>s+r,0)/t.length:null;case"min":return t.length>0?Math.min(...t):null;case"max":return t.length>0?Math.max(...t):null;case"first":return n.length>0?String(n[0]??""):null;case"last":return n.length>0?String(n[n.length-1]??""):null;default:return null}}async function Re(e,n){let t="",s=[];for(let h=0;h<e.length;h++){let u=e[h];(u==="-s"||u==="--sort")&&h+1<e.length?t=e[++h]:u.startsWith("-")||s.push(u)}if(s.length<2)return{stdout:"",stderr:`xan merge: usage: xan merge [OPTIONS] FILE1 FILE2 ...
49
+ `,exitCode:1};let[,l,f]=p;r.length===0&&(r=i.filter(y=>y!==t&&y!==f));let c=[];for(let y of h){let x=String(y[t]??"");c.includes(x)||c.push(x)}let a=new Map,d=[];for(let y of h){let x=r.map(A=>String(y[A]??"")).join("\0"),I=String(y[t]??""),N=y[f];a.has(x)||(a.set(x,new Map),d.push(x));let C=a.get(x);C&&(C.has(I)||C.set(I,[]),C.get(I)?.push(N))}let m=[...r,...c],g=[];for(let y of d){let x=y.split("\0"),I=a.get(y);if(!I)continue;let N=O();for(let C=0;C<r.length;C++)b(N,r[C],x[C]);for(let C of c){let A=I.get(C)||[];b(N,C,it(l,A))}g.push(N)}return{stdout:w(m,g),stderr:"",exitCode:0}}function it(e,n){let t=n.filter(s=>s!=null).map(s=>typeof s=="number"?s:Number.parseFloat(String(s))).filter(s=>!Number.isNaN(s));switch(e){case"count":return n.length;case"sum":return t.reduce((s,r)=>s+r,0);case"mean":case"avg":return t.length>0?t.reduce((s,r)=>s+r,0)/t.length:null;case"min":return t.length>0?Math.min(...t):null;case"max":return t.length>0?Math.max(...t):null;case"first":return n.length>0?String(n[0]??""):null;case"last":return n.length>0?String(n[n.length-1]??""):null;default:return null}}async function Re(e,n){let t="",s=[];for(let h=0;h<e.length;h++){let u=e[h];(u==="-s"||u==="--sort")&&h+1<e.length?t=e[++h]:u.startsWith("-")||s.push(u)}if(s.length<2)return{stdout:"",stderr:`xan merge: usage: xan merge [OPTIONS] FILE1 FILE2 ...
50
50
  `,exitCode:1};let r=[],o=null;for(let h of s){let u=await v([h],n);if(u.error)return u.error;if(o===null)o=u.headers;else if(JSON.stringify(o)!==JSON.stringify(u.headers))return{stdout:"",stderr:`xan merge: all files must have the same headers
51
51
  `,exitCode:1};r.push({headers:u.headers,data:u.data})}if(!o)return{stdout:"",stderr:"",exitCode:0};let i=[];for(let{data:h}of r)i=i.concat(h);if(t){if(!o.includes(t))return{stdout:"",stderr:`xan merge: column '${t}' not found
52
- `,exitCode:1};i.sort((h,u)=>{let p=h[t],l=u[t],f=typeof p=="number"?p:Number.parseFloat(String(p)),c=typeof l=="number"?l:Number.parseFloat(String(l));return!Number.isNaN(f)&&!Number.isNaN(c)?f-c:String(p??"").localeCompare(String(l??""))})}return{stdout:w(o,i),stderr:"",exitCode:0}}U();async function Me(e,n){let t=e.filter(u=>!u.startsWith("-")),{headers:s,data:r,error:o}=await v(t,n);return o||(r.length===0?{stdout:"",stderr:"",exitCode:0}:{stdout:r.map(u=>s.map(p=>u[p])).map(u=>u.map(p=>it(p)).join(",")).join(`
52
+ `,exitCode:1};i.sort((h,u)=>{let p=h[t],l=u[t],f=typeof p=="number"?p:Number.parseFloat(String(p)),c=typeof l=="number"?l:Number.parseFloat(String(l));return!Number.isNaN(f)&&!Number.isNaN(c)?f-c:String(p??"").localeCompare(String(l??""))})}return{stdout:w(o,i),stderr:"",exitCode:0}}U();async function Me(e,n){let t=e.filter(u=>!u.startsWith("-")),{headers:s,data:r,error:o}=await v(t,n);return o||(r.length===0?{stdout:"",stderr:"",exitCode:0}:{stdout:r.map(u=>s.map(p=>u[p])).map(u=>u.map(p=>at(p)).join(",")).join(`
53
53
  `)+`
54
- `,stderr:"",exitCode:0})}function it(e){if(e==null)return"";let n=String(e);return n.includes(",")||n.includes('"')||n.includes(`
54
+ `,stderr:"",exitCode:0})}function at(e){if(e==null)return"";let n=String(e);return n.includes(",")||n.includes('"')||n.includes(`
55
55
  `)?`"${n.replace(/"/g,'""')}"`:n}async function $e(e,n){let t=null,s=null,r=[];for(let c=0;c<e.length;c++){let a=e[c];if(a==="--seed"&&c+1<e.length)s=Number.parseInt(e[++c],10);else if(!a.startsWith("-")){let d=Number.parseInt(a,10);t===null&&!Number.isNaN(d)&&d>0?t=d:r.push(a)}}if(t===null)return{stdout:"",stderr:`xan sample: usage: xan sample <sample-size> [FILE]
56
56
  `,exitCode:1};let{headers:o,data:i,error:h}=await v(r,n);if(h)return h;if(i.length<=t)return{stdout:w(o,i),stderr:"",exitCode:0};let u=s!==null?s:Date.now(),p=()=>(u=u*1103515245+12345&2147483647,u/2147483647),l=i.map((c,a)=>a);for(let c=l.length-1;c>0;c--){let a=Math.floor(p()*(c+1));[l[c],l[a]]=[l[a],l[c]]}let f=l.slice(0,t).sort((c,a)=>c-a).map(c=>i[c]);return{stdout:w(o,f),stderr:"",exitCode:0}}async function Te(e,n){let t=!1,s=[];for(let u=0;u<e.length;u++){let p=e[u];p==="-p"||p==="--pad"?t=!0:p.startsWith("-")||s.push(p)}if(s.length===0)return{stdout:"",stderr:`xan cat: no files specified
57
- `,exitCode:1};let r=await We(n,s,{cmdName:"xan cat",stopOnError:!0});if(r.exitCode!==0)return{stdout:"",stderr:r.stderr,exitCode:r.exitCode};let o=[],i=[];for(let{content:u}of r.files){let{headers:p,data:l}=qe(u);o.push({headers:p,data:l});for(let f of p)i.includes(f)||i.push(f)}if(!t){let u=JSON.stringify(o[0].headers);for(let p=1;p<o.length;p++)if(JSON.stringify(o[p].headers)!==u)return{stdout:"",stderr:`xan cat: headers do not match (use -p to pad)
58
- `,exitCode:1};i=o[0].headers}let h=[];for(let{headers:u,data:p}of o)for(let l of p){let f=F();for(let c of i)b(f,c,u.includes(c)?l[c]:"");h.push(f)}return{stdout:w(i,h),stderr:"",exitCode:0}}async function je(e,n){let t="",s=[],r=!1,o=!1,i=[];for(let a=0;a<e.length;a++){let d=e[a];(d==="-s"||d==="--select")&&a+1<e.length?s=e[++a].split(","):d==="-v"||d==="--invert"?r=!0:d==="-i"||d==="--ignore-case"?o=!0:d==="-r"||d==="--regex"||d.startsWith("-")||(t?i.push(d):t=d)}if(!t)return{stdout:"",stderr:`xan search: no pattern specified
57
+ `,exitCode:1};let r=await We(n,s,{cmdName:"xan cat",stopOnError:!0});if(r.exitCode!==0)return{stdout:"",stderr:r.stderr,exitCode:r.exitCode};let o=[],i=[];for(let{content:u}of r.files){let{headers:p,data:l}=_e(u);o.push({headers:p,data:l});for(let f of p)i.includes(f)||i.push(f)}if(!t){let u=JSON.stringify(o[0].headers);for(let p=1;p<o.length;p++)if(JSON.stringify(o[p].headers)!==u)return{stdout:"",stderr:`xan cat: headers do not match (use -p to pad)
58
+ `,exitCode:1};i=o[0].headers}let h=[];for(let{headers:u,data:p}of o)for(let l of p){let f=O();for(let c of i)b(f,c,u.includes(c)?l[c]:"");h.push(f)}return{stdout:w(i,h),stderr:"",exitCode:0}}async function je(e,n){let t="",s=[],r=!1,o=!1,i=[];for(let a=0;a<e.length;a++){let d=e[a];(d==="-s"||d==="--select")&&a+1<e.length?s=e[++a].split(","):d==="-v"||d==="--invert"?r=!0:d==="-i"||d==="--ignore-case"?o=!0:d==="-r"||d==="--regex"||d.startsWith("-")||(t?i.push(d):t=d)}if(!t)return{stdout:"",stderr:`xan search: no pattern specified
59
59
  `,exitCode:1};let{headers:h,data:u,error:p}=await v(i,n);if(p)return p;let l=s.length>0?s:h,f;try{f=H(t,o?"i":"")}catch{return{stdout:"",stderr:`xan search: invalid regex pattern '${t}'
60
60
  `,exitCode:1}}let c=u.filter(a=>{let d=l.some(m=>{let g=a[m];return g!=null&&f.test(String(g))});return r?!d:d});return{stdout:w(h,c),stderr:"",exitCode:0}}async function De(e,n){let t="",s=[];for(let c of e)c.startsWith("-")||(t?s.push(c):t=c);if(!t)return{stdout:"",stderr:`xan flatmap: no expression specified
61
- `,exitCode:1};let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let u=V(t).map(({expr:c,name:a})=>({alias:typeof a=="string"?a:a[0],ast:O(c)})),p={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},l=[...r,...u.map(c=>c.alias)],f=[];for(let c of o){let a=[],d=1;for(let m of u){let g=$(c,m.ast,p),y=g.length>0&&Array.isArray(g[0])?g[0]:g;a.push(y),d=Math.max(d,y.length)}for(let m=0;m<d;m++){let g=M(c);for(let y=0;y<u.length;y++){let x=a[y][m]??null;b(g,u[y].alias,x)}f.push(g)}}return{stdout:w(l,f),stderr:"",exitCode:0}}async function Ve(e,n){let{cmdView:t}=await import("./xan-view-ECQUO7AJ.js");return t(e,n)}var Ye=new Set(["fuzzy-join","glob","hist","input","parallel","plot","progress","range","scrape","tokenize","union-find"]),at=new Set(["agg","behead","cat","count","dedup","drop","enum","explode","f","filter","fixlengths","flatmap","flatten","fmt","frequency","freq","from","groupby","head","headers","implode","join","map","merge","partition","pivot","rename","reverse","sample","search","select","shuffle","slice","sort","split","stats","tail","to","top","transform","transpose","view",...Ye]),Xe={name:"xan",summary:"CSV toolkit for data manipulation",usage:"xan <COMMAND> [OPTIONS] [FILE]",description:`xan is a collection of commands for working with CSV data.
61
+ `,exitCode:1};let{headers:r,data:o,error:i}=await v(s,n);if(i)return i;let u=V(t).map(({expr:c,name:a})=>({alias:typeof a=="string"?a:a[0],ast:F(c)})),p={limits:n.limits?{maxIterations:n.limits.maxJqIterations}:void 0},l=[...r,...u.map(c=>c.alias)],f=[];for(let c of o){let a=[],d=1;for(let m of u){let g=$(c,m.ast,p),y=g.length>0&&Array.isArray(g[0])?g[0]:g;a.push(y),d=Math.max(d,y.length)}for(let m=0;m<d;m++){let g=M(c);for(let y=0;y<u.length;y++){let x=a[y][m]??null;b(g,u[y].alias,x)}f.push(g)}}return{stdout:w(l,f),stderr:"",exitCode:0}}async function Ve(e,n){let{cmdView:t}=await import("./xan-view-ECQUO7AJ.js");return t(e,n)}var Be=new Set(["fuzzy-join","glob","hist","input","parallel","plot","progress","range","scrape","tokenize","union-find"]),lt=new Set(["agg","behead","cat","count","dedup","drop","enum","explode","f","filter","fixlengths","flatmap","flatten","fmt","frequency","freq","from","groupby","head","headers","implode","join","map","merge","partition","pivot","rename","reverse","sample","search","select","shuffle","slice","sort","split","stats","tail","to","top","transform","transpose","view",...Be]),Ye={name:"xan",summary:"CSV toolkit for data manipulation",usage:"xan <COMMAND> [OPTIONS] [FILE]",description:`xan is a collection of commands for working with CSV data.
62
62
  It provides a simple, ergonomic interface for common data operations.
63
63
 
64
64
  COMMANDS:
@@ -132,8 +132,8 @@ EXAMPLES:
132
132
  xan groupby region 'count() as n' data.csv
133
133
  xan explode tags data.csv
134
134
  xan join id file1.csv id file2.csv
135
- xan pivot year 'sum(sales)' data.csv`,options:[" --help display this help and exit"]},lt={headers:{name:"xan headers",summary:"Show column names",usage:"xan headers [OPTIONS] [FILE]",description:"Display column names from a CSV file.",options:["-j, --just-names show names only (no index)"]},count:{name:"xan count",summary:"Count rows",usage:"xan count [FILE]",description:"Count the number of data rows (excluding header).",options:[]},filter:{name:"xan filter",summary:"Filter rows by expression",usage:"xan filter [OPTIONS] EXPR [FILE]",description:"Filter CSV rows using moonblade expressions.",options:["-v, --invert invert match","-l, --limit N limit output rows"]},search:{name:"xan search",summary:"Filter rows by regex",usage:"xan search [OPTIONS] PATTERN [FILE]",description:"Filter CSV rows by regex match on columns.",options:["-s, --select COLS search only these columns","-v, --invert invert match","-i, --ignore-case case insensitive"]},select:{name:"xan select",summary:"Select columns",usage:"xan select COLS [FILE]",description:"Select columns by name, index, glob, or range.",options:["Supports: col names, indices (0,1), ranges (a:c), globs (vec_*), negation (!col)"]},explode:{name:"xan explode",summary:"Split column into rows",usage:"xan explode COLUMN [OPTIONS] [FILE]",description:"Split delimited column values into multiple rows.",options:["-s, --separator SEP separator (default: |)","--drop-empty drop empty values","-r, --rename NAME rename column"]},implode:{name:"xan implode",summary:"Combine rows",usage:"xan implode COLUMN [OPTIONS] [FILE]",description:"Combine consecutive rows, joining column values.",options:["-s, --sep SEP separator (default: |)","-r, --rename NAME rename column"]},join:{name:"xan join",summary:"Join CSV files",usage:"xan join KEY1 FILE1 KEY2 FILE2 [OPTIONS]",description:"Join two CSV files on key columns.",options:["--left left outer join","--right right outer join","--full full outer join","-D, --default VAL default for missing"]},pivot:{name:"xan pivot",summary:"Reshape to columns",usage:"xan pivot COLUMN AGG_EXPR [OPTIONS] [FILE]",description:"Turn row values into columns.",options:["-g, --groupby COLS group by columns"]}},cn={name:"xan",async execute(e,n){if(e.length===0||K(e))return D(Xe);let t=e[0],s=e.slice(1);if(K(s)){let r=lt[t];return r?D(r):D(Xe)}if(Ye.has(t))return{stdout:"",stderr:`xan ${t}: not yet implemented
136
- `,exitCode:1};switch(t){case"headers":return ue(s,n);case"count":return ce(s,n);case"head":return pe(s,n);case"tail":return fe(s,n);case"slice":return de(s,n);case"reverse":return he(s,n);case"behead":return Me(s,n);case"sample":return $e(s,n);case"select":return oe(s,n);case"drop":return ie(s,n);case"rename":return ae(s,n);case"enum":return le(s,n);case"filter":return Se(s,n);case"search":return je(s,n);case"sort":return Ie(s,n);case"dedup":return ke(s,n);case"top":return Ne(s,n);case"map":return Ee(s,n);case"transform":return Ae(s,n);case"explode":return Fe(s,n);case"implode":return Oe(s,n);case"flatmap":return De(s,n);case"pivot":return Pe(s,n);case"agg":return te(s,n);case"groupby":return ne(s,n);case"frequency":case"freq":return se(s,n);case"stats":return re(s,n);case"cat":return Te(s,n);case"join":return Le(s,n);case"merge":return Re(s,n);case"split":return we(s,n);case"partition":return ve(s,n);case"to":return Ce(s,n);case"from":return be(s,n);case"transpose":return ge(s,n);case"shuffle":return ye(s,n);case"fixlengths":return xe(s,n);case"view":return Y(s,n);case"flatten":case"f":return X(s,n);case"fmt":return Ve(s,n);default:return at.has(t)?{stdout:"",stderr:`xan ${t}: not yet implemented
135
+ xan pivot year 'sum(sales)' data.csv`,options:[" --help display this help and exit"]},ut={headers:{name:"xan headers",summary:"Show column names",usage:"xan headers [OPTIONS] [FILE]",description:"Display column names from a CSV file.",options:["-j, --just-names show names only (no index)"]},count:{name:"xan count",summary:"Count rows",usage:"xan count [FILE]",description:"Count the number of data rows (excluding header).",options:[]},filter:{name:"xan filter",summary:"Filter rows by expression",usage:"xan filter [OPTIONS] EXPR [FILE]",description:"Filter CSV rows using moonblade expressions.",options:["-v, --invert invert match","-l, --limit N limit output rows"]},search:{name:"xan search",summary:"Filter rows by regex",usage:"xan search [OPTIONS] PATTERN [FILE]",description:"Filter CSV rows by regex match on columns.",options:["-s, --select COLS search only these columns","-v, --invert invert match","-i, --ignore-case case insensitive"]},select:{name:"xan select",summary:"Select columns",usage:"xan select COLS [FILE]",description:"Select columns by name, index, glob, or range.",options:["Supports: col names, indices (0,1), ranges (a:c), globs (vec_*), negation (!col)"]},explode:{name:"xan explode",summary:"Split column into rows",usage:"xan explode COLUMN [OPTIONS] [FILE]",description:"Split delimited column values into multiple rows.",options:["-s, --separator SEP separator (default: |)","--drop-empty drop empty values","-r, --rename NAME rename column"]},implode:{name:"xan implode",summary:"Combine rows",usage:"xan implode COLUMN [OPTIONS] [FILE]",description:"Combine consecutive rows, joining column values.",options:["-s, --sep SEP separator (default: |)","-r, --rename NAME rename column"]},join:{name:"xan join",summary:"Join CSV files",usage:"xan join KEY1 FILE1 KEY2 FILE2 [OPTIONS]",description:"Join two CSV files on key columns.",options:["--left left outer join","--right right outer join","--full full outer join","-D, --default VAL default for missing"]},pivot:{name:"xan pivot",summary:"Reshape to columns",usage:"xan pivot COLUMN AGG_EXPR [OPTIONS] [FILE]",description:"Turn row values into columns.",options:["-g, --groupby COLS group by columns"]}},fn={name:"xan",async execute(e,n){if(e.length===0||G(e))return D(Ye);let t=e[0],s=e.slice(1);if(G(s)){let r=ut[t];return r?D(r):D(Ye)}if(Be.has(t))return{stdout:"",stderr:`xan ${t}: not yet implemented
136
+ `,exitCode:1};switch(t){case"headers":return ue(s,n);case"count":return ce(s,n);case"head":return pe(s,n);case"tail":return fe(s,n);case"slice":return de(s,n);case"reverse":return he(s,n);case"behead":return Me(s,n);case"sample":return $e(s,n);case"select":return oe(s,n);case"drop":return ie(s,n);case"rename":return ae(s,n);case"enum":return le(s,n);case"filter":return Se(s,n);case"search":return je(s,n);case"sort":return Ie(s,n);case"dedup":return ke(s,n);case"top":return Ne(s,n);case"map":return Ee(s,n);case"transform":return Ae(s,n);case"explode":return Oe(s,n);case"implode":return Fe(s,n);case"flatmap":return De(s,n);case"pivot":return Pe(s,n);case"agg":return te(s,n);case"groupby":return ne(s,n);case"frequency":case"freq":return se(s,n);case"stats":return re(s,n);case"cat":return Te(s,n);case"join":return Le(s,n);case"merge":return Re(s,n);case"split":return we(s,n);case"partition":return ve(s,n);case"to":return Ce(s,n);case"from":return be(s,n);case"transpose":return ge(s,n);case"shuffle":return ye(s,n);case"fixlengths":return xe(s,n);case"view":return B(s,n);case"flatten":case"f":return Y(s,n);case"fmt":return Ve(s,n);default:return lt.has(t)?{stdout:"",stderr:`xan ${t}: not yet implemented
137
137
  `,exitCode:1}:{stdout:"",stderr:`xan: unknown command '${t}'
138
138
  Run 'xan --help' for usage.
139
- `,exitCode:1}}}},pn={name:"xan",flags:[],stdinType:"text",needsArgs:!0};export{cn as a,pn as b};
139
+ `,exitCode:1}}}},dn={name:"xan",flags:[],stdinType:"text",needsArgs:!0};export{fn as a,dn as b};
@@ -0,0 +1,11 @@
1
+ import{a as x}from"./chunk-3ZUFRYJ4.js";import{a as c,b as p}from"./chunk-A5O5YHGN.js";import{a as O}from"./chunk-IPJHKYVM.js";import{a as h,b as A,c as u}from"./chunk-74CEPOFO.js";var v={name:"timeout",summary:"run a command with a time limit",usage:"timeout [OPTION] DURATION COMMAND [ARG]...",description:`Start COMMAND, and kill it if still running after DURATION.
2
+
3
+ DURATION is a number with optional suffix:
4
+ s - seconds (default)
5
+ m - minutes
6
+ h - hours
7
+ d - days`,options:["-k, --kill-after=DURATION send KILL signal after DURATION if still running","-s, --signal=SIGNAL specify signal to send (default: TERM)"," --preserve-status exit with same status as COMMAND, even on timeout"," --foreground run command in foreground"," --help display this help and exit"]},N={name:"timeout",async execute(s,r){if(A(s))return h(v);let i=0;for(let e=0;e<s.length;e++){let t=s[e];if(t==="--preserve-status")i=e+1;else if(t==="--foreground")i=e+1;else if(t==="-k"||t==="--kill-after")e++,i=e+1;else if(t.startsWith("--kill-after="))i=e+1;else if(t==="-s"||t==="--signal")e++,i=e+1;else if(t.startsWith("--signal="))i=e+1;else{if(t.startsWith("--")&&t!=="--")return u("timeout",t);if(t.startsWith("-")&&t.length>1&&t!=="--")if(t.startsWith("-k"))i=e+1;else if(t.startsWith("-s"))i=e+1;else return u("timeout",t);else{i=e;break}}}let n=s.slice(i);if(n.length===0)return{stdout:"",stderr:`timeout: missing operand
8
+ `,exitCode:1};let m=n[0],d=x(m);if(d===null)return{stdout:"",stderr:`timeout: invalid time interval '${m}'
9
+ `,exitCode:1};let o=n.slice(1);if(o.length===0)return{stdout:"",stderr:`timeout: missing operand
10
+ `,exitCode:1};if(!r.exec)return{stdout:"",stderr:`timeout: exec not available
11
+ `,exitCode:1};let f=new AbortController,a;try{let e=new Promise(l=>{a=c(()=>{f.abort(),l({timedOut:!0})},d)}),t=r.exec(O([o[0]]),{cwd:r.cwd,signal:f.signal,stdin:r.stdin,args:o.slice(1)}).then(l=>({timedOut:!1,result:l})),g=await Promise.race([e,t]);return g.timedOut?{stdout:"",stderr:"",exitCode:124}:g.result}finally{a!==void 0&&p(a)}}},D={name:"timeout",flags:[{flag:"-k",type:"value",valueHint:"string"},{flag:"-s",type:"value",valueHint:"string"},{flag:"--preserve-status",type:"boolean"},{flag:"--foreground",type:"boolean"}],needsArgs:!0,minArgs:2};export{N as a,D as b};
@@ -0,0 +1,25 @@
1
+ import{d}from"./chunk-CWQS3NFK.js";import{a as b}from"./chunk-44UOCSGV.js";import{a as T,b as w,c as f}from"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";function c(s){let t=s.indexOf("=");if(t>=0){let a=s.slice(0,t),r=s.slice(t+1);return a?`${encodeURIComponent(a)}=${encodeURIComponent(r)}`:encodeURIComponent(r)}return encodeURIComponent(s)}function m(s){let t=s.indexOf("=");if(t<0)return null;let a=s.slice(0,t),r=s.slice(t+1),e,i,o=r.match(/;type=([^;]+)$/);o&&(i=o[1],r=r.slice(0,-o[0].length));let n=r.match(/;filename=([^;]+)/);return n&&(e=n[1],r=r.replace(n[0],"")),(r.startsWith("@")||r.startsWith("<"))&&(e=e??r.slice(1).split("/").pop()),{name:a,value:r,filename:e,contentType:i}}function v(s,t){let a=`----CurlFormBoundary${Date.now().toString(36)}`,r=[];for(let e of s){let i=e.value;if(i.startsWith("@")||i.startsWith("<")){let n=i.slice(1);i=t.get(n)??""}let o=`--${a}\r
2
+ `;e.filename?(o+=`Content-Disposition: form-data; name="${e.name}"; filename="${e.filename}"\r
3
+ `,e.contentType&&(o+=`Content-Type: ${e.contentType}\r
4
+ `)):o+=`Content-Disposition: form-data; name="${e.name}"\r
5
+ `,o+=`\r
6
+ ${i}\r
7
+ `,r.push(o)}return r.push(`--${a}--\r
8
+ `),{body:r.join(""),boundary:a}}var F={name:"curl",summary:"transfer a URL",usage:"curl [OPTIONS] URL",options:["-X, --request METHOD HTTP method (GET, POST, PUT, DELETE, etc.)","-H, --header HEADER Add header (can be used multiple times)","-d, --data DATA HTTP POST data"," --data-raw DATA HTTP POST data (no @ interpretation)"," --data-binary DATA HTTP POST binary data"," --data-urlencode DATA URL-encode and POST data","-F, --form NAME=VALUE Multipart form data","-u, --user USER:PASS HTTP authentication","-A, --user-agent STR Set User-Agent header","-e, --referer URL Set Referer header","-b, --cookie DATA Send cookies (name=value or @file)","-c, --cookie-jar FILE Save cookies to file","-T, --upload-file FILE Upload file (PUT)","-o, --output FILE Write output to file","-O, --remote-name Write to file named from URL","-I, --head Show headers only (HEAD request)","-i, --include Include response headers in output","-s, --silent Silent mode (no progress)","-S, --show-error Show errors even when silent","-f, --fail Fail silently on HTTP errors (no output)","-L, --location Follow redirects (default)"," --max-redirs NUM Maximum redirects (default: 20)","-m, --max-time SECS Maximum time for request"," --connect-timeout SECS Connection timeout","-w, --write-out FMT Output format after completion","-v, --verbose Verbose output"," --help Display this help and exit","","Note: Network access must be configured via BashEnv network option."," curl is not available by default for security reasons."]};function O(s){let t={method:"GET",headers:new d,dataBinary:!1,formFields:[],useRemoteName:!1,headOnly:!1,includeHeaders:!1,silent:!1,showError:!1,failSilently:!1,followRedirects:!0,verbose:!1},a=!1;for(let r=0;r<s.length;r++){let e=s[r];if(e==="-X"||e==="--request")t.method=s[++r]??"GET";else if(e.startsWith("-X"))t.method=e.slice(2);else if(e.startsWith("--request="))t.method=e.slice(10);else if(e==="-H"||e==="--header"){let i=s[++r];if(i){let o=i.indexOf(":");if(o>0){let n=i.slice(0,o).trim(),l=i.slice(o+1).trim();t.headers.append(n,l)}}}else if(e.startsWith("--header=")){let i=e.slice(9),o=i.indexOf(":");if(o>0){let n=i.slice(0,o).trim(),l=i.slice(o+1).trim();t.headers.append(n,l)}}else if(e==="-d"||e==="--data"||e==="--data-raw")t.data=s[++r]??"",a=!0;else if(e.startsWith("-d"))t.data=e.slice(2),a=!0;else if(e.startsWith("--data="))t.data=e.slice(7),a=!0;else if(e.startsWith("--data-raw="))t.data=e.slice(11),a=!0;else if(e==="--data-binary")t.data=s[++r]??"",t.dataBinary=!0,a=!0;else if(e.startsWith("--data-binary="))t.data=e.slice(14),t.dataBinary=!0,a=!0;else if(e==="--data-urlencode"){let i=s[++r]??"";t.data=(t.data?`${t.data}&`:"")+c(i),a=!0}else if(e.startsWith("--data-urlencode=")){let i=e.slice(17);t.data=(t.data?`${t.data}&`:"")+c(i),a=!0}else if(e==="-F"||e==="--form"){let i=s[++r]??"",o=m(i);o&&t.formFields.push(o),a=!0}else if(e.startsWith("--form=")){let i=e.slice(7),o=m(i);o&&t.formFields.push(o),a=!0}else if(e==="-u"||e==="--user")t.user=s[++r];else if(e.startsWith("-u"))t.user=e.slice(2);else if(e.startsWith("--user="))t.user=e.slice(7);else if(e==="-A"||e==="--user-agent")t.headers.set("User-Agent",s[++r]??"");else if(e.startsWith("-A"))t.headers.set("User-Agent",e.slice(2));else if(e.startsWith("--user-agent="))t.headers.set("User-Agent",e.slice(13));else if(e==="-e"||e==="--referer")t.headers.set("Referer",s[++r]??"");else if(e.startsWith("-e"))t.headers.set("Referer",e.slice(2));else if(e.startsWith("--referer="))t.headers.set("Referer",e.slice(10));else if(e==="-b"||e==="--cookie")t.headers.set("Cookie",s[++r]??"");else if(e.startsWith("-b"))t.headers.set("Cookie",e.slice(2));else if(e.startsWith("--cookie="))t.headers.set("Cookie",e.slice(9));else if(e==="-c"||e==="--cookie-jar")t.cookieJar=s[++r];else if(e.startsWith("--cookie-jar="))t.cookieJar=e.slice(13);else if(e==="-T"||e==="--upload-file")t.uploadFile=s[++r],t.method==="GET"&&(t.method="PUT");else if(e.startsWith("--upload-file="))t.uploadFile=e.slice(14),t.method==="GET"&&(t.method="PUT");else if(e==="-m"||e==="--max-time"){let i=parseFloat(s[++r]??"0");!Number.isNaN(i)&&i>0&&(t.timeoutMs=i*1e3)}else if(e.startsWith("--max-time=")){let i=parseFloat(e.slice(11));!Number.isNaN(i)&&i>0&&(t.timeoutMs=i*1e3)}else if(e==="--connect-timeout"){let i=parseFloat(s[++r]??"0");!Number.isNaN(i)&&i>0&&t.timeoutMs===void 0&&(t.timeoutMs=i*1e3)}else if(e.startsWith("--connect-timeout=")){let i=parseFloat(e.slice(18));!Number.isNaN(i)&&i>0&&t.timeoutMs===void 0&&(t.timeoutMs=i*1e3)}else if(e==="-o"||e==="--output")t.outputFile=s[++r];else if(e.startsWith("--output="))t.outputFile=e.slice(9);else if(e==="-O"||e==="--remote-name")t.useRemoteName=!0;else if(e==="-I"||e==="--head")t.headOnly=!0,t.method="HEAD";else if(e==="-i"||e==="--include")t.includeHeaders=!0;else if(e==="-s"||e==="--silent")t.silent=!0;else if(e==="-S"||e==="--show-error")t.showError=!0;else if(e==="-f"||e==="--fail")t.failSilently=!0;else if(e==="-L"||e==="--location")t.followRedirects=!0;else if(e==="--max-redirs")r++;else if(!e.startsWith("--max-redirs="))if(e==="-w"||e==="--write-out")t.writeOut=s[++r];else if(e.startsWith("--write-out="))t.writeOut=e.slice(12);else if(e==="-v"||e==="--verbose")t.verbose=!0;else{if(e.startsWith("--")&&e!=="--")return f("curl",e);if(e.startsWith("-")&&e!=="-")for(let i of e.slice(1))switch(i){case"s":t.silent=!0;break;case"S":t.showError=!0;break;case"f":t.failSilently=!0;break;case"L":t.followRedirects=!0;break;case"I":t.headOnly=!0,t.method="HEAD";break;case"i":t.includeHeaders=!0;break;case"O":t.useRemoteName=!0;break;case"v":t.verbose=!0;break;default:return f("curl",`-${i}`)}else e.startsWith("-")||(t.url=e)}}return a&&t.method==="GET"&&(t.method="POST"),t}function h(s){return Object.entries(s).map(([t,a])=>`${t}: ${a}`).join(`\r
9
+ `)}function W(s){try{return new URL(s).pathname.split("/").pop()||"index.html"}catch{return"index.html"}}function p(s,t){let a=s;return a=a.replace(/%\{http_code\}/g,String(t.status)),a=a.replace(/%\{content_type\}/g,t.headers["content-type"]||""),a=a.replace(/%\{url_effective\}/g,t.url),a=a.replace(/%\{size_download\}/g,String(t.bodyLength)),a=a.replace(/\\n/g,`
10
+ `),a}async function S(s,t){if(s.uploadFile){let a=t.fs.resolvePath(t.cwd,s.uploadFile);return{body:await t.fs.readFile(a)}}if(s.formFields.length>0){let a=new Map;for(let i of s.formFields)if(i.value.startsWith("@")||i.value.startsWith("<")){let o=t.fs.resolvePath(t.cwd,i.value.slice(1));try{let n=await t.fs.readFile(o);a.set(i.value.slice(1),n)}catch{a.set(i.value.slice(1),"")}}let{body:r,boundary:e}=v(s.formFields,a);return{body:r,contentType:`multipart/form-data; boundary=${e}`}}return s.data!==void 0?{body:s.data}:{}}function E(s,t){let a=new d(s.headers);if(s.user){let r=Buffer.from(s.user).toString("base64");a.set("Authorization",`Basic ${r}`)}return t&&!a.has("Content-Type")&&a.set("Content-Type",t),a}async function P(s,t,a){if(!s.cookieJar)return;let r=t["set-cookie"];if(!r)return;let e=a.fs.resolvePath(a.cwd,s.cookieJar);await a.fs.writeFile(e,r)}function H(s,t,a){let r="";if(s.verbose){r+=`> ${s.method} ${a}
11
+ `;for(let[e,i]of s.headers)r+=`> ${e}: ${i}
12
+ `;r+=`>
13
+ `,r+=`< HTTP/1.1 ${t.status} ${t.statusText}
14
+ `;for(let[e,i]of Object.entries(t.headers))r+=`< ${e}: ${i}
15
+ `;r+=`<
16
+ `}return s.includeHeaders&&!s.verbose&&(r+=`HTTP/1.1 ${t.status} ${t.statusText}\r
17
+ `,r+=h(t.headers),r+=`\r
18
+ \r
19
+ `),s.headOnly?s.includeHeaders||s.verbose||(r+=`HTTP/1.1 ${t.status} ${t.statusText}\r
20
+ `,r+=h(t.headers),r+=`\r
21
+ `):r+=t.body,s.writeOut&&(r+=p(s.writeOut,{status:t.status,headers:t.headers,url:t.url,bodyLength:t.body.length})),r}var q={name:"curl",async execute(s,t){if(w(s))return T(F);let a=O(s);if("exitCode"in a)return a;let r=a;if(!r.url)return{stdout:"",stderr:`curl: no URL specified
22
+ `,exitCode:2};if(!t.fetch)return{stdout:"",stderr:`curl: internal error: fetch not available
23
+ `,exitCode:1};let e=r.url;e.match(/^https?:\/\//)||(e=`https://${e}`);try{let{body:i,contentType:o}=await S(r,t),n=E(r,o),l=await t.fetch(e,{method:r.method,headers:n,body:i,followRedirects:r.followRedirects,timeoutMs:r.timeoutMs});if(await P(r,l.headers,t),r.failSilently&&l.status>=400)return{stdout:"",stderr:r.showError||!r.silent?`curl: (22) The requested URL returned error: ${l.status}
24
+ `:"",exitCode:22};let u=H(r,l,e);if(r.outputFile||r.useRemoteName){let y=r.outputFile||W(e),$=t.fs.resolvePath(t.cwd,y);await t.fs.writeFile($,r.headOnly?"":l.body),r.verbose||(u=""),r.writeOut&&(u=p(r.writeOut,{status:l.status,headers:l.headers,url:l.url,bodyLength:l.body.length}))}return{stdout:u,stderr:"",exitCode:0}}catch(i){let o=b(i),n=1;return o.includes("Network access denied")?n=7:o.includes("HTTP method")&&o.includes("not allowed")?n=3:o.includes("Redirect target not in allow-list")||o.includes("Too many redirects")?n=47:o.includes("aborted")&&(n=28),{stdout:"",stderr:!r.silent||r.showError?`curl: (${n}) ${o}
25
+ `:"",exitCode:n}}}};export{q as curlCommand};
@@ -0,0 +1 @@
1
+ import{a,b,c,d}from"./chunk-NAERJDUW.js";import"./chunk-OJDRYQWQ.js";import"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";export{a as envCommand,c as flagsForFuzzing,b as printenvCommand,d as printenvFlagsForFuzzing};
@@ -1 +1 @@
1
- import{A as c,B as d,C as e,I as f,J as g,K as h,L as i,M as j,N as k,O as l,y as a,z as b}from"./chunk-TRD56HID.js";import"./chunk-YNYSPYQ5.js";import"./chunk-GFQRA5P5.js";import"./chunk-NUFRM6SI.js";import"./chunk-DXB73IDG.js";export{d as escapeGlobChars,e as escapeRegexChars,l as expandRedirectTarget,g as expandWord,i as expandWordForPattern,h as expandWordForRegex,j as expandWordWithGlob,a as getArrayElements,c as getVariable,k as hasQuotedMultiValueAt,b as isArray,f as isWordFullyQuoted};
1
+ import{A as c,B as d,C as e,I as f,J as g,K as h,L as i,M as j,N as k,O as l,y as a,z as b}from"./chunk-FEIOJCZD.js";import"./chunk-YNYSPYQ5.js";import"./chunk-GFQRA5P5.js";import"./chunk-NUFRM6SI.js";import"./chunk-DXB73IDG.js";export{d as escapeGlobChars,e as escapeRegexChars,l as expandRedirectTarget,g as expandWord,i as expandWordForPattern,h as expandWordForRegex,j as expandWordWithGlob,a as getArrayElements,c as getVariable,k as hasQuotedMultiValueAt,b as isArray,f as isWordFullyQuoted};
@@ -1 +1 @@
1
- import{a,b}from"./chunk-D2FZX7A2.js";import"./chunk-X2AJGDEF.js";import"./chunk-J642UCRS.js";import"./chunk-IPJHKYVM.js";import"./chunk-YNYSPYQ5.js";import"./chunk-EEXR5ZDP.js";import"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";export{a as findCommand,b as flagsForFuzzing};
1
+ import{a,b}from"./chunk-LPQPILI2.js";import"./chunk-X2AJGDEF.js";import"./chunk-J642UCRS.js";import"./chunk-IPJHKYVM.js";import"./chunk-YNYSPYQ5.js";import"./chunk-EEXR5ZDP.js";import"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";export{a as findCommand,b as flagsForFuzzing};
@@ -1 +1 @@
1
- import{b as yr}from"./chunk-ZXL7TQLN.js";import{b as Ar}from"./chunk-JKLUDNMU.js";import{b as $r}from"./chunk-ZLJ5TCLC.js";import"./chunk-F55TLFGB.js";import"./chunk-SYMJJMQ4.js";import{c as Sr}from"./chunk-IUWCBQII.js";import{b as wr}from"./chunk-MDLLFABN.js";import{b as xr}from"./chunk-2GOYXRRP.js";import{b as vr}from"./chunk-A65PWWJC.js";import{b as kr}from"./chunk-MHTUABJP.js";import{b as qr}from"./chunk-4HHKTUW3.js";import{b as Cr}from"./chunk-HJQJAYMS.js";import{b as br}from"./chunk-PP6PSHAB.js";import{d as Ir,e as Mr,f as jr}from"./chunk-LTZRCH7N.js";import{b as tr}from"./chunk-WECLUBEQ.js";import{b as lr}from"./chunk-EX62JIX3.js";import{b as ur}from"./chunk-A7A2DBEE.js";import{b as pr}from"./chunk-RVT3MU3A.js";import{b as er}from"./chunk-APT7OOP2.js";import{b as dr}from"./chunk-XKQRETAK.js";import{b as cr}from"./chunk-5V6VZH6T.js";import"./chunk-EIZGF4BS.js";import{b as hr}from"./chunk-CR5AFCPT.js";import{c as or,d as ar}from"./chunk-R6QSAL5T.js";import{b as sr}from"./chunk-LL3S3NLB.js";import{c as ir,d as gr}from"./chunk-D6CWQ5DW.js";import{b as mr}from"./chunk-AKVMAONP.js";import"./chunk-D4QDMGEB.js";import"./chunk-DZZS6SJP.js";import{b as Fr}from"./chunk-QJ7O6ZN3.js";import{b as zr}from"./chunk-TLSUDHID.js";import{b as fr}from"./chunk-D7MEQ3VN.js";import{b as nr}from"./chunk-GOV5EKKI.js";import"./chunk-3ZUFRYJ4.js";import{b as R}from"./chunk-ALLTKNUZ.js";import{b as U}from"./chunk-4Q4SM6WR.js";import{b as V}from"./chunk-XVDPCNWR.js";import{b as W}from"./chunk-RPNGRAAP.js";import{c as X,d as Y}from"./chunk-3RA5L262.js";import{c as Z,d as _}from"./chunk-VOBGTVA6.js";import{b as N}from"./chunk-NCNPKYJZ.js";import{b as rr}from"./chunk-ZSJYNBAF.js";import{b as G}from"./chunk-VJFXDYWH.js";import{b as H}from"./chunk-PYSFUGCK.js";import{b as J}from"./chunk-VYOJP4TV.js";import{b as K}from"./chunk-MYE6AGBJ.js";import{b as L}from"./chunk-LWEGUNWT.js";import{b as O}from"./chunk-A7ICOL4V.js";import{b as P}from"./chunk-55VFSPNA.js";import{b as Q}from"./chunk-D2FZX7A2.js";import{b as y}from"./chunk-WKFATFPP.js";import{b as A}from"./chunk-Z7JVV2SM.js";import{b as $}from"./chunk-SDNKECQQ.js";import{b as S}from"./chunk-JVPRLUMK.js";import{b as T}from"./chunk-XXZ46GOX.js";import{b as B}from"./chunk-QCDB2VPH.js";import{b as D}from"./chunk-F23WWYKW.js";import{b as E}from"./chunk-D4J545R4.js";import{b as w}from"./chunk-DCAAORBQ.js";import{b as x}from"./chunk-GXVXFKBA.js";import{b as v}from"./chunk-5QVNJEHU.js";import"./chunk-X2AJGDEF.js";import{d as k,e as q,f as C}from"./chunk-YS3AZT3J.js";import"./chunk-J642UCRS.js";import{b}from"./chunk-OKEHYWBE.js";import"./chunk-VLGZJRPG.js";import{b as I}from"./chunk-V3IEYMEA.js";import{b as M}from"./chunk-JDMQDJYE.js";import{b as j}from"./chunk-KMEYNNUA.js";import{b as t}from"./chunk-IP7G3BNA.js";import{b as l}from"./chunk-NUYSJFDK.js";import{b as u}from"./chunk-A4JSPFCI.js";import{b as p}from"./chunk-FGALERPA.js";import{b as e}from"./chunk-4GTNDTRF.js";import{b as d}from"./chunk-A4HU7SVR.js";import{b as c}from"./chunk-HJWBQKYG.js";import{b as h}from"./chunk-64BAICW3.js";import"./chunk-HDQ56CKY.js";import"./chunk-RH6GWZAJ.js";import"./chunk-A5O5YHGN.js";import"./chunk-IPJHKYVM.js";import"./chunk-OJDRYQWQ.js";import"./chunk-24IMIIXA.js";import"./chunk-5QMZ5MUS.js";import"./chunk-YNYSPYQ5.js";import{b as i}from"./chunk-GCTKCWKD.js";import{b as g}from"./chunk-TXBZCHCQ.js";import"./chunk-7L36YK2X.js";import{b as m}from"./chunk-T56QNPHK.js";import"./chunk-EEXR5ZDP.js";import"./chunk-GFQRA5P5.js";import{b as F}from"./chunk-V7TAPXDL.js";import"./chunk-NUFRM6SI.js";import{b as z}from"./chunk-64CW2LGZ.js";import"./chunk-CCNMISUL.js";import{b as f}from"./chunk-OCS6LSEM.js";import"./chunk-HWKDQ44K.js";import{b as n}from"./chunk-OCLXQMOG.js";import"./chunk-44UOCSGV.js";import"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";var Er=[i,g,m,F,z,f,n,t,l,u,p,e,d,c,h,w,x,v,k,q,C,b,I,M,j,y,A,$,S,T,B,D,E,G,H,J,K,L,O,P,Q,R,U,V,W,X,Y,Z,_,N,rr,or,ar,sr,ir,gr,mr,Fr,zr,fr,nr,tr,lr,ur,pr,er,dr,cr,hr,wr,xr,vr,kr,qr,Cr,br,Ir,Mr,jr,yr,Ar,$r,Sr];function Tr(){return Er}var Br=new Map;for(let r of Tr())Br.set(r.name,new Set(r.flags.map(o=>o.flag)));function Fa(r,o,Dr){let a=Br.get(o);if(!(!a||a.size===0))for(let s of Dr)a.has(s)&&r.hit(`cmd:flag:${o}:${s}`)}export{Fa as emitFlagCoverage};
1
+ import{b as yr}from"./chunk-ZXL7TQLN.js";import{b as Ar}from"./chunk-O2DBFL6Z.js";import{b as $r}from"./chunk-UNYNJIFU.js";import"./chunk-F55TLFGB.js";import"./chunk-SYMJJMQ4.js";import{c as Sr}from"./chunk-IUWCBQII.js";import{b as wr}from"./chunk-MDLLFABN.js";import{b as xr}from"./chunk-MLXIYONF.js";import{b as vr}from"./chunk-A65PWWJC.js";import{b as kr}from"./chunk-MHTUABJP.js";import{b as qr}from"./chunk-4HHKTUW3.js";import{b as Cr}from"./chunk-HJQJAYMS.js";import{b as br}from"./chunk-PP6PSHAB.js";import{d as Ir,e as Mr,f as jr}from"./chunk-LTZRCH7N.js";import{b as tr}from"./chunk-YTNYSM6T.js";import{b as lr}from"./chunk-F5CMUULS.js";import{b as ur}from"./chunk-A7A2DBEE.js";import{b as pr}from"./chunk-RVT3MU3A.js";import{b as er}from"./chunk-APT7OOP2.js";import{b as dr}from"./chunk-XKQRETAK.js";import{b as cr}from"./chunk-5V6VZH6T.js";import"./chunk-EIZGF4BS.js";import{b as hr}from"./chunk-CR5AFCPT.js";import{c as or,d as ar}from"./chunk-R6QSAL5T.js";import{b as sr}from"./chunk-LL3S3NLB.js";import{c as ir,d as gr}from"./chunk-D6CWQ5DW.js";import{b as mr}from"./chunk-RUF7WQ7U.js";import"./chunk-BBXLRYSX.js";import{b as Fr}from"./chunk-QJ7O6ZN3.js";import{b as zr}from"./chunk-TLSUDHID.js";import{b as fr}from"./chunk-D7MEQ3VN.js";import{b as nr}from"./chunk-GOV5EKKI.js";import"./chunk-3ZUFRYJ4.js";import{b as R}from"./chunk-ALLTKNUZ.js";import{b as U}from"./chunk-4Q4SM6WR.js";import{b as V}from"./chunk-XVDPCNWR.js";import{b as W}from"./chunk-RPNGRAAP.js";import{c as X,d as Y}from"./chunk-NAERJDUW.js";import{c as Z,d as _}from"./chunk-VOBGTVA6.js";import{b as N}from"./chunk-NCNPKYJZ.js";import{b as rr}from"./chunk-TOMNU26N.js";import{b as G}from"./chunk-VJFXDYWH.js";import{b as H}from"./chunk-PYSFUGCK.js";import{b as J}from"./chunk-VYOJP4TV.js";import{b as K}from"./chunk-MYE6AGBJ.js";import{b as L}from"./chunk-LWEGUNWT.js";import{b as O}from"./chunk-A7ICOL4V.js";import{b as P}from"./chunk-55VFSPNA.js";import{b as Q}from"./chunk-LPQPILI2.js";import{b as y}from"./chunk-WKFATFPP.js";import{b as A}from"./chunk-Z7JVV2SM.js";import{b as $}from"./chunk-SDNKECQQ.js";import{b as S}from"./chunk-JVPRLUMK.js";import{b as T}from"./chunk-XXZ46GOX.js";import{b as B}from"./chunk-QCDB2VPH.js";import{b as D}from"./chunk-F23WWYKW.js";import{b as E}from"./chunk-D4J545R4.js";import{b as w}from"./chunk-DCAAORBQ.js";import{b as x}from"./chunk-GXVXFKBA.js";import{b as v}from"./chunk-5QVNJEHU.js";import"./chunk-X2AJGDEF.js";import{d as k,e as q,f as C}from"./chunk-YS3AZT3J.js";import"./chunk-J642UCRS.js";import{b}from"./chunk-NYQYO467.js";import"./chunk-7TSDKFEO.js";import"./chunk-VLGZJRPG.js";import{b as I}from"./chunk-V3IEYMEA.js";import{b as M}from"./chunk-OARHFVLG.js";import{b as j}from"./chunk-KMEYNNUA.js";import{b as t}from"./chunk-IP7G3BNA.js";import{b as l}from"./chunk-NUYSJFDK.js";import{b as u}from"./chunk-A4JSPFCI.js";import{b as p}from"./chunk-FGALERPA.js";import{b as e}from"./chunk-4GTNDTRF.js";import{b as d}from"./chunk-A4HU7SVR.js";import{b as c}from"./chunk-HJWBQKYG.js";import{b as h}from"./chunk-64BAICW3.js";import"./chunk-HDQ56CKY.js";import"./chunk-CWQS3NFK.js";import"./chunk-A5O5YHGN.js";import"./chunk-IPJHKYVM.js";import"./chunk-OJDRYQWQ.js";import"./chunk-24IMIIXA.js";import"./chunk-5QMZ5MUS.js";import"./chunk-YNYSPYQ5.js";import{b as i}from"./chunk-GCTKCWKD.js";import{b as g}from"./chunk-TXBZCHCQ.js";import"./chunk-7L36YK2X.js";import{b as m}from"./chunk-T56QNPHK.js";import"./chunk-EEXR5ZDP.js";import"./chunk-GFQRA5P5.js";import{b as F}from"./chunk-V7TAPXDL.js";import"./chunk-NUFRM6SI.js";import{b as z}from"./chunk-64CW2LGZ.js";import"./chunk-CCNMISUL.js";import{b as f}from"./chunk-OCS6LSEM.js";import"./chunk-HWKDQ44K.js";import{b as n}from"./chunk-OCLXQMOG.js";import"./chunk-44UOCSGV.js";import"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";var Er=[i,g,m,F,z,f,n,t,l,u,p,e,d,c,h,w,x,v,k,q,C,b,I,M,j,y,A,$,S,T,B,D,E,G,H,J,K,L,O,P,Q,R,U,V,W,X,Y,Z,_,N,rr,or,ar,sr,ir,gr,mr,Fr,zr,fr,nr,tr,lr,ur,pr,er,dr,cr,hr,wr,xr,vr,kr,qr,Cr,br,Ir,Mr,jr,yr,Ar,$r,Sr];function Tr(){return Er}var Br=new Map;for(let r of Tr())Br.set(r.name,new Set(r.flags.map(o=>o.flag)));function Fa(r,o,Dr){let a=Br.get(o);if(!(!a||a.size===0))for(let s of Dr)a.has(s)&&r.hit(`cmd:flag:${o}:${s}`)}export{Fa as emitFlagCoverage};
@@ -1 +1 @@
1
- import{a,b}from"./chunk-2GOYXRRP.js";import"./chunk-IPJHKYVM.js";import"./chunk-DXB73IDG.js";export{b as flagsForFuzzing,a as helpCommand};
1
+ import{a,b}from"./chunk-MLXIYONF.js";import"./chunk-IPJHKYVM.js";import"./chunk-DXB73IDG.js";export{b as flagsForFuzzing,a as helpCommand};
@@ -1 +1 @@
1
- import{a,b}from"./chunk-AKVMAONP.js";import"./chunk-D4QDMGEB.js";import"./chunk-DZZS6SJP.js";import"./chunk-OJDRYQWQ.js";import"./chunk-24IMIIXA.js";import"./chunk-5QMZ5MUS.js";import"./chunk-YNYSPYQ5.js";import"./chunk-7L36YK2X.js";import"./chunk-GFQRA5P5.js";import"./chunk-NUFRM6SI.js";import"./chunk-CCNMISUL.js";import"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";export{b as flagsForFuzzing,a as jqCommand};
1
+ import{a,b}from"./chunk-RUF7WQ7U.js";import"./chunk-BBXLRYSX.js";import"./chunk-7TSDKFEO.js";import"./chunk-OJDRYQWQ.js";import"./chunk-24IMIIXA.js";import"./chunk-5QMZ5MUS.js";import"./chunk-YNYSPYQ5.js";import"./chunk-7L36YK2X.js";import"./chunk-GFQRA5P5.js";import"./chunk-NUFRM6SI.js";import"./chunk-CCNMISUL.js";import"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";export{b as flagsForFuzzing,a as jqCommand};