@aventurevc/aventure-cli 0.8.92 → 0.8.93

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.
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{_i as e,di as t,li as n,ua as r,vi as i}from"../chunks/client-Djb0zInE.js";import{_ as a,t as o}from"../chunks/oauth-bearer-credential-Bb1zYxZP.js";import{i as s}from"../chunks/text-field-DsPStHwQ.js";import{c,i as l,t as u}from"../chunks/openapi-commands-CtM5W92Z.js";var d=process.argv.slice(2);l(d)&&t(!1),d.includes(`--all-fields`)&&s(!0);try{if(i(),c(d,u)===`optional`)try{await o(),await a()}catch(t){n({component:e().bin[0],event:`optional_auth_materialization_failed`,message:`saved credential unavailable; continuing with credential-optional command`,error:t})}await import(`../chunks/aventure-cli-B8jht5Od.js`)}catch(e){if(!(e instanceof r))throw e;process.stderr.write(`${e.message}\n`),process.exitCode=e.exitCode}export{};
2
+ import{_i as e,di as t,li as n,ua as r,vi as i}from"../chunks/client-CSM8LFD4.js";import{_ as a,t as o}from"../chunks/oauth-bearer-credential-Bk7yuZTS.js";import{i as s}from"../chunks/text-field-BAMV7Ssk.js";import{c,i as l,t as u}from"../chunks/openapi-commands-CB-iISG0.js";var d=process.argv.slice(2);l(d)&&t(!1),d.includes(`--all-fields`)&&s(!0);try{if(i(),c(d,u)===`optional`)try{await o(),await a()}catch(t){n({component:e().bin[0],event:`optional_auth_materialization_failed`,message:`saved credential unavailable; continuing with credential-optional command`,error:t})}await import(`../chunks/aventure-cli-C1-ulgs6.js`)}catch(e){if(!(e instanceof r))throw e;process.stderr.write(`${e.message}\n`),process.exitCode=e.exitCode}export{};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "generatedFrom": "MCP_GENERATION_CONTRACT",
4
- "generatedAt": "2026-10-07T07:27:29.824Z",
4
+ "generatedAt": "2026-10-07T07:53:22.295Z",
5
5
  "totalOperations": 140,
6
6
  "note": "Projection of MCP_GENERATION_CONTRACT - see mcp/scripts/build-unified-operations.ts header for SSOT rules.",
7
7
  "operations": [
@@ -1,4 +1,4 @@
1
- import{Ai as e,C as t,Ei as n,O as r,Oi as i,Si as a,Ti as o,_i as s,a as c,b as l,c as u,ca as d,d as f,da as p,f as m,hi as h,i as g,ji as _,ki as v,l as y,la as b,li as x,m as S,n as ee,o as te,p as ne,r as re,sa as ie,si as ae,u as oe,v as se,w as ce,wi as le,x as ue,xi as de,yi as C}from"./client-Djb0zInE.js";import{M as fe,O as pe,i as w,o as me,v as he,w as T,y as E}from"./person-owner-BJgNYLKX.js";import{A as ge,C as _e,D as ve,E as ye,M as be,N as xe,O as D,S as Se,T as Ce,_ as we,a as Te,b as Ee,c as De,h as Oe,i as ke,k as Ae,l as je,o as Me,p as Ne,s as Pe,t as Fe,u as Ie,v as Le,x as Re,y as ze}from"./oauth-bearer-credential-Bb1zYxZP.js";import{c as Be,d as Ve,h as He,m as Ue,o as We,p as Ge,s as Ke,u as qe}from"./text-field-DsPStHwQ.js";import{a as Je,c as Ye,d as Xe,f as Ze,g as Qe,h as $e,l as et,m as tt,n as nt,o as O,p as rt,r as k,s as it,t as A,u as at}from"./openapi-commands-CtM5W92Z.js";import{a as ot,c as st,i as j,n as ct,o as lt,p as ut,r as dt,s as ft,t as pt,u as mt}from"./text-response-48WgHI9c.js";import{n as ht,r as gt,t as _t}from"./oauth-login-CcRqmpst.js";import{spawnSync as vt}from"node:child_process";import{basename as yt,dirname as M,resolve as N,sep as bt}from"node:path";import{copyFileSync as xt,existsSync as St,lstatSync as Ct,mkdirSync as wt,mkdtempSync as Tt,readFileSync as Et,readlinkSync as Dt,realpathSync as Ot,renameSync as kt,rmdirSync as At,unlinkSync as jt,writeFileSync as Mt}from"node:fs";import P,{stderr as F,stdin as Nt}from"node:process";import{TextDecoder as Pt,inspect as Ft}from"node:util";import{fileURLToPath as It}from"node:url";import{readFile as Lt}from"node:fs/promises";import{setTimeout as Rt}from"node:timers/promises";import{webcrypto as zt}from"node:crypto";import{homedir as Bt,hostname as Vt,platform as Ht}from"node:os";import{createInterface as Ut}from"node:readline/promises";function Wt(t,n,r){let i={...r};for(let e of n.parameter){let n=e.envName;if(n===void 0)continue;let r=process.env[n]?.trim();if(r===void 0||r.length===0)continue;let a=i[e.optionKey];if(a!==void 0&&(typeof a!=`string`||a!==r))return{...v(`${t} ${e.flag.split(` `)[0]??e.name} conflicts with ${n}; omit the flag or use ${r}.`),data:i};a===void 0&&(i[e.optionKey]=r)}return e(`Environment-bound options applied`,i)}function Gt(e,t,n){if(!I(n))return null;for(let r of t.parameter){let t=r.envName,i=t===void 0?void 0:process.env[t]?.trim();if(t===void 0||i===void 0||i.length===0||!on(n,r.name))continue;let a=an(n,r.name);if(typeof a!=`string`||a!==i)return`${e} ${r.name} in --from-file conflicts with ${t}; omit the field or use ${i}.`}return null}function Kt(e){let t=new Set(e.parameter.map(({name:e})=>e));return e.kind===`multipart`?e.requiredPath:e.requiredPath.filter(e=>!t.has(e))}function qt(t,n,r,i=!1){if(i||!ln(n)||!Array.isArray(r))return dn(t,n,r);for(let[e,i]of r.entries()){let r=dn(t,n,i,e);if(!r.ok)return r}return e(`Body value assigned`,null)}function Jt(e,t,n,r){return dn(e,t,r,n)}function Yt(e){let t=[];for(let n of e.split(`.`)){let e=pn(n);if(t.push(e.key),e.isArray)return t.join(`.`)}return null}function Xt(e,t){let n=Yt(t);if(n===null)return null;let r=rn(e,n.split(`.`));return Array.isArray(r)?{path:n,rowCount:r.length,firstHole:nn(r)}:null}function Zt(t,n){if(ln(t.name)||t.schemaType===`array`)return e(`Repeated body option selected`,typeof n==`string`?[n]:n);if(!Array.isArray(n))return e(`Scalar body option selected`,n);let r=t.flag.split(` `)[0]??t.name;return n.length===1?e(`Scalar body option selected`,n[0]):v(`${r} was already given; pass it once.`)}var Qt=/^(?<row>\d+):(?<item>.*)$/su;function $t(e,t){let n=Yt(e.name);if(e.schemaType!==`array`||n===null||t===void 0||typeof t==`boolean`)return null;let r=new Map,i=[];for(let e of typeof t==`string`?[t]:t){let t=Qt.exec(e)?.groups,n=t?.row,a=t?.item;if(n===void 0||a===void 0){i.push(e);continue}let o=r.get(Number(n));o===void 0?r.set(Number(n),[a]):o.push(a)}return r.size===0?null:{container:n,rows:r,plain:i}}function en(e,t,n){let r=0;for(let i of e.parameter){let e=t[i.optionKey];e!==void 0&&typeof e!=`boolean`&&Yt(i.name)===n&&(r=Math.max(r,typeof e==`string`?1:e.length))}return r}function tn(e,t,n,r){for(let i of t.parameter){let t=n[i.optionKey];if(t===void 0)continue;let a=Xt(r,i.name);if(a===null)continue;if(a.firstHole!==null)return v(`${e} has no ${a.path}[] row ${a.firstHole} — number ${a.path}[] rows from 0 with no gaps.`);if(i.schemaType!==`array`||a.rowCount<=1||$t(i,t)!==null)continue;let o=i.flag.split(` `)[0]??i.name;return v(`${o} fills one ${a.path}[] row's list, so ${e} cannot also build ${a.rowCount} ${a.path}[] rows from direct options — prefix each value with its 0-based ${a.path}[] row index, as 0:value, or pass the rows with --from-file.`)}return null}function nn(e){for(let t=0;t<e.length;t+=1)if(e[t]===void 0)return t;return null}function rn(e,t){let n=e;for(let e of t){if(!I(n))return;n=n[e]??null}return n}function an(e,t){if(!ln(t))return rn(e,t.split(`.`))}function on(e,t){return cn(e,t.split(`.`))}function sn(e,t,n){if(!I(n))return null;let r=new Set(t.parameter.map(({name:e})=>e));for(let i of e)if(i!==t){for(let e of i.parameter)if(!r.has(e.name)&&on(n,e.name))return`${e.name} in --from-file requires --content-type ${i.contentType}.`}return null}function cn(e,t){let[n,...r]=t;if(n===void 0)return!0;let i=pn(n);if(!I(e)||!Object.hasOwn(e,i.key))return!1;let a=e[i.key]??null;return i.isArray?Array.isArray(a)&&a.every(e=>cn(e,r)):cn(a,r)}function ln(e){return e.split(`.`).some(e=>pn(e).isArray)}function un(e,t){return e.parameter.length===0||!I(t)?null:hn(t,[],mn(e.parameter))}function I(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function dn(t,n,r,i=0){let a=n.split(`.`),o=t;for(let[t,s]of a.entries()){let c=pn(s),l=t===a.length-1,u=fn(o,c,n,l,r,i);if(!u.ok||u.data===null)return v(u.summary,u.warnings);if(l)return e(`Body value assigned`,null);o=u.data}return v(`${n} is not a valid body option path.`)}function fn(t,n,r,i,a,o){let s=()=>v(`${r} cannot be combined with another body option at ${n.key}.`),c=t[n.key];if(n.isArray){if(c!==void 0&&!Array.isArray(c))return s();let r=c??[];if(c===void 0&&(t[n.key]=r),i)return r[o]===void 0?(r[o]=a,e(`Body value assigned`,t)):s();let l=r[o];if(l===void 0){let t={};return r[o]=t,e(`Body path created`,t)}return I(l)?e(`Body path stepped`,l):s()}if(i)return c===void 0?(t[n.key]=a,e(`Body value assigned`,t)):s();if(c===void 0){let r={};return t[n.key]=r,e(`Body path created`,r)}return I(c)?e(`Body path stepped`,c):s()}function pn(e){let t=e.endsWith(`[]`);return{key:t?e.slice(0,-2):e,isArray:t}}function mn(e){let t=new Set,n=new Set;for(let r of e){let e=`${r.name}${r.schemaType===`array`?`[]`:``}`;t.add(e);let i=e.split(`.`);for(let e=1;e<i.length;e+=1)n.add(i.slice(0,e).join(`.`))}return{leaf:t,prefix:n}}function hn(e,t,n){if(Array.isArray(e)){if(e.length===0)return null;for(let r of e){let e=hn(r,t,n);if(e!==null)return e}return null}if(!I(e))return null;for(let[r,i]of Object.entries(e)){let e=[...t,Array.isArray(i)?`${r}[]`:r],a=e.join(`.`);if(!gn(a,n)){if(!_n(e))continue;return{path:a,suggestion:vn(e,n)}}let o=hn(i,e,n);if(o!==null)return o}return null}function gn(e,t){return t.prefix.has(e)||t.leaf.has(e)}function _n(e){return e.slice(0,-1).some(e=>e.endsWith(`[]`))}function vn(e,t){let n=e.slice(0,-1).join(`.`),r=e.at(-1)?.replace(/\[\]$/u,``).toLowerCase()??``;return[...t.leaf].filter(e=>e.split(`.`).slice(0,-1).join(`.`)===n).map(e=>({path:e,score:yn(r,e.split(`.`).at(-1)??``)})).filter(({score:e})=>e<1/0).toSorted((e,t)=>e.score-t.score||e.path.localeCompare(t.path))[0]?.path}function yn(e,t){let n=t.replace(/\[\]$/u,``).toLowerCase();return n===e?0:n.endsWith(e)||e.endsWith(n)?1:n.includes(e)||e.includes(n)?2:1/0}function bn(e,t){let n=new Map;for(let e of t){let t=e.flag?.split(` `)[0];t!==void 0&&n.set(t,t===`--from-file`?{...e,inputType:`file`}:e)}for(let t of e){let e=t.long===void 0?void 0:n.get(t.long);e!==void 0&&(t.helpGroup(Ue(e)),t.description=u(t.description,{...e,hasParseDefault:t.defaultValue!==void 0}))}e.sort((e,t)=>{let r=e.long===void 0?void 0:n.get(e.long),i=t.long===void 0?void 0:n.get(t.long);return r!==void 0&&i!==void 0?On(r,i):r===void 0?i===void 0?0:1:-1})}function xn(e){let t=new Map;for(let n of e)for(let e of n.parameter){let r=e.flag.split(` `)[0]??e.flag,i=t.get(r);i===void 0?t.set(r,{variant:[{descriptor:n,parameter:e}]}):t.set(r,{variant:[...i.variant,{descriptor:n,parameter:e}]})}return[...t.values()]}function Sn(e){let{flag:t}=e.variant[0].parameter;return e.variant.every(({parameter:e})=>e.flag===t)?t:`${t.split(` `)[0]??t} <value>`}function Cn(e){let t=e.variant.map(({descriptor:e,parameter:t})=>({contentType:e.contentType,text:En(e,t)})),n=t[0];return n===void 0?``:t.every(({text:e})=>e===n.text)?`${n.text===``?``:`${n.text} `}Request content: ${t.map(({contentType:e})=>e).join(`, `)}.`:t.map(({contentType:e,text:t})=>`${e}: ${t}`).join(` `)}function wn(e,t){return[...new Set((e.cliConflicts??[]).filter(e=>e.includes(t)).flatMap(e=>e.filter(e=>e!==t)))]}function Tn(e,t){let n=e.kind===`multipart`?`Read a JSON object keyed by multipart part name from a file, or use - for stdin`:`Read the JSON request body from a file, or use - for stdin`,r=t.filter(e=>!t.some(t=>t.startsWith(`${e}.`)||t.startsWith(`${e}[].`)));return r.length===0?He(n):`${He(n)} Required JSON paths: ${r.join(`, `)}.`}function En(e,t){let n=Ve(t.description,void 0),r=e.kind!==`multipart`&&ln(t.name),i=e.kind!==`multipart`&&t.optionKey!==t.name&&/^\w+$/u.test(t.name);return`${n}${r?` Repeat to add another value.`:``}${i?` --from-file JSON key: ${t.name}.`:``}${Dn(e,t)}`}function Dn(e,t){if(e.kind===`multipart`||t.schemaType!==`array`)return``;let n=Yt(t.name);return n===null?``:` Prefix each value with its 0-based ${n}[] row index, as 0:value, to fill more than one ${n}[] row. A leading digits-and-colon is always read as that index, so name the row of a value that starts the same way, as 0:0:00 for the value 0:00.`}function On(e,t){return Ge(e)-Ge(t)||Number(e.required!==!0)-Number(t.required!==!0)}async function kn(t){let n;try{n=t===`-`?await An():await Lt(t,`utf8`)}catch(e){return v(`Could not read input: ${e.message}`,[`path=${t}`])}try{if(n.trim().length===0)return e(`No input provided`,null);let t=JSON.parse(n);return e(`Input parsed`,t)}catch(e){return v(`Input is not valid JSON: ${e.message}`)}}async function An(){if(process.stdin.isTTY)throw Error(`--from-file - requires JSON on stdin, but stdin is a TTY`);process.stdin.setEncoding(`utf8`);let e=``;for await(let t of process.stdin)e+=t;return e}var jn=`--content-type`;function Mn(e,t,n){let r=e=>!n?.has(e)&&(n?.add(e),!0),i=t.requestBody??[];if(i.length>1&&r(jn)){let t=i.map(({contentType:e})=>e);e.addOption(new d(`${jn} <media-type>`,`Select the request content type; omit for ${t[0]}.`).choices(t).argParser(Pn(i)))}if($n(t)&&r(`--from-file`)){let n=i[0];if(n===void 0)throw Error(`${t.operationId} has no request body`);e.addOption(new d(`--from-file <path>`,Tn(n,n.requiredPath)).argParser(In(`--from-file`)))}let a=xn(i).filter(e=>r(L(e.variant[0].parameter)));for(let t of a.toSorted((e,t)=>On(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:n,parameter:r}=t.variant[0],a=new d(Sn(t),i.length>1?Cn(t):En(n,r));i.length===1&&r.envName!==void 0&&a.env(r.envName);let o=i.length===1?wn(n,r.optionKey):[];o.length>0&&a.conflicts(o),i.length>1?a.argParser(Nn):ln(r.name)||r.schemaType===`array`?a.argParser(Fn):a.argParser(In(r.flag)),e.addOption(a),a.envVar!==void 0&&e.on(`optionEnv:${a.name()}`,()=>{let t=e.opts()[r.optionKey];typeof t==`string`&&t.trim()&&e.setOptionValueWithSource(r.optionKey,t.trim(),`env`)})}Qn(e,t,a)}function Nn(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function Pn(e){return(t,n)=>{if(n!==void 0)throw new p(`${jn} was already given; pass it once.`);let i=r(e,t);if(!i.ok)throw new p(i.summary);return t}}function Fn(e,t){return[...t??[],e]}function In(e){let t=e.split(/\s+/u)[0]??e;return(e,n)=>{if(n!==void 0)throw new p(`${t} was already given; pass it once.`);return e}}async function Ln(t,n){let i=Xe(t,n),a=r(t.requestBody??[],i);if(!a.ok||a.data===null)return v(a.summary,a.warnings);let o=a.data;if(o===void 0)return e(`No body`,void 0);let s=Rn(t,o,n);if(s!==null)return v(s);let c=Wt(t.operationId,o,n);if(!c.ok)return v(c.summary,c.warnings);n=c.data;let l=zn(o,n);if(l!==null)return v(l);let u=await Un(n);if(!u.ok)return v(u.summary,u.warnings);let d=sn(t.requestBody??[],o,u.data);if(d!==null)return v(d);let f=Hn(t.operationId,o,u.data);if(!f.ok)return f;let p=Gt(t.operationId,o,u.data);if(p!==null)return v(p);let m=Wn(t.operationId,o,n);if(!m.ok)return m;if(u.data===void 0&&m.data===void 0)return o.required?v(Zn(t.operationId,o)):e(`No body`,void 0);let h=Kn(t.operationId,u.data,m.data);if(!h.ok||h.data===void 0)return h;if(o.schemaType===`array`&&!Array.isArray(h.data))return v(`${t.operationId} requires a JSON array body.`);if(o.parameter.length>0&&!I(h.data)){let e=o.kind===`multipart`?` keyed by multipart part name`:` body`;return v(`${t.operationId} requires a JSON object${e}.`)}let g=Vn(o,h.data);if(g.length>0)return v(`${t.operationId} requires body option(s): ${g.join(`, `)}`);let _=h.data,y=I(_)?Kt(o).filter(e=>!on(_,e)):[];return y.length>0?v(Bn(t.operationId,o,y)):h}function Rn(e,t,n){let r=new Set(t.parameter.map(({optionKey:e})=>e));for(let i of e.requestBody??[])if(i!==t)for(let t of i.parameter){if(r.has(t.optionKey)||n[t.optionKey]===void 0)continue;let i=(e.requestBody??[]).filter(e=>e.parameter.some(({optionKey:e})=>e===t.optionKey)).map(({contentType:e})=>e);return`${L(t)} requires ${jn} ${i.join(` or `)}.`}return null}function zn(e,t){for(let n of e.cliConflicts??[]){let e=n.filter(e=>t[e]!==void 0);if(e.length>1)return`Options ${e.join(`, `)} cannot be used together.`}return null}function Bn(e,t,n){let r=`${e} requires JSON body path(s): ${n.join(`, `)}`;return t.kind===`multipart`?`${r}. ${n.includes(`body`)?`For multipart --from-file, wrap the endpoint JSON under top-level "body".`:`For multipart --from-file, put the missing nested path(s) inside top-level "body".`}`:r}function Vn(e,t){return I(t)?e.parameter.filter(e=>e.required&&!on(t,e.name)).map(L):[]}function Hn(t,n,r){let i=un(n,r);if(i===null)return e(`Body file paths validated`,null);let a=i.suggestion===void 0?``:` Use ${i.suggestion}.`;return v(`${t} --from-file contains unknown JSON path ${i.path}.${a}`)}async function Un(t){let n=typeof t.fromFile==`string`?t.fromFile:void 0;if(n===void 0)return e(`No body file`,void 0);let r=await kn(n);if(!r.ok)return v(r.summary,r.warnings);let i=_.safeParse(r.data);return i.success?e(`Input parsed`,i.data):v(`Input is not valid JSON value: ${i.error.message}`)}function Wn(t,n,r){let i={},a=!1;for(let e of n.parameter){let t=Zt(e,r[e.optionKey]);if(!t.ok||t.data===null)return v(t.summary,t.warnings);let o=t.data;if(o===void 0)continue;let s=Gn(n,r,i,e,o);if(!s.ok)return v(s.summary,s.warnings);a=!0}if(!a)return e(`No direct body options`,void 0);let o=tn(t,n,r,i);return o===null?e(`Direct body options parsed`,i):o}function Gn(t,n,r,i,a){let o=$t(i,a);if(o===null){let e=Yn(i,a);return e.ok?qt(r,i.name,e.data,i.schemaType===`array`):v(e.summary,e.warnings)}if(o.plain.length>0)return v(`${L(i)} mixes row-form values with plain value(s): ${o.plain.join(`, `)} — prefix every value with its 0-based ${o.container}[] row index, as 0:value.`);let s=en(t,n,o.container);for(let e of o.rows.keys())if(!(e<s))return v(`${L(i)} names ${o.container}[] row ${e}, but these options build at most ${s} ${o.container}[] row(s) — number rows from 0, and name the row of a value that itself starts with digits and a colon, as 0:0:00 for the value 0:00.`);for(let[e,t]of o.rows){let n=[];for(let e of t){let t=Xn(i.name,i.itemSchemaType,e);if(!t.ok)return v(t.summary,t.warnings);n.push(t.data)}let a=Jt(r,i.name,e,n);if(!a.ok)return a}return e(`Body value assigned`,null)}var L=e=>e.flag.split(` `)[0]??e.name;function Kn(t,n,r){if(n===void 0)return e(`Direct body parsed`,r);if(r===void 0)return e(`Input parsed`,n);if(I(n)&&I(r))try{return e(`Input parsed`,qn(n,r))}catch(e){return v(`${t} ${e.message}`)}return v(`${t} cannot combine --from-file with direct body options unless the file body is an object.`)}function qn(e,t){let n={...e};for(let[e,r]of Object.entries(t)){let t=n[e];if(Array.isArray(t)&&Array.isArray(r))throw Error(`cannot combine --from-file array '${e}' with array body options at the same key — move the per-item fields inside the matching '${e}[]' object(s) in the file body.`);if(t!==void 0&&Jn(t)!==Jn(r))throw Error(`cannot combine --from-file ${Jn(t)} '${e}' with ${Jn(r)} body option(s) at the same key — align the file body shape with the schema.`);n[e]=I(t)&&I(r)?qn(t,r):r}return n}function Jn(e){return Array.isArray(e)?`array`:I(e)?`object`:`scalar`}function Yn(t,n){if(typeof n==`boolean`)return e(`Body value parsed`,n);if(n===void 0||typeof n==`string`)return Xn(t.name,t.schemaType,n??``);let r=[],i=ln(t.name)&&t.schemaType!==`array`?t.schemaType:t.itemSchemaType;for(let e of n){let n=Xn(t.name,i,e);if(!n.ok)return n;r.push(n.data)}return e(`Body value parsed`,r)}function Xn(t,n,r){if(n===`boolean`)return r===`true`?e(`Body value parsed`,!0):r===`false`?e(`Body value parsed`,!1):v(`${t} must be true or false.`);if(n===`number`||n===`integer`){let i=r.trim(),a=Number(i);return i===``||!Number.isFinite(a)?v(`${t} must be a finite ${n}.`):n===`integer`&&!Number.isInteger(a)?v(`${t} must be an integer.`):e(`Body value parsed`,a)}return e(`Body value parsed`,r)}function Zn(e,t){let n=t.parameter.filter(e=>e.required);if(n.length>0&&t.requiredPath.every(e=>n.some(({name:t})=>t===e||t.startsWith(`${e}.`))))return`${e} requires body option(s): ${n.map(L).join(`, `)}`;let r=Kt(t);if(r.length>0)return`${e} requires --from-file with JSON body path(s): ${r.join(`, `)}`;let i=t.parameter.map(L).join(`, `);return i.length===0?`${e} requires --from-file`:`${e} requires --from-file or body option(s): ${i}`}function Qn(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:jn,location:`body`}),$n(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),bn(e.options,r)}function $n(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function er(e){let t=i(e);return lr(t),process.stdout.write(`${JSON.stringify(t)}\n`),t}function tr(e){let t=i(e);lr(t);let n=pt(t.data,t.summary),r=[];if(t.ok&&n!==null){let e=nr(t);r.push(n.endsWith(`
1
+ import{Ai as e,C as t,Ei as n,O as r,Oi as i,Si as a,Ti as o,_i as s,a as c,b as l,c as u,ca as d,d as f,da as p,f as m,hi as h,i as g,ji as _,ki as v,l as y,la as b,li as x,m as S,n as ee,o as te,p as ne,r as re,sa as ie,si as ae,u as oe,v as se,w as ce,wi as le,x as ue,xi as de,yi as C}from"./client-CSM8LFD4.js";import{M as fe,O as pe,i as w,o as me,v as he,w as T,y as E}from"./person-owner-BJgNYLKX.js";import{A as ge,C as _e,D as ve,E as ye,M as be,N as xe,O as D,S as Se,T as Ce,_ as we,a as Te,b as Ee,c as De,h as Oe,i as ke,k as Ae,l as je,o as Me,p as Ne,s as Pe,t as Fe,u as Ie,v as Le,x as Re,y as ze}from"./oauth-bearer-credential-Bk7yuZTS.js";import{c as Be,d as Ve,h as He,m as Ue,o as We,p as Ge,s as Ke,u as qe}from"./text-field-BAMV7Ssk.js";import{a as Je,c as Ye,d as Xe,f as Ze,g as Qe,h as $e,l as et,m as tt,n as nt,o as O,p as rt,r as k,s as it,t as A,u as at}from"./openapi-commands-CB-iISG0.js";import{a as ot,c as st,i as j,n as ct,o as lt,p as ut,r as dt,s as ft,t as pt,u as mt}from"./text-response-DHheBYgm.js";import{n as ht,r as gt,t as _t}from"./oauth-login-9y38oA_2.js";import{spawnSync as vt}from"node:child_process";import{basename as yt,dirname as M,resolve as N,sep as bt}from"node:path";import{copyFileSync as xt,existsSync as St,lstatSync as Ct,mkdirSync as wt,mkdtempSync as Tt,readFileSync as Et,readlinkSync as Dt,realpathSync as Ot,renameSync as kt,rmdirSync as At,unlinkSync as jt,writeFileSync as Mt}from"node:fs";import P,{stderr as F,stdin as Nt}from"node:process";import{TextDecoder as Pt,inspect as Ft}from"node:util";import{fileURLToPath as It}from"node:url";import{readFile as Lt}from"node:fs/promises";import{setTimeout as Rt}from"node:timers/promises";import{webcrypto as zt}from"node:crypto";import{homedir as Bt,hostname as Vt,platform as Ht}from"node:os";import{createInterface as Ut}from"node:readline/promises";function Wt(t,n,r){let i={...r};for(let e of n.parameter){let n=e.envName;if(n===void 0)continue;let r=process.env[n]?.trim();if(r===void 0||r.length===0)continue;let a=i[e.optionKey];if(a!==void 0&&(typeof a!=`string`||a!==r))return{...v(`${t} ${e.flag.split(` `)[0]??e.name} conflicts with ${n}; omit the flag or use ${r}.`),data:i};a===void 0&&(i[e.optionKey]=r)}return e(`Environment-bound options applied`,i)}function Gt(e,t,n){if(!I(n))return null;for(let r of t.parameter){let t=r.envName,i=t===void 0?void 0:process.env[t]?.trim();if(t===void 0||i===void 0||i.length===0||!on(n,r.name))continue;let a=an(n,r.name);if(typeof a!=`string`||a!==i)return`${e} ${r.name} in --from-file conflicts with ${t}; omit the field or use ${i}.`}return null}function Kt(e){let t=new Set(e.parameter.map(({name:e})=>e));return e.kind===`multipart`?e.requiredPath:e.requiredPath.filter(e=>!t.has(e))}function qt(t,n,r,i=!1){if(i||!ln(n)||!Array.isArray(r))return dn(t,n,r);for(let[e,i]of r.entries()){let r=dn(t,n,i,e);if(!r.ok)return r}return e(`Body value assigned`,null)}function Jt(e,t,n,r){return dn(e,t,r,n)}function Yt(e){let t=[];for(let n of e.split(`.`)){let e=pn(n);if(t.push(e.key),e.isArray)return t.join(`.`)}return null}function Xt(e,t){let n=Yt(t);if(n===null)return null;let r=rn(e,n.split(`.`));return Array.isArray(r)?{path:n,rowCount:r.length,firstHole:nn(r)}:null}function Zt(t,n){if(ln(t.name)||t.schemaType===`array`)return e(`Repeated body option selected`,typeof n==`string`?[n]:n);if(!Array.isArray(n))return e(`Scalar body option selected`,n);let r=t.flag.split(` `)[0]??t.name;return n.length===1?e(`Scalar body option selected`,n[0]):v(`${r} was already given; pass it once.`)}var Qt=/^(?<row>\d+):(?<item>.*)$/su;function $t(e,t){let n=Yt(e.name);if(e.schemaType!==`array`||n===null||t===void 0||typeof t==`boolean`)return null;let r=new Map,i=[];for(let e of typeof t==`string`?[t]:t){let t=Qt.exec(e)?.groups,n=t?.row,a=t?.item;if(n===void 0||a===void 0){i.push(e);continue}let o=r.get(Number(n));o===void 0?r.set(Number(n),[a]):o.push(a)}return r.size===0?null:{container:n,rows:r,plain:i}}function en(e,t,n){let r=0;for(let i of e.parameter){let e=t[i.optionKey];e!==void 0&&typeof e!=`boolean`&&Yt(i.name)===n&&(r=Math.max(r,typeof e==`string`?1:e.length))}return r}function tn(e,t,n,r){for(let i of t.parameter){let t=n[i.optionKey];if(t===void 0)continue;let a=Xt(r,i.name);if(a===null)continue;if(a.firstHole!==null)return v(`${e} has no ${a.path}[] row ${a.firstHole} — number ${a.path}[] rows from 0 with no gaps.`);if(i.schemaType!==`array`||a.rowCount<=1||$t(i,t)!==null)continue;let o=i.flag.split(` `)[0]??i.name;return v(`${o} fills one ${a.path}[] row's list, so ${e} cannot also build ${a.rowCount} ${a.path}[] rows from direct options — prefix each value with its 0-based ${a.path}[] row index, as 0:value, or pass the rows with --from-file.`)}return null}function nn(e){for(let t=0;t<e.length;t+=1)if(e[t]===void 0)return t;return null}function rn(e,t){let n=e;for(let e of t){if(!I(n))return;n=n[e]??null}return n}function an(e,t){if(!ln(t))return rn(e,t.split(`.`))}function on(e,t){return cn(e,t.split(`.`))}function sn(e,t,n){if(!I(n))return null;let r=new Set(t.parameter.map(({name:e})=>e));for(let i of e)if(i!==t){for(let e of i.parameter)if(!r.has(e.name)&&on(n,e.name))return`${e.name} in --from-file requires --content-type ${i.contentType}.`}return null}function cn(e,t){let[n,...r]=t;if(n===void 0)return!0;let i=pn(n);if(!I(e)||!Object.hasOwn(e,i.key))return!1;let a=e[i.key]??null;return i.isArray?Array.isArray(a)&&a.every(e=>cn(e,r)):cn(a,r)}function ln(e){return e.split(`.`).some(e=>pn(e).isArray)}function un(e,t){return e.parameter.length===0||!I(t)?null:hn(t,[],mn(e.parameter))}function I(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function dn(t,n,r,i=0){let a=n.split(`.`),o=t;for(let[t,s]of a.entries()){let c=pn(s),l=t===a.length-1,u=fn(o,c,n,l,r,i);if(!u.ok||u.data===null)return v(u.summary,u.warnings);if(l)return e(`Body value assigned`,null);o=u.data}return v(`${n} is not a valid body option path.`)}function fn(t,n,r,i,a,o){let s=()=>v(`${r} cannot be combined with another body option at ${n.key}.`),c=t[n.key];if(n.isArray){if(c!==void 0&&!Array.isArray(c))return s();let r=c??[];if(c===void 0&&(t[n.key]=r),i)return r[o]===void 0?(r[o]=a,e(`Body value assigned`,t)):s();let l=r[o];if(l===void 0){let t={};return r[o]=t,e(`Body path created`,t)}return I(l)?e(`Body path stepped`,l):s()}if(i)return c===void 0?(t[n.key]=a,e(`Body value assigned`,t)):s();if(c===void 0){let r={};return t[n.key]=r,e(`Body path created`,r)}return I(c)?e(`Body path stepped`,c):s()}function pn(e){let t=e.endsWith(`[]`);return{key:t?e.slice(0,-2):e,isArray:t}}function mn(e){let t=new Set,n=new Set;for(let r of e){let e=`${r.name}${r.schemaType===`array`?`[]`:``}`;t.add(e);let i=e.split(`.`);for(let e=1;e<i.length;e+=1)n.add(i.slice(0,e).join(`.`))}return{leaf:t,prefix:n}}function hn(e,t,n){if(Array.isArray(e)){if(e.length===0)return null;for(let r of e){let e=hn(r,t,n);if(e!==null)return e}return null}if(!I(e))return null;for(let[r,i]of Object.entries(e)){let e=[...t,Array.isArray(i)?`${r}[]`:r],a=e.join(`.`);if(!gn(a,n)){if(!_n(e))continue;return{path:a,suggestion:vn(e,n)}}let o=hn(i,e,n);if(o!==null)return o}return null}function gn(e,t){return t.prefix.has(e)||t.leaf.has(e)}function _n(e){return e.slice(0,-1).some(e=>e.endsWith(`[]`))}function vn(e,t){let n=e.slice(0,-1).join(`.`),r=e.at(-1)?.replace(/\[\]$/u,``).toLowerCase()??``;return[...t.leaf].filter(e=>e.split(`.`).slice(0,-1).join(`.`)===n).map(e=>({path:e,score:yn(r,e.split(`.`).at(-1)??``)})).filter(({score:e})=>e<1/0).toSorted((e,t)=>e.score-t.score||e.path.localeCompare(t.path))[0]?.path}function yn(e,t){let n=t.replace(/\[\]$/u,``).toLowerCase();return n===e?0:n.endsWith(e)||e.endsWith(n)?1:n.includes(e)||e.includes(n)?2:1/0}function bn(e,t){let n=new Map;for(let e of t){let t=e.flag?.split(` `)[0];t!==void 0&&n.set(t,t===`--from-file`?{...e,inputType:`file`}:e)}for(let t of e){let e=t.long===void 0?void 0:n.get(t.long);e!==void 0&&(t.helpGroup(Ue(e)),t.description=u(t.description,{...e,hasParseDefault:t.defaultValue!==void 0}))}e.sort((e,t)=>{let r=e.long===void 0?void 0:n.get(e.long),i=t.long===void 0?void 0:n.get(t.long);return r!==void 0&&i!==void 0?On(r,i):r===void 0?i===void 0?0:1:-1})}function xn(e){let t=new Map;for(let n of e)for(let e of n.parameter){let r=e.flag.split(` `)[0]??e.flag,i=t.get(r);i===void 0?t.set(r,{variant:[{descriptor:n,parameter:e}]}):t.set(r,{variant:[...i.variant,{descriptor:n,parameter:e}]})}return[...t.values()]}function Sn(e){let{flag:t}=e.variant[0].parameter;return e.variant.every(({parameter:e})=>e.flag===t)?t:`${t.split(` `)[0]??t} <value>`}function Cn(e){let t=e.variant.map(({descriptor:e,parameter:t})=>({contentType:e.contentType,text:En(e,t)})),n=t[0];return n===void 0?``:t.every(({text:e})=>e===n.text)?`${n.text===``?``:`${n.text} `}Request content: ${t.map(({contentType:e})=>e).join(`, `)}.`:t.map(({contentType:e,text:t})=>`${e}: ${t}`).join(` `)}function wn(e,t){return[...new Set((e.cliConflicts??[]).filter(e=>e.includes(t)).flatMap(e=>e.filter(e=>e!==t)))]}function Tn(e,t){let n=e.kind===`multipart`?`Read a JSON object keyed by multipart part name from a file, or use - for stdin`:`Read the JSON request body from a file, or use - for stdin`,r=t.filter(e=>!t.some(t=>t.startsWith(`${e}.`)||t.startsWith(`${e}[].`)));return r.length===0?He(n):`${He(n)} Required JSON paths: ${r.join(`, `)}.`}function En(e,t){let n=Ve(t.description,void 0),r=e.kind!==`multipart`&&ln(t.name),i=e.kind!==`multipart`&&t.optionKey!==t.name&&/^\w+$/u.test(t.name);return`${n}${r?` Repeat to add another value.`:``}${i?` --from-file JSON key: ${t.name}.`:``}${Dn(e,t)}`}function Dn(e,t){if(e.kind===`multipart`||t.schemaType!==`array`)return``;let n=Yt(t.name);return n===null?``:` Prefix each value with its 0-based ${n}[] row index, as 0:value, to fill more than one ${n}[] row. A leading digits-and-colon is always read as that index, so name the row of a value that starts the same way, as 0:0:00 for the value 0:00.`}function On(e,t){return Ge(e)-Ge(t)||Number(e.required!==!0)-Number(t.required!==!0)}async function kn(t){let n;try{n=t===`-`?await An():await Lt(t,`utf8`)}catch(e){return v(`Could not read input: ${e.message}`,[`path=${t}`])}try{if(n.trim().length===0)return e(`No input provided`,null);let t=JSON.parse(n);return e(`Input parsed`,t)}catch(e){return v(`Input is not valid JSON: ${e.message}`)}}async function An(){if(process.stdin.isTTY)throw Error(`--from-file - requires JSON on stdin, but stdin is a TTY`);process.stdin.setEncoding(`utf8`);let e=``;for await(let t of process.stdin)e+=t;return e}var jn=`--content-type`;function Mn(e,t,n){let r=e=>!n?.has(e)&&(n?.add(e),!0),i=t.requestBody??[];if(i.length>1&&r(jn)){let t=i.map(({contentType:e})=>e);e.addOption(new d(`${jn} <media-type>`,`Select the request content type; omit for ${t[0]}.`).choices(t).argParser(Pn(i)))}if($n(t)&&r(`--from-file`)){let n=i[0];if(n===void 0)throw Error(`${t.operationId} has no request body`);e.addOption(new d(`--from-file <path>`,Tn(n,n.requiredPath)).argParser(In(`--from-file`)))}let a=xn(i).filter(e=>r(L(e.variant[0].parameter)));for(let t of a.toSorted((e,t)=>On(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:n,parameter:r}=t.variant[0],a=new d(Sn(t),i.length>1?Cn(t):En(n,r));i.length===1&&r.envName!==void 0&&a.env(r.envName);let o=i.length===1?wn(n,r.optionKey):[];o.length>0&&a.conflicts(o),i.length>1?a.argParser(Nn):ln(r.name)||r.schemaType===`array`?a.argParser(Fn):a.argParser(In(r.flag)),e.addOption(a),a.envVar!==void 0&&e.on(`optionEnv:${a.name()}`,()=>{let t=e.opts()[r.optionKey];typeof t==`string`&&t.trim()&&e.setOptionValueWithSource(r.optionKey,t.trim(),`env`)})}Qn(e,t,a)}function Nn(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function Pn(e){return(t,n)=>{if(n!==void 0)throw new p(`${jn} was already given; pass it once.`);let i=r(e,t);if(!i.ok)throw new p(i.summary);return t}}function Fn(e,t){return[...t??[],e]}function In(e){let t=e.split(/\s+/u)[0]??e;return(e,n)=>{if(n!==void 0)throw new p(`${t} was already given; pass it once.`);return e}}async function Ln(t,n){let i=Xe(t,n),a=r(t.requestBody??[],i);if(!a.ok||a.data===null)return v(a.summary,a.warnings);let o=a.data;if(o===void 0)return e(`No body`,void 0);let s=Rn(t,o,n);if(s!==null)return v(s);let c=Wt(t.operationId,o,n);if(!c.ok)return v(c.summary,c.warnings);n=c.data;let l=zn(o,n);if(l!==null)return v(l);let u=await Un(n);if(!u.ok)return v(u.summary,u.warnings);let d=sn(t.requestBody??[],o,u.data);if(d!==null)return v(d);let f=Hn(t.operationId,o,u.data);if(!f.ok)return f;let p=Gt(t.operationId,o,u.data);if(p!==null)return v(p);let m=Wn(t.operationId,o,n);if(!m.ok)return m;if(u.data===void 0&&m.data===void 0)return o.required?v(Zn(t.operationId,o)):e(`No body`,void 0);let h=Kn(t.operationId,u.data,m.data);if(!h.ok||h.data===void 0)return h;if(o.schemaType===`array`&&!Array.isArray(h.data))return v(`${t.operationId} requires a JSON array body.`);if(o.parameter.length>0&&!I(h.data)){let e=o.kind===`multipart`?` keyed by multipart part name`:` body`;return v(`${t.operationId} requires a JSON object${e}.`)}let g=Vn(o,h.data);if(g.length>0)return v(`${t.operationId} requires body option(s): ${g.join(`, `)}`);let _=h.data,y=I(_)?Kt(o).filter(e=>!on(_,e)):[];return y.length>0?v(Bn(t.operationId,o,y)):h}function Rn(e,t,n){let r=new Set(t.parameter.map(({optionKey:e})=>e));for(let i of e.requestBody??[])if(i!==t)for(let t of i.parameter){if(r.has(t.optionKey)||n[t.optionKey]===void 0)continue;let i=(e.requestBody??[]).filter(e=>e.parameter.some(({optionKey:e})=>e===t.optionKey)).map(({contentType:e})=>e);return`${L(t)} requires ${jn} ${i.join(` or `)}.`}return null}function zn(e,t){for(let n of e.cliConflicts??[]){let e=n.filter(e=>t[e]!==void 0);if(e.length>1)return`Options ${e.join(`, `)} cannot be used together.`}return null}function Bn(e,t,n){let r=`${e} requires JSON body path(s): ${n.join(`, `)}`;return t.kind===`multipart`?`${r}. ${n.includes(`body`)?`For multipart --from-file, wrap the endpoint JSON under top-level "body".`:`For multipart --from-file, put the missing nested path(s) inside top-level "body".`}`:r}function Vn(e,t){return I(t)?e.parameter.filter(e=>e.required&&!on(t,e.name)).map(L):[]}function Hn(t,n,r){let i=un(n,r);if(i===null)return e(`Body file paths validated`,null);let a=i.suggestion===void 0?``:` Use ${i.suggestion}.`;return v(`${t} --from-file contains unknown JSON path ${i.path}.${a}`)}async function Un(t){let n=typeof t.fromFile==`string`?t.fromFile:void 0;if(n===void 0)return e(`No body file`,void 0);let r=await kn(n);if(!r.ok)return v(r.summary,r.warnings);let i=_.safeParse(r.data);return i.success?e(`Input parsed`,i.data):v(`Input is not valid JSON value: ${i.error.message}`)}function Wn(t,n,r){let i={},a=!1;for(let e of n.parameter){let t=Zt(e,r[e.optionKey]);if(!t.ok||t.data===null)return v(t.summary,t.warnings);let o=t.data;if(o===void 0)continue;let s=Gn(n,r,i,e,o);if(!s.ok)return v(s.summary,s.warnings);a=!0}if(!a)return e(`No direct body options`,void 0);let o=tn(t,n,r,i);return o===null?e(`Direct body options parsed`,i):o}function Gn(t,n,r,i,a){let o=$t(i,a);if(o===null){let e=Yn(i,a);return e.ok?qt(r,i.name,e.data,i.schemaType===`array`):v(e.summary,e.warnings)}if(o.plain.length>0)return v(`${L(i)} mixes row-form values with plain value(s): ${o.plain.join(`, `)} — prefix every value with its 0-based ${o.container}[] row index, as 0:value.`);let s=en(t,n,o.container);for(let e of o.rows.keys())if(!(e<s))return v(`${L(i)} names ${o.container}[] row ${e}, but these options build at most ${s} ${o.container}[] row(s) — number rows from 0, and name the row of a value that itself starts with digits and a colon, as 0:0:00 for the value 0:00.`);for(let[e,t]of o.rows){let n=[];for(let e of t){let t=Xn(i.name,i.itemSchemaType,e);if(!t.ok)return v(t.summary,t.warnings);n.push(t.data)}let a=Jt(r,i.name,e,n);if(!a.ok)return a}return e(`Body value assigned`,null)}var L=e=>e.flag.split(` `)[0]??e.name;function Kn(t,n,r){if(n===void 0)return e(`Direct body parsed`,r);if(r===void 0)return e(`Input parsed`,n);if(I(n)&&I(r))try{return e(`Input parsed`,qn(n,r))}catch(e){return v(`${t} ${e.message}`)}return v(`${t} cannot combine --from-file with direct body options unless the file body is an object.`)}function qn(e,t){let n={...e};for(let[e,r]of Object.entries(t)){let t=n[e];if(Array.isArray(t)&&Array.isArray(r))throw Error(`cannot combine --from-file array '${e}' with array body options at the same key — move the per-item fields inside the matching '${e}[]' object(s) in the file body.`);if(t!==void 0&&Jn(t)!==Jn(r))throw Error(`cannot combine --from-file ${Jn(t)} '${e}' with ${Jn(r)} body option(s) at the same key — align the file body shape with the schema.`);n[e]=I(t)&&I(r)?qn(t,r):r}return n}function Jn(e){return Array.isArray(e)?`array`:I(e)?`object`:`scalar`}function Yn(t,n){if(typeof n==`boolean`)return e(`Body value parsed`,n);if(n===void 0||typeof n==`string`)return Xn(t.name,t.schemaType,n??``);let r=[],i=ln(t.name)&&t.schemaType!==`array`?t.schemaType:t.itemSchemaType;for(let e of n){let n=Xn(t.name,i,e);if(!n.ok)return n;r.push(n.data)}return e(`Body value parsed`,r)}function Xn(t,n,r){if(n===`boolean`)return r===`true`?e(`Body value parsed`,!0):r===`false`?e(`Body value parsed`,!1):v(`${t} must be true or false.`);if(n===`number`||n===`integer`){let i=r.trim(),a=Number(i);return i===``||!Number.isFinite(a)?v(`${t} must be a finite ${n}.`):n===`integer`&&!Number.isInteger(a)?v(`${t} must be an integer.`):e(`Body value parsed`,a)}return e(`Body value parsed`,r)}function Zn(e,t){let n=t.parameter.filter(e=>e.required);if(n.length>0&&t.requiredPath.every(e=>n.some(({name:t})=>t===e||t.startsWith(`${e}.`))))return`${e} requires body option(s): ${n.map(L).join(`, `)}`;let r=Kt(t);if(r.length>0)return`${e} requires --from-file with JSON body path(s): ${r.join(`, `)}`;let i=t.parameter.map(L).join(`, `);return i.length===0?`${e} requires --from-file`:`${e} requires --from-file or body option(s): ${i}`}function Qn(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:jn,location:`body`}),$n(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),bn(e.options,r)}function $n(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function er(e){let t=i(e);return lr(t),process.stdout.write(`${JSON.stringify(t)}\n`),t}function tr(e){let t=i(e);lr(t);let n=pt(t.data,t.summary),r=[];if(t.ok&&n!==null){let e=nr(t);r.push(n.endsWith(`
2
2
  `)?n.slice(0,-1):n),r.push(...e),process.stdout.write(ct(r.join(`
3
3
  `),!0,!0,e.length));return}let a=t.ok?`OK`:`FAIL`;r.push(`[${a}] ${t.summary}`),!t.ok&&t.problem!==void 0&&r.push(...ar(t.problem)),r.push(...nr(t)),process.stdout.write(ct(r.join(`
4
4
  `),!0))}function nr(e){let t=[];e.ids.length>0&&t.push(` ids: ${e.ids.join(`, `)}`);for(let[n,r]of Object.entries(e.counts))t.push(` ${n}: ${r}`);for(let n of e.references)t.push(` ref: ${n}`);if(e.truncation!==void 0){let n=e.truncation.omitted.join(`, `);t.push(` truncated: byteLength=${e.truncation.byteLength} maxBytes=${e.truncation.maxBytes} omitted=${n}`,` recovery: ${e.truncation.recovery}`)}for(let n of e.warnings)t.push(` warn: ${n}`);return t}function R(e,t){if(e.mode===`data`||e.mode===`data-full`){let n=e.mode===`data`?i(t):t;lr(n),process.stdout.write(`${JSON.stringify(n.ok&&n.truncated!==!0?rr(n.data):n)}\n`),n.ok||(process.exitCode=1);return}let n=e.mode===`json`?er(t):t;e.mode===`text`&&tr(n),n.ok||(process.exitCode=1)}function rr(e){return typeof e!=`object`||!e||Array.isArray(e)||!Reflect.has(e,`method`)||!Reflect.has(e,`endpoint`)||!(`response`in e)||e.response===void 0?e:e.response}function ir(e,t){let n=dt(t);if(n===null){process.stderr.write(`explain: the response carried no search interpretation